Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Implement validation in EntityModelCellTable
......................................................................

webadmin: Implement validation in EntityModelCellTable

Validation accepts a list of errors, and outlines invalid entries
(ones which have non-empty errors) with a red outline, as well as adds
the invalidity reason as tooltip.

Change-Id: I8cddd3a6dbfe3cd9b18b631f4da13865b367d096
Bug-Url: https://bugzilla.redhat.com/1048752
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/31324/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
index f11fb36..965545d 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelCellTable.java
@@ -13,11 +13,14 @@
 import org.ovirt.engine.ui.common.widget.table.header.SelectAllCheckBoxHeader;
 import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
 import org.ovirt.engine.ui.uicommonweb.models.ListModel;
+import org.ovirt.engine.ui.uicompat.external.StringUtils;
 
 import com.google.gwt.cell.client.Cell;
 import com.google.gwt.cell.client.CheckboxCell;
 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.Style.OutlineStyle;
 import com.google.gwt.dom.client.Style.Unit;
 import com.google.gwt.safehtml.shared.SafeHtml;
 import com.google.gwt.safehtml.shared.SafeHtmlUtils;
@@ -306,6 +309,18 @@
         return asEditor().flush();
     }
 
+    public void validate(List<String> errors) {
+        for (int i=0; i < getRowCount(); ++i) {
+            String error = errors.get(i);
+            Element element = getRowElement(i);
+            boolean valid = StringUtils.isEmpty(error);
+            element.setTitle(valid ? null : error);
+            element.getStyle().setOutlineStyle(valid ? OutlineStyle.NONE : 
OutlineStyle.SOLID);
+            element.getStyle().setOutlineColor("red"); //$NON-NLS-1$
+            element.getStyle().setOutlineWidth(1, Unit.PX);
+        }
+    }
+
     @Override
     public HasEditorDriver<M> asEditor() {
         return editorAdapter;


-- 
To view, visit http://gerrit.ovirt.org/31324
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to