Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin: move guide link to branding ......................................................................
userportal, webadmin: move guide link to branding Removed some extraneous logic around showing/hiding of the Guide link. Moved the Guide link URL and label to be a part of the branding package. Change-Id: Ic1655ae4491cc9a90f85ba87dad06aa396c802b6 Bug-Url: https://bugzilla.redhat.com/987862 Signed-off-by: Greg Sheremeta <gsher...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractHeaderPresenterWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/DynamicMessages.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationDynamicMessages.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/HeaderPresenterWidget.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/HeaderView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationDynamicMessages.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/HeaderPresenterWidget.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/HeaderView.java M packaging/branding/ovirt.brand/messages.properties 9 files changed, 53 insertions(+), 72 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/18146/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractHeaderPresenterWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractHeaderPresenterWidget.java index 0595fbb..a954918 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractHeaderPresenterWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/AbstractHeaderPresenterWidget.java @@ -2,17 +2,11 @@ import org.ovirt.engine.ui.common.auth.CurrentUser; import org.ovirt.engine.ui.common.utils.WebUtils; -import org.ovirt.engine.ui.uicommonweb.Configurator; -import org.ovirt.engine.ui.uicommonweb.TypeResolver; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.HasClickHandlers; -import com.google.gwt.event.dom.client.HasMouseOverHandlers; -import com.google.gwt.event.dom.client.MouseOverEvent; -import com.google.gwt.event.dom.client.MouseOverHandler; import com.google.gwt.event.shared.EventBus; -import com.google.gwt.event.shared.HasHandlers; import com.gwtplatform.mvp.client.PresenterWidget; import com.gwtplatform.mvp.client.View; @@ -24,29 +18,25 @@ HasClickHandlers getLogoutLink(); - HasHandlers getGuideLink(); - - void setGuideLinkEnabled(boolean enabled); + HasClickHandlers getGuideLink(); } private final CurrentUser user; - private final String documentationGuidePath; private final String windowName; + private final String guideUrl; - public AbstractHeaderPresenterWidget(EventBus eventBus, V view, - CurrentUser user, String documentationGuidePath, String windowName) { + public AbstractHeaderPresenterWidget(EventBus eventBus, V view, CurrentUser user, + String windowName, String guideUrl) { super(eventBus, view); this.user = user; - this.documentationGuidePath = documentationGuidePath; this.windowName = windowName; + this.guideUrl = guideUrl; } @Override protected void onBind() { super.onBind(); - - getView().setGuideLinkEnabled(false); registerHandler(getView().getLogoutLink().addClickHandler(new ClickHandler() { @Override @@ -55,13 +45,13 @@ } })); - if (getView().getGuideLink() instanceof HasClickHandlers) { - registerGuideLinkClickHandler((HasClickHandlers) getView().getGuideLink()); - } + registerHandler(getView().getGuideLink().addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + WebUtils.openUrlInNewWindow(windowName, guideUrl, WebUtils.OPTION_SCROLLBARS); + } + })); - if (getView().getGuideLink() instanceof HasMouseOverHandlers) { - registerGuideLinkMouseOverHandler((HasMouseOverHandlers) getView().getGuideLink()); - } } @Override @@ -69,29 +59,6 @@ super.onReset(); getView().setUserName(user.getUserName()); - } - - void registerGuideLinkClickHandler(HasClickHandlers guideLink) { - registerHandler(guideLink.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - Configurator configurator = (Configurator) TypeResolver.getInstance().resolve(Configurator.class); - if (configurator.isDocumentationAvailable()) { - String url = configurator.getDocumentationLibURL() + documentationGuidePath; - WebUtils.openUrlInNewWindow(windowName, url, WebUtils.OPTION_SCROLLBARS); - } - } - })); - } - - void registerGuideLinkMouseOverHandler(HasMouseOverHandlers guideLink) { - registerHandler(guideLink.addMouseOverHandler(new MouseOverHandler() { - @Override - public void onMouseOver(MouseOverEvent event) { - Configurator configurator = (Configurator) TypeResolver.getInstance().resolve(Configurator.class); - getView().setGuideLinkEnabled(configurator.isDocumentationAvailable()); - } - })); } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/DynamicMessages.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/DynamicMessages.java index 36e6981..4524755 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/DynamicMessages.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/DynamicMessages.java @@ -33,6 +33,8 @@ COPY_RIGHT_NOTICE("copy_right_notice"), //$NON-NLS-1$ FEEDBACK_URL("feedback_url"), //$NON-NLS-1$ FEEDBACK_MESSAGE("feedback_message"), //$NON-NLS-1$ + GUIDE_URL("guide_url"), //$NON-NLS-1$ + GUIDE_LINK_LABEL("guide_link_label"), //$NON-NLS-1$ DOC("doc"); //$NON-NLS-1$ private final String value; @@ -234,23 +236,43 @@ * Get the feedback URL using the {@code Dictionary} in the host page. With a fall back to the standard GWT * Constant. * - * @return The copy right notice string. + * @return The feedback URL. */ public final String feedbackUrl() { return getString(DynamicMessageKey.FEEDBACK_URL); } /** - * Get the feedback URL using the {@code Dictionary} in the host page. With a fall back to the standard GWT + * Get the feedback link label using the {@code Dictionary} in the host page. With a fall back to the standard GWT * Constant. * - * @return The copy right notice string. + * @return The feedback link label. */ public final String feedbackMessage() { return getString(DynamicMessageKey.FEEDBACK_MESSAGE); } /** + * Get the guide URL using the {@code Dictionary} in the host page. With a fall back to the standard GWT + * Constant. + * + * @return The guide URL. + */ + public final String guideUrl() { + return getString(DynamicMessageKey.GUIDE_URL); + } + + /** + * Get the guide link label using the {@code Dictionary} in the host page. With a fall back to the standard GWT + * Constant. + * + * @return The guide link label. + */ + public final String guideLinkLabel() { + return getString(DynamicMessageKey.GUIDE_LINK_LABEL); + } + + /** * Get the application documentation title using the {@code Dictionary} in the host page. With a fall back to the standard GWT * Constant. * diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationDynamicMessages.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationDynamicMessages.java index c66f01e..24226cd 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationDynamicMessages.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/ApplicationDynamicMessages.java @@ -16,6 +16,7 @@ addFallback(DynamicMessageKey.MAIN_HEADER_LABEL, constants.mainHeaderLabel()); addFallback(DynamicMessageKey.COPY_RIGHT_NOTICE, constants.copyRightNotice()); addFallback(DynamicMessageKey.DOC, constants.userPortalDoc()); + addFallback(DynamicMessageKey.GUIDE_LINK_LABEL, constants.guideLinkLabel()); } } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/HeaderPresenterWidget.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/HeaderPresenterWidget.java index 351d224..13e1332 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/HeaderPresenterWidget.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/HeaderPresenterWidget.java @@ -5,7 +5,6 @@ import org.ovirt.engine.ui.common.widget.tab.AbstractHeadlessTabPanel.TabWidgetHandler; import org.ovirt.engine.ui.userportal.ApplicationDynamicMessages; import org.ovirt.engine.ui.userportal.auth.CurrentUserRole; -import org.ovirt.engine.ui.userportal.uicommon.UserPortalConfigurator; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -32,8 +31,7 @@ public HeaderPresenterWidget(EventBus eventBus, ViewDef view, CurrentUser user, CurrentUserRole userRole, AboutPopupPresenterWidget aboutPopup, ApplicationDynamicMessages dynamicMessages) { - super(eventBus, view, user, - UserPortalConfigurator.DOCUMENTATION_GUIDE_PATH, dynamicMessages.applicationDocTitle()); + super(eventBus, view, user, dynamicMessages.applicationDocTitle(), dynamicMessages.guideUrl()); this.userRole = userRole; this.aboutPopup = aboutPopup; } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/HeaderView.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/HeaderView.java index 7dc96a4..fb319dc 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/HeaderView.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/HeaderView.java @@ -4,12 +4,11 @@ import org.ovirt.engine.ui.common.idhandler.WithElementId; import org.ovirt.engine.ui.common.view.AbstractView; import org.ovirt.engine.ui.userportal.ApplicationConstants; +import org.ovirt.engine.ui.userportal.ApplicationDynamicMessages; import org.ovirt.engine.ui.userportal.section.main.presenter.HeaderPresenterWidget; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Cursor; import com.google.gwt.event.dom.client.HasClickHandlers; -import com.google.gwt.event.shared.HasHandlers; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Anchor; @@ -52,9 +51,10 @@ FlowPanel mainTabContainer; @Inject - public HeaderView(ApplicationConstants constants) { + public HeaderView(ApplicationConstants constants, + ApplicationDynamicMessages dynamicMessages) { this.logoutLink = new Anchor(constants.logoutLinkLabel()); - this.guideLink = new Anchor(constants.guideLinkLabel()); + this.guideLink = new Anchor(dynamicMessages.guideLinkLabel()); this.aboutLink = new Anchor(constants.aboutLinkLabel()); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); @@ -87,18 +87,13 @@ } @Override - public void setMainTabPanelVisible(boolean visible) { - mainTabBarPanel.setVisible(visible); - } - - @Override - public HasHandlers getGuideLink() { + public HasClickHandlers getGuideLink() { return guideLink; } @Override - public void setGuideLinkEnabled(boolean enabled) { - guideLink.getElement().getStyle().setCursor(enabled ? Cursor.POINTER : Cursor.DEFAULT); + public void setMainTabPanelVisible(boolean visible) { + mainTabBarPanel.setVisible(visible); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationDynamicMessages.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationDynamicMessages.java index ef619b2..24dcfc6 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationDynamicMessages.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationDynamicMessages.java @@ -17,6 +17,7 @@ addFallback(DynamicMessageKey.COPY_RIGHT_NOTICE, constants.copyRightNotice()); addFallback(DynamicMessageKey.DOC, constants.engineWebAdminDoc()); addFallback(DynamicMessageKey.FEEDBACK_MESSAGE, constants.feedbackMessage()); + addFallback(DynamicMessageKey.GUIDE_LINK_LABEL, constants.guideLinkLabel()); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/HeaderPresenterWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/HeaderPresenterWidget.java index 00dcbc9..734edb3 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/HeaderPresenterWidget.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/HeaderPresenterWidget.java @@ -5,7 +5,6 @@ import org.ovirt.engine.ui.common.widget.tab.AbstractHeadlessTabPanel.TabWidgetHandler; import org.ovirt.engine.ui.webadmin.ApplicationDynamicMessages; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.configure.ConfigurePopupPresenterWidget; -import org.ovirt.engine.ui.webadmin.uicommon.WebAdminConfigurator; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -44,8 +43,7 @@ AboutPopupPresenterWidget aboutPopup, ConfigurePopupPresenterWidget configurePopup, ApplicationDynamicMessages dynamicMessages) { - super(eventBus, view, user, - WebAdminConfigurator.DOCUMENTATION_GUIDE_PATH, dynamicMessages.applicationDocTitle()); + super(eventBus, view, user, dynamicMessages.applicationDocTitle(), dynamicMessages.guideUrl()); this.searchPanel = searchPanel; this.aboutPopup = aboutPopup; this.configurePopup = configurePopup; diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/HeaderView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/HeaderView.java index 8fb2434..79eb922 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/HeaderView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/HeaderView.java @@ -8,7 +8,6 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.HeaderPresenterWidget; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Cursor; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.editor.client.Editor.Ignore; import com.google.gwt.event.dom.client.HasClickHandlers; @@ -79,7 +78,7 @@ this.configureLink = new Anchor(constants.configureLinkLabel()); this.logoutLink = new Anchor(constants.logoutLinkLabel()); this.aboutLink = new Anchor(constants.aboutLinkLabel()); - this.guideLink = new Anchor(constants.guideLinkLabel()); + this.guideLink = new Anchor(dynamicMessages.guideLinkLabel()); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); mainTabBarPanel.getElement().getStyle().setZIndex(1); @@ -149,11 +148,6 @@ @Override public Label getFeedbackLabel() { return feedbackImageLabel; - } - - @Override - public void setGuideLinkEnabled(boolean enabled) { - guideLink.getElement().getStyle().setCursor(enabled ? Cursor.POINTER : Cursor.DEFAULT); } } diff --git a/packaging/branding/ovirt.brand/messages.properties b/packaging/branding/ovirt.brand/messages.properties index 63a9b84..bed457c 100644 --- a/packaging/branding/ovirt.brand/messages.properties +++ b/packaging/branding/ovirt.brand/messages.properties @@ -33,6 +33,11 @@ # Feedback URL obrand.webadmin.feedback_url=mailto:us...@ovirt.org obrand.webadmin.feedback_message=Feedback +# Guide URL +obrand.webadmin.guide_url=http://www.ovirt.org/Documentation +obrand.webadmin.guide_link_label=Guide +obrand.userportal.guide_url=http://www.ovirt.org/Documentation +obrand.userportal.guide_link_label=Guide # The welcome page obrand.welcome.header.main= -- To view, visit http://gerrit.ovirt.org/18146 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic1655ae4491cc9a90f85ba87dad06aa396c802b6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches