diff options
author | Fritz Schinkel | 2020-01-23 14:22:07 +0000 |
---|---|---|
committer | Beat Schwarzentrub | 2020-01-23 15:14:33 +0000 |
commit | 663b3c984cf424f1b0a034c705b8e6912a47557e (patch) | |
tree | ca350c8bec66112e7f9bfec1d2f6be771659c9fd /org.eclipse.scout.rt.client | |
parent | 50af72f013fe7549fec9256c4b2f3dfd789c697a (diff) | |
download | org.eclipse.scout.rt-663b3c984cf424f1b0a034c705b8e6912a47557e.tar.gz org.eclipse.scout.rt-663b3c984cf424f1b0a034c705b8e6912a47557e.tar.xz org.eclipse.scout.rt-663b3c984cf424f1b0a034c705b8e6912a47557e.zip |
Add "Home-Button" to DesktopLogo
The DesktopLogo now works as a button that activates the desktops
default view.
249434
Signed-off-by: Fritz Schinkel <fritz.schinkel@bsi-software.com>
Change-Id: I895ca0ccd85d33ad0fdec77e8d0adc1e2247610a
Reviewed-on: https://git.eclipse.org/r/156434
Tested-by: CI Bot
Reviewed-by: Beat Schwarzentrub <bsh@bsiag.com>
Diffstat (limited to 'org.eclipse.scout.rt.client')
7 files changed, 117 insertions, 7 deletions
diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/AbstractDesktopExtension.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/AbstractDesktopExtension.java index 35e000be5b..269926c34d 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/AbstractDesktopExtension.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/AbstractDesktopExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopFor import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopGuiAttachedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopGuiDetachedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopInitChain; +import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopLogoActionChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopOpenedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopOutlineChangedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopPageDetailFormChangedChain; @@ -100,4 +101,9 @@ public abstract class AbstractDesktopExtension<DESKTOP extends AbstractDesktop> public void execDefaultView(DesktopDefaultViewChain chain) { chain.execDefaultView(); } + + @Override + public void execLogoAction(DesktopLogoActionChain chain) { + chain.execLogoAction(); + } } diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/DesktopChains.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/DesktopChains.java index e5fbc8eb2f..b193a523a0 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/DesktopChains.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/DesktopChains.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -252,4 +252,21 @@ public final class DesktopChains { callChain(methodInvocation); } } + + public static class DesktopLogoActionChain extends AbstractDesktopChain { + + public DesktopLogoActionChain(List<? extends IDesktopExtension<? extends AbstractDesktop>> extensions) { + super(extensions); + } + + public void execLogoAction() { + MethodInvocation<Object> methodInvocation = new MethodInvocation<Object>() { + @Override + protected void callMethod(IDesktopExtension<? extends AbstractDesktop> next) { + next.execLogoAction(DesktopLogoActionChain.this); + } + }; + callChain(methodInvocation); + } + } } diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/IDesktopExtension.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/IDesktopExtension.java index 471bbe88f6..959a5b36e2 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/IDesktopExtension.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/extension/ui/desktop/IDesktopExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopFor import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopGuiAttachedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopGuiDetachedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopInitChain; +import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopLogoActionChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopOpenedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopOutlineChangedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopPageDetailFormChangedChain; @@ -58,4 +59,6 @@ public interface IDesktopExtension<DESKTOP extends AbstractDesktop> extends IExt void execDefaultView(DesktopDefaultViewChain chain); + void execLogoAction(DesktopLogoActionChain chain); + } diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java index b2758c5ccb..c9670f6bc7 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2018 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,6 +39,7 @@ import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopFor import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopGuiAttachedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopGuiDetachedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopInitChain; +import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopLogoActionChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopOpenedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopOutlineChangedChain; import org.eclipse.scout.rt.client.extension.ui.desktop.DesktopChains.DesktopPageDetailFormChangedChain; @@ -376,6 +377,17 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop return true; } + /** + * Configures if the logo action is enabled. + * <p> + * Subclasses can override this method. Default is {@code false} + */ + @ConfigProperty(ConfigProperty.BOOLEAN) + @Order(100) + protected boolean getConfiguredLogoActionEnabled() { + return false; + } + private List<Class<? extends IAction>> getConfiguredActions() { Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass()); List<Class<IAction>> fca = ConfigurationUtility.filterClasses(dca, IAction.class); @@ -563,6 +575,11 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop protected void execDefaultView() { } + @Order(140) + @ConfigOperation + protected void execLogoAction() { + } + public List<IDesktopExtension> getDesktopExtensions() { return CollectionUtility.arrayList(m_desktopExtensions); } @@ -611,6 +628,7 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop setDisplayStyle(getConfiguredDisplayStyle()); initDisplayStyle(getDisplayStyle()); setCacheSplitterPosition(getConfiguredCacheSplitterPosition()); + setLogoActionEnabled(getConfiguredLogoActionEnabled()); List<IDesktopExtension> extensions = getDesktopExtensions(); m_contributionHolder = new ContributionComposite(this); @@ -2130,6 +2148,13 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop } } + @Override + public void doLogoAction() { + if (isLogoActionEnabled()) { + interceptLogoAction(); + } + } + /** * Checks whether the given path is a valid deep-link. If that is the case the deep-link is handled. When an error * occurs while handling the deep-link a {@link DeepLinkException} is thrown, usually this exception is thrown when @@ -2335,6 +2360,16 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop } @Override + public boolean isLogoActionEnabled() { + return propertySupport.getPropertyBool(PROP_LOGO_ACTION_ENABLED); + } + + @Override + public void setLogoActionEnabled(boolean logoActionEnabled) { + propertySupport.setPropertyBool(PROP_LOGO_ACTION_ENABLED, logoActionEnabled); + } + + @Override public void setDense(boolean dense) { propertySupport.setPropertyBool(PROP_DENSE, dense); } @@ -2577,6 +2612,11 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop } @Override + public void fireLogoAction() { + doLogoAction(); + } + + @Override public void removedNotificationFromUI(IDesktopNotification notification) { AbstractDesktop.this.removeNotificationInternal(notification, false); } @@ -2812,6 +2852,10 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop getOwner().execDefaultView(); } + @Override + public void execLogoAction(DesktopLogoActionChain chain) { + getOwner().execLogoAction(); + } } protected final void interceptOpened() { @@ -2886,6 +2930,12 @@ public abstract class AbstractDesktop extends AbstractWidget implements IDesktop chain.execDefaultView(); } + protected final void interceptLogoAction() { + List<? extends org.eclipse.scout.rt.client.extension.ui.desktop.IDesktopExtension<? extends AbstractDesktop>> extensions = getAllExtensions(); + DesktopLogoActionChain chain = new DesktopLogoActionChain(extensions); + chain.execLogoAction(); + } + protected class P_LocalPropertyChangeListener implements PropertyChangeListener { @Override diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java index 699dd56a07..478fd89718 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2018 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -135,6 +135,8 @@ public interface IDesktop extends IWidget, IDisplayParent, IStyleable, IContextM String PROP_BENCH_LAYOUT_DATA = "benchLayoutData"; + String PROP_LOGO_ACTION_ENABLED = "logoActionEnabled"; + String PROP_STARTUP_REQUEST_PARAMS = "startupRequestParams"; String STARTUP_REQUEST_PARAM_URL = "url"; @@ -666,6 +668,11 @@ public interface IDesktop extends IWidget, IDisplayParent, IStyleable, IContextM void openUri(BinaryResource binaryResource, IOpenUriAction openUriAction); /** + * Executes the logo action. + */ + void doLogoAction(); + + /** * Activates a {@link Bookmark} on this desktop. * <p /> * First the specific {@link Bookmark#getOutlineClassName()} is evaluated and activated, afterwards every page from @@ -905,6 +912,16 @@ public interface IDesktop extends IWidget, IDisplayParent, IStyleable, IContextM Future<Coordinates> requestGeolocation(); /** + * @since 8.0 + */ + void setLogoActionEnabled(boolean logoActionEnabled); + + /** + * @since 8.0 + */ + boolean isLogoActionEnabled(); + + /** * Returns request or URL parameters available at the time the Scout session/desktop has been attached. This map will * be available after the desktop has been created but before the openFromUI and attachedFromUI are called. * <p> diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java index c38d10b3ae..202c1e6dc9 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -82,6 +82,8 @@ public interface IDesktopUIFacade { void fireGeolocationFailed(String errorCode, String errorMessage); + void fireLogoAction(); + /** * Called after DesktopNotification was removed from UI */ diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java index 27310a447f..69abd9b2f0 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2018 BSI Business Systems Integration AG. + * Copyright (c) 2010-2020 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -158,6 +158,11 @@ public class VirtualDesktop implements IDesktop { } @Override + public void doLogoAction() { + throw createUnsupportedOperationException(); + } + + @Override public void activateBookmark(Bookmark bm) { throw createUnsupportedOperationException(); } @@ -798,6 +803,16 @@ public class VirtualDesktop implements IDesktop { } @Override + public void setLogoActionEnabled(boolean logoActionEnabled) { + // NOP + } + + @Override + public boolean isLogoActionEnabled() { + return false; + } + + @Override public boolean cancelForms(Set<IForm> formSet) { throw createUnsupportedOperationException(); } |