Alexander Wels has uploaded a new change for review.

Change subject: webadmin: bookmarks first try
......................................................................

webadmin: bookmarks first try

- Bookmarks are not working the very first time you try, if
  you hadn't selected anything in the system tree yet. This
  is because for some reason the system tree would fire an
  event that caused it to clear the search string after the
  bookmark had set the search string. This patch selects the
  root node of the system tree so the event doesn't fire and
  doesn't wipe out the search string.

Change-Id: I323869918c0affe15281526983e936db18ad6506
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1110444
Signed-off-by: Alexander Wels <aw...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SystemTreeModel.java
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/32434/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SystemTreeModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SystemTreeModel.java
index 9085312..d2a6e72 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SystemTreeModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SystemTreeModel.java
@@ -107,7 +107,12 @@
     @Override
     public void setItems(Collection<SystemTreeItemModel> value) {
         getBeforeItemsChangedEvent().raise(this, EventArgs.EMPTY);
+        // If none of the items have been set yet, and we are setting it, mark 
the root as the selected item.
+        boolean emptyItems = (items == null || items.isEmpty());
         super.setItems(value);
+        if (emptyItems && value != null && !value.isEmpty()) {
+            setSelectedItem(value.toArray(new SystemTreeItemModel[1])[0]);
+        }
     }
 
     public void setItems(ArrayList<SystemTreeItemModel> value)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I323869918c0affe15281526983e936db18ad6506
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <aw...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to