Vojtech Szocs has posted comments on this change. Change subject: webadmin: Implement sorting by simple status image ......................................................................
Patch Set 10: (2 comments) http://gerrit.ovirt.org/#/c/28753/10/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/NicActivateStatusColumn.java File frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/NicActivateStatusColumn.java: Line 37: Line 38: public void makeSortable() { Line 39: makeSortable(new Comparator<T>() { Line 40: Line 41: SimpleStatusImageComparator imageComparator = new SimpleStatusImageComparator(); > Functionally it would be the same so I don't see the harm, but from a desig OK, it was just a suggestion, I am also OK with comparator per column. (My motivation was to avoid unnecessary comparator instance creation since the actual comparator used here is stateless. I also always prefer stateless to stateful whenever possible.) So I suggest to make it private & final then :-) Line 42: Line 43: @Override Line 44: public int compare(T o1, T o2) { Line 45: return imageComparator.compare(getImage(o1), getImage(o2)); http://gerrit.ovirt.org/#/c/28753/10/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/SimpleStatusImageComparator.java File frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/SimpleStatusImageComparator.java: Line 23: return (o1 == null) ? -1 : 1; Line 24: } else if (o1.equals(o2)) { Line 25: return 0; Line 26: } else { Line 27: return downImage.equals(o1) ? -1 : 1; > Please take a look at http://gerrit.ovirt.org/#/c/28755/. I agree that for simple none/up/down status, enum might not be necessary, so I'm OK with current approach here. Looking at #28755 - looks good, didn't know we already have an interface (Identifiable) that can be used for ordering enums :-) Line 28: } Line 29: } Line 30: -- To view, visit http://gerrit.ovirt.org/28753 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9ac043ef1d522f67678b5c70b461833a82d3d9f0 Gerrit-PatchSet: 10 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <lver...@redhat.com> Gerrit-Reviewer: Alexander Wels <aw...@redhat.com> Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com> Gerrit-Reviewer: Einav Cohen <eco...@redhat.com> Gerrit-Reviewer: Lior Vernia <lver...@redhat.com> Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches