Greg Sheremeta has uploaded a new change for review.

Change subject: userportal, webadmin: changed custom Cell classes to set IDs pt 
2
......................................................................

userportal, webadmin: changed custom Cell classes to set IDs pt 2

(Patch 4an of 12)

Changed all of our custom Cell classes to use the Element ID framework
and set IDs on their renderings.

(Missed a few -- fixed in this patch.)

No functional changes -- just makes it easier for Selenium testing.

Change-Id: Idb15db81e13e3ebb2fd30f891b1130d5009465a7
Signed-off-by: Greg Sheremeta <gsher...@redhat.com>
---
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/resources/VmTable.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationTemplates.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityStatusCell.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeBrickStatusCell.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeCapacityCell.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeTaskWaitingCell.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/AbstractProgressBarColumn.java
8 files changed, 35 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/37/38737/1

diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java
index f488aae..790b2bf 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedVirtualMachineView.java
@@ -6,8 +6,8 @@
 
 import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
 import org.ovirt.engine.ui.common.system.ClientStorage;
-import org.ovirt.engine.ui.common.utils.ElementIdUtils;
 import org.ovirt.engine.ui.common.widget.table.SimpleActionTable;
+import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell;
 import org.ovirt.engine.ui.common.widget.table.cell.ImageButtonCell;
 import org.ovirt.engine.ui.uicommonweb.ErrorPopupManager;
 import org.ovirt.engine.ui.uicommonweb.UICommand;
@@ -39,7 +39,6 @@
 import 
org.ovirt.engine.ui.userportal.widget.table.column.VmImageColumn.OsTypeExtractor;
 import org.ovirt.engine.ui.userportal.widget.table.column.VmStatusColumn;
 
-import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.cell.client.Cell;
 import com.google.gwt.cell.client.CompositeCell;
 import com.google.gwt.cell.client.HasCell;
@@ -168,9 +167,9 @@
 
         Cell<UserPortalItemModel> nameAndDescriptionCell = new 
AbstractCell<UserPortalItemModel>() {
             @Override
-            public void render(Context context, UserPortalItemModel item, 
SafeHtmlBuilder sb) {
+            public void render(Context context, UserPortalItemModel item, 
SafeHtmlBuilder sb, String id) {
                 sb.append(templates.vmNameCellItem(
-                        
ElementIdUtils.createTableCellElementId(elementIdPrefix, "name", context), 
//$NON-NLS-1$
+                        id,
                         item.getName()));
 
                 String description = item.getDescription();
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/resources/VmTable.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/resources/VmTable.java
index 45d74a1..6085f3b 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/resources/VmTable.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/resources/VmTable.java
@@ -10,6 +10,8 @@
 import org.ovirt.engine.ui.common.widget.HasEditorDriver;
 import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable;
 import org.ovirt.engine.ui.common.widget.table.ActionCellTable;
+import org.ovirt.engine.ui.common.widget.table.cell.CompositeTooltipCell;
+import org.ovirt.engine.ui.common.widget.table.column.AbstractColumn;
 import 
org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn;
 import org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn;
 import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
@@ -19,7 +21,6 @@
 import org.ovirt.engine.ui.userportal.ApplicationResources;
 import 
org.ovirt.engine.ui.userportal.uicommon.model.UserPortalDataBoundModelProvider;
 
-import com.google.gwt.cell.client.CompositeCell;
 import com.google.gwt.cell.client.HasCell;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.Element;
@@ -259,8 +260,8 @@
                         vmRowResources,
                         true);
 
-        Column<EntityModel, EntityModel> vmImageWithNameColumn =
-                new Column<EntityModel, 
EntityModel>(createVmImageWithNameCompositeCell()) {
+        AbstractColumn<EntityModel, EntityModel> vmImageWithNameColumn =
+                new AbstractColumn<EntityModel, 
EntityModel>(createVmImageWithNameCompositeCell()) {
 
                     @Override
                     public EntityModel getValue(EntityModel object) {
@@ -314,7 +315,7 @@
         return new VmTreeItem(table, vm);
     }
 
-    private CompositeCell<EntityModel> 
createDiskImageWithMappingComoisiteCell() {
+    private CompositeTooltipCell<EntityModel> 
createDiskImageWithMappingComoisiteCell() {
 
         final AbstractImageResourceColumn<EntityModel> diskImageColumn = new 
AbstractImageResourceColumn<EntityModel>() {
 
@@ -350,7 +351,7 @@
 
     }
 
-    private CompositeCell<EntityModel> createVmImageWithNameCompositeCell() {
+    private CompositeTooltipCell<EntityModel> 
createVmImageWithNameCompositeCell() {
         final AbstractImageResourceColumn<EntityModel> vmImageColumn = new 
AbstractImageResourceColumn<EntityModel>() {
 
             @Override
@@ -463,7 +464,7 @@
 
 }
 
-class StyledCompositeCell<T> extends CompositeCell<T> {
+class StyledCompositeCell<T> extends CompositeTooltipCell<T> {
 
     private final List<HasCell<T, ?>> hasCells;
     private final StyledProvider<T> styleProvider;
@@ -475,14 +476,17 @@
     }
 
     @Override
-    public void render(Context context, T value, SafeHtmlBuilder sb) {
+    public void render(Context context, T value, SafeHtmlBuilder sb, String 
id) {
+        int i = 1;
+        // TODO use Template
         for (HasCell<T, ?> hasCell : hasCells) {
             String style =
                     styleProvider.styleStringOf(hasCell) == null ? "" : 
"style=\"" //$NON-NLS-1$ //$NON-NLS-2$
                             + styleProvider.styleStringOf(hasCell) + "\""; 
//$NON-NLS-1$
-            sb.appendHtmlConstant("<div " + style + ">"); //$NON-NLS-1$ 
//$NON-NLS-2$
+            sb.appendHtmlConstant("<div id=\"" + id + "_" + i + "\" " + style 
+ ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
             render(context, value, sb, hasCell);
             sb.appendHtmlConstant("</div>"); //$NON-NLS-1$
+            i++;
         }
     }
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationTemplates.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationTemplates.java
index ca646fc..109aea9 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationTemplates.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationTemplates.java
@@ -15,10 +15,10 @@
      * @param text
      *            Text to show within the progress bar.
      */
-    @Template("<div class='{3}'>" +
+    @Template("<div id=\"{4}\" class='{3}'>" +
             "<div style='background: {2}; width: {0}%; height: 100%'></div>" +
             "<div class='engine-progress-text'>{1}</div></div>")
-    SafeHtml progressBar(int progress, String text, String color, String 
style);
+    SafeHtml progressBar(int progress, String text, String color, String 
style, String id);
 
     @Template("<div>" +
             "<div style='float:right; width: {2}px; color: {3}; font-weight: 
{4}'>{5}%</div>" +
@@ -145,13 +145,13 @@
     @Template("<div style='line-height: 100%; text-align: center; 
vertical-align: middle;'>{0}</div>")
     SafeHtml image(SafeHtml statusImage);
 
-    @Template("<table> <tr> " +
+    @Template("<table id=\"{4}\"> <tr> " +
             "<td> <div>{0}</div> </td>" +
             "<td> {1} </td>" +
             "<td> <div> {2} </div> </td>" +
             "<td> {3} </td>" +
             "</tr> </table>")
-    SafeHtml volumeBrickStatusTemplate(SafeHtml upImage, int upCount, SafeHtml 
downImage, int downCount);
+    SafeHtml volumeBrickStatusTemplate(SafeHtml upImage, int upCount, SafeHtml 
downImage, int downCount, String id);
 
     @Template("<div style='line-height: 100%; text-align: center; 
vertical-align: middle;'>{0}</div>")
     SafeHtml volumeSnapshotsStatusTemplate(int snapshotCount);
@@ -159,8 +159,8 @@
     @Template("<div style='line-height: 100%; text-align: center; 
vertical-align: middle; border: solid 1px transparent; '>{0}</div>")
     SafeHtml volumeActivityMenu(SafeHtml statusImage);
 
-    @Template("<div title=\'{1}'style='line-height: 100%; text-align: center; 
vertical-align: middle;'>{0}</div>")
-    SafeHtml image(SafeHtml statusImage, String title);
+    @Template("<div id=\"{2}\" title=\'{1}'style='line-height: 100%; 
text-align: center; vertical-align: middle;'>{0}</div>")
+    SafeHtml image(SafeHtml statusImage, String title, String id);
 
     @Template("<div title=\"{2}\"><table cellspacing='0' cellpadding='0' 
style='line-height: 5px;'>" +
             "<tr>" +
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityStatusCell.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityStatusCell.java
index 5784c99..dd47f7f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityStatusCell.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityStatusCell.java
@@ -2,11 +2,11 @@
 
 import org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport;
+import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell;
 import org.ovirt.engine.ui.webadmin.ApplicationConstants;
 import org.ovirt.engine.ui.webadmin.ApplicationResources;
 import org.ovirt.engine.ui.webadmin.ApplicationTemplates;
 
-import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.safehtml.shared.SafeHtml;
@@ -21,7 +21,7 @@
     private final ApplicationConstants constants = 
GWT.create(ApplicationConstants.class);
 
     @Override
-    public void render(Context context, T value, SafeHtmlBuilder sb) {
+    public void render(Context context, T value, SafeHtmlBuilder sb, String 
id) {
         // Nothing to render if no task is provided, or if task status is 
empty:
         if (value == null || value.getAsyncTask() == null || 
value.getAsyncTask().getType() == null
                 ||value.getAsyncTask().getStatus() == null) {
@@ -92,7 +92,7 @@
             // Generate the HTML for the image:
             SafeHtml activityImageHtml =
                     
SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(taskImage).getHTML());
-            sb.append(templates.image(activityImageHtml, tooltip));
+            sb.append(templates.image(activityImageHtml, tooltip, id));
         }
     }
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeBrickStatusCell.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeBrickStatusCell.java
index f4fe041..4cf8f49 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeBrickStatusCell.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeBrickStatusCell.java
@@ -2,10 +2,10 @@
 
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
+import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell;
 import org.ovirt.engine.ui.webadmin.ApplicationResources;
 import org.ovirt.engine.ui.webadmin.ApplicationTemplates;
 
-import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.safehtml.shared.SafeHtml;
@@ -19,7 +19,7 @@
     private final ApplicationResources resources = 
GWT.create(ApplicationResources.class);
 
     @Override
-    public void render(Context context, GlusterVolumeEntity volume, 
SafeHtmlBuilder sb) {
+    public void render(Context context, GlusterVolumeEntity volume, 
SafeHtmlBuilder sb, String id) {
         // Nothing to render if no volume is provided:
         if (volume == null) {
             return;
@@ -42,6 +42,6 @@
         // Generate the HTML for the images
         SafeHtml upImageHtml = 
SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(upImage).getHTML());
         SafeHtml downImageHtml = 
SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(downImage).getHTML());
-        sb.append(templates.volumeBrickStatusTemplate(upImageHtml, upBricks, 
downImageHtml, downBricks));
+        sb.append(templates.volumeBrickStatusTemplate(upImageHtml, upBricks, 
downImageHtml, downBricks, id));
     }
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeCapacityCell.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeCapacityCell.java
index cc8e8bd3..c6f193f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeCapacityCell.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeCapacityCell.java
@@ -2,9 +2,9 @@
 
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo;
+import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell;
 import org.ovirt.engine.ui.webadmin.ApplicationTemplates;
 
-import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.safehtml.shared.SafeHtml;
 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
@@ -14,7 +14,7 @@
     private final ApplicationTemplates templates = 
GWT.create(ApplicationTemplates.class);
 
     @Override
-    public void render(Context context, GlusterVolumeEntity object, 
SafeHtmlBuilder sb) {
+    public void render(Context context, GlusterVolumeEntity object, 
SafeHtmlBuilder sb, String id) {
         GlusterVolumeSizeInfo sizeInfo = null;
         int progress;
         if (! (object.getAdvancedDetails() == null || 
object.getAdvancedDetails().getCapacityInfo() == null)) {
@@ -25,7 +25,7 @@
         }
         String sizeString = getProgressText(sizeInfo);
         String color = progress < 70 ? "#669966" : progress < 95 ? "#FF9900" : 
"#FF0000"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        SafeHtml safeHtml = templates.progressBar(progress, sizeString, color, 
"engine-progress-box"); //$NON-NLS-1$
+        SafeHtml safeHtml = templates.progressBar(progress, sizeString, color, 
"engine-progress-box", id); //$NON-NLS-1$
         sb.append(safeHtml);
     }
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeTaskWaitingCell.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeTaskWaitingCell.java
index 1f76cbc..bdbe28d 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeTaskWaitingCell.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeTaskWaitingCell.java
@@ -2,11 +2,11 @@
 
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport;
 import org.ovirt.engine.core.common.job.JobExecutionStatus;
+import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell;
 import org.ovirt.engine.ui.webadmin.ApplicationConstants;
 import org.ovirt.engine.ui.webadmin.ApplicationResources;
 import org.ovirt.engine.ui.webadmin.ApplicationTemplates;
 
-import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.safehtml.shared.SafeHtml;
@@ -21,7 +21,7 @@
     private final ApplicationConstants constants = 
GWT.create(ApplicationConstants.class);
 
     @Override
-    public void render(Context context, T value, SafeHtmlBuilder sb) {
+    public void render(Context context, T value, SafeHtmlBuilder sb, String 
id) {
         // Waiting icon need to be rendered only if job is started and task 
ref is empty
         if (value.getAsyncTask() == null || value.getAsyncTask().getJobId() == 
null
                 || value.getAsyncTask().getType() != null
@@ -35,7 +35,7 @@
         // Generate the HTML for the image:
         SafeHtml activityImageHtml =
                 
SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(taskImage).getHTML());
-        sb.append(templates.image(activityImageHtml, tooltip));
+        sb.append(templates.image(activityImageHtml, tooltip, id));
     }
 
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/AbstractProgressBarColumn.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/AbstractProgressBarColumn.java
index d6d0aa9..6a03d22 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/AbstractProgressBarColumn.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/AbstractProgressBarColumn.java
@@ -7,6 +7,7 @@
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.user.client.DOM;
 
 /**
  * Column for displaying generic progress bar.
@@ -44,7 +45,7 @@
         // Choose color by progress
         String color = getColorByProgress(progress);
 
-        return templates.progressBar(progress, text, color, getStyle());
+        return templates.progressBar(progress, text, color, getStyle(), 
DOM.createUniqueId());
     }
 
     protected String getStyle() {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb15db81e13e3ebb2fd30f891b1130d5009465a7
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