Martin Betak has posted comments on this change. Change subject: frontend: refactoring: Generify list models ......................................................................
Patch Set 19: (3 comments) http://gerrit.ovirt.org/#/c/32907/19/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/HasEntity.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/HasEntity.java: Line 3: import org.ovirt.engine.ui.uicompat.Event; Line 4: import org.ovirt.engine.ui.uicompat.EventArgs; Line 5: import org.ovirt.engine.ui.uicompat.EventDefinition; Line 6: Line 7: public interface HasEntity<T> extends IModel { > Is there any justification for this interface? Both EntityModel and ListMod Yes, this interface is used when we need to polymorphically treat instances of EntityModel<E> and list models that extend ListModelWithEntity. This is usually in details models and you can see this throughout the ModelProvider infrastructure that used to treat all main list models as instances of EntityModel. Line 8: Line 9: EventDefinition entityChangedEventDefinition = new EventDefinition("EntityChanged", HasEntity.class); //$NON-NLS-1$; Line 10: Line 11: Event<EventArgs> getEntityChangedEvent(); http://gerrit.ovirt.org/#/c/32907/19/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SortedListModel.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SortedListModel.java: Line 11: /** Line 12: * @param <E> {@link org.ovirt.engine.ui.uicommonweb.models.ListModelWithEntity.E} Line 13: * @param <T> {@link org.ovirt.engine.ui.uicommonweb.models.ListModelWithEntity.T} Line 14: */ Line 15: public class SortedListModel<E, T> extends ListModelWithEntity<E, T> { > This shouldn't extend ListModelWithEntity - there's no specific functionali Yes, it is true that SortedListModel has nothing to with entities but its subclasses and our ModelProviders deeply rely on the fact that those list models "have" get/setEntity methods. My patch is intended to make those hidden dependencies visible (and also typesafe in the process). After that, I will be only happy if it serves as base for more future refactoring but currently we need the HasEntity interface and we need its implementation (in the form of ListModelWithEntity) quite early in the hierarchy. Line 16: Line 17: static class SortSensitiveComparator<T> implements Comparator<T> { Line 18: Line 19: private final Comparator<? super T> comparator; http://gerrit.ovirt.org/#/c/32907/19/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/NetworkItemModel.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/NetworkItemModel.java: Line 9: * Line 10: * @param <T> Line 11: * The Item status enum type Line 12: */ Line 13: public abstract class NetworkItemModel<E, T extends Enum<T>> extends ListModelWithEntity<E, LogicalNetworkModel> implements Comparable<NetworkItemModel<E, T>> { > So now this extends SortedListModel as well, even though it used to only ex No, it just extends ListModelWithEntity which just adds entity E to plain ListModel. There is no SortedListModel in NetworkItemModel hierarchy. SortedListModel extends ListModelWithEntity. Line 14: Line 15: private final HostSetupNetworksModel setupModel; Line 16: Line 17: private String error = null; -- To view, visit http://gerrit.ovirt.org/32907 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I00f1671a5839fe31b49ad0d1c99bad84e5f0c7c4 Gerrit-PatchSet: 19 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Alexander Wels <aw...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Frank Kobzik <fkob...@redhat.com> Gerrit-Reviewer: Greg Sheremeta <gsher...@redhat.com> Gerrit-Reviewer: Jakub Niedermertl <jnied...@redhat.com> Gerrit-Reviewer: Lior Vernia <lver...@redhat.com> Gerrit-Reviewer: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjeli...@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