org.argouml.ui
Class LookAndFeelMgr

java.lang.Object
  extended by org.argouml.ui.LookAndFeelMgr

public final class LookAndFeelMgr
extends java.lang.Object

Controls the look and feel and theme of ArgoUML. LookAndFeelMgr has a "Look and Feel" property which represents the Swing Pluggable Look-and-feel. It also has a "Theme" property which represents a MetalTheme when the Metal look-and-feel is selected (for other LAFs, a theme is not supported).

Themes have 2 kinds of names: 1. The "display name" shown in the UI, which is retrieved by theme.getName(), and 2. the "class name", which is the name of the theme class, and is retrieved by theme.getClass().getName().


Method Summary
 java.lang.String[] getAvailableLookAndFeelNames()
          Returns the display names of the available look and feel choices.
 java.lang.String[] getAvailableThemeNames()
          Returns the display names of the available theme choices.
 java.lang.String getCurrentLookAndFeel()
          Returns the string identifier for the current look and feel.
 java.lang.String getCurrentLookAndFeelName()
          Returns the display name of the current look and feel.
 java.lang.String getCurrentThemeClassName()
          Returns the string identifier for the current theme.
 java.lang.String getCurrentThemeName()
          Returns the display name of the current theme.
static LookAndFeelMgr getInstance()
          Get the single instance of the LookAndFeelMgr.
 java.lang.String getLookAndFeelFromName(java.lang.String name)
          Returns the Look and Feel class name identifier for the specified display name, or null if no such Look and Feel is found.
 java.awt.Font getSmallFont()
           
 java.awt.Font getStandardFont()
           
 java.lang.String getThemeClassNameFromArg(java.lang.String arg)
          Detecting the theme from the command line.
 java.lang.String getThemeFromName(java.lang.String name)
          Returns the theme class name identifier for the specified display name, or null if no such theme is found.
 void initializeLookAndFeel()
          Sets the appearance of the UI using the current values of the LookAndFeel and Theme properties.
 boolean isThemeCompatibleLookAndFeel(java.lang.String lafClass)
          Returns true if the specified look and feel class supports setting different themes.
 void printThemeArgs()
          Outputs command-line arguments supported by this class.
 void setCurrentLAFAndThemeByName(java.lang.String lafName, java.lang.String themeName)
          Sets the current look and feel, storing the new value in Configuration.
 void setCurrentTheme(java.lang.String themeClass)
          Sets the current theme, storing the new value in Configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LookAndFeelMgr getInstance()
Get the single instance of the LookAndFeelMgr.

Returns:
the single instance of the LookAndFeelMgr

initializeLookAndFeel

public void initializeLookAndFeel()
Sets the appearance of the UI using the current values of the LookAndFeel and Theme properties.


getThemeClassNameFromArg

public java.lang.String getThemeClassNameFromArg(java.lang.String arg)
Detecting the theme from the command line.

Parameters:
arg - the argument from the command line
Returns:
the theme

printThemeArgs

public void printThemeArgs()
Outputs command-line arguments supported by this class.


getAvailableLookAndFeelNames

public java.lang.String[] getAvailableLookAndFeelNames()
Returns the display names of the available look and feel choices. This may be used to fill a combobox to allow the user to select the LAF.

Returns:
look and feel display names

getAvailableThemeNames

public java.lang.String[] getAvailableThemeNames()
Returns the display names of the available theme choices. This may be used to fill a combobox to allow the user to select the theme.

Returns:
theme display names

getLookAndFeelFromName

public java.lang.String getLookAndFeelFromName(java.lang.String name)
Returns the Look and Feel class name identifier for the specified display name, or null if no such Look and Feel is found.

Parameters:
name - display name of desired look and feel
Returns:
class name for desired look and feel

getThemeFromName

public java.lang.String getThemeFromName(java.lang.String name)
Returns the theme class name identifier for the specified display name, or null if no such theme is found.

Parameters:
name - display name of desired theme
Returns:
class name for desired theme

isThemeCompatibleLookAndFeel

public boolean isThemeCompatibleLookAndFeel(java.lang.String lafClass)
Returns true if the specified look and feel class supports setting different themes.

Parameters:
lafClass - look and feel class name
Returns:
true if supports themes

getCurrentLookAndFeel

public java.lang.String getCurrentLookAndFeel()
Returns the string identifier for the current look and feel. This is the class name of the LookAndFeel class for the look and feel. Returns null if no look and feel has been specified, in which case Swing's default look and feel should be used.

Returns:
current look and feel class name

getCurrentLookAndFeelName

public java.lang.String getCurrentLookAndFeelName()
Returns the display name of the current look and feel.

Returns:
look and feel display name

setCurrentLAFAndThemeByName

public void setCurrentLAFAndThemeByName(java.lang.String lafName,
                                        java.lang.String themeName)
Sets the current look and feel, storing the new value in Configuration. If argument is null, indicates that Swing's default look and feel should be used.

Parameters:
lafName - the name of desired look and feel
themeName - the name of the theme

getCurrentThemeClassName

public java.lang.String getCurrentThemeClassName()
Returns the string identifier for the current theme. This is the class name of the MetalTheme class for the theme. This method returns null when the configuration does not return a valid metaltheme.

Returns:
current theme class name or null

getCurrentThemeName

public java.lang.String getCurrentThemeName()
Returns the display name of the current theme. Guaranteed to return the display name of one of the themes in the THEMES list.

Returns:
theme display name

setCurrentTheme

public void setCurrentTheme(java.lang.String themeClass)
Sets the current theme, storing the new value in Configuration. Argument should not be null, and argument class should be an instance of MetalTheme.

Parameters:
themeClass - class name of desired theme

getStandardFont

public java.awt.Font getStandardFont()
Returns:
the standard textfield font

getSmallFont

public java.awt.Font getSmallFont()
Returns:
the small font


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook