Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin: changed all custom Cell classes to set IDs ......................................................................
userportal, webadmin: changed all custom Cell classes to set IDs (Patch 4x of 12) Changed all of our custom Cell classes to use the Element ID framework and set IDs on their renderings. No functional changes -- just makes it easier for Selenium testing. Change-Id: I0cec903914043ebb48a03d9ba17db15b130c65ef Signed-off-by: Greg Sheremeta <gsher...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EnumRadioEditor.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCellWithTooltip.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractEditableCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractImageButtonCell.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractInputCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractTitlePanelCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeTooltipCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/DecoratedImageResourceCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/EditTextCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageButtonCell.java 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/LinkCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ListModelListBoxCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LunSelectionCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/PasswordTextInputCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/SafeHtmlCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ScrollableTextCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/StatusCompositeCellWithElementId.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextCell.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextInputCell.java A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractColumn.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractLunTextColumn.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlColumn.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlWithSafeHtmlTooltipColumn.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSortableColumn.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledCheckboxCell.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledRadioCell.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/widget/extended/vm/AbstractConsoleButtonCell.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/BrickStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/HostStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VmStatusCell.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeStatusCell.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 37 files changed, 456 insertions(+), 164 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/38701/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EnumRadioEditor.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EnumRadioEditor.java index af4e7c2..fcbea27 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EnumRadioEditor.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EnumRadioEditor.java @@ -92,7 +92,7 @@ @SuppressWarnings("unchecked") @Override - public void render(com.google.gwt.cell.client.Cell.Context context, Boolean value, SafeHtmlBuilder sb) { + public void render(Context context, Boolean value, SafeHtmlBuilder sb, String id) { // Get the view data. Object key = context.getKey(); E keyValue = (E) key; @@ -111,7 +111,7 @@ } } else { // enabled - super.render(context, value, sb); + super.render(context, value, sb, id); } } } 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..0f0fcfc --- /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.idhandler.CellWithElementId; +import org.ovirt.engine.ui.common.utils.ElementIdUtils; + +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/AbstractCellWithTooltip.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCellWithTooltip.java index d15b29b..12a7494 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCellWithTooltip.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractCellWithTooltip.java @@ -2,7 +2,6 @@ import org.ovirt.engine.ui.common.utils.ElementUtils; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractEditableCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractEditableCell.java new file mode 100644 index 0000000..2276bf1 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractEditableCell.java @@ -0,0 +1,60 @@ +package org.ovirt.engine.ui.common.widget.table.cell; + +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; +import org.ovirt.engine.ui.common.utils.ElementIdUtils; + +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 AbstractEditableCell. + * Supports rendering Element ids via the oVirt Element-ID framework. + * </p> + */ +public abstract class AbstractEditableCell<C, V> extends com.google.gwt.cell.client.AbstractEditableCell<C, V> implements CellWithElementId<C> { + + private String elementIdPrefix = DOM.createUniqueId(); // default + private String columnId; + + public AbstractEditableCell(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/AbstractImageButtonCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractImageButtonCell.java index b2be396..8b29254 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractImageButtonCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractImageButtonCell.java @@ -1,6 +1,7 @@ package org.ovirt.engine.ui.common.widget.table.cell; -import com.google.gwt.cell.client.AbstractCell; +import org.ovirt.engine.ui.uicommonweb.UICommand; + import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; @@ -10,10 +11,7 @@ import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlUtils; -import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.AbstractImagePrototype; -import org.ovirt.engine.ui.common.utils.ElementIdUtils; -import org.ovirt.engine.ui.uicommonweb.UICommand; /** * Cell that renders ActionButtonDefinition-like image buttons. @@ -25,21 +23,9 @@ private final SafeHtml imageHtml; - // DOM element ID settings for the text container element - private String elementIdPrefix = DOM.createUniqueId(); - private String columnId; - public AbstractImageButtonCell(ImageResource image) { super(BrowserEvents.CLICK); this.imageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(image).getHTML()); - } - - public void setElementIdPrefix(String elementIdPrefix) { - this.elementIdPrefix = elementIdPrefix; - } - - public void setColumnId(String columnId) { - this.columnId = columnId; } @Override @@ -57,9 +43,9 @@ } @Override - public void render(Context context, C value, SafeHtmlBuilder sb) { + public void render(Context context, C value, SafeHtmlBuilder sb, String id) { sb.appendHtmlConstant("<span id=\"" //$NON-NLS-1$ - + ElementIdUtils.createTableCellElementId(elementIdPrefix, columnId, context) + + id + "\" style=\"vertical-align: middle;\" title=\"" //$NON-NLS-1$ + SafeHtmlUtils.htmlEscape(getTitle(value)) + "\">"); //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractInputCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractInputCell.java new file mode 100644 index 0000000..8913ba1 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractInputCell.java @@ -0,0 +1,58 @@ +package org.ovirt.engine.ui.common.widget.table.cell; + +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; +import org.ovirt.engine.ui.common.utils.ElementIdUtils; + +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.user.client.DOM; + +/** + * Base class for all Cells that would otherwise extend GWT AbstractInputCell. + * Supports rendering Element ids via the oVirt Element-ID framework. + */ +public abstract class AbstractInputCell<C, V> extends com.google.gwt.cell.client.AbstractInputCell<C, V> implements CellWithElementId<C> { + + private String elementIdPrefix = DOM.createUniqueId(); // default + private String columnId; + + public AbstractInputCell(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/AbstractTitlePanelCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractTitlePanelCell.java index 76ba256..31a0268 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractTitlePanelCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/AbstractTitlePanelCell.java @@ -1,6 +1,5 @@ package org.ovirt.engine.ui.common.widget.table.cell; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeTooltipCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeTooltipCell.java index 8dfcf11..1212592 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeTooltipCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/CompositeTooltipCell.java @@ -3,13 +3,16 @@ import java.util.List; import org.ovirt.engine.ui.common.idhandler.CellWithElementId; +import org.ovirt.engine.ui.common.utils.ElementIdUtils; +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.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.DOM; /** - * A composite cell that sets an ID when it renders. + * A composite cell that supports rendering Element ids via the oVirt Element-ID framework. * TODO tt add tooltip support * * @param <C> @@ -17,14 +20,53 @@ */ public class CompositeTooltipCell<C> extends CompositeCell<C> implements CellWithElementId<C> { - public CompositeTooltipCell(List<HasCell<C, ?>> hasCells) { - super(hasCells); - } + private final List<HasCell<C, ?>> hasCells; // DOM element ID settings for text container element private String elementIdPrefix = DOM.createUniqueId(); private String columnId; + public CompositeTooltipCell(List<HasCell<C, ?>> hasCells) { + super(hasCells); + this.hasCells = hasCells; + } + + /** + * 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 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) { + Cell<X> cell = hasCell.getCell(); + sb.appendHtmlConstant("<span id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ + cell.render(context, hasCell.getValue(value), sb); + sb.appendHtmlConstant("</span>"); //$NON-NLS-1$ + } + public void setElementIdPrefix(String elementIdPrefix) { this.elementIdPrefix = elementIdPrefix; } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/DecoratedImageResourceCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/DecoratedImageResourceCell.java index 69b896d..8b65fa3 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/DecoratedImageResourceCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/DecoratedImageResourceCell.java @@ -12,10 +12,11 @@ public class DecoratedImageResourceCell extends AbstractTitlePanelCell<ImageWithDecorator> { interface CellTemplate extends SafeHtmlTemplates { - @Template("<div style=\"position: relative; left: 0; top: 0;\"><span style=\"position: relative; left: 0px; top: 0px;\">{0}</span><span style=\"position: absolute; left: {2}px; top: {3}px;\">{1}</span></div>") - SafeHtml doubleImageContainer(SafeHtml imageHtml, SafeHtml decoratorHtml, int left, int top); + @Template("<div id=\"{4}\" style=\"position: relative; left: 0; top: 0;\"><span style=\"position: relative; left: 0px; top: 0px;\">{0}</span><span style=\"position: absolute; left: {2}px; top: {3}px;\">{1}</span></div>") + SafeHtml doubleImageContainer(SafeHtml imageHtml, SafeHtml decoratorHtml, int left, int top, String id); } + // TODO is there a reason this doesn't lazy instantiate like the other cells? private static final CellTemplate template = GWT.create(CellTemplate.class); public DecoratedImageResourceCell() { @@ -23,10 +24,10 @@ } @Override - public void render(Context context, ImageWithDecorator value, SafeHtmlBuilder sb) { + public void render(Context context, ImageWithDecorator value, SafeHtmlBuilder sb, String id) { if (value != null) { - SafeHtml mainImageHtml = SafeHtmlUtils.fromTrustedString(""); - SafeHtml decorateImageHtml = SafeHtmlUtils.fromTrustedString(""); + SafeHtml mainImageHtml = SafeHtmlUtils.fromTrustedString(""); //$NON-NLS-1$ + SafeHtml decorateImageHtml = SafeHtmlUtils.fromTrustedString(""); //$NON-NLS-1$ if (value.getImage() != null) { mainImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(value.getImage()).getHTML()); @@ -38,7 +39,8 @@ sb.append(template.doubleImageContainer(mainImageHtml, decorateImageHtml, value.getDecoratorPositionLeft(), - value.getDecoratorPositionTop())); + value.getDecoratorPositionTop(), + id)); } } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/EditTextCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/EditTextCell.java index 30a6233..0393200 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/EditTextCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/EditTextCell.java @@ -23,7 +23,8 @@ } @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { + public void render(Context context, String value, SafeHtmlBuilder sb, String id) { + // TODO use ID? perhaps wrap in a div delegate.render(context, value, sb); } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageButtonCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageButtonCell.java index c66d446..609d3d4 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageButtonCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ImageButtonCell.java @@ -1,9 +1,7 @@ package org.ovirt.engine.ui.common.widget.table.cell; -import org.ovirt.engine.ui.common.utils.ElementIdUtils; import org.ovirt.engine.ui.uicommonweb.UICommand; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; @@ -13,7 +11,6 @@ import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlUtils; -import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.AbstractImagePrototype; /** @@ -30,10 +27,6 @@ private final SafeHtml disabledHtml; private final String disabledCss; - // DOM element ID settings for the text container element - private String elementIdPrefix = DOM.createUniqueId(); - private String columnId; - public ImageButtonCell(ImageResource enabledImage, String enabledCss, ImageResource disabledImage, String disabledCss) { super(BrowserEvents.CLICK); @@ -41,14 +34,6 @@ this.enabledCss = enabledCss; this.disabledHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(disabledImage).getHTML()); this.disabledCss = disabledCss; - } - - public void setElementIdPrefix(String elementIdPrefix) { - this.elementIdPrefix = elementIdPrefix; - } - - public void setColumnId(String columnId) { - this.columnId = columnId; } @Override @@ -67,11 +52,11 @@ } @Override - public void render(Context context, T value, SafeHtmlBuilder sb) { + public void render(Context context, T value, SafeHtmlBuilder sb, String id) { boolean isEnabled = isEnabled(value); // TODO(vszocs) consider using SafeHtmlTemplates instead of building HTML manually sb.appendHtmlConstant("<span id=\"" //$NON-NLS-1$ - + ElementIdUtils.createTableCellElementId(elementIdPrefix, columnId, context) + + id + "\" class=\"" //$NON-NLS-1$ + (isEnabled ? enabledCss : disabledCss) + "\" title=\"" //$NON-NLS-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 4bb8622a..30f3230 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 @@ -35,7 +35,8 @@ } @Override - public void render(Context context, ImageResource value, SafeHtmlBuilder sb) { + public void render(Context context, ImageResource value, SafeHtmlBuilder sb, String id) { + // this class is removed in a follow-up patch. that is why i'm ignoring the id here. if (value != null) { sb.append(template.imageContainerWithStyleClass( style, diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LinkCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LinkCell.java index 2058f1a..156860b 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LinkCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LinkCell.java @@ -3,9 +3,12 @@ import org.ovirt.engine.core.compat.StringHelper; import com.google.gwt.cell.client.ValueUpdater; +import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.safehtml.client.SafeHtmlTemplates; +import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; /** @@ -16,15 +19,24 @@ @SuppressWarnings("deprecation") public class LinkCell extends TextCell { + private final static String CONTENT_ID_SUFFIX = "_content"; //$NON-NLS-1$ + + public interface CellTemplate extends SafeHtmlTemplates { + @Template("<a id='{0}' href='javascript:;' style='display: inline-block'>") + SafeHtml link(String id); + } + + private CellTemplate template = GWT.create(CellTemplate.class); + public LinkCell(int maxTextLength) { super(maxTextLength, BrowserEvents.MOUSEOVER, BrowserEvents.CLICK); } @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { + public void render(Context context, String value, SafeHtmlBuilder sb, String id) { if (value != null) { - sb.appendHtmlConstant("<a href='javascript:;' style='display: inline-block'>"); //$NON-NLS-1$ - super.render(context, value, sb); + sb.append(template.link(id)); + super.render(context, value, sb, id + CONTENT_ID_SUFFIX); sb.appendHtmlConstant("</a>"); //$NON-NLS-1$ } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ListModelListBoxCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ListModelListBoxCell.java index 72d9cde..d0890da 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ListModelListBoxCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ListModelListBoxCell.java @@ -8,13 +8,13 @@ import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.ListModel; -import com.google.gwt.cell.client.AbstractInputCell; import com.google.gwt.cell.client.SelectionCell; import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.text.shared.Renderer; import com.google.gwt.view.client.CellPreviewEvent; @@ -61,14 +61,16 @@ @SuppressWarnings("unchecked") @Override - public void render(Context context, ListModel value, SafeHtmlBuilder sb) { + public void render(Context context, ListModel value, SafeHtmlBuilder sb, String id) { setOptions(value); SafeHtmlBuilder sbDelegate = new SafeHtmlBuilder(); delegate.render(context, renderer.render((T) value.getSelectedItem()), sbDelegate); + String select = sbDelegate.toSafeHtml().asString(); + select = select.replaceFirst(PATTERN_SELECT, PATTERN_SELECT + " id=\"" + id + "\""); //$NON-NLS-1$ //$NON-NLS-2$ if (value.getIsChangable()) { - sb.append(sbDelegate.toSafeHtml()); + sb.append(SafeHtmlUtils.fromTrustedString(select)); } else { - sb.appendHtmlConstant(sbDelegate.toSafeHtml().asString().replaceFirst(PATTERN_SELECT, REPLACEMENT_SELECT)); + sb.appendHtmlConstant(select.replaceFirst(PATTERN_SELECT, REPLACEMENT_SELECT)); } } @@ -103,7 +105,7 @@ } Element target = nativeEvent.getEventTarget().cast(); String tagName = target.getTagName().toLowerCase(); - return "select".equals(tagName) || "option".equals(tagName); //$NON-NLS-1$ $NON-NLS-2$ + return "select".equals(tagName) || "option".equals(tagName); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LunSelectionCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LunSelectionCell.java index 61daf1a..cb8fa91 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LunSelectionCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/LunSelectionCell.java @@ -3,7 +3,6 @@ import org.ovirt.engine.ui.common.CommonApplicationResources; import org.ovirt.engine.ui.uicommonweb.models.storage.LunModel; -import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.core.client.GWT; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlUtils; @@ -22,21 +21,24 @@ } @Override - public void render(Context context, LunModel value, SafeHtmlBuilder sb) { + public void render(Context context, LunModel value, SafeHtmlBuilder sb, String id) { ImageResourceCell imageCell = new ImageResourceCell(); imageCell.setStyle("text-align: center;"); //$NON-NLS-1$ if (value.getIsIncluded()) { - imageCell.render(context, resources.okSmallImage(), sb); + // ImageResourceCell sets the id + imageCell.render(context, resources.okSmallImage(), sb, id); } else if (!value.getIsAccessible()) { - imageCell.render(context, resources.logWarningImage(), sb); + // ImageResourceCell sets the id + imageCell.render(context, resources.logWarningImage(), sb, id); } else { - sb.append(SafeHtmlUtils.fromTrustedString("<span style=\"padding-left: 1px;\">")); //$NON-NLS-1$ + sb.append(SafeHtmlUtils.fromTrustedString("<span id=\"" + id + " style=\"padding-left: 1px;\">")); //$NON-NLS-1$ //$NON-NLS-2$ String type = multiSelection ? "type='checkbox' " : "type='radio' "; //$NON-NLS-1$ //$NON-NLS-2$ String checked = value.getIsSelected() ? "checked='checked' " : ""; //$NON-NLS-1$ //$NON-NLS-2$ String disabled = value.getIsGrayedOut() ? "disabled='disabled' " : ""; //$NON-NLS-1$ //$NON-NLS-2$ - String input = "<input " + type + checked + disabled + " tabindex='-1'/>"; //$NON-NLS-1$ //$NON-NLS-2$ + // include the id + String input = "<input id=\"" + id + "_input" + "\" " + type + checked + disabled + " tabindex='-1'/>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ sb.append(SafeHtmlUtils.fromTrustedString(input)); sb.append(SafeHtmlUtils.fromTrustedString("</span>")); //$NON-NLS-1$ diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/PasswordTextInputCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/PasswordTextInputCell.java index 4e9b4a1..65c17e0 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/PasswordTextInputCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/PasswordTextInputCell.java @@ -1,6 +1,5 @@ package org.ovirt.engine.ui.common.widget.table.cell; -import com.google.gwt.cell.client.TextInputCell; import com.google.gwt.core.client.GWT; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; @@ -9,8 +8,11 @@ public class PasswordTextInputCell extends TextInputCell { interface PasswordTemplate extends SafeHtmlTemplates { - @Template("<input type=\"password\" value=\"{0}\" tabindex=\"-1\"></input>") - SafeHtml input(String value); + @Template("<input id=\"\" type=\"password\" value=\"{1}\" tabindex=\"-1\"></input>") + SafeHtml inputWithValue(String id, String value); + + @Template("<input id=\"\" type=\"password\" tabindex=\"-1\"></input>") + SafeHtml input(String id); } private static PasswordTemplate template; @@ -22,7 +24,7 @@ } @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { + public void render(Context context, String value, SafeHtmlBuilder sb, String id) { // Get the view data. Object key = context.getKey(); ViewData viewData = getViewData(key); @@ -33,9 +35,9 @@ String s = (viewData != null) ? viewData.getCurrentValue() : value; if (s != null) { - sb.append(template.input(s)); + sb.append(template.inputWithValue(id, s)); } else { - sb.appendHtmlConstant("<input type=\"password\" tabindex=\"-1\"></input>"); //$NON-NLS-1$ + sb.append(template.input(id)); } } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java index dc12cd1..5f5d4e1 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/RadioboxCell.java @@ -1,33 +1,30 @@ package org.ovirt.engine.ui.common.widget.table.cell; -import com.google.gwt.cell.client.AbstractEditableCell; import com.google.gwt.cell.client.ValueUpdater; +import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.InputElement; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; -import com.google.gwt.safehtml.shared.SafeHtmlUtils; /** - * A cell used to render a checkbox. The value of the checkbox may be toggled using the ENTER key as well as via mouse + * A cell used to render a radio button. The value of the radio may be toggled using the ENTER key as well as via mouse * click. */ public class RadioboxCell extends AbstractEditableCell<Boolean, Boolean> { - /** - * An html string representation of a checked input box. - */ - private static final SafeHtml INPUT_CHECKED = SafeHtmlUtils.fromSafeConstant( - "<input type=\"radio\" tabindex=\"-1\" checked/>"); //$NON-NLS-1$ + interface RadioboxCellTemplates extends SafeHtmlTemplates { + @Template("<input id=\"{0}\" type=\"radio\" tabindex=\"-1\" checked/>") + SafeHtml radioChecked(String id); + @Template("<input id=\"{0}\" type=\"radio\" tabindex=\"-1\"/>") + SafeHtml radioUnchecked(String id); + } - /** - * An html string representation of an unchecked input box. - */ - private static final SafeHtml INPUT_UNCHECKED = SafeHtmlUtils.fromSafeConstant( - "<input type=\"radio\" tabindex=\"-1\"/>"); //$NON-NLS-1$ + private static RadioboxCellTemplates templates = GWT.create(RadioboxCellTemplates.class); private final boolean dependsOnSelection; private final boolean handlesSelection; @@ -121,7 +118,7 @@ } @Override - public void render(Context context, Boolean value, SafeHtmlBuilder sb) { + public void render(Context context, Boolean value, SafeHtmlBuilder sb, String id) { // Get the view data. Object key = context.getKey(); Boolean viewData = getViewData(key); @@ -131,9 +128,9 @@ } if (value != null && ((viewData != null) ? viewData : value)) { - sb.append(INPUT_CHECKED); + sb.append(templates.radioChecked(id)); } else { - sb.append(INPUT_UNCHECKED); + sb.append(templates.radioUnchecked(id)); } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/SafeHtmlCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/SafeHtmlCell.java index 6b9469d..7c2984d 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/SafeHtmlCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/SafeHtmlCell.java @@ -22,9 +22,9 @@ } @Override - public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { + public void render(Context context, SafeHtml value, SafeHtmlBuilder sb, String id) { if (value != null) { - sb.appendHtmlConstant("<div style='display:block'>"); //$NON-NLS-1$ + sb.appendHtmlConstant("<div id=\" " + id + "\" style='display:block'>"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append(value); sb.appendHtmlConstant("</div>"); //$NON-NLS-1$ } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ScrollableTextCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ScrollableTextCell.java index 0361576d..b1c379b 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ScrollableTextCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/ScrollableTextCell.java @@ -1,6 +1,5 @@ package org.ovirt.engine.ui.common.widget.table.cell; -import com.google.gwt.cell.client.TextInputCell; import com.google.gwt.core.client.GWT; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; @@ -9,15 +8,15 @@ public class ScrollableTextCell extends TextInputCell { public interface CellTemplate extends SafeHtmlTemplates { - @Template("<input style=\"background: transparent; border: 0px; width: 95%; {1}\"" + + @Template("<input id=\"{2}\" style=\"background: transparent; border: 0px; width: 95%; {1}\"" + "readonly=\"readonly\" type=\"text\" value=\"{0}\" title=\"{0}\" tabindex=\"-1\"></input>") - SafeHtml input(String value, String customStyle); + SafeHtml input(String value, String customStyle, String id); } @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { + public void render(Context context, String value, SafeHtmlBuilder sb, String id) { CellTemplate template = GWT.create(CellTemplate.class); - sb.append(template.input(value, "")); //$NON-NLS-1$ + sb.append(template.input(value, "", id)); //$NON-NLS-1$ } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/StatusCompositeCellWithElementId.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/StatusCompositeCellWithElementId.java index ea9e997..196f583 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/StatusCompositeCellWithElementId.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/StatusCompositeCellWithElementId.java @@ -3,7 +3,6 @@ import java.util.List; import org.ovirt.engine.ui.common.idhandler.CellWithElementId; -import org.ovirt.engine.ui.common.utils.ElementIdUtils; import org.ovirt.engine.ui.common.widget.table.HasStyleClass; import com.google.gwt.cell.client.Cell; @@ -52,9 +51,8 @@ } @Override - public void render(Cell.Context context, C value, SafeHtmlBuilder sb) { - sb.append(getTemplate().id(ElementIdUtils.createTableCellElementId( - getElementIdPrefix(), getColumnId(), context))); + public void render(Cell.Context context, C value, SafeHtmlBuilder sb, String id) { + sb.append(getTemplate().id(id)); for (HasCell<C, ?> hasCell : hasCells) { render(context, value, sb, hasCell); 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 ac877ec..8471079 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 @@ -1,8 +1,8 @@ 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.HasStyleClass; +import com.google.gwt.cell.client.Cell.Context; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; @@ -10,7 +10,6 @@ import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlUtils; -import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.HTML; /** @@ -29,9 +28,6 @@ public static final int UNLIMITED_LENGTH = -1; private static final String TOO_LONG_TEXT_POSTFIX = "..."; //$NON-NLS-1$ - // DOM element ID settings for text container element - private String elementIdPrefix = DOM.createUniqueId(); - private String columnId; private String title; private String styleClass = ""; //$NON-NLS-1$ @@ -64,21 +60,13 @@ title = value; } - public void setElementIdPrefix(String elementIdPrefix) { - this.elementIdPrefix = elementIdPrefix; - } - - public void setColumnId(String columnId) { - this.columnId = columnId; - } - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { + public void render(Context context, String value, SafeHtmlBuilder sb, String id) { if (value != null) { SafeHtml escapedValue = getEscapedValue(value); SafeHtml renderedValue = getRenderedValue(escapedValue); sb.append(template.textContainer(styleClass, - ElementIdUtils.createTableCellElementId(elementIdPrefix, columnId, context), + id, renderedValue)); } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextInputCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextInputCell.java new file mode 100644 index 0000000..cd37b60 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/TextInputCell.java @@ -0,0 +1,54 @@ +package org.ovirt.engine.ui.common.widget.table.cell; + +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; +import org.ovirt.engine.ui.common.utils.ElementIdUtils; + +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.user.client.DOM; + +/** + * Base class for all Cells that would otherwise extend GWT TextInputCell. + * Supports rendering Element ids via the oVirt Element-ID framework. + */ +public abstract class TextInputCell extends com.google.gwt.cell.client.TextInputCell implements CellWithElementId<String> { + + private String elementIdPrefix = DOM.createUniqueId(); // default + private String columnId; + + /** + * 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, String 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, String 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/column/AbstractColumn.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractColumn.java new file mode 100644 index 0000000..8a7aab8 --- /dev/null +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractColumn.java @@ -0,0 +1,26 @@ +package org.ovirt.engine.ui.common.widget.table.column; + +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; + +import com.google.gwt.user.cellview.client.Column; + +/** + * Base class for Columns that work with Cells that use the Element ID framework. + */ +public abstract class AbstractColumn<T, C> extends Column<T, C> implements ColumnWithElementId { + + public AbstractColumn(CellWithElementId<C> cell) { + super(cell); + } + + public CellWithElementId<C> getCell() { + return (CellWithElementId<C>) getCell(); + } + + @Override + public void configureElementId(String elementIdPrefix, String columnId) { + getCell().setElementIdPrefix(elementIdPrefix); + getCell().setColumnId(columnId); + } + +} diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractLunTextColumn.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractLunTextColumn.java index 8416bb7..a917cea 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractLunTextColumn.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractLunTextColumn.java @@ -5,11 +5,13 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.user.client.DOM; public abstract class AbstractLunTextColumn extends AbstractSafeHtmlColumn<LunModel> { @Override public final SafeHtml getValue(LunModel object) { + // TODO this should use a cell to render, not return HTML itself ScrollableTextCell.CellTemplate template = GWT.create(ScrollableTextCell.CellTemplate.class); String color = ""; //$NON-NLS-1$ @@ -23,7 +25,8 @@ } } - return template.input(getRawValue(object), "color:" + color); //$NON-NLS-1$ + // TODO use a proper ID + return template.input(getRawValue(object), "color:" + color, DOM.createUniqueId()); //$NON-NLS-1$ } public abstract String getRawValue(LunModel object); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlColumn.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlColumn.java index a3b5f73..6b93b45 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlColumn.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlColumn.java @@ -1,6 +1,7 @@ package org.ovirt.engine.ui.common.widget.table.column; -import com.google.gwt.cell.client.SafeHtmlCell; +import org.ovirt.engine.ui.common.widget.table.cell.SafeHtmlCell; + import com.google.gwt.safehtml.shared.SafeHtml; /** diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlWithSafeHtmlTooltipColumn.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlWithSafeHtmlTooltipColumn.java index d8c06e2..2cb25d3 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlWithSafeHtmlTooltipColumn.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSafeHtmlWithSafeHtmlTooltipColumn.java @@ -1,6 +1,7 @@ package org.ovirt.engine.ui.common.widget.table.column; -import com.google.gwt.cell.client.AbstractCell; +import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell; + import com.google.gwt.cell.client.Cell.Context; import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.dom.client.BrowserEvents; @@ -27,7 +28,7 @@ } @Override - public void render(com.google.gwt.cell.client.Cell.Context context, SafeHtml value, SafeHtmlBuilder sb) { + public void render(Context context, SafeHtml value, SafeHtmlBuilder sb, String id) { if (value != null) { sb.append(value); } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSortableColumn.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSortableColumn.java index 5b8718b..01af52d 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSortableColumn.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/AbstractSortableColumn.java @@ -2,7 +2,8 @@ import java.util.Comparator; -import com.google.gwt.cell.client.Cell; +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; + import com.google.gwt.user.cellview.client.Column; /** @@ -23,7 +24,7 @@ // (applies in case of client-side sorting) private Comparator<? super T> comparator; - public AbstractSortableColumn(Cell<C> cell) { + public AbstractSortableColumn(CellWithElementId<C> cell) { super(cell); } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledCheckboxCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledCheckboxCell.java index 5b0d30f..ad62bc7 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledCheckboxCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledCheckboxCell.java @@ -1,15 +1,21 @@ package org.ovirt.engine.ui.common.widget.table.column; +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; import org.ovirt.engine.ui.common.widget.table.cell.EventHandlingCell; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import com.google.gwt.cell.client.CheckboxCell; +import com.google.gwt.user.client.DOM; import com.google.gwt.view.client.CellPreviewEvent; /** - * A Cell that renders a checkbox. + * Base class for all Cells that would otherwise extend GWT CheckboxCell. + * Supports rendering Element ids via the oVirt Element-ID framework. */ -public class EnabledDisabledCheckboxCell extends CheckboxCell implements EventHandlingCell { +public class EnabledDisabledCheckboxCell extends CheckboxCell implements EventHandlingCell, CellWithElementId<Boolean> { + + private String elementIdPrefix = DOM.createUniqueId(); // default + private String columnId; public EnabledDisabledCheckboxCell() { super(true, false); @@ -20,4 +26,20 @@ return AbstractCheckboxColumn.handlesEvent(event); } + 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/column/EnabledDisabledRadioCell.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledRadioCell.java index 157b633..2fe1b18 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledRadioCell.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/EnabledDisabledRadioCell.java @@ -1,12 +1,17 @@ package org.ovirt.engine.ui.common.widget.table.column; +import org.ovirt.engine.ui.common.idhandler.CellWithElementId; import org.ovirt.engine.ui.common.widget.table.cell.EventHandlingCell; import org.ovirt.engine.ui.common.widget.table.cell.RadioboxCell; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import com.google.gwt.view.client.CellPreviewEvent; -public class EnabledDisabledRadioCell extends RadioboxCell implements EventHandlingCell { +/** + * EnabledDisabledRadioCell. + * Supports rendering Element ids via the oVirt Element-ID framework. + */ +public class EnabledDisabledRadioCell extends RadioboxCell implements EventHandlingCell, CellWithElementId<Boolean> { public EnabledDisabledRadioCell() { super(true, false); 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 ce4f625..c3a8c69 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 @@ -1,7 +1,9 @@ package org.ovirt.engine.ui.userportal.widget.extended.vm; -import com.google.gwt.cell.client.AbstractCell; +import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell; +import org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalItemModel; + import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; @@ -15,10 +17,6 @@ import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlUtils; -import com.google.gwt.user.client.DOM; - -import org.ovirt.engine.ui.common.utils.ElementIdUtils; -import org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalItemModel; public abstract class AbstractConsoleButtonCell extends AbstractCell<UserPortalItemModel> { @@ -44,10 +42,6 @@ private final String title; - // DOM element ID settings for the text container element - private String elementIdPrefix = DOM.createUniqueId(); - private String columnId; - private static CellTemplate template; public AbstractConsoleButtonCell(String enabledCss, String disabledCss, @@ -62,14 +56,6 @@ if (template == null) { template = GWT.create(CellTemplate.class); } - } - - public void setElementIdPrefix(String elementIdPrefix) { - this.elementIdPrefix = elementIdPrefix; - } - - public void setColumnId(String columnId) { - this.columnId = columnId; } @Override @@ -102,9 +88,9 @@ } @Override - public void render(Context context, UserPortalItemModel model, SafeHtmlBuilder sb) { + public void render(Context context, UserPortalItemModel model, SafeHtmlBuilder sb, String id) { sb.append(template.consoleButton( - ElementIdUtils.createTableCellElementId(elementIdPrefix, columnId, context), + id, title, shouldRenderCell(model) ? enabledCss : disabledCss)); } 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 c8bf4d3..36d34b4 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 @@ -95,11 +95,11 @@ SafeHtml alertEventButton(SafeHtml image, String text, String start, String stretch, String end, String contentStyleName); - @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 title=\"{1}\" style=\"text-align: center;\">{0}</div>") - SafeHtml statusTemplate(SafeHtml statusImage, String title); + @Template("<div id=\"{2}\" title=\"{1}\" style=\"text-align: center;\">{0}</div>") + SafeHtml statusTemplate(SafeHtml statusImage, String title, String id); @Template("<button type='button' tabindex='-1' style='float: right; height: 20px;'>" + diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/BrickStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/BrickStatusCell.java index 170e9a2..bf889d8 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/BrickStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/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/cell/HostStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/HostStatusCell.java index b38e0e0..5ffd838 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/HostStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/HostStatusCell.java @@ -2,10 +2,10 @@ import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSStatus; +import org.ovirt.engine.ui.common.widget.table.cell.AbstractCell; import org.ovirt.engine.ui.webadmin.ApplicationResources; 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; @@ -15,7 +15,7 @@ public class HostStatusCell extends AbstractCell<VDS> { @Override - public void render(Context context, VDS vds, SafeHtmlBuilder sb) { + public void render(Context context, VDS vds, SafeHtmlBuilder sb, String id) { // Nothing to render if no host is provided: if (vds == null) { return; @@ -81,7 +81,7 @@ // Generate the HTML for the cell including the exclamation mark only if // power management is not enabled or there are network configuration // changes that haven't been saved yet: - sb.appendHtmlConstant("<div style=\"text-align: center;\">"); //$NON-NLS-1$ + sb.appendHtmlConstant("<div id=\"" + id + " \" style=\"text-align: center;\">"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append(statusImageHtml); boolean getnet_config_dirty = vds.getNetConfigDirty() == null ? false : vds.getNetConfigDirty().booleanValue(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VmStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VmStatusCell.java index d4cb84c..9809ff4 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VmStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VmStatusCell.java @@ -5,12 +5,12 @@ 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.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/cell/VolumeStatusCell.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeStatusCell.java index cfce337..b1a0f4d 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeStatusCell.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeStatusCell.java @@ -1,6 +1,7 @@ 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.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,7 +61,7 @@ } @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; @@ -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)); } } 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)); } } -- To view, visit https://gerrit.ovirt.org/38701 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0cec903914043ebb48a03d9ba17db15b130c65ef 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