Alexander Wels has uploaded a new change for review. Change subject: webadmin: clicking system tree doesn't update main tab ......................................................................
webadmin: clicking system tree doesn't update main tab - When clicking through items in the system tree, if there was only one item in the tab grid, it would auto select the item and change the place accordingly. However it would do this before the tab had fully loaded and it would cause the tab to not properly update. This patch fixes the issue by making sure the auto selection does not occur unless the view of the table that is being auto selection is attached to the DOM. Change-Id: I9ee1171f16ec239332c981bf28f7d5c9fa690edc Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1194293 Signed-off-by: Alexander Wels <aw...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java 1 file changed, 29 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/42238/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java index 8b79d75..2ba0842 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java @@ -168,15 +168,8 @@ public void setRowData(int start, final List<? extends T> values) { super.setRowData(start, values); selectionModel.resolveChanges(); - if (values.size() == 1 && selectionModel.getSelectedList().isEmpty() && doAutoSelect) { - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - - @Override - public void execute() { - selectionModel.setSelected(values.get(0), true); - } - }); - doAutoSelect = false; + if (isAttached() && isVisible()) { + autoSelectFirst(); } updateTableControls(); enforceScrollPosition(); @@ -264,6 +257,33 @@ } addModelSearchStringChangeListener(dataProvider.getModel()); addScrollSelectionModelChangeListener(); + } + + @Override + public void onLoad() { + super.onLoad(); + autoSelectFirst(); + } + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible && isAttached()) { + autoSelectFirst(); + } + } + + private void autoSelectFirst() { + if (table.getRowCount() == 1 && selectionModel.getSelectedList().isEmpty() && doAutoSelect) { + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + selectionModel.setSelected(table.getVisibleItems().get(0), true); + } + }); + doAutoSelect = false; + } } private void addScrollSelectionModelChangeListener() { @@ -458,7 +478,6 @@ // Reset main table container's scroll position enforceScrollPosition(); - this.doAutoSelect = true; } void initSortHandler() { -- To view, visit https://gerrit.ovirt.org/42238 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9ee1171f16ec239332c981bf28f7d5c9fa690edc 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