Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Moved NetworkModel command initiation to constructor
......................................................................

webadmin: Moved NetworkModel command initiation to constructor

It had been previously performed only following some backend queries,
but I couldn't find a reason why; the command initialization doesn't
seem to depend on the state of NetworkModel.

Change-Id: I56f3a54081b00e8f8fb0a47f9d2d4234cdb6bc24
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java
3 files changed, 2 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/82/22682/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
index e8253ae..9771949 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java
@@ -47,10 +47,6 @@
     @Override
     public void syncWithBackend() {
         super.syncWithBackend();
-        if (firstInit) {
-            firstInit = false;
-            addCommands();
-        }
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
index 85703b5..38797ae 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java
@@ -71,6 +71,7 @@
 
     public NetworkModel(Network network, ListModel sourceListModel)
     {
+        addCommands();
         this.network = network;
         this.sourceListModel = sourceListModel;
         setName(new EntityModel());
@@ -434,8 +435,6 @@
                 && profilesValid;
     }
 
-    protected boolean firstInit = true;
-
     public void syncWithBackend() {
         final StoragePool dc = getSelectedDc();
         if (dc == null) {
@@ -472,7 +471,7 @@
         getProfiles().updateDcId(dc.getId());
     }
 
-    protected void addCommands() {
+    private void addCommands() {
         UICommand tempVar2 = new UICommand("OnSave", this); //$NON-NLS-1$
         tempVar2.setTitle(ConstantsManager.getInstance().getConstants().ok());
         tempVar2.setIsDefault(true);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java
index e5254c0..98a0a78 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java
@@ -71,11 +71,6 @@
             items.add(createNetworkClusterModel(cluster));
         }
         getNetworkClusterList().setItems(items);
-
-        if (firstInit) {
-            firstInit = false;
-            addCommands();
-        }
     }
 
     protected NetworkClusterModel createNetworkClusterModel(VDSGroup cluster) {


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

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