Tomas Jelinek has uploaded a new change for review.

Change subject: frontend: [JP] Resource allocation broken
......................................................................

frontend: [JP] Resource allocation broken

In new/edit/clone VM the resource allocation tab's layout was broken.

Since the original design was too vulnerable to break in different languages
fixed by changing the layout to a more robust one.

Change-Id: Iea77af79f7552d855685fab8a8521a2465808aa7
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1000336
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/AbstractVmPopupView.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelListBoxOnlyEditor.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml
4 files changed, 90 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/26/19326/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/AbstractVmPopupView.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/AbstractVmPopupView.java
index 710d1bf..7d160ac 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/AbstractVmPopupView.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/AbstractVmPopupView.java
@@ -16,7 +16,7 @@
     @Inject
     public AbstractVmPopupView(EventBus eventBus, CommonApplicationResources 
resources,
             AbstractVmPopupWidget popupWidget) {
-        this(eventBus, resources, popupWidget, "670px", "530px"); 
//$NON-NLS-1$ //$NON-NLS-2$
+        this(eventBus, resources, popupWidget, "685px", "530px"); 
//$NON-NLS-1$ //$NON-NLS-2$
     }
 
     public AbstractVmPopupView(EventBus eventBus, CommonApplicationResources 
resources,
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelListBoxOnlyEditor.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelListBoxOnlyEditor.java
index 4d45487..c3f384a 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelListBoxOnlyEditor.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelListBoxOnlyEditor.java
@@ -1,6 +1,7 @@
 package org.ovirt.engine.ui.common.widget.editor;
 
 import org.ovirt.engine.ui.common.widget.AbstractValidatedWidgetWithLabel;
+import org.ovirt.engine.ui.common.widget.VisibilityRenderer;
 import org.ovirt.engine.ui.common.widget.renderer.StringRenderer;
 
 import com.google.gwt.editor.client.IsEditor;
@@ -21,7 +22,11 @@
     }
 
     public ListModelListBoxOnlyEditor(Renderer<T> renderer) {
-        super(new ListModelListBox<T>(renderer));
+        this(renderer, new VisibilityRenderer.SimpleVisibilityRenderer());
+    }
+
+    public ListModelListBoxOnlyEditor(Renderer<T> renderer, VisibilityRenderer 
visibilityRenderer) {
+        super(new ListModelListBox<T>(renderer), visibilityRenderer);
         this.editor = WidgetWithLabelEditor.of(getContentWidget().asEditor(), 
this);
     }
 
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
index b0b7b5f..2a2eebe 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
@@ -1,3 +1,4 @@
+
 package org.ovirt.engine.ui.common.widget.uicommon.popup;
 
 import static 
org.ovirt.engine.ui.common.widget.uicommon.popup.vm.PopupWidgetConfig.simpleField;
@@ -33,6 +34,7 @@
 import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxEditor;
 import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxOnlyEditor;
 import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
+import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxOnlyEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadListBoxEditor;
 import org.ovirt.engine.ui.common.widget.form.key_value.KeyValueWidget;
 import org.ovirt.engine.ui.common.widget.parser.MemorySizeParser;
@@ -429,7 +431,11 @@
     @UiField(provided = true)
     @Path(value = "cpuSharesAmountSelection.selectedItem")
     @WithElementId("cpuSharesAmountSelection")
-    public ListModelListBoxEditor<Object> cpuSharesAmountSelectionEditor;
+    public ListModelListBoxOnlyEditor<Object> cpuSharesAmountSelectionEditor;
+
+    @UiField
+    @Ignore
+    public Label cpuSharesEditor;
 
     @UiField(provided = true)
     @Path(value = "cpuSharesAmount.entity")
@@ -659,7 +665,6 @@
         numOfVmsEditor = new EntityModelTextBoxEditor(new 
ModeSwitchingVisibilityRenderer());
         cpuPinning = new EntityModelTextBoxOnlyEditor(new 
ModeSwitchingVisibilityRenderer());
         cpuSharesAmountEditor = new EntityModelTextBoxOnlyEditor(new 
ModeSwitchingVisibilityRenderer());
-        cpuSharesAmountEditor.asValueBox().setWidth("110px");//$NON-NLS-1$
         kernel_pathEditor = new EntityModelTextBoxEditor(new 
ModeSwitchingVisibilityRenderer());
         initrd_pathEditor = new EntityModelTextBoxEditor(new 
ModeSwitchingVisibilityRenderer());
         kernel_parametersEditor = new EntityModelTextBoxEditor(new 
ModeSwitchingVisibilityRenderer());
@@ -894,9 +899,7 @@
         }, new ModeSwitchingVisibilityRenderer());
 
         cpuSharesAmountSelectionEditor =
-                new ListModelListBoxEditor<Object>(new EnumRenderer(), new 
ModeSwitchingVisibilityRenderer());
-        cpuSharesAmountSelectionEditor.asListBox().setWidth("110px"); 
//$NON-NLS-1$
-        
cpuSharesAmountSelectionEditor.getContentWidgetContainer().setWidth("110px"); 
//$NON-NLS-1$
+                new ListModelListBoxOnlyEditor<Object>(new EnumRenderer(), new 
ModeSwitchingVisibilityRenderer());
     }
 
     private String typeAheadNameDescriptionTemplateNullSafe(String name, 
String description) {
@@ -975,7 +978,6 @@
         provisioningThinEditor.setLabel(constants.thinVmPopup());
         provisioningCloneEditor.setLabel(constants.cloneVmPopup());
         minAllocatedMemoryEditor.setLabel(constants.physMemGuarVmPopup());
-        cpuSharesAmountSelectionEditor.setLabel(constants.cpuShares());
 
         // Boot Options
         firstBootDeviceEditor.setLabel(constants.firstDeviceVmPopup());
@@ -1121,6 +1123,17 @@
                 }
             }
         });
+
+        
object.getCpuSharesAmountSelection().getPropertyChangedEvent().addListener(new 
IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+
+                if ("IsDisksAvailable".equals(((PropertyChangedEventArgs) 
args).PropertyName)) { //$NON-NLS-1$
+                    changeApplicationLevelVisibility(cpuSharesEditor, 
object.getCpuSharesAmountSelection().getIsAvailable());
+                }
+            }
+        });
+
     }
 
     /**
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml
index ebd95f0..a0917a2 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml
@@ -19,6 +19,8 @@
 
         .sectionPanelTight {
             margin-bottom: 6px;
+            float: left;
+            width: 100%;
         }
 
                .sectionLabel {
@@ -253,26 +255,53 @@
             width: 250px;
         }
 
-        .cpuPinningLabel {
-            float: left;
-            color: #333333;
-            width: 220px;
-            margin: 5px;
-        }
-
-        .cpuSharesSelector {
-            float: left;
-            width: 370px;
-        }
-
-        .cpuSahresValue {
-            width: 120px;
-            float:left;
-        }
-
                .hostSelector {
                        width: 416px;
                }
+
+        .labelToCouple {
+            line-height: 30px;
+            text-align: left;
+            float: left;
+            width: 100%;
+        }
+
+        .labelToCoupleLabel {
+            color: gray;
+            font-family: Verdana,sans-serif;
+            font-size: 13px;
+            line-height: 30px;
+            padding: 0 5px;
+            float: left;
+        }
+
+        .labelToCoupleCouple {
+            float: right;
+            line-height: 30px;
+            padding: 0 5px;
+            width: 230px;
+        }
+
+        .labelToCoupleCoupleLeft {
+            float: left;
+        }
+
+        .labelToCoupleCoupleRight {
+            float: left;
+        }
+
+        .cpuSahresValueListBox, .cpuSahresValueTextBox {
+            width: 110px;
+        }
+
+        .cpuPinningTextBox {
+            width: 202px;
+            padding-left: 5px;
+        }
+
+        .cpuSahresValueTextBox {
+            padding-left: 5px;
+        }
 
                .migrationSelectorInner {
                        width: 260px;
@@ -482,12 +511,24 @@
                                <t:content>
                                        <g:FlowPanel>
                                                <g:FlowPanel 
addStyleNames="{style.sectionPanelTight}">
-                                                       <g:Label 
addStyleNames="{style.sectionLabel}" text="{constants.cpuAllocVmPopup}"/>
-                                                       
<e:ListModelListBoxEditor ui:field="cpuSharesAmountSelectionEditor" 
addStyleNames="{style.cpuSharesSelector}"/>
-                                                       
<e:EntityModelTextBoxOnlyEditor ui:field="cpuSharesAmountEditor" 
addStyleNames="{style.cpuSahresValue}"/>
-                                                       <g:Label 
text="{constants.cpuPinningLabel}" addStyleNames="{style.cpuPinningLabel}"/>
-                                                       <d:InfoIcon 
ui:field="cpuPinningInfo" addStyleNames="{style.poolNameIcon}"/>
-                                                       
<e:EntityModelTextBoxOnlyEditor ui:field="cpuPinning" 
addStyleNames="{style.cpuPinningStyle}"/>
+                            <g:Label addStyleNames="{style.sectionLabel}" 
text="{constants.cpuAllocVmPopup}"/>
+
+                                                       <g:FlowPanel 
addStyleNames="{style.labelToCouple}">
+                                <g:Label ui:field="cpuSharesEditor" 
text="{constants.cpuShares}" addStyleNames="{style.labelToCoupleLabel}"/>
+                                <g:FlowPanel 
addStyleNames="{style.labelToCoupleCouple}">
+                                    <e:ListModelListBoxOnlyEditor 
ui:field="cpuSharesAmountSelectionEditor" 
addStyleNames="{style.labelToCoupleCoupleLeft}" 
contentWidgetStyleName="{style.cpuSahresValueListBox}" />
+                                    <e:EntityModelTextBoxOnlyEditor 
ui:field="cpuSharesAmountEditor" 
addStyleNames="{style.labelToCoupleCoupleRight}" 
contentWidgetStyleName="{style.cpuSahresValueTextBox}" />
+                                </g:FlowPanel>
+                                                       </g:FlowPanel>
+
+                            <g:FlowPanel addStyleNames="{style.labelToCouple}">
+                                <g:Label text="{constants.cpuPinningLabel}" 
addStyleNames="{style.labelToCoupleLabel}"/>
+                                <g:FlowPanel 
addStyleNames="{style.labelToCoupleCouple}">
+                                    <d:InfoIcon ui:field="cpuPinningInfo" 
addStyleNames="{style.labelToCoupleCoupleLeft}"/>
+                                    <e:EntityModelTextBoxOnlyEditor 
ui:field="cpuPinning" addStyleNames="{style.labelToCoupleCoupleRight}" 
contentWidgetStyleName="{style.cpuPinningTextBox}"/>
+                                </g:FlowPanel>
+                            </g:FlowPanel>
+
                                                </g:FlowPanel>
                                                <g:FlowPanel 
addStyleNames="{style.sectionPanelTight}">
                                                        <g:Label 
addStyleNames="{style.sectionLabel}" text="{constants.memAllocVmPopup}" />


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

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

Reply via email to