Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Scout/HowTo/4.0/Branding the Swing Client"

< Scout‎ | HowTo‎ | 4.0
(Created page with "{{ScoutPage|cat=HowTo 4.0}} This how-to describes how to brand the swing client. All icons and images that will be referenced must be placed in the Swing client's resource...")
 
(Replaced content with "The Scout documentation has been moved to https://eclipsescout.github.io/.")
 
Line 1: Line 1:
{{ScoutPage|cat=HowTo 4.0}}
+
The Scout documentation has been moved to https://eclipsescout.github.io/.
 
+
This how-to describes how to brand the swing client.
+
 
+
All icons and images that will be referenced must be placed in the Swing client's resources/icons directory (e.g. org.eclipse.minicrm.ui.swing/resources/icons)
+
 
+
= Logo  =
+
 
+
[[Image:Scout-branding-swing-client-logo.png]]
+
 
+
This image is defined in the plugin ''org.eclipse.scout.rt.client'' in the folder resources/icons (logo.png). To exchange this image, put your image to the resources folder in your swing plugin (e.g. org.example.logo.ui.swing) and add the extension org.eclipse.scout.rt.ui.swing.scouticons (logo) that points to your image.
+
 
+
[[Image:Scout-branding-swing-client-plugin.xml.png]]
+
 
+
<br>
+
 
+
= Icons  =
+
 
+
Beside the logo, there are a other icons that can be exchanged that way, for example the tray icon. Use the context menu ''New'' on the ''org.eclipse.scout.rt.ui.swing.scouticons'' node to see the other possible entries.
+
 
+
[[Image:Branding-Swing-Client-Icons-Extensions.png]]<br>
+
 
+
The reason that you should supply icons for all different sizes is that they are used in many different places (Window title, Alt-Tab view on windows, task bar, etc). The result of the above configuration could look like this:<br>
+
 
+
[[Image:Branding-Swing-Client-Icons.png]]<br>
+
 
+
'''Note:''' With the Rayo Look and Feel, the icon in the title bar will not be shown by default. To change this, add the following line to the Swing client's config.ini file:
+
<pre>scout.laf.useLafFrameAndDialog=false
+
</pre>
+
<br>
+
 
+
= Splash screen<br>  =
+
 
+
Add the following member variable and methods to the class '''SwingEnvironment''':
+
<pre>  private SwingIconLocator m_splashIconLocator;
+
  private static String SPLASH_FILE = "Splash"; // filename without extension
+
 
+
  @Override
+
  public void interceptUIDefaults(UIDefaults defaults) {
+
    // see UIDefaultsInjector
+
    super.interceptUIDefaults(defaults);
+
    defaults.put("Splash.icon", createIconUIResource(SPLASH_FILE));
+
  }
+
+
  private SwingIconLocator getIconLocator() {
+
    if (m_splashIconLocator == null) {
+
      /* this is the activator of your swing bundle containing your splash image */
+
      Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
+
      BundleIconLocator iconLocator = new BundleIconLocator(bundle);
+
 
+
      /* this is the folder inside the bundle given above specifying where to search for the images */
+
      iconLocator.getIconLocatorService().setFolderName("resources/icons");
+
 
+
      m_splashIconLocator = new SwingIconLocator(iconLocator);
+
    }
+
    return m_splashIconLocator;
+
  }
+
 
+
  private IconUIResource createIconUIResource(String resourceSimpleName) {
+
    Icon icon = getIconLocator().getIcon(resourceSimpleName);
+
    if (icon&nbsp;!= null) {
+
      return new IconUIResource(icon);
+
    }
+
    else {
+
      return null;
+
    }
+
  }
+
</pre>
+
<br>
+

Latest revision as of 07:35, 18 March 2024

The Scout documentation has been moved to https://eclipsescout.github.io/.

Back to the top