Alexander Wels has uploaded a new change for review. Change subject: webadmin: Fix action button regression fix ......................................................................
webadmin: Fix action button regression fix - Fixed certain situations where the previous fix failed to fix the visibility. The original fix didn't take into account the event handler that could change the visibility of an action button. So the original button would be visible then an event would make it invisible, but the flag would not get updated. Causing the fix to not work in certain cases. Change-Id: Ib3c5ccb0a8732b206c94591b930fc6a01456a47d Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1058214 Signed-off-by: Alexander Wels <aw...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/AbstractActionPanel.java 1 file changed, 15 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/24017/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/AbstractActionPanel.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/AbstractActionPanel.java index 14add5b..296c295 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/AbstractActionPanel.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/AbstractActionPanel.java @@ -1,8 +1,10 @@ package org.ovirt.engine.ui.common.widget.action; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.ovirt.engine.ui.common.idhandler.HasElementId; import org.ovirt.engine.ui.common.idhandler.ProvidesElementId; @@ -100,7 +102,7 @@ private final List<ActionButtonDefinition<T>> toolbarOnlyActionButtonList = new ArrayList<ActionButtonDefinition<T>>(); // List of original visibility state for each button - private final List<Boolean> originallyVisible = new ArrayList<Boolean>(); + private final Map<Widget, Boolean> originallyVisible = new HashMap<Widget, Boolean>(); private final SearchableModelProvider<T, ?> dataProvider; private final EventBus eventBus; @@ -191,9 +193,6 @@ if (widgetMinWidth > 0) { siblingWidth = calculateSiblingWidth(); } - for (int i = 0; i < contentPanel.getWidgetCount() - 1; i++) { - originallyVisible.add(contentPanel.getWidget(i).isVisible()); - } initializeCascadeMenuPanel(); } }); @@ -245,18 +244,17 @@ boolean foundEdge = false; if (contentPanel.getWidgetCount() > 1) { for (int i = 0; i < contentPanel.getWidgetCount() - 1; i++) { - if (!originallyVisible.get(i)) { - continue; - } Widget widget = contentPanel.getWidget(i); - widget.setVisible(true); //temporarily show the widget, so we get the actual width of the widget. - if (foundEdge || (widgetWidth + widget.getOffsetWidth() > currentWidth)) { - widget.setVisible(false); - toolbarOnlyActionButtonList.get(i).setCascaded(true); - foundEdge = true; - } else { - toolbarOnlyActionButtonList.get(i).setCascaded(false); - widgetWidth += widget.getOffsetWidth(); + if (originallyVisible.get(widget)) { + widget.setVisible(true); //temporarily show the widget, so we get the actual width of the widget. + if (foundEdge || (widgetWidth + widget.getOffsetWidth() > currentWidth)) { + widget.setVisible(false); + toolbarOnlyActionButtonList.get(i).setCascaded(true); + foundEdge = true; + } else { + toolbarOnlyActionButtonList.get(i).setCascaded(false); + widgetWidth += widget.getOffsetWidth(); + } } } } @@ -601,6 +599,8 @@ && buttonDef.isVisible(getSelectedItems()) && !buttonDef.isCascaded()); button.setEnabled(buttonDef.isEnabled(getSelectedItems())); button.setTitle(buttonDef.getButtonToolTip() != null ? buttonDef.getButtonToolTip() : buttonDef.getTitle()); + originallyVisible.put(button.asWidget(), buttonDef.isAccessible(getSelectedItems()) + && buttonDef.isVisible(getSelectedItems())); } /** -- To view, visit http://gerrit.ovirt.org/24017 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3c5ccb0a8732b206c94591b930fc6a01456a47d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Alexander Wels <aw...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches