csheets.ui.ext
Class UIExtension

java.lang.Object
  extended by csheets.ui.ext.UIExtension
Direct Known Subclasses:
AssertionUIExtension, DependencyTreeUIExtension, StyleUIExtension, TestUIExtension

public abstract class UIExtension
extends Object

A base class for user interface extensions to the CleanSheets application. Subclasses should override the accessor methods for the components that they provide, and add components as selection listeners whenever required.

A user interface extension should only create one instance of each type of component, and therefore always return the same component when a given method is called.

Author:
Einar Pehrson
See Also:
SelectionListener

Field Summary
protected  Extension extension
          The name of the extension
protected  Properties props
          The application's user properties
protected  UIController uiController
          The user interface controller
 
Constructor Summary
UIExtension(Extension extension, UIController uiController)
          Creates a new user interface extension..
 
Method Summary
 CellDecorator getCellDecorator()
          Returns a cell decorator that visualizes the data added by the extension.
 Boolean getEnabledProperty(String propKey)
          Returns the enabled property corresponding to the given component key.
 Extension getExtension()
          Returns the extension for which this UI extension provides components.
 Icon getIcon()
          Returns an icon to display with the extension's name.
 JMenu getMenu()
          Returns a menu component that gives access to extension-specific functionality.
 JComponent getSideBar()
          Returns a side bar that gives access to extension-specific functionality.
 TableDecorator getTableDecorator()
          Returns a table decorator that visualizes the data added by the extension.
 JToolBar getToolBar()
          Returns a toolbar that gives access to extension-specific functionality.
 void setEnabledProperty(String propKey, boolean enabled)
          Sets the enabled property corresponding to the given component key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extension

protected final Extension extension
The name of the extension


uiController

protected final UIController uiController
The user interface controller


props

protected final Properties props
The application's user properties

Constructor Detail

UIExtension

public UIExtension(Extension extension,
                   UIController uiController)
Creates a new user interface extension..

Parameters:
extension - the extension for which components are provided
uiController - the user interface controller
Method Detail

getExtension

public final Extension getExtension()
Returns the extension for which this UI extension provides components.

Returns:
the extension for which this UI extension provides components

getEnabledProperty

public final Boolean getEnabledProperty(String propKey)
Returns the enabled property corresponding to the given component key.

Parameters:
propKey - the property key of the relevant component
Returns:
a Boolean value if a property is found, null otherwise

setEnabledProperty

public final void setEnabledProperty(String propKey,
                                     boolean enabled)
Sets the enabled property corresponding to the given component key.

Parameters:
propKey - the property key of the relevant component
enabled - whether the component should be enabled or not

getIcon

public Icon getIcon()
Returns an icon to display with the extension's name.

Returns:
an icon, or null if the extension does not provide one

getCellDecorator

public CellDecorator getCellDecorator()
Returns a cell decorator that visualizes the data added by the extension.

Returns:
a cell decorator, or null if the extension does not provide one

getTableDecorator

public TableDecorator getTableDecorator()
Returns a table decorator that visualizes the data added by the extension.

Returns:
a table decorator, or null if the extension does not provide one

getMenu

public JMenu getMenu()
Returns a menu component that gives access to extension-specific functionality.

Returns:
a JMenu component, or null if the extension does not provide one

getToolBar

public JToolBar getToolBar()
Returns a toolbar that gives access to extension-specific functionality.

Returns:
a JToolBar component, or null if the extension does not provide one

getSideBar

public JComponent getSideBar()
Returns a side bar that gives access to extension-specific functionality.

Returns:
a component, or null if the extension does not provide one