org.openpermis.editor.policy.view
Class ContextView

java.lang.Object
  extended by org.openpermis.editor.policy.view.AbstractView
      extended by org.openpermis.editor.policy.view.ContextView
All Implemented Interfaces:
ErrorReporter, DockControlListener, EventListener, View, ViewContext
Direct Known Subclasses:
PolicyView

public abstract class ContextView
extends AbstractView
implements ViewContext, DockControlListener

Abstract view implementation that provides a view context.

Since:
0.1.0

Constructor Summary
ContextView(org.jdesktop.application.ApplicationContext context, AdapterTrader trader, org.jdesktop.swingx.JXFrame frame)
          Creates a context view for the specified application context.
 
Method Summary
protected  void activateEditor(Editor editor)
          Activates an already opened editor.
 void addViewContextListener(ViewContextListener listener)
          Adds a listener for view context events.
abstract  boolean canEditPart(org.openpermis.policy.bean.PartBean part)
          Tests if the part specified can be edited.
 boolean closeView(View view, boolean force)
          Closes the specified view.
protected  JComponent createContentPane()
          Creates the content pane of this view.
abstract  Editor editPart(org.openpermis.policy.bean.PartBean part)
          Opens an editor for the specified part.
protected  Set<Editor> getEditorViews()
          Returns a set of all editor views.
 void openView(View view)
          Opens the specified view.
protected  void refresh(org.openpermis.policy.bean.PolicyBean policy, PolicyContext context)
          Notifies all tool views managed that the policy and the dispatcher have changed.
 void removeViewContextListener(ViewContextListener listener)
          Removes a listener from this view context.
 void updateViewTitle(View view)
          Updates the title of the specified view.
 void viewActivated(View view)
          Indicates that a view has been activated in a dock control.
 void viewClosed(View view)
          Indicates that a view has been closed in a dock control.
 void viewDeactivated(View view)
          Indicates that a view has been deactivated in a dock control.
 void viewOpened(View view)
          Indicates that a view has been opened in a dock control.
 
Methods inherited from class org.openpermis.editor.policy.view.AbstractView
attach, canClose, contentPaneCreated, detach, getActionMap, getAdapteeTrader, getContentPane, getIcon, getResourceMap, getTitle, getTitleParameters, getViewContext, label, showStatusError, toolBar, 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.gui.binding.ErrorReporter
showStatusError
 

Constructor Detail

ContextView

public ContextView(org.jdesktop.application.ApplicationContext context,
                   AdapterTrader trader,
                   org.jdesktop.swingx.JXFrame frame)
Creates a context view for the specified application context.

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

refresh

protected void refresh(org.openpermis.policy.bean.PolicyBean policy,
                       PolicyContext context)
Notifies all tool views managed that the policy and the dispatcher have changed.

Parameters:
policy - the new policy that is active.
context - the policy context to use.
Since:
0.1.0

getEditorViews

protected Set<Editor> getEditorViews()
Returns a set of all editor views.

Returns:
the currently showing editor views.
Since:
0.1.0

activateEditor

protected void activateEditor(Editor editor)
Activates an already opened editor.

Parameters:
editor - the editor to activate.
Since:
0.1.0

createContentPane

protected JComponent createContentPane()
Description copied from class: AbstractView
Creates the content pane of this view.

Specified by:
createContentPane in class AbstractView
Returns:
the content pane of this view, must not be null.
Since:
0.1.0

addViewContextListener

public void addViewContextListener(ViewContextListener listener)
Description copied from interface: ViewContext
Adds a listener for view context events.

The same listener object may be added more than once, and will be called as many times as it is added.

If the listener is null, no action is taken.

Specified by:
addViewContextListener in interface ViewContext
Parameters:
listener - the listener to add, may be null.
Since:
0.1.0

removeViewContextListener

public void removeViewContextListener(ViewContextListener listener)
Description copied from interface: ViewContext
Removes a listener from this view context.

If the same listener was added more than once, it will be notified one less time after being removed.

If the listener is null, or was never added, no action is taken.

Specified by:
removeViewContextListener in interface ViewContext
Parameters:
listener - the listener to be removed, may be null.
Since:
0.1.0

editPart

public abstract Editor editPart(org.openpermis.policy.bean.PartBean part)
Description copied from interface: ViewContext
Opens an editor for the specified part.

If there is already an editor open, the editor will be shown.

Specified by:
editPart in interface ViewContext
Overrides:
editPart in class AbstractView
Parameters:
part - the part to edit.
Returns:
the editor of this part, null if the part cannot be edited.
Since:
0.1.0

canEditPart

public abstract boolean canEditPart(org.openpermis.policy.bean.PartBean part)
Description copied from interface: ViewContext
Tests if the part specified can be edited.

There are part types for which there may be no editor type registered, in such a case the part is not editable and calling ViewContext.editPart(PartBean) will yield a null editor. Use this method if you want to test prior to actually creating the editor.

Specified by:
canEditPart in interface ViewContext
Overrides:
canEditPart in class AbstractView
Parameters:
part - the part to test.
Returns:
true if the part can be edited, false otherwise.
Since:
0.3.0

updateViewTitle

public void updateViewTitle(View view)
Description copied from interface: ViewContext
Updates the title of the specified view.

Specified by:
updateViewTitle in interface ViewContext
Parameters:
view - the view for which to update the title.
Since:
0.1.0

openView

public void openView(View view)
Description copied from interface: ViewContext
Opens the specified view.

Specified by:
openView in interface ViewContext
Overrides:
openView in class AbstractView
Parameters:
view - the view to be opened.
Since:
0.1.0

closeView

public boolean closeView(View view,
                         boolean force)
Description copied from interface: ViewContext
Closes the specified view.

Specified by:
closeView in interface ViewContext
Overrides:
closeView in class AbstractView
Parameters:
view - the view to be closed.
force - true to force closing of the view.
Returns:
true if the view was closed, false if the view denied closing.
Since:
0.1.0

viewActivated

public void viewActivated(View view)
Description copied from interface: DockControlListener
Indicates that a view has been activated in a dock control.

Specified by:
viewActivated in interface DockControlListener
Parameters:
view - the view that has been activated.
Since:
0.1.0

viewDeactivated

public void viewDeactivated(View view)
Description copied from interface: DockControlListener
Indicates that a view has been deactivated in a dock control.

Specified by:
viewDeactivated in interface DockControlListener
Parameters:
view - the view that has been deactivated.
Since:
0.1.0

viewClosed

public void viewClosed(View view)
Description copied from interface: DockControlListener
Indicates that a view has been closed in a dock control.

Specified by:
viewClosed in interface DockControlListener
Parameters:
view - the view that has been closed.
Since:
0.1.0

viewOpened

public void viewOpened(View view)
Description copied from interface: DockControlListener
Indicates that a view has been opened in a dock control.

Specified by:
viewOpened in interface DockControlListener
Parameters:
view - the view that has been opened.
Since:
0.1.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:33
Copyright (c) 2002-2007 Ergon Informatik AG