com.yospace.yae.yogi
Class Toolkit

java.lang.Object
  |
  +--com.yospace.yae.yogi.Toolkit

public class Toolkit
extends java.lang.Object

This is the overall YoGI Management class - it creates most of the control objects used by YoGI, and is the access point for referencing the UIManager. It is implemented as a singleton.

See Also:
get()

Constructor Summary
protected Toolkit(UIManager uiMgr, YogiRootWindow rootWindow)
          Installs the specified UIManager and sets up the root window (which acts as the repaint manager).
 
Method Summary
static Toolkit get()
          Singleton accessor method for the Toolkit.
static Font getFont(java.lang.String fontName)
          This method retrieves custom YoGI fonts (not System fonts).
 Dimension getRootContentPaneSize()
          Gets the size of the root content pane, so that perhaps the user can size a popup accordingly.
static java.lang.String getSystemStringResource(java.lang.String resourceId)
          Gets the named locale-specific system string resource.
 java.util.Timer getTimer()
          YoGI provides this single Timer object both for its own internal purposes, and for the convenience of UIs and applications.
static UIManager getUIManager()
          Accessor method for the UIManager.
 void grabResources(YogiRootWindow key)
          Notification that the YoGI/panelet system is now running and that any resources, such as Threads and Canvases should be allocated.
static void init(UIManager uiMgr, YogiRootWindow rootWindow)
          Singleton setup method.
 java.lang.String parseUrlForDeviceInfo(java.lang.String url)
          Parses a given URL, inserting system properties if a $-delimited String is encountered.
 void trimResources(YogiRootWindow key)
          Notification that the YoGI/panelet system is going to sleep, and that resources grabbed in grabResources(key) should be relinquished.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Toolkit

protected Toolkit(UIManager uiMgr,
                  YogiRootWindow rootWindow)
Installs the specified UIManager and sets up the root window (which acts as the repaint manager).
Parameters:
uiMgr - the UIManager for the windows system to use.
rootWindow - the (root window) repaint manager.
Method Detail

get

public static Toolkit get()
Singleton accessor method for the Toolkit.
Returns:
the one and only Toolkit.
Throws:
IllegalStateException - if the init(UIManager,YogiRootWindow) method hasn't been called yet to initialize the toolkit.

init

public static void init(UIManager uiMgr,
                        YogiRootWindow rootWindow)
Singleton setup method. Must be called before any other static methods are used.
Parameters:
uiMgr - the UIManager for the windows system to use.
rootWindow - the (root window) repaint manager.

getUIManager

public static UIManager getUIManager()
Accessor method for the UIManager.
Returns:
the current UIManager.

getRootContentPaneSize

public Dimension getRootContentPaneSize()
Gets the size of the root content pane, so that perhaps the user can size a popup accordingly.
Returns:
the size of the root content pane.

grabResources

public void grabResources(YogiRootWindow key)
Notification that the YoGI/panelet system is now running and that any resources, such as Threads and Canvases should be allocated.
Parameters:
key - the YogiRootWindow passed in as a key to ensure that starting the RepaintManager can only be achieved by YoGI internally.

trimResources

public void trimResources(YogiRootWindow key)
Notification that the YoGI/panelet system is going to sleep, and that resources grabbed in grabResources(key) should be relinquished.
Parameters:
key - the YogiRootWindow passed in as a key to ensure that stopping the RepaintManager can only be achieved by YoGI internally.

getFont

public static Font getFont(java.lang.String fontName)
This method retrieves custom YoGI fonts (not System fonts). The Toolkit maintains a cache of such fonts, as they are expensive to load, and will attempt to find the font in its cache. If the font has not been loaded before, then it will be loaded from its origin.
Parameters:
fontname - the name of the font, as passed to the CustomFont constructor.
Returns:
the font object representing the specified font.

getTimer

public java.util.Timer getTimer()
YoGI provides this single Timer object both for its own internal purposes, and for the convenience of UIs and applications. It is available for general use, but should not be stopped, blocked, or otherwise compromised. Using this Timer, rather than creating an application specific one, may reduce the Thread count and hence improve efficiency.
Returns:
the common YoGI timer

getSystemStringResource

public static java.lang.String getSystemStringResource(java.lang.String resourceId)
Gets the named locale-specific system string resource.
Parameters:
resourceId - the Id of the string resource to obtain.
Returns:
the required string resource.

parseUrlForDeviceInfo

public java.lang.String parseUrlForDeviceInfo(java.lang.String url)
Parses a given URL, inserting system properties if a $-delimited String is encountered. eg "http://www.myDomain.com/YogiXML/ScrollListPanelet.xml?numColors=$(numColors)" will be converted to "http://www.myDomain.com/YogiXML/ScrollListPanelet.xml?numColors=16777216" (depending on device).
Parameters:
url - the URL to parse.
Returns:
the parsed URL.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.