Skip to main content
Jump to: navigation, search

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

< Scout‎ | HowTo‎ | 3.8
m (add ScoutPage)
(Added more details about "Icons"; Added part about "Splash Screen")
 
Line 1: Line 1:
{{ScoutPage|cat=HowTo 3.8}}
+
{{ScoutPage|cat=HowTo 3.8}}  
  
This how-to describes how to brand the swing client.
+
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  =
 
= Logo  =
 +
 
[[Image:Scout-branding-swing-client-logo.png]]  
 
[[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).  
+
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.  
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");
  
[[Image:Scout-branding-swing-client-plugin.xml.png]]]
+
      m_splashIconLocator = new SwingIconLocator(iconLocator);
 +
    }
 +
    return m_splashIconLocator;
 +
  }
  
Beside the logo, there are a few 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.
+
  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 03:05, 6 March 2013


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitterG+
Bugzilla
Bugzilla


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)

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.

Scout-branding-swing-client-plugin.xml.png


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.

Branding-Swing-Client-Icons-Extensions.png

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:

Branding-Swing-Client-Icons.png

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:

scout.laf.useLafFrameAndDialog=false


Splash screen

Add the following member variable and methods to the class SwingEnvironment:

  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 != null) {
      return new IconUIResource(icon);
    }
    else {
      return null;
    }
  }


Back to the top