net.refractions.udig.project
Class StyleContent

java.lang.Object
  extended by net.refractions.udig.project.StyleContent
Direct Known Subclasses:
ShowViewInterceptor.ViewStyleContent

public abstract class StyleContent
extends java.lang.Object

Provides a way to persist an arbitrary object placed on the style blackboard.

Since:
1.0.0
Author:
Jesse

Field Summary
static java.lang.String XPID
          XPID field
 
Constructor Summary
protected StyleContent(java.lang.String id)
          Construct with ID suplied by subclass.
 
Method Summary
abstract  java.lang.Object createDefaultStyle(IGeoResource resource, java.awt.Color colour, IProgressMonitor monitor)
          Creates a default Style give a resource and color.
 java.lang.String getId()
          Unique identifier of the style.
abstract  java.lang.Class getStyleClass()
          Returns the class of the object which does the actual styling work.
abstract  java.lang.Object load(IMemento memento)
          Loads a style object from a memento.
abstract  java.lang.Object load(java.net.URL url, IProgressMonitor monitor)
          Loads a style object from a URL.
abstract  void save(IMemento memento, java.lang.Object value)
          Saves the state of a style object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XPID

public static final java.lang.String XPID
XPID field

See Also:
Constant Field Values
Constructor Detail

StyleContent

protected StyleContent(java.lang.String id)
Construct with ID suplied by subclass. This id must be the same as the id declared by the extension point.

Parameters:
id -
Method Detail

getId

public java.lang.String getId()
Unique identifier of the style. This id must be the same as the id declared by the extension point.

This id is also used by Renderer and StyleConfigurator, often implementation will have a static final String ID defined for programmers.

Returns:
The style id which identifies the style.

getStyleClass

public abstract java.lang.Class getStyleClass()
Returns the class of the object which does the actual styling work.

Returns:
the class of the style object.

save

public abstract void save(IMemento memento,
                          java.lang.Object value)
Saves the state of a style object.

(Currently used with XMLMemento to persist StyleEntry, it is hoped that an EMFMemento can be writen).

Parameters:
style - the style object to persisit.
memento - Momento used to store the style object state.

load

public abstract java.lang.Object load(IMemento memento)
Loads a style object from a memento.

(Currently used with XMLMemento to persist StyleEntry, it is hoped that an EMFMemento can be writen).

Parameters:
memento - object which contains previously saved object state.
Returns:
Loaded object and state.

load

public abstract java.lang.Object load(java.net.URL url,
                                      IProgressMonitor monitor)
                               throws java.io.IOException
Loads a style object from a URL. This method is blocking.

Parameters:
url - the URL pointing to the style's location
monitor - Progress monitor to report back to caller, allowed to be null.
Returns:
a load style object, or null if it could not be loaded
Throws:
java.io.IOException - if there is an error loading the URL

createDefaultStyle

public abstract java.lang.Object createDefaultStyle(IGeoResource resource,
                                                    java.awt.Color colour,
                                                    IProgressMonitor monitor)
                                             throws java.io.IOException
Creates a default Style give a resource and color.

Parameters:
resource - to attempt to create a style for.
colour - color to use while creating style.
monitor - monitor used to show progress of style creation.
Returns:
a "default" style or null if the style does not apply to the resource
Throws:
java.io.IOException - if a problem occurs accessing the GeoResource.