org.openpermis.editor.policy.view
Class AbstractToolView<P extends Presenter<?>>

java.lang.Object
  extended by org.openpermis.editor.policy.view.AbstractView
      extended by org.openpermis.editor.policy.view.AbstractToolView<P>
Type Parameters:
P - the presenter model type.
All Implemented Interfaces:
ErrorReporter, Tool, View
Direct Known Subclasses:
DecisionTool, ProblemListTool, RecentFilesTool, RoleAssignmentRuleListTool, RoleAssignmentTool, RoleHierarchyListTool, TargetAccessRuleListTool

public abstract class AbstractToolView<P extends Presenter<?>>
extends AbstractView
implements Tool

Abstract base class for tool views.

Since:
0.1.0

Constructor Summary
AbstractToolView(ApplicationContext context, Adapter trader)
          Creates an abstract tool view for the specified application context.
 
Method Summary
protected  void attachPresenter(P presenter, org.jdesktop.beansbinding.BindingGroup bindings)
          Attaches any listeners required to the new presenter and binds components.
protected  void contentPaneCreated()
          Hook called after the content pane has been created.
protected  JToolBar createToolBar()
          Factory method to lazily create the view tool bar.
protected  void detachPresenter(P presenter)
          Unlinks any listeners from the specified old presenter.
 String getDefaultLocation()
          Returns the desired default location relative to the working area for this tool view.
protected  P getPresenter()
          Returns the presenter rendered by this view.
 JToolBar getToolBar()
          Returns the tool bar of this tool view.
 String getToolIdentifier()
          Returns a unique identifier for this tool view.
protected  void setPresenter(P presenter)
          Sets the presenter that this view renders.
protected  void updateContent()
          Prompts the tool to update its content according to the presenter state.
 
Methods inherited from class org.openpermis.editor.policy.view.AbstractView
attach, canClose, canEditPart, closeView, createContentPane, createEditor, createFormBuilder, createTranslationConverter, detach, editPart, getAction, getActionMap, getAdapteeTrader, getApplicationContext, getContentPane, getControlFactory, getDefaultFocusComponent, getIcon, getParentView, getResourceMap, getTitle, getTitleParameters, getViewContext, isEmbedded, openView, setEnabled, setParentView, showStatusError, updateTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openpermis.editor.policy.view.Tool
refresh
 
Methods inherited from interface org.openpermis.editor.policy.view.View
attach, canClose, detach, getContentPane, getDefaultFocusComponent, getIcon, getParentView, getTitle, isEmbedded, setParentView
 

Constructor Detail

AbstractToolView

public AbstractToolView(ApplicationContext context,
                        Adapter trader)
Creates an abstract tool view for the specified application context.

Parameters:
context - the application context used to lookup the action and resource map.
Since:
0.1.0
Method Detail

updateContent

protected void updateContent()
Prompts the tool to update its content according to the presenter state.

The default implementation does nothing.

Notes:
Super call mandatory if overwritten.
Since:
0.1.0

detachPresenter

protected void detachPresenter(P presenter)
Unlinks any listeners from the specified old presenter.

This is called before a new presenter is set.

The default implementation removes any bean bindings.

Notes:
Super call mandatory if overwritten.
Parameters:
presenter - the presenter to unlink.
See Also:
setPresenter(Presenter)
Since:
0.1.0

attachPresenter

protected void attachPresenter(P presenter,
                               org.jdesktop.beansbinding.BindingGroup bindings)
Attaches any listeners required to the new presenter and binds components.

The default implementation does nothing.

Notes:
Super call mandatory if overwritten.
Parameters:
presenter - the new presenter to attach to.
bindings - the binding group to add bindings to.
Since:
0.1.0

setPresenter

protected void setPresenter(P presenter)
Sets the presenter that this view renders.

The view needs to take appropriate actions to rebind and render the presenter passed in, bindings to an old presenter are to be discarded in the process.

Also makes sure that the content pane is created.

Notes:
Super call mandatory if overwritten.
Parameters:
presenter - the presenter to set.
Since:
0.1.0

getPresenter

protected P getPresenter()
Returns the presenter rendered by this view.

Returns:
the presenter rendered by this view.
Since:
0.1.0

createToolBar

protected JToolBar createToolBar()
Factory method to lazily create the view tool bar.

The default implementation creates a tool bar based on the resource key View.toolbar.

Returns:
the tool bar or null if this view does not feature a tool bar.
Since:
0.1.0

getToolIdentifier

public final String getToolIdentifier()
Description copied from interface: Tool
Returns a unique identifier for this tool view.

Specified by:
getToolIdentifier in interface Tool
Returns:
a unique identifier for this tool view.
Since:
0.1.0

getDefaultLocation

public String getDefaultLocation()
Description copied from interface: Tool
Returns the desired default location relative to the working area for this tool view.

Specified by:
getDefaultLocation in interface Tool
Returns:
the desired default location of this tool view.
Since:
0.1.0

getToolBar

public JToolBar getToolBar()
Description copied from interface: Tool
Returns the tool bar of this tool view.

Specified by:
getToolBar in interface Tool
Returns:
the tool bar of this tool view.
Since:
0.1.0

contentPaneCreated

protected void contentPaneCreated()
Description copied from class: AbstractView
Hook called after the content pane has been created.

Overrides:
contentPaneCreated in class AbstractView
Since:
0.1.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG