Extension SDK 10.1.2

oracle.javatools.editor.language
Class StyleRegistry

java.lang.Object
  extended byoracle.javatools.editor.language.StyleRegistry

public final class StyleRegistry
extends java.lang.Object

A StyleRegistry is a registry of all known styles for all known language modules.


Field Summary
static java.lang.String PROPERTY_STYLE_CHANGED
          Name of the pseudo-property that the StyleRegistry uses to notify listeners (views) that settings in the registry have changed.
 
Constructor Summary
StyleRegistry()
          Constructs a new style registry.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this registry to track changes to styles.
 java.lang.Object clone()
          Creates and returns a copy of this class.
 BaseStyle createStyle(java.lang.String styleName, java.lang.String presentationName, java.lang.String parentStyleName)
          Create a new BaseStyle based on the given parent style and inheriting all of its attributes from the parent.
 BaseStyle createStyle(java.lang.String styleName, java.lang.String presentationName, java.lang.String parentStyleName, java.awt.Color fgColor)
          Create a new BaseStyle based on the given parent style, with the specified overriding foreground color.
 BaseStyle createStyle(java.lang.String styleName, java.lang.String presentationName, java.lang.String parentStyleName, java.awt.Color fgColor, java.awt.Color bgColor, int fontStyle)
          Create a new BaseStyle based on the given parent style, but overriding all of its attributes.
 BaseStyle createStyle(java.lang.String styleName, java.lang.String presentationName, java.lang.String parentStyleName, java.awt.Color fgColor, int fontStyle)
          Create a new BaseStyle based on the given parent style, with the specified overriding foreground and font style.
 BaseStyle createStyle(java.lang.String styleName, java.lang.String presentationName, java.lang.String parentStyleName, int fontStyle)
          Create a new BaseStyle based on the given parent style, with the specified overriding font style.
 java.util.Iterator getStyleIterator()
          Fetch an Iterator for all of the styles within this registry.
 BaseStyle lookupStyle(java.lang.String styleName)
          Fetches the style with the given name.
 void modifyStyle(java.lang.String styleName, boolean useParentFG, java.awt.Color fgColor, boolean useParentBG, java.awt.Color bgColor, boolean useParentFontStyle, int fontStyle)
          Modifies this style's attributes.
 void modifyStyleBackground(java.lang.String styleName, boolean useParentBG, java.awt.Color bgColor)
          Modifies the style's background attributes.
 void modifyStyleFontStyle(java.lang.String styleName, boolean useParentFontStyle, int fontStyle)
          Modifies the style's font attributes.
 void modifyStyleForeground(java.lang.String styleName, boolean useParentFG, java.awt.Color fgColor)
          Modifies the style's foreground attributes.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this registry.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_STYLE_CHANGED

public static final java.lang.String PROPERTY_STYLE_CHANGED
Name of the pseudo-property that the StyleRegistry uses to notify listeners (views) that settings in the registry have changed.

See Also:
Constant Field Values
Constructor Detail

StyleRegistry

public StyleRegistry()
Constructs a new style registry.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this registry to track changes to styles.

Parameters:
listener - the listener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this registry.

Parameters:
listener - the listener to be removed

getStyleIterator

public java.util.Iterator getStyleIterator()
Fetch an Iterator for all of the styles within this registry. Note that some of these styles may not be completely initialized - clients that use this style list for the purposes of display a list of available styles should call lookupStyle() on each style to ensure that the given style has been initialized properly.

Returns:
an iterator for all styles

clone

public java.lang.Object clone()
Creates and returns a copy of this class. This will return a completely independent StyleRegistry with a copy of its own styles separate from this one.

Returns:
a copy of this StyleRegistry

createStyle

public BaseStyle createStyle(java.lang.String styleName,
                             java.lang.String presentationName,
                             java.lang.String parentStyleName)
Create a new BaseStyle based on the given parent style and inheriting all of its attributes from the parent.

Parameters:
styleName - the name of the style
presentationName - the presentation or public name of the style that can be used for UI purposes
parentStyleName - the name of the parent style

createStyle

public BaseStyle createStyle(java.lang.String styleName,
                             java.lang.String presentationName,
                             java.lang.String parentStyleName,
                             java.awt.Color fgColor)
Create a new BaseStyle based on the given parent style, with the specified overriding foreground color.

Parameters:
styleName - the name of the style
presentationName - the presentation or public name of the style that can be used for UI purposes
parentStyleName - the name of the parent style
fgColor - the foreground color to use

createStyle

public BaseStyle createStyle(java.lang.String styleName,
                             java.lang.String presentationName,
                             java.lang.String parentStyleName,
                             int fontStyle)
Create a new BaseStyle based on the given parent style, with the specified overriding font style.

Parameters:
styleName - the name of the style
presentationName - the presentation or public name of the style that can be used for UI purposes
parentStyleName - the name of the parent style
fontStyle - the font style to use

createStyle

public BaseStyle createStyle(java.lang.String styleName,
                             java.lang.String presentationName,
                             java.lang.String parentStyleName,
                             java.awt.Color fgColor,
                             int fontStyle)
Create a new BaseStyle based on the given parent style, with the specified overriding foreground and font style.

Parameters:
styleName - the name of the style
presentationName - the presentation or public name of the style that can be used for UI purposes
parentStyleName - the name of the parent style
fgColor - the foreground color to use
fontStyle - the font style to use

createStyle

public BaseStyle createStyle(java.lang.String styleName,
                             java.lang.String presentationName,
                             java.lang.String parentStyleName,
                             java.awt.Color fgColor,
                             java.awt.Color bgColor,
                             int fontStyle)
Create a new BaseStyle based on the given parent style, but overriding all of its attributes.

Parameters:
styleName - the name of the style
presentationName - the presentation or public name of the style that can be used for UI purposes
parentStyleName - the name of the parent style
fgColor - the foreground color to use
bgColor - the background color to use
fontStyle - the font style to use

lookupStyle

public BaseStyle lookupStyle(java.lang.String styleName)
Fetches the style with the given name.

Returns:
the style with the given name, or null if it is not found

modifyStyleForeground

public void modifyStyleForeground(java.lang.String styleName,
                                  boolean useParentFG,
                                  java.awt.Color fgColor)
Modifies the style's foreground attributes.

Parameters:
styleName - the name of the style to modify
useParentFG - whether the style should inherit from the parent
fgColor - the foreground color to use

modifyStyleBackground

public void modifyStyleBackground(java.lang.String styleName,
                                  boolean useParentBG,
                                  java.awt.Color bgColor)
Modifies the style's background attributes.

Parameters:
styleName - the name of the style to modify
useParentBG - whether the style should inherit from the parent
bgColor - the background color to use

modifyStyleFontStyle

public void modifyStyleFontStyle(java.lang.String styleName,
                                 boolean useParentFontStyle,
                                 int fontStyle)
Modifies the style's font attributes.

Parameters:
styleName - the name of the style to modify
useParentFontStyle - whether the style should inherit from the parent
fontStyle - the font style to use

modifyStyle

public void modifyStyle(java.lang.String styleName,
                        boolean useParentFG,
                        java.awt.Color fgColor,
                        boolean useParentBG,
                        java.awt.Color bgColor,
                        boolean useParentFontStyle,
                        int fontStyle)
Modifies this style's attributes. If the style has not yet been created or initialized, these settings will be stored and applied when the style is actually created by the owning LanguageModule.

Parameters:
styleName - the name of the style to modify
useParentFG - whether the style should inherit from the parent
fgColor - the foreground color to use
useParentBG - whether the style should inherit from the parent
bgColor - the background color to use
useParentFontStyle - whether the style should inherit from the parent
fontStyle - the font style to use

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.