sub_arctic.style
Class style_manager

java.lang.Object
  |
  +--sub_arctic.style.style_manager

public class style_manager
extends java.lang.Object

This class provides overall management for styles. Currently this only involves support for registering resource names and mapping registered names to resource designators. (Later we expect to add support for loading new styles, looking up styles by name, etc. This is a static class (has all static methods and instance variables) and is never instantiated.


Field Summary
protected static style _current_style
          The currently active global style.
protected static java.util.Hashtable _desig_table
          Search table for resource designators (indexed by name string).
protected static style _interactor_resources
          The style used to store fallback resources for interactors not in the standard library.
protected static style _root_style
          The root style that all (regular) styles directly or indirectly inherit from.
protected static style _standard_library_resources
          The style used to store fallback resources for interactors in the standard library.
protected static java.util.Hashtable _style_table
          Search table for styles.
static java.lang.String default_not_found_mess
          Default error message for unregistered resource designator names
 
Constructor Summary
style_manager()
           
 
Method Summary
static style current_style()
          The currently active global style.
static style_resource_desig desig_for(java.lang.String name)
          Look up a previously registered resource designator by name.
static style_resource_desig desig_for(java.lang.String name, java.lang.String message)
          Look up a previously registered resource designator by name.
static style find_style(java.lang.String with_name)
          Retreive a registered style by name.
static style interactor_resources()
          The style used to store fallback resources for interactors in the standard library.
static style_resource_desig lookup_desig(java.lang.String name)
          Look up a previously registered style resource designator by name.
static void register_desig(style_resource_desig the_desig)
          Register a new resource designator.
static void register_style(style styl)
          Register a style for later lookup by name.
static void remove_style(java.lang.String with_name)
          rEMOve a registered style form the style table.
static style root_style()
          The root style that all (regular) styles directly or indirectly inherit from.
static void set_current_style(style new_style)
          Set the currently active global style.
protected static void setup_blank_names()
          Register standard blank names.
protected static void setup_standard_names()
          Register standard resource names.
protected static void setup_standard_styles()
          Register standard styles.
static style standard_library_resources()
          The style used to store fallback resources for interactors in the standard library.
static style_resource_desig temp_desig_for(java.lang.String name)
          Lookup a resource designator by name, creating a "temporary" designator if none exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_desig_table

protected static java.util.Hashtable _desig_table
Search table for resource designators (indexed by name string).

default_not_found_mess

public static final java.lang.String default_not_found_mess
Default error message for unregistered resource designator names

_style_table

protected static java.util.Hashtable _style_table
Search table for styles. This will contain style objects indexed by name string).

_root_style

protected static style _root_style
The root style that all (regular) styles directly or indirectly inherit from.

_standard_library_resources

protected static style _standard_library_resources
The style used to store fallback resources for interactors in the standard library. This is placed at the very top of the style hierarchy (the root style actually inherits from this) so that its always there, but can also always be overridden by any style (which in fact we expect that every style will do).

_interactor_resources

protected static style _interactor_resources
The style used to store fallback resources for interactors not in the standard library. This is placed at the very top of the style hierarchy (the root style actually inherits from this) so that its always there, but can also always be overridden by any style.

_current_style

protected static style _current_style
The currently active global style.
Constructor Detail

style_manager

public style_manager()
Method Detail

register_desig

public static void register_desig(style_resource_desig the_desig)
Register a new resource designator. This designator will be placed in the designator table indexed by its string. If a designator by that name already exists in the table then one of two things will happen. If the existing name has a null fallback then the existing designator will be completed by filling in the fallback from the given designator. In that case the new designator will not be registered. If an existing designator with a non-null fallback is found (or a null designator, or name string is found), an error will thrown.
Parameters:
style_resource_desig - the_desig the designator to be registered.

lookup_desig

public static style_resource_desig lookup_desig(java.lang.String name)
Look up a previously registered style resource designator by name.
Parameters:
String - name the name of the designator we are looking for.
Returns:
style_resource_desig the designator registered under the given name, or null if no such designator has been registered.
See Also:
desig_for(java.lang.String, java.lang.String)

desig_for

public static style_resource_desig desig_for(java.lang.String name,
                                             java.lang.String message)
Look up a previously registered resource designator by name. If no such designator has been registers, an error with the given message is thrown.
Parameters:
String - name the name of the designator we are looking for.
String - message error message for potential not-found error. The sequence "(\"" + name + "\")" is appended to this message before it is thrown.
Returns:
style_resource_desig the designator registered under the given name.

desig_for

public static style_resource_desig desig_for(java.lang.String name)
Look up a previously registered resource designator by name. If no such designator has been registered, an error with a default message is thrown.
Parameters:
String - name the name of the designator we are looking for.
Returns:
style_resource_desig the designator registered under the given name.

temp_desig_for

public static style_resource_desig temp_desig_for(java.lang.String name)
Lookup a resource designator by name, creating a "temporary" designator if none exists.
Parameters:
String - name the name of the designator we are looking for.
Returns:
style_resource_desig the designator registered under the given name.

find_style

public static style find_style(java.lang.String with_name)
Retreive a registered style by name. If no such style has been registered, null is returned.
Parameters:
String - with_name the name of the style we are looking for.
Returns:
style the style registered under that name, or null if there is none.

register_style

public static void register_style(style styl)
Register a style for later lookup by name. If a style is already registered by that name, an exception is thrown.
Parameters:
String - name the name the style is to be registered under
style - styl the style being registered

remove_style

public static void remove_style(java.lang.String with_name)
rEMOve a registered style form the style table. This is typically only used to replace a style (you must do a remove followed by a register to replace a style. If there is no style registered under the given name, nothing happens.
Parameters:
String - with_name name of style to be unregistered.

root_style

public static style root_style()
The root style that all (regular) styles directly or indirectly inherit from.

standard_library_resources

public static style standard_library_resources()
The style used to store fallback resources for interactors in the standard library. This is placed at the very top of the style hierarchy (the root style actually inherits from this) so that its always there, but can also always be overridden by any style (which in fact we expect that every style will do).

interactor_resources

public static style interactor_resources()
The style used to store fallback resources for interactors in the standard library. This is placed at the very top of the style hierarchy (the root style actually inherits from this) so that its always there, but can also always be overridden by any style.

setup_standard_names

protected static void setup_standard_names()
Register standard resource names. This will be invoked by a static initializer block to set up the core set of standard names to serve as fallbacks for all the styles in the system. This does not include blanks which are standard but specific to some interactor in the standard library -- those are registered by the interactors which "own" them. The work for this is divided into categories based on trees in the name full fallback forest with a separate method handling each category. Currently categories include: blanks (setup_blank_names()).
See Also:
setup_blank_names()

setup_blank_names

protected static void setup_blank_names()
Register standard blank names. The two levels of the blank hierarchy looks like (all these names start with "#std."):
generic_blank
Root of the blank fallback tree. If all else fails this serves as the deep fallback.
simple_blank:normal
Blank for normal (non-active, non-depressed, etc.) display. Often this would be a slightly raised blank.
simple_blank:active
Blank which has been activated in some way (e.g. pressed). The important property of this blank is that it is recognizably distinct with simple_blank:normal in appearance. It should also normally be visualy distinct from simple_blank:distinguished. Often this would be a slightly inset blank.
simple_blank:distinguished
Blank being used with an object which has been emphasized, highlighted, or focused upon in some way. For example, the default action button on a dialog box. This blank must be visualy distinct from simple_blank:normal and should generally be distinct from simple_blank active as well. Often this blank might have a special border or make use of different colors.
simple_blank:disabled
A blank used for something which is disabled.
The next level under the main 3 looks like:
pressable_blank:out
Blank for something that can be pressed but isn't currently (under simple_blank:normal).
pressable_blank:in
Pressable blank that has been pressed (under simple_blank:active).
pressable_blank:disabled
Pressable blank that has been disabled (under simple_blank:disabled).
In addition, names for several sets of blanks are available:
simple_blank:set
Note: currently this set does not include simple_blank:distinguished.
pressable_blank:set
See Also:
#register_standard_names

setup_standard_styles

protected static void setup_standard_styles()
Register standard styles. This will be invoked by a static initializer block to set up a minimum set of standard styles that the style manager itself is responsible for establishing. Standard styles set up here currently include: #root_style which all regular styles inherit from, #standard_library_resources which the standard library interactors place fallback resources into, and #interactor_resources which interactors not int he standard library may place fallback resources into.

Note: that #root_style actually inherits from both #standard_library_resources and #interactor_resources. While this is a bit unusual for a "root", this arrangement allows interactors to place resources in a fallback position, so that they will normally be overrriden in regular classes, but are always there just in case the current class has omitted something they need to operate properly. Basically, these represent "deep fallback" resources that will guarentee an interactor class can operate no matter what the current style does.


current_style

public static style current_style()
The currently active global style. Nearly all newly created interactor objects will get their style derived resources from this style object.

set_current_style

public static void set_current_style(style new_style)
Set the currently active global style. This will cause the manager to do a pass over the currently instantiated interactor trees and attempt to restyle all existing and installed interactors under the new style.
Parameters:
style - new_style the new current style