Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Fixed network sorting in VM networks popup
......................................................................

webadmin: Fixed network sorting in VM networks popup

Used LexoNumericComparator to sort the networks by name.

Change-Id: I5bf460633674135ba93babb6b0ffa851ca79d4d6
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=911027
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
1 file changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/12158/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
index 5947240..380c1a0 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java
@@ -1,6 +1,8 @@
 package org.ovirt.engine.ui.uicommonweb.models.vms;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 
 import org.ovirt.engine.core.common.action.VdcActionParametersBase;
 import org.ovirt.engine.core.common.action.VdcActionType;
@@ -11,6 +13,7 @@
 import org.ovirt.engine.core.common.businessentities.network.VmInterfaceType;
 import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import org.ovirt.engine.core.common.queries.ConfigurationValues;
+import org.ovirt.engine.core.common.utils.LexoNumericComparator;
 import org.ovirt.engine.core.compat.StringHelper;
 import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
@@ -452,6 +455,23 @@
                     networks.add(null);
                 }
 
+                Collections.sort(networks, new Comparator<Network>() {
+
+                    private LexoNumericComparator lexoNumeric = new 
LexoNumericComparator();
+
+                    @Override
+                    public int compare(Network net1, Network net2) {
+                        if (net1 == null) {
+                            return 1;
+                        } else if (net2 == null) {
+                            return -1;
+                        } else {
+                            return lexoNumeric.compare(net1.getName(), 
net2.getName());
+                        }
+                    }
+
+                });
+
                 getNetwork().setItems(networks);
                 initSelectedNetwork();
 


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

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