Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Fix vNIC widget behavior
......................................................................

webadmin: Fix vNIC widget behavior

The relatively recent adjustment of the widget to allow
arbitrary-length labels caused labels to always appear as enabled -
this patch properly renders them again.

Change-Id: I76cf6c99f5e894470396751fee533e67f04bbcb3
Bug-Url: https://bugzilla.redhat.com/1086259
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/label/LabelWithTextOverflow.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/profile/ProfilesInstanceTypeEditor.java
2 files changed, 17 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/31880/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/label/LabelWithTextOverflow.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/label/LabelWithTextOverflow.java
index 8173aa9..6978e1c 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/label/LabelWithTextOverflow.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/label/LabelWithTextOverflow.java
@@ -8,6 +8,7 @@
 import com.google.gwt.editor.client.IsEditor;
 import com.google.gwt.editor.client.LeafValueEditor;
 import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasEnabled;
 import com.google.gwt.user.client.ui.Label;
 
 /*
@@ -15,9 +16,10 @@
  * '...' (three dots) are appended to the string. The tooltip contains the 
full text
  * string.
  */
-public class LabelWithTextOverflow extends Composite implements 
IsEditor<LeafValueEditor<String>> {
+public class LabelWithTextOverflow extends Composite implements 
IsEditor<LeafValueEditor<String>>, HasEnabled {
 
     private Label label;
+    private boolean enabled = true;
 
     public LabelWithTextOverflow() {
         label = new Label();
@@ -63,4 +65,15 @@
     public LeafValueEditor<String> asEditor() {
         return label.asEditor();
     }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+        getElement().getStyle().setColor(enabled ? "#333333" : "gray"); 
//$NON-NLS-1$ $NON-NLS-2$
+    }
 }
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/profile/ProfilesInstanceTypeEditor.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/profile/ProfilesInstanceTypeEditor.java
index d2b869d..fc8afcd 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/profile/ProfilesInstanceTypeEditor.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/profile/ProfilesInstanceTypeEditor.java
@@ -92,9 +92,9 @@
     }
 
     @Override
-    protected void toggleGhost(VnicInstanceType value, 
ProfileInstanceTypeEditor item, boolean becomingGhost) {
-        item.profileEditor.setEnabled(!becomingGhost);
-        item.profileEditor.asWidget().setEnabled(true);
+    protected void toggleGhost(VnicInstanceType value, 
ProfileInstanceTypeEditor widget, boolean becomingGhost) {
+        super.toggleGhost(value, widget, becomingGhost);
+        widget.vnicLabel.setEnabled(!becomingGhost);
     }
 
 }


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

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