org.openpermis.editor.policy.view
Class AbstractView

java.lang.Object
  extended by org.openpermis.editor.policy.view.AbstractView
All Implemented Interfaces:
ErrorReporter, View
Direct Known Subclasses:
AbstractEditor, AbstractToolView, ContextView

public abstract class AbstractView
extends Object
implements View, ErrorReporter

Abstract base class for views.

Since:
0.1.0

Constructor Summary
AbstractView(ApplicationContext context, Adapter trader)
          Creates an abstract view that operates on an action and resource map derived from the implementation class of this view.
 
Method Summary
 void attach(ViewContext theContext)
          Attaches this view to the specified context.
 boolean canClose()
          Prompts the view to save unsaved changes before closing.
 boolean canEditPart(org.openpermis.policy.bean.PartBean part)
           
protected  boolean closeView(View view, boolean force)
           
protected  void contentPaneCreated()
          Hook called after the content pane has been created.
protected abstract  JComponent createContentPane()
          Creates the content pane of this view.
 Editor createEditor(org.openpermis.policy.bean.PartBean part)
           
protected  FormBuilder createFormBuilder()
          Creates a form builder that is configured for use with this view.
protected  org.jdesktop.beansbinding.Converter<String,String> createTranslationConverter(String prefix)
          Creates a translation converter for the specified prefix.
 void detach(ViewContext theContext)
          Detaches this view from the specified context.
protected  Editor editPart(org.openpermis.policy.bean.PartBean part)
           
protected  Action getAction(String name)
          Convenience method to retrieve an action by name.
protected  ActionMap getActionMap()
          Returns the application action map of this view class and instance.
 Adapter getAdapteeTrader()
          Returns the adaptee trader of this view class.
protected  ApplicationContext getApplicationContext()
          Returns the context of the application that owns this view.
 JComponent getContentPane()
          Returns the Swing content pane of this view.
protected  ControlFactory getControlFactory()
          Returns the control factory that can create controls for this view.
 JComponent getDefaultFocusComponent()
          Returns the default focus component.
 Icon getIcon()
          Returns the icon of this view.
 View getParentView()
          Returns the parent view or null if this is a toplevel view.
protected  org.jdesktop.application.ResourceMap getResourceMap()
          Returns the context resource map of this view class.
 String getTitle()
          Returns the title of this view.
 Object[] getTitleParameters()
          Returns the parameters for the title of this view.
protected  ViewContext getViewContext()
          Returns the view context of this view.
 boolean isEmbedded()
          Check if this view is embedded in another view.
protected  void openView(View view)
           
protected  void setEnabled(boolean enabled)
          Enables or disables all controls in this view.
 void setParentView(View view)
          Sets the view this view is embedded in.
 void showStatusError(String message)
          Shows an error message.
protected  void updateTitle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractView

public AbstractView(ApplicationContext context,
                    Adapter trader)
Creates an abstract view that operates on an action and resource map derived from the implementation class of this view.

Parameters:
context - the application context used to lookup the action and resource map.
trader - the adaptee trader of this view class.
Since:
0.1.0
Method Detail

getAdapteeTrader

public Adapter getAdapteeTrader()
Returns the adaptee trader of this view class.

Returns:
the adaptee trader of this view class.
Since:
0.3.0

getApplicationContext

protected ApplicationContext getApplicationContext()
Returns the context of the application that owns this view.

Returns:
the context of the application that owns this view.
Since:
0.9.0

getResourceMap

protected org.jdesktop.application.ResourceMap getResourceMap()
Returns the context resource map of this view class.

Returns:
the context resource map of this view class.
Since:
0.1.0

getActionMap

protected ActionMap getActionMap()
Returns the application action map of this view class and instance.

Returns:
the application action map of this view class and instance.
Since:
0.1.0

getControlFactory

protected ControlFactory getControlFactory()
Returns the control factory that can create controls for this view.

Returns:
the control factory configured with the resource and action map of this view.
Since:
0.9.0

getAction

protected Action getAction(String name)
Convenience method to retrieve an action by name.

Bascially corresponds to getActionMap().get(name).

Note: If the action does not exist an error message including stack trace is logged and an action that does nothing is returned.

Parameters:
name - the name of the action to retrieve.
Returns:
the action requested or void action if there is no such action.
Since:
0.9.0

createContentPane

protected abstract JComponent createContentPane()
Creates the content pane of this view.

Returns:
the content pane of this view, must not be null.
Since:
0.1.0

getViewContext

protected ViewContext getViewContext()
Returns the view context of this view.

Returns:
the view context of this view, may be null.
Since:
0.1.0

openView

protected void openView(View view)
Since:
0.1.0

closeView

protected boolean closeView(View view,
                            boolean force)
Since:
0.1.0

createEditor

public Editor createEditor(org.openpermis.policy.bean.PartBean part)
Since:
0.9.0

editPart

protected Editor editPart(org.openpermis.policy.bean.PartBean part)
Since:
0.1.0

canEditPart

public boolean canEditPart(org.openpermis.policy.bean.PartBean part)
Since:
0.3.0

updateTitle

protected void updateTitle()
Since:
0.1.0

createTranslationConverter

protected org.jdesktop.beansbinding.Converter<String,String> createTranslationConverter(String prefix)
Creates a translation converter for the specified prefix.

Parameters:
prefix - the prefix for all input strings in the translation map.
Returns:
the converter requested.
Since:
0.9.0

createFormBuilder

protected FormBuilder createFormBuilder()
Creates a form builder that is configured for use with this view.

Returns:
the form builder requested.
Since:
0.9.0

setEnabled

protected void setEnabled(boolean enabled)
Enables or disables all controls in this view.

Parameters:
enabled - true to enable, false to disable.
Since:
0.9.0

attach

public void attach(ViewContext theContext)
Attaches this view to the specified context.

Specified by:
attach in interface View
Notes:
Do not call this method directly, it is called by the context exclusively.
Parameters:
theContext - the context to attach this view to.
Since:
0.1.0

detach

public void detach(ViewContext theContext)
Detaches this view from the specified context.

Specified by:
detach in interface View
Notes:
Do not call this method directly, it is called by the context exclusively.
Parameters:
theContext - the context to detach this view from.
Since:
0.1.0

isEmbedded

public boolean isEmbedded()
Description copied from interface: View
Check if this view is embedded in another view.

If this view is embedded the he parent view (View.getParentView() is set to a non-null value. If embedded the view is not a fully functional toplevel view, but rather its content pane is embedded in the parent view.

Specified by:
isEmbedded in interface View
Returns:
true if this view is embedded in another view, false if this view is a toplevel view.
See Also:
View.getParentView()
Since:
0.9.0

getParentView

public View getParentView()
Description copied from interface: View
Returns the parent view or null if this is a toplevel view.

The parent view is only set if this view is embedded in another view. If embedded the view is not a fully functional toplevel view, but rather its content pane is embedded in the parent view.

Specified by:
getParentView in interface View
Returns:
the parent view or null.
Since:
0.9.0

setParentView

public void setParentView(View view)
Description copied from interface: View
Sets the view this view is embedded in.

The parent view is only set if this view is embedded in another view. If embedded the view is not a fully functional toplevel view, but rather its content pane is embedded in the parent view.

Specified by:
setParentView in interface View
Parameters:
view - the parent view to set.
Since:
0.9.0

getTitleParameters

public Object[] getTitleParameters()
Returns the parameters for the title of this view.

The default implementations returns an empty array.

Returns:
the parameters for the title of this view, must not be null.
Since:
0.1.0

getTitle

public String getTitle()
Returns the title of this view.

Specified by:
getTitle in interface View
Returns:
the title of this view.
Since:
0.1.0

getIcon

public Icon getIcon()
Returns the icon of this view.

Specified by:
getIcon in interface View
Returns:
the icon of this view.
Since:
0.1.0

contentPaneCreated

protected void contentPaneCreated()
Hook called after the content pane has been created.

Since:
0.1.0

getContentPane

public final JComponent getContentPane()
Returns the Swing content pane of this view.

Specified by:
getContentPane in interface View
Returns:
the Swing content pane of this view.
Since:
0.1.0

getDefaultFocusComponent

public JComponent getDefaultFocusComponent()
Returns the default focus component.

The default implementation returns the component (declared as a member variable) that has the DefaultFocus annotation.

Specified by:
getDefaultFocusComponent in interface View
Returns:
the default focus component or null if none could be found.
Since:
0.9.0

canClose

public boolean canClose()
Description copied from interface: View
Prompts the view to save unsaved changes before closing.

Specified by:
canClose in interface View
Returns:
true if the view may be closed, false otherwise.
Since:
0.1.0

showStatusError

public void showStatusError(String message)
Description copied from interface: ErrorReporter
Shows an error message.

Specified by:
showStatusError in interface ErrorReporter
Parameters:
message - the message to display.
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