dsto.dfc.swing.styles
Class AbstractStyle

java.lang.Object
  extended by dsto.dfc.util.AbstractEnumerationValue
      extended by dsto.dfc.util.StringEnumerationValue
          extended by dsto.dfc.swing.icons.IconicEnumerationValue
              extended by dsto.dfc.swing.styles.AbstractStyle
All Implemented Interfaces:
Iconic, Style, EnumerationValue, Serializable

public abstract class AbstractStyle
extends IconicEnumerationValue
implements Style, EnumerationValue, Serializable

Base implementation of the Style interface. The intended use of this class is to create a set of related styles, so this class also implements the EnumerationValue interface. Subclasses of this class must implement getEnumValues () to return all other styles in the style set, and override readResolve () to call super.readResolve (). This enables inheritance of the singleton deserialization logic from the IconicEnumerationValue class.

Version:
$Revision$
Author:
Matthew Phillips
See Also:
Serialized Form

Field Summary
protected  String description
           
protected  Class type
           
 
Fields inherited from class dsto.dfc.swing.icons.IconicEnumerationValue
icon
 
Fields inherited from class dsto.dfc.util.StringEnumerationValue
name, text
 
Fields inherited from interface dsto.dfc.swing.icons.Iconic
NULL_ICON
 
Constructor Summary
protected AbstractStyle()
           
  AbstractStyle(String name, String text, Class type, String description, Icon icon)
          Creates a new AbstractStyle instance.
  AbstractStyle(String name, String text, Class type, String description, String iconResource)
          Creates a new AbstractStyle instance.
 
Method Summary
 String getDescription()
          A short (tooltip length) description of the style.
abstract  EnumerationValue[] getEnumValues()
          Get the list of values within the enumeration.
 Class getType()
          The type of value for the style.
protected  Object readResolve()
          Serialization support: resolves instance written to stream to the equivalent instance in getEnumValues () using equals ().
 
Methods inherited from class dsto.dfc.swing.icons.IconicEnumerationValue
getIcon, getLargeIcon
 
Methods inherited from class dsto.dfc.util.StringEnumerationValue
equals, findIndex, findValue, getName, getText, hashCode, setName, toString
 
Methods inherited from class dsto.dfc.util.AbstractEnumerationValue
findIndex, findIndex
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dsto.dfc.swing.styles.Style
getIcon, getLargeIcon, getText
 
Methods inherited from interface dsto.dfc.swing.icons.Iconic
getName
 

Field Detail

type

protected transient Class type

description

protected transient String description
Constructor Detail

AbstractStyle

protected AbstractStyle()

AbstractStyle

public AbstractStyle(String name,
                     String text,
                     Class type,
                     String description,
                     String iconResource)
Creates a new AbstractStyle instance.

Parameters:
name - The logical unique name of the style. This is used (via IconicEnumerationValue's deserialization) to resolve saved instances to the singleton instance.
text - The user-readable textual name of the style.
type - The type of value for the style.
description - A short (tooltip length) description of the style.
iconResource - The name of an icon resource for the style. May be null for no icon.

AbstractStyle

public AbstractStyle(String name,
                     String text,
                     Class type,
                     String description,
                     Icon icon)
Creates a new AbstractStyle instance.

Parameters:
name - The logical unique name of the style. This is used (via IconicEnumerationValue's deserialization) to resolve saved instances to the singleton instance.
text - The user-readable textual name of the style.
type - The type of value for the style.
description - A short (tooltip length) description of the style.
icon - The icon for the style. May be null for no icon.
Method Detail

getEnumValues

public abstract EnumerationValue[] getEnumValues()
Description copied from interface: EnumerationValue
Get the list of values within the enumeration.

Specified by:
getEnumValues in interface EnumerationValue
Specified by:
getEnumValues in class IconicEnumerationValue

getType

public Class getType()
Description copied from interface: Style
The type of value for the style.

Specified by:
getType in interface Style

getDescription

public String getDescription()
Description copied from interface: Style
A short (tooltip length) description of the style.

Specified by:
getDescription in interface Style

readResolve

protected Object readResolve()
                      throws InvalidObjectException
Description copied from class: AbstractEnumerationValue
Serialization support: resolves instance written to stream to the equivalent instance in getEnumValues () using equals (). Superclasses that wish to use this feature must override this method and call super.readResolve ().

Overrides:
readResolve in class AbstractEnumerationValue
Throws:
InvalidObjectException - if value could not be resolved to a valid entry in the list of enum values.


Copyright © 2008 Commonwealth of Australia