Vojtech Szocs has uploaded a new change for review. Change subject: userportal: Optimization fixes ......................................................................
userportal: Optimization fixes 1. Fixed a problem when Basic view item selection was not retained after subsequent data refresh 2. Fixed a problem when Basic view UI was redrawn even when there was no change in items 3. Removed duplicate code with regard to clearing UserPortalItemModel references by moving it to IUserPortalListModel (parent class) Change-Id: I81b30a5e03d35862d92e6630aac71c70f7cd75de Signed-off-by: Vojtech Szocs <vsz...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/IUserPortalListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalBasicListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/UserPortalDataBoundModelProvider.java 5 files changed, 30 insertions(+), 19 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/12213/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/IUserPortalListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/IUserPortalListModel.java index fb6d3bf..f4e1cae 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/IUserPortalListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/IUserPortalListModel.java @@ -308,4 +308,14 @@ return null; } + + protected void clearItemReferences() { + if (items != null) { + // Clear circular references inside the model + for (UserPortalItemModel itemModel : (Iterable<UserPortalItemModel>) items) { + itemModel.clearReferences(); + } + } + } + } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalBasicListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalBasicListModel.java index 0b1fe46..989cd48 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalBasicListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalBasicListModel.java @@ -166,12 +166,7 @@ public void setItems(Iterable value) { if (items != value) { - if(items != null) { - //Clear circular references inside the model. - for (UserPortalItemModel itemModel : (Iterable<UserPortalItemModel>) items) { - itemModel.clearReferences(); - } - } + clearItemReferences(); ItemsChanging(value, items); items = value; getItemsChangedEvent().raise(this, EventArgs.Empty); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java index 6a0fa9a..00a8bf2 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java @@ -323,13 +323,7 @@ { if (items != value) { - if(items != null) { - //Clear circular references inside the model. - for (UserPortalItemModel itemModel : (Iterable<UserPortalItemModel>) items) { - itemModel.clearReferences(); - } - } - + clearItemReferences(); ItemsChanging(value, items); items = value; getItemsChangedEvent().raise(this, EventArgs.Empty); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java index 05ae19b..35c7ddc 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/AbstractUserPortalListProvider.java @@ -32,10 +32,17 @@ super.updateDataProvider(items); } - // Subsequent data update + // Subsequent data update, with item change else if (itemsChanged(items, currentItems)) { super.updateDataProvider(items); } + + // Subsequent data update, without item change + else { + retainSelectedItems(); + } + + currentItems = items; } /** diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/UserPortalDataBoundModelProvider.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/UserPortalDataBoundModelProvider.java index fd42e2b..bd126bb 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/UserPortalDataBoundModelProvider.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/UserPortalDataBoundModelProvider.java @@ -76,17 +76,22 @@ @Override protected void updateDataProvider(List<T> items) { super.updateDataProvider(items); - - // Retain item selection within the model - if (selectedItems != null) { - super.setSelectedItems(selectedItems); - } + retainSelectedItems(); if (dataChangeListener != null) { dataChangeListener.onDataChange(items); } } + /** + * Retains the item selection of the model. + */ + protected void retainSelectedItems() { + if (selectedItems != null) { + super.setSelectedItems(selectedItems); + } + } + @Override public void setSelectedItems(List<T> items) { super.setSelectedItems(items); -- To view, visit http://gerrit.ovirt.org/12213 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I81b30a5e03d35862d92e6630aac71c70f7cd75de Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vojtech Szocs <vsz...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches