net.refractions.udig.style.sld.editor
Class StyleEditorPage

java.lang.Object
  extended by DialogPage
      extended by net.refractions.udig.style.sld.editor.StyleEditorPage
All Implemented Interfaces:
IEditorPage, IStyleEditorPage
Direct Known Subclasses:
StyleEditorPageAdapter, StyleThemePage, StyleXMLPage

public abstract class StyleEditorPage
extends DialogPage
implements IStyleEditorPage

Provides a user interface (by extension point) for pages in the SLD Editor.

Note: this will be rewritten in uDig 1.1.1

Since:
1.1
Author:
chorner

Field Summary
protected static java.lang.String XPID
           
 
Constructor Summary
StyleEditorPage()
           
 
Method Summary
 void applyData(java.lang.Object data)
           
 Point computeSize()
          Computes the size for this page's UI control.
 void createControl(Composite parent)
          Creates the page Control.
protected  Label createDescriptionLabel(Composite parent)
          Creates and returns an SWT label under the given composite.
abstract  void createPageContent(Composite parent)
          Creates the page content.
 void dispose()
           
protected  Point doComputeSize()
          Computes the size needed by this page's UI control.
 IStyleEditorPageContainer getContainer()
           
 StyleEditorPage getEditorPage()
           
abstract  java.lang.String getErrorMessage()
          Returns an error message, if applicable.
abstract  java.lang.String getLabel()
           
 StyleLayer getSelectedLayer()
           
 StyledLayerDescriptor getSLD()
          Returns the StyledLayerDescriptor from the style object on the blackboard (and creates one if it is missing).
 Style getStyle()
          Returns the current style object from the dialog.
abstract  void gotFocus()
          Each subclass must implement this method which is called each time the page obtains focus.
 void init(IWorkbench bench)
          Initializes the page (optional) Subclasses may override this method if they need to initialize.
 boolean isValid()
          Determines if the page contents are valid input.
abstract  boolean performCancel()
          Invoked when the user clicks cancel.
 void setContainer(IEditorPageContainer container)
           
 void setSize(Point size)
          Sets the size of this page's UI component.
 void setStyle(Style style)
          Sets the current style object (on our styleblackboard clone).
abstract  void styleChanged(GTEvent event)
          Each subclass must implement this method which is called each time the style object is modified on ANY page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.refractions.udig.style.sld.IEditorPage
okToLeave, performApply, performOk, refresh
 

Field Detail

XPID

protected static final java.lang.String XPID
See Also:
Constant Field Values
Constructor Detail

StyleEditorPage

public StyleEditorPage()
Method Detail

applyData

public void applyData(java.lang.Object data)
Specified by:
applyData in interface IEditorPage

createControl

public void createControl(Composite parent)
Creates the page Control. Subclasses should not override this method, but instead use createPageContent to create their contents.

Parameters:
parent - the parent composite

createPageContent

public abstract void createPageContent(Composite parent)
Creates the page content. Subclasses must define this method and create their child controls here.

Parameters:
parent - composite to put the page content in

getLabel

public abstract java.lang.String getLabel()

init

public void init(IWorkbench bench)
Initializes the page (optional) Subclasses may override this method if they need to initialize.

Parameters:
bench -

computeSize

public Point computeSize()
Computes the size for this page's UI control.

The default implementation of this IPreferencePage method returns the size set by setSize; if no size has been set, but the page has a UI control, the framework method doComputeSize is called to compute the size.

Specified by:
computeSize in interface IEditorPage
Returns:
the size of the preference page encoded as new Point(width,height), or (0,0) if the page doesn't currently have any UI component

doComputeSize

protected Point doComputeSize()
Computes the size needed by this page's UI control.

All pages should override this method and set the appropriate sizes of their widgets, and then call super.doComputeSize.

Returns:
the size of the preference page encoded as new Point(width,height)

performCancel

public abstract boolean performCancel()
Invoked when the user clicks cancel.

Specified by:
performCancel in interface IEditorPage
Returns:
false to abort the container's cancel procedure and true to allow the cancel to happen

getContainer

public IStyleEditorPageContainer getContainer()
Specified by:
getContainer in interface IStyleEditorPage

setContainer

public void setContainer(IEditorPageContainer container)
Specified by:
setContainer in interface IEditorPage

setSize

public void setSize(Point size)
Description copied from interface: IEditorPage
Sets the size of this page's UI component.

Specified by:
setSize in interface IEditorPage
Parameters:
size - the size of the preference page encoded as new Point(width,height)

dispose

public void dispose()

getErrorMessage

public abstract java.lang.String getErrorMessage()
Returns an error message, if applicable. The dialog automagically calls this method and displays it with an error icon if it returns a non-null string. Subclasses should determine the state of their respective pages in this method and return null if everything is okay.


createDescriptionLabel

protected Label createDescriptionLabel(Composite parent)
Creates and returns an SWT label under the given composite.

Parameters:
parent - the parent composite
Returns:
the new label

isValid

public boolean isValid()
Determines if the page contents are valid input. Subclasses should override if invalid input is possible.

Specified by:
isValid in interface IEditorPage
Returns:
true if the page is in a valid state, and false if invalid

getSLD

public StyledLayerDescriptor getSLD()
Returns the StyledLayerDescriptor from the style object on the blackboard (and creates one if it is missing).

Returns:
SLD Object

getStyle

public Style getStyle()
Returns the current style object from the dialog.

Returns:
style

setStyle

public void setStyle(Style style)
Sets the current style object (on our styleblackboard clone).

Parameters:
style -

getEditorPage

public StyleEditorPage getEditorPage()

getSelectedLayer

public StyleLayer getSelectedLayer()

gotFocus

public abstract void gotFocus()
Each subclass must implement this method which is called each time the page obtains focus.


styleChanged

public abstract void styleChanged(GTEvent event)
Each subclass must implement this method which is called each time the style object is modified on ANY page.