com.yospace.yae.yogi
Class UIManager

java.lang.Object
  |
  +--com.yospace.yae.yogi.UIManager
Direct Known Subclasses:
StandardPlafUIManager, StandardPlafUIManager

public abstract class UIManager
extends java.lang.Object

This is the abstract superclass of UI managers. It performs the UI specific decisions about focus management, and boilerplate images, and it maps YogiComponents to their corresponding UI delegates (subclasses of ComponentUI).


Field Summary
static int DIALOG_ALERT_IMAGE
          Identifier for requesting this UI's standard image for Alert-style dialogs.
static int DIALOG_CONFIRM_IMAGE
          Identifier for requesting this UI's standard image for Confirm-style dialogs.
static int DIALOG_WAITING_IMAGE
          Identifier for requesting this UI's standard image for Waiting-style dialogs.
 
Constructor Summary
UIManager()
           
 
Method Summary
protected  boolean buildSystemStringResources(java.lang.String resourcesXmlUrl)
          Builds the Hashtable of system string resources from a given URL.
abstract  Image getDialogImage(int type)
          This method returns an Image object for displaying on dialog windows.
abstract  FocusManager getFocusManager()
          This factory method returns the FocusManager appropriate to the current Look and Feel.
abstract  int[] getKeyMapping(java.lang.String actionName)
          Retrieves the current key mappings for the specified action name.
 java.lang.String getSystemStringResource(java.lang.String resourceId)
          This method returns the system String resource mapped to the specified id.
abstract  ComponentUI getUI(java.lang.String componentClassName)
          This factory method retrieves an instance of the UI object corresponding to the specified YogiComponent's fully qualified class name.
abstract  ComponentUI getUI(YogiComponent component)
          This factory method retrieves an instance of the UI object corresponding to the specified YogiComponent.
abstract  boolean isMappedKey(int key, java.lang.String actionName)
          Determines whether the supplied key code has been mapped to the supplied action name.
abstract  void setKeyMapping(int[] keys, java.lang.String actionName)
          Maps the specified keycodes to the supplied action name.
abstract  void setUI(java.lang.String componentClassName, java.lang.String uiComponentClassName)
          This method registers a UI class against the specified component type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIALOG_ALERT_IMAGE

public static final int DIALOG_ALERT_IMAGE
Identifier for requesting this UI's standard image for Alert-style dialogs. This image is often some form of exclamation mark.
See Also:
getDialogImage(int type), YogiPopup.showDialog(), YogiPopup.DIALOG_ALERT

DIALOG_CONFIRM_IMAGE

public static final int DIALOG_CONFIRM_IMAGE
Identifier for requesting this UI's standard image for Confirm-style dialogs. This image is often some form of question mark.
See Also:
getDialogImage(int type), YogiPopup#showDialog, YogiPopup.DIALOG_CONFIRM

DIALOG_WAITING_IMAGE

public static final int DIALOG_WAITING_IMAGE
Identifier for requesting this UI's standard image for Waiting-style dialogs. This image is often some form of clock or hourglass.
See Also:
getDialogImage(int type), YogiPopup#showDialog, YogiPopup.DIALOG_WAITING
Constructor Detail

UIManager

public UIManager()
Method Detail

getUI

public abstract ComponentUI getUI(YogiComponent component)
                           throws java.lang.IllegalArgumentException
This factory method retrieves an instance of the UI object corresponding to the specified YogiComponent. The UI object may be shared amongst many similar components if it is stateless.
Parameters:
component - the component whose UI is to be returned.
Returns:
an appropriate UI delegate object
Throws:
java.lang.IllegalArgumentException - if there is no corresponding UI class. This may be treated as a fatal condition for a normal YoGI application, as it implies that a required class is not present, or that a YoBean has not been installed correctly.
See Also:
getUI(java.lang.String), ComponentUI.getInstance()

getUI

public abstract ComponentUI getUI(java.lang.String componentClassName)
                           throws java.lang.IllegalArgumentException
This factory method retrieves an instance of the UI object corresponding to the specified YogiComponent's fully qualified class name. The UI object may be shared amongst many similar components if it is stateless.
Parameters:
componentClassName - the component type whose UI is to be returned.
Returns:
an appropriate UI delegate object.
Throws:
java.lang.IllegalArgumentException - if there is no corresponding UI class. This may be treated as a fatal condition for a normal YoGI application, as it implies that a required class is not present, or that a YoBean has not been installed correctly.
See Also:
ComponentUI.getInstance()

setUI

public abstract void setUI(java.lang.String componentClassName,
                           java.lang.String uiComponentClassName)
This method registers a UI class against the specified component type. The class names must be fully qualified, and should probably be loadable. This method does not normally try to load or instantiate either class, as it is possible that YoGI may be initialized with more component or UI classes than are actually included in its download bundle.
Parameters:
componentClassName - the component class name whose UI is to be defined.
uiComponentClassName - the UI class to use for the component, componentClassName.

getFocusManager

public abstract FocusManager getFocusManager()
This factory method returns the FocusManager appropriate to the current Look and Feel. The FocusManager is responsible for the focus traversal strategy, and decides how events should be posted to components.
Returns:
this UI's implementation of the FocusManager.

isMappedKey

public abstract boolean isMappedKey(int key,
                                    java.lang.String actionName)
Determines whether the supplied key code has been mapped to the supplied action name. These mappings are set in a UI dependent fashion, usually in the same manner to the way that UI delegates are designated (e.g., a config file or other dynamically loaded setup).
Parameters:
key - the keycode of the key that was pressed. This is the keycode passed by the MIDP canvas when the key is pressed.
actionName - the registered action name. This can be any string.
Returns:
true if the key has been mapped to that action name; false otherwise
See Also:
setKeyMapping(int[],java.lang.String)

setKeyMapping

public abstract void setKeyMapping(int[] keys,
                                   java.lang.String actionName)
Maps the specified keycodes to the supplied action name.
Parameters:
keys - an array of keycodes of the keys to be mapped. These are the keycodes passed by the MIDP canvas when a key is pressed.
actionName - the action name to be registered. This can be any string.
See Also:
isMappedKey(int,java.lang.String)

getKeyMapping

public abstract int[] getKeyMapping(java.lang.String actionName)
Retrieves the current key mappings for the specified action name.
Parameters:
actionName - the action name to get the key mappings of.
Returns:
the set of key codes for the specified action, or null if none exist.

getDialogImage

public abstract Image getDialogImage(int type)
This method returns an Image object for displaying on dialog windows. Applications may need to access these images if they need to create highly customized pop-up dialogs of their own, whilst still fitting in with the look and feel.
Parameters:
type - the image type, one of DIALOG_ALERT_IMAGE, DIALOG_CONFIRM_IMAGE or DIALOG_WAITING_IMAGE.
Returns:
an Image object representing the requested image.

getSystemStringResource

public java.lang.String getSystemStringResource(java.lang.String resourceId)
This method returns the system String resource mapped to the specified id.
Parameters:
resourceId - id of the String resource.
Returns:
the String corresponding to this resource.

buildSystemStringResources

protected boolean buildSystemStringResources(java.lang.String resourcesXmlUrl)
Builds the Hashtable of system string resources from a given URL.
Parameters:
resourcesXmlUrl - url denoting the location of the string resources XML file.
Returns:
the success of the build - true if the system string resources were successfully built, false if the build failed.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.