Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit.plaf
Class UIManager

java.lang.Object
  extended by com.sun.dtv.lwuit.plaf.UIManager

public class UIManager
extends Object

Central point singleton managing the look of the application, this class allows us to customize the styles (themes) as well as the look instance.


Method Summary
 Style getComponentStyle(String id)
          Returns the style of the component with the given id or a new instance of the default style.
static UIManager getInstance()
          Singleton instance method.
 LookAndFeel getLookAndFeel()
          Returns the currently installed look and feel.
 Hashtable getResourceBundle()
          The resource bundle allows us to implicitly localize the UI on the fly, once its installed all internal application strings query the resource bundle and extract their values from this table if applicable.
 String getThemeName()
          Returns the name of the current theme for theme switching UI's.
 void loadTheme(InputStream input)
          Loads a theme from the given input stream.
 String localize(String key, String defaultValue)
          Localizes the given string from the resource bundle if such a String exists in the resource bundle.
 void setComponentStyle(String id, Style style)
          Allows a developer to programmatically install a style into the UI manager.
 void setLookAndFeel(LookAndFeel plaf)
          Sets the currently installed look and feel.
 void setResourceBundle(Hashtable resourceBundle)
          The resource bundle allows us to implicitly localize the UI on the fly, once its installed all internal application strings query the resource bundle and extract their values from this table if applicable.
 void setThemeProps(Hashtable themeProps)
          Allows manual theme loading from a hashtable of key/value pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UIManager getInstance()
Singleton instance method.

Returns:
Instance of the ui manager

getLookAndFeel

public LookAndFeel getLookAndFeel()
Returns the currently installed look and feel.

Returns:
the currently installed look and feel
See Also:
setLookAndFeel(com.sun.dtv.lwuit.plaf.LookAndFeel)

setLookAndFeel

public void setLookAndFeel(LookAndFeel plaf)
Sets the currently installed look and feel.

Parameters:
plaf - the look and feel
See Also:
getLookAndFeel()

setComponentStyle

public void setComponentStyle(String id,
                              Style style)
Allows a developer to programmatically install a style into the UI manager.

Parameters:
id - the component id matching the given style
style - the style object to install
See Also:
getComponentStyle(java.lang.String)

getComponentStyle

public Style getComponentStyle(String id)
Returns the style of the component with the given id or a new instance of the default style. This method will always return a new style instance to prevent modification of the global style object.

Parameters:
id - the component id
Returns:
the appropriate style (this method never returns null)
See Also:
setComponentStyle(java.lang.String, com.sun.dtv.lwuit.plaf.Style)

loadTheme

public void loadTheme(InputStream input)
               throws IOException
Loads a theme from the given input stream. The theme can be specified in any stream using the following notation:
 ButtonFont=System{FACE_SYSTEM;STYLE_PLAIN;SIZE_SMALL}
 LabelFgColor=333333
 

Parameters:
input - the input stream
Throws:
IOException - if loading fails

getThemeName

public String getThemeName()
Returns the name of the current theme for theme switching UI's.

Returns:
the name of the current theme for theme switching UI's

setThemeProps

public void setThemeProps(Hashtable themeProps)
Allows manual theme loading from a hashtable of key/value pairs.

Parameters:
themeProps - the hashtable containing the theme's props

getResourceBundle

public Hashtable getResourceBundle()
The resource bundle allows us to implicitly localize the UI on the fly, once its installed all internal application strings query the resource bundle and extract their values from this table if applicable.

Returns:
the resource bundle
See Also:
setResourceBundle(java.util.Hashtable)

setResourceBundle

public void setResourceBundle(Hashtable resourceBundle)
The resource bundle allows us to implicitly localize the UI on the fly, once its installed all internal application strings query the resource bundle and extract their values from this table if applicable.

Parameters:
resourceBundle - the resourceBundle
See Also:
getResourceBundle()

localize

public String localize(String key,
                       String defaultValue)
Localizes the given string from the resource bundle if such a String exists in the resource bundle. If no key exists in the bundle then or a bundle is not installed the default value is returned.

Parameters:
key - The key used to lookup in the resource bundle
defaultValue - the value returned if no such key exists
Returns:
either default value or the appropriate value

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.