Greg Sheremeta has uploaded a new change for review.

Change subject: userportal, webadmin: cleanup CellTemplate usages
......................................................................

userportal, webadmin: cleanup CellTemplate usages

Cleaned up some usages of CellTemplate where GWT.create was needlessly
deferred until first use. (It's compile-time -- no need to defer.)

No functional changes -- just a refactor.

Change-Id: I953c1e9a872bf4850ef36723137df134d243b367
Signed-off-by: Greg Sheremeta <gsher...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell2.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextCell.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/extended/vm/AbstractConsoleButtonCell.java
4 files changed, 6 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/38731/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell.java
index 30f3230..8805bac 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell.java
@@ -23,16 +23,7 @@
     private String style = "line-height: 100%; text-align: center; 
vertical-align: middle;"; //$NON-NLS-1$
     private String styleClass = ""; //$NON-NLS-1$
 
-    private static CellTemplate template;
-
-    public ImageResourceCell() {
-        super();
-
-        // Delay cell template creation until the first time it's needed
-        if (template == null) {
-            template = GWT.create(CellTemplate.class);
-        }
-    }
+    private static CellTemplate template = GWT.create(CellTemplate.class);
 
     @Override
     public void render(Context context, ImageResource value, SafeHtmlBuilder 
sb, String id) {
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell2.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell2.java
index 7529d18..5b2a908 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell2.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageResourceCell2.java
@@ -24,16 +24,7 @@
     private String style = "line-height: 100%; text-align: center; 
vertical-align: middle;"; //$NON-NLS-1$
     private String styleClass = ""; //$NON-NLS-1$
 
-    private CellTemplate template;
-
-    public ImageResourceCell2() {
-        super();
-
-        // Delay cell template creation until the first time it's needed
-        if (template == null) {
-            template = GWT.create(CellTemplate.class);
-        }
-    }
+    private CellTemplate template = GWT.create(CellTemplate.class);
 
     @Override
     public void render(Context context, ImageResource value, SafeHtmlBuilder 
sb, String id) {
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextCell.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextCell.java
index 8471079..bd9f733 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextCell.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextCell.java
@@ -25,6 +25,8 @@
         SafeHtml textContainer(String style, String id, SafeHtml text);
     }
 
+    private static CellTemplate template = GWT.create(CellTemplate.class);
+
     public static final int UNLIMITED_LENGTH = -1;
     private static final String TOO_LONG_TEXT_POSTFIX = "..."; //$NON-NLS-1$
 
@@ -34,8 +36,6 @@
     // Text longer than this value will be shortened, providing tooltip with 
original text
     private final int maxTextLength;
 
-    private static CellTemplate template;
-
     public TextCell(int maxTextLength) {
         this(maxTextLength, BrowserEvents.MOUSEOVER);
     }
@@ -43,11 +43,6 @@
     public TextCell(int maxTextLength, String... consumedEvents) {
         super(consumedEvents);
         this.maxTextLength = maxTextLength;
-
-        // Delay cell template creation until the first time it's needed
-        if (template == null) {
-            template = GWT.create(CellTemplate.class);
-        }
     }
 
     public void setStyleClass(String styleClass) {
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/extended/vm/AbstractConsoleButtonCell.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/extended/vm/AbstractConsoleButtonCell.java
index c3a8c69..8923c66 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/extended/vm/AbstractConsoleButtonCell.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/extended/vm/AbstractConsoleButtonCell.java
@@ -34,6 +34,8 @@
 
     }
 
+    private static CellTemplate template = GWT.create(CellTemplate.class);
+
     private final ConsoleButtonCommand command;
 
     private final String enabledCss;
@@ -42,8 +44,6 @@
 
     private final String title;
 
-    private static CellTemplate template;
-
     public AbstractConsoleButtonCell(String enabledCss, String disabledCss,
             String title, ConsoleButtonCommand command) {
         super(BrowserEvents.CLICK);
@@ -51,11 +51,6 @@
         this.disabledCss = SafeHtmlUtils.htmlEscape(disabledCss);
         this.title = SafeHtmlUtils.htmlEscape(title);
         this.command = command;
-
-        // Delay cell template creation until the first time it's needed
-        if (template == null) {
-            template = GWT.create(CellTemplate.class);
-        }
     }
 
     @Override


-- 
To view, visit https://gerrit.ovirt.org/38731
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I953c1e9a872bf4850ef36723137df134d243b367
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to