Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin: fix broken helptag implementation ......................................................................
userportal, webadmin: fix broken helptag implementation Helptags were reusing some of the hashname infrastructure. This was 1. messy, 2. caused a bug where the help icon would not render unless the helptag == hashname. Cleaned this up and fixed the bug. Change-Id: Id244c5d068c6146da92287536bf919da1d5aee3c Bug-Url: https://bugzilla.redhat.com/1176581 Bug-Url: https://bugzilla.redhat.com/1176583 Bug-Url: https://bugzilla.redhat.com/1223529 Signed-off-by: Greg Sheremeta <gsher...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractModelBoundPopupPresenterWidget.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/Model.java 2 files changed, 15 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/41348/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractModelBoundPopupPresenterWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractModelBoundPopupPresenterWidget.java index ed902d5..2175bcd 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractModelBoundPopupPresenterWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractModelBoundPopupPresenterWidget.java @@ -9,6 +9,7 @@ import org.ovirt.engine.ui.common.widget.HasEditorDriver; import org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers; import org.ovirt.engine.ui.uicommonweb.UICommand; +import org.ovirt.engine.ui.uicommonweb.help.HelpTag; import org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel; import org.ovirt.engine.ui.uicommonweb.models.ListModel; import org.ovirt.engine.ui.uicommonweb.models.Model; @@ -154,6 +155,7 @@ updateMessage(model); updateItems(model); updateHashName(model); + updateHelpTag(model); model.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { @@ -167,6 +169,8 @@ updateItems(model); } else if ("HashName".equals(propName)) { //$NON-NLS-1$ updateHashName(model); + } else if ("HelpTag".equals(propName)) { //$NON-NLS-1$ + updateHelpTag(model); } else if ("OpenDocumentation".equals(propName)) { //$NON-NLS-1$ openDocumentation(model); } @@ -241,18 +245,16 @@ protected void updateHashName(T model) { String hashName = model.getHashName(); getView().setHashName(hashName); - - UICommand openDocumentationCommand = model.getOpenDocumentationCommand(); - if (openDocumentationCommand != null) { - boolean isDocumentationAvailable = hashName != null && - ContextSensitiveHelpManager.getPath(hashName) != null; - openDocumentationCommand.setIsAvailable(isDocumentationAvailable); - updateHelpCommand(isDocumentationAvailable ? openDocumentationCommand : null); - } } - void updateHelpCommand(UICommand command) { - getView().setHelpCommand(command); // also sets the help icon visible + protected void updateHelpTag(T model) { + HelpTag helpTag = model.getHelpTag(); + UICommand command = model.getOpenDocumentationCommand(); + + if (command != null && helpTag != null && ContextSensitiveHelpManager.getPath(helpTag.name()) != null) { + command.setIsAvailable(true); + getView().setHelpCommand(command); // also sets the help icon visible + } } void updateItems(T model) { @@ -299,7 +301,7 @@ * ContextSensitiveHelpManager locates the proper URL via helptag/csh mapping file. */ protected void openDocumentation(T model) { - String helpTag = model.getHelpTag().name; + String helpTag = model.getHelpTag().name(); String docPath = ContextSensitiveHelpManager.getPath(helpTag); String docBase = model.getConfigurator().getDocsBaseUrl(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/Model.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/Model.java index 2632713..acb1723 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/Model.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/Model.java @@ -171,7 +171,6 @@ public void setHashName(String value) { sethashName(value); - setOpenDocumentationCommand(new UICommand("OpenDocumentation", this)); //$NON-NLS-1$ onPropertyChanged(new PropertyChangedEventArgs("HashName")); //$NON-NLS-1$ } @@ -185,6 +184,8 @@ public void setHelpTag(HelpTag helpTag) { this.helpTag = helpTag; + setOpenDocumentationCommand(new UICommand("OpenDocumentation", this)); //$NON-NLS-1$ + onPropertyChanged(new PropertyChangedEventArgs("HelpTag")); //$NON-NLS-1$ } public HelpTag getHelpTag() -- To view, visit https://gerrit.ovirt.org/41348 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id244c5d068c6146da92287536bf919da1d5aee3c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches