anmolbabu has uploaded a new change for review. Change subject: webadmin : Fix volume main and sub tab column id issue ......................................................................
webadmin : Fix volume main and sub tab column id issue This patch does the following, 1. Adding column's to MainTabVolumeView require columns to override AbstractColumn or handle id on own. But overriding AbstractColumn provides base implementation for ColumnWithElementId#configureElementId which actually assigns ids for columns. Accordingly changes are performed in, [i] Changed VolumeActivityColumn Change-Id: I930f656e9e867bed5f5675a2401a10476d3c7672 Signed-off-by: Anmol Babu <anb...@redhat.com> --- A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCell.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/Cell.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeCell.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/VolumeInfoCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/BrickStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/GlusterVolumeSnapshotStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/StorageDeviceStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VmStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeActivityCompositeCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeBrickStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusCell.java 12 files changed, 250 insertions(+), 31 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/41599/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCell.java new file mode 100644 index 0000000..9f20d70 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCell.java @@ -0,0 +1,60 @@ +package org.ovirt.engine.ui.common.widget.table.cell; + +import org.ovirt.engine.ui.common.utils.ElementIdUtils; +import org.ovirt.engine.ui.common.widget.table.column.CellWithElementId; + +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.user.client.DOM; + +/** + * <p> + * Base class for all Cells that would otherwise extend GWT AbstractCell. + * Supports rendering Element ids via the oVirt Element-ID framework. + * </p> + */ +public abstract class AbstractCell<C> extends com.google.gwt.cell.client.AbstractCell<C> implements CellWithElementId<C> { + + private String elementIdPrefix = DOM.createUniqueId(); // default + private String columnId; + + public AbstractCell(String... consumedEvents) { + super(consumedEvents); + } + + /** + * Override the normal render to pass along an id. + * + * @see com.google.gwt.cell.client.AbstractCell#render(com.google.gwt.cell.client.Cell.Context, java.lang.Object, com.google.gwt.safehtml.shared.SafeHtmlBuilder) + */ + public final void render(Context context, C value, SafeHtmlBuilder sb) { + String id = ElementIdUtils.createTableCellElementId(getElementIdPrefix(), getColumnId(), context); + render(context, value, sb, id); + } + + /** + * Render the cell. Using the value, the id, and the context, append some HTML to the + * SafeHtmlBuilder that will show in the cell when it is rendered. + * + * Override this and use the id in your render. + * + * @see org.ovirt.engine.ui.common.widget.table.cell.TooltipCell#render(com.google.gwt.cell.client.Cell.Context, java.lang.Object, com.google.gwt.safehtml.shared.SafeHtmlBuilder, java.lang.String) + */ + public abstract void render(Context context, C value, SafeHtmlBuilder sb, String id); + + public void setElementIdPrefix(String elementIdPrefix) { + this.elementIdPrefix = elementIdPrefix; + } + + public void setColumnId(String columnId) { + this.columnId = columnId; + } + + public String getElementIdPrefix() { + return elementIdPrefix; + } + + public String getColumnId() { + return columnId; + } + +} diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/Cell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/Cell.java new file mode 100644 index 0000000..0678073 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/Cell.java @@ -0,0 +1,33 @@ +package org.ovirt.engine.ui.common.widget.table.cell; + + +import org.ovirt.engine.ui.common.widget.table.column.CellWithElementId; + +import com.google.gwt.cell.client.ValueUpdater; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; + +/** + * Interface for all Cells that would otherwise implement GWT Cell. Includes methods for tooltips + * and Element ID framework. + * + * @param <C> cell render type + */ +public interface Cell<C> extends com.google.gwt.cell.client.Cell<C>, CellWithElementId<C> { + + /** + * Called by AbstractColumn when an event occurs in a Cell. The only difference from GWT's native + * Column is that here we ask the column to provide us a tooltip value in addition to the cell's + * C value. + */ + public void onBrowserEvent(Context context, final Element parent, C value, final SafeHtml tooltipContent, + final NativeEvent event, ValueUpdater<C> valueUpdater); + + /** + * Called by AbstractColumn to render a cell. Sends the cell id so your template can include it + * in the render. + */ + public abstract void render(Context context, C value, SafeHtmlBuilder sb, String id); +} diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeCell.java new file mode 100644 index 0000000..f373fa1 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeCell.java @@ -0,0 +1,120 @@ +package org.ovirt.engine.ui.common.widget.table.cell; + +import java.util.List; + +import org.ovirt.engine.ui.common.utils.ElementIdUtils; + +import com.google.gwt.cell.client.HasCell; +import com.google.gwt.cell.client.ValueUpdater; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.user.client.DOM; + +/** + * <p> + * Base class for all Cells that would otherwise extend GWT AbstractCell. + * Supports rendering Element ids via the oVirt Element-ID framework. + * Support tooltips. Note that for a Composite cell, you may want tooltips on each component + * of the cell. In that case, do not implement getTooltip() in this cell's Column. Instead, implement + * it in each component Cell. (The downside of this is that you have no access to the row type, so + * you cannot make a component tooltip be a property of that row type. For example, you cannot have + * a component tooltip be a VM's name. It must be a constant.) + * </p> + * @param <C> Cell data type. + */ +public class CompositeCell<C> extends com.google.gwt.cell.client.CompositeCell<C> implements Cell<C> { + + private final List<HasCell<C, ?>> hasCells; + + // DOM element ID settings for text container element + private String elementIdPrefix = DOM.createUniqueId(); + private String columnId; + + public CompositeCell(List<HasCell<C, ?>> hasCells) { + super(hasCells); + this.hasCells = hasCells; + } + + /** + * Let the Cell render the tooltip using C value. This is only attempted if the Column itself + * did not provide a tooltip. This is usually only used when there is a Composite Column that + * contains multiple Cells, but each Cell needs its own tooltip. + */ + public SafeHtml getTooltip(C value) { + return null; + } + + /** + * Override the normal render to pass along an id. + * + * @see com.google.gwt.cell.client.AbstractCell#render(com.google.gwt.cell.client.Cell.Context, java.lang.Object, com.google.gwt.safehtml.shared.SafeHtmlBuilder) + */ + public final void render(Context context, C value, SafeHtmlBuilder sb) { + String id = ElementIdUtils.createTableCellElementId(getElementIdPrefix(), getColumnId(), context); + render(context, value, sb, id); + } + + /** + * Override the normal render just to prevent anyone from calling it. + */ + protected final <X> void render(Context context, C value, SafeHtmlBuilder sb, HasCell<C, X> hasCell) { + throw new IllegalStateException("Please do not call this overload of render(). Use the overload with an id."); //$NON-NLS-1$ + } + + /** + * Render the cell. Using the value, the id, and the context, append some HTML to the + * SafeHtmlBuilder that will show in the cell when it is rendered. + * + * Override this and use the id in your render. + * + * @see org.ovirt.engine.ui.common.widget.table.cell.Cell#render(com.google.gwt.cell.client.Cell.Context, java.lang.Object, com.google.gwt.safehtml.shared.SafeHtmlBuilder, java.lang.String) + */ + public void render(Context context, C value, SafeHtmlBuilder sb, String id) { + int i = 1; + for (HasCell<C, ?> hasCell : hasCells) { + render(context, value, sb, hasCell, id + "_" + i); //$NON-NLS-1$ + i++; + } + } + + /** + * TODO-GWT: copied from CompositeCell, with id injected. Keep in sync on GWT upgrades. + */ + protected <X> void render(Context context, C value, SafeHtmlBuilder sb, HasCell<C, X> hasCell, String id) { + com.google.gwt.cell.client.Cell<X> _cell = hasCell.getCell(); + if (_cell instanceof Cell) { + Cell<X> cell = (Cell<X>) _cell; // cast from GWT Cell to our Cell impl + sb.appendHtmlConstant("<span id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ + cell.render(context, hasCell.getValue(value), sb, id); + sb.appendHtmlConstant("</span>"); //$NON-NLS-1$ + } + else { + throw new IllegalStateException("CompositeCell cannot render Cells that do not implement " //$NON-NLS-1$ + + Cell.class.getName()); + } + } + + public void setElementIdPrefix(String elementIdPrefix) { + this.elementIdPrefix = elementIdPrefix; + } + + public void setColumnId(String columnId) { + this.columnId = columnId; + } + + public String getElementIdPrefix() { + return elementIdPrefix; + } + + public String getColumnId() { + return columnId; + } + + @Override + public void onBrowserEvent(Context context, Element parent, C value, SafeHtml tooltipContent, NativeEvent event, ValueUpdater<C> valueUpdater) { + super.onBrowserEvent(context, parent, value, event, valueUpdater); + } + +} 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 e0d0241..dbdadd6 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 @@ -89,6 +89,12 @@ @Template("<div style=\"text-align: center;\">{0}{1}</div>") SafeHtml statusWithAlertTemplate(SafeHtml statusImage, SafeHtml alertImage); + @Template("<div id='{2}' style=\"text-align: center;\">{0}{1}</div>") + SafeHtml statusWithAlertTemplate(SafeHtml statusImage, SafeHtml alertImage, String id); + + @Template("<div id='{2}' title=\"{1}\" style=\"text-align: center;\">{0}</div>") + SafeHtml statusTemplate(SafeHtml statusImage, String title, String id); + @Template("<div title=\"{1}\" style=\"text-align: center;\">{0}</div>") SafeHtml statusTemplate(SafeHtml statusImage, String title); @@ -136,13 +142,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); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeInfoCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeInfoCell.java index 8ccc1fc..02f36cc 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeInfoCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeInfoCell.java @@ -1,12 +1,12 @@ package org.ovirt.engine.ui.webadmin.widget.table.cell; 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.ApplicationConstants; import org.ovirt.engine.ui.webadmin.ApplicationMessages; 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.shared.GWT; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; @@ -26,7 +26,7 @@ protected ImageResource snapshotScheduledImage = resources.snapshotScheduledImage(); @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; @@ -34,7 +34,7 @@ if (volume.getIsGeoRepMaster()) { SafeHtml geoRepMasterHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(geoRepMasterImage).getHTML()); - sb.append(applicationTemplates.statusTemplate(geoRepMasterHtml, constants.geoRepMasterVolumeToolTip())); + sb.append(applicationTemplates.statusTemplate(geoRepMasterHtml, constants.geoRepMasterVolumeToolTip(), id)); } if (volume.getIsGeoRepSlave()) { SafeHtml geoRepSlaveHtml = @@ -43,13 +43,13 @@ String volName = volClusterNames[0]; String clusterName = volClusterNames.length == 2 ? volClusterNames[1] : "UNKNOWN"; //$NON-NLS-1$ sb.append(applicationTemplates.statusTemplate(geoRepSlaveHtml, - messages.geoRepSlaveVolumeToolTip(volName, clusterName))); + messages.geoRepSlaveVolumeToolTip(volName, clusterName), id)); } if (volume.getSnapshotScheduled()) { SafeHtml snapshotScheduledHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(snapshotScheduledImage).getHTML()); sb.append(applicationTemplates.statusTemplate(snapshotScheduledHtml, - constants.glusterVolumeSnapshotsScheduledToolTip())); + constants.glusterVolumeSnapshotsScheduledToolTip(), id)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/BrickStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/BrickStatusCell.java index 8b065d1..61bfce9 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/BrickStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/BrickStatusCell.java @@ -2,12 +2,12 @@ import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus; +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 org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -23,7 +23,7 @@ ApplicationTemplates applicationTemplates = ClientGinjectorProvider.getApplicationTemplates(); @Override - public void render(Context context, GlusterBrickEntity brick, SafeHtmlBuilder sb) { + public void render(Context context, GlusterBrickEntity brick, SafeHtmlBuilder sb, String id) { // Nothing to render if no brick is provided: if (brick == null) { return; @@ -55,7 +55,7 @@ // Generate the HTML for the image: SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); - sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); + sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip, id)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/GlusterVolumeSnapshotStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/GlusterVolumeSnapshotStatusCell.java index b86e13e..ba4aec2 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/GlusterVolumeSnapshotStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/GlusterVolumeSnapshotStatusCell.java @@ -2,12 +2,12 @@ import org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity; +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 org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -23,7 +23,7 @@ private static final ApplicationTemplates applicationTemplates = ClientGinjectorProvider.getApplicationTemplates(); @Override - public void render(Context context, GlusterVolumeSnapshotEntity snapshot, SafeHtmlBuilder sb) { + public void render(Context context, GlusterVolumeSnapshotEntity snapshot, SafeHtmlBuilder sb, String id) { // Nothing to render if no snapshot is provided: if (snapshot == null) { return; @@ -55,6 +55,6 @@ // Generate the HTML for the image: SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); - sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); + sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip, id)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/StorageDeviceStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/StorageDeviceStatusCell.java index e3c4b84..66634ea 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/StorageDeviceStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/StorageDeviceStatusCell.java @@ -1,12 +1,12 @@ package org.ovirt.engine.ui.webadmin.widget.table.column; import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice; +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 org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -22,7 +22,7 @@ ApplicationTemplates applicationTemplates = ClientGinjectorProvider.getApplicationTemplates(); @Override - public void render(Context context, StorageDevice device, SafeHtmlBuilder sb) { + public void render(Context context, StorageDevice device, SafeHtmlBuilder sb, String id) { // No lock if we can create brick from the device if (device.getCanCreateBrick()) { return; @@ -37,7 +37,7 @@ // Generate the HTML for the image: SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); - sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); + sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip, id)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VmStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VmStatusCell.java index 9c6868e..9a09e91 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VmStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VmStatusCell.java @@ -4,13 +4,13 @@ import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmPauseStatus; import org.ovirt.engine.ui.common.CommonApplicationConstants; +import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell; import org.ovirt.engine.ui.uicompat.EnumTranslator; import org.ovirt.engine.ui.uicompat.Translator; import org.ovirt.engine.ui.webadmin.ApplicationResources; import org.ovirt.engine.ui.webadmin.ApplicationTemplates; import org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -23,7 +23,7 @@ CommonApplicationConstants constants = ClientGinjectorProvider.getApplicationConstants(); @Override - public void render(Context context, VM vm, SafeHtmlBuilder sb) { + public void render(Context context, VM vm, SafeHtmlBuilder sb, String id) { // Nothing to render if no vm is provided: if (vm == null) { return; @@ -111,9 +111,9 @@ if (alertImageHtml != null) { // this already has the tooltip set - sb.append(applicationTemplates.statusWithAlertTemplate(statusImageHtml, alertImageHtml)); + sb.append(applicationTemplates.statusWithAlertTemplate(statusImageHtml, alertImageHtml, id)); } else { - sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); + sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip, id)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeActivityCompositeCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeActivityCompositeCell.java index 5977b06..e5e859f 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeActivityCompositeCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeActivityCompositeCell.java @@ -4,9 +4,9 @@ import java.util.List; import org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport; +import org.ovirt.engine.ui.common.widget.table.cell.CompositeCell; import com.google.gwt.cell.client.Cell; -import com.google.gwt.cell.client.CompositeCell; import com.google.gwt.cell.client.HasCell; import com.google.gwt.dom.client.Element; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -21,12 +21,12 @@ } @Override - public void render(Context context, T value, SafeHtmlBuilder sb) { + public void render(Context context, T value, SafeHtmlBuilder sb, String id) { if (!isVisible(value)) { return; } - sb.appendHtmlConstant("<table style=\"margin:0 auto\"><tr>"); //$NON-NLS-1$ + sb.appendHtmlConstant("<table id=\"" + id + "\" style=\"margin:0 auto\"><tr>"); //$NON-NLS-1$ //$NON-NLS-2$ Iterator<HasCell<T, ?>> iterator = hasCells.iterator(); while (iterator.hasNext()) { render(context, value, sb, iterator.next()); @@ -46,7 +46,7 @@ protected <X> void render(Context context, T value, SafeHtmlBuilder sb, - HasCell<T, X> hasCell) { + HasCell<T, X> hasCell, String id) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); //$NON-NLS-1$ cell.render(context, hasCell.getValue(value), sb); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeBrickStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeBrickStatusCell.java index dbedfc6..95e75bc 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeBrickStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeBrickStatusCell.java @@ -2,11 +2,11 @@ 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 org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -20,7 +20,7 @@ ApplicationTemplates applicationTemplates = ClientGinjectorProvider.getApplicationTemplates(); @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; @@ -43,6 +43,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(applicationTemplates.volumeBrickStatusTemplate(upImageHtml, upBricks, downImageHtml, downBricks)); + sb.append(applicationTemplates.volumeBrickStatusTemplate(upImageHtml, upBricks, downImageHtml, downBricks, id)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusCell.java index a774830..6cb022a 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/VolumeStatusCell.java @@ -1,6 +1,7 @@ package org.ovirt.engine.ui.webadmin.widget.table.column; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; +import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell; import org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils; import org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus; import org.ovirt.engine.ui.webadmin.ApplicationConstants; @@ -8,7 +9,6 @@ import org.ovirt.engine.ui.webadmin.ApplicationTemplates; import org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -61,8 +61,8 @@ } @Override - public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { - // Nothing to render if no volume is provided: + public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb, String id) { + // Nothing to render if no volume is provided: if (volume == null) { return; } @@ -72,6 +72,6 @@ // Generate the HTML for the image: SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); - sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); + sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip, id)); } } -- To view, visit https://gerrit.ovirt.org/41599 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I930f656e9e867bed5f5675a2401a10476d3c7672 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: anmolbabu <anb...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches