org.openpermis.editor.policy.view
Class PolicyView

java.lang.Object
  extended by org.openpermis.editor.policy.view.AbstractView
      extended by org.openpermis.editor.policy.view.ContextView
          extended by org.openpermis.editor.policy.view.PolicyView
All Implemented Interfaces:
ApplicationView, ErrorReporter, ControlFactory.Resolver, DockControlListener, EventListener, MenuBarFactory.Resolver, ToolBarFactory.Resolver, PolicyHolder, View, ViewContext

public class PolicyView
extends ContextView
implements ApplicationView, PolicyHolder, ControlFactory.Resolver

View for a complete PolicyBean.

The PolicyView describes the toplevel view including menubar and toolbar for a complete policy editor. This view will serve as a view manager for all other views used to edit the policy attached to the PolicyView.

Since:
0.1.0

Constructor Summary
PolicyView(Application application, Adapter trader, org.jdesktop.swingx.JXFrame frame, Configuration configuration)
          Creates a policy view for the specified application context.
 
Method Summary
 boolean canClose()
          Prompts the view to save unsaved changes before closing.
 boolean canEditPart(org.openpermis.policy.bean.PartBean part)
          Tests if the part specified can be edited.
 boolean canReplacePolicyPresenter()
          Check if the current policy presenter can be replaces.
 org.jdesktop.application.FrameView configure(org.jdesktop.application.FrameView frameView)
          Configures the specified frame view for displaying this view.
 Editor createEditor(org.openpermis.policy.bean.PartBean part)
          Creates an editor suitable for embedding in another view.
 void customizeMenu(String placeholder, MenuBarFactory.Customizer customizer)
          Called once a placeholder is read to resolve its customization.
 void customizeToolBar(String placeholder, ToolBarFactory.Customizer customizer)
          Called once a placeholder is read to resolve its customization.
 Editor editPart(org.openpermis.policy.bean.PartBean part)
          Opens an editor for the specified part.
 void editRedo()
          Redo one action.
 void editUndo()
          Undo one action.
 void fileClose()
          Closes the currently edited policy.
 void fileNew()
          Creates a new policy.
 void fileOpen()
          Opens an existing policy.
 void fileQuit()
          Quits the policy editor.
 void fileSave()
          Saves the policy editor.
 void fileSaveAs()
          Saves the policy editor.
protected  String getLocation(View view)
          Retrieves the location specification for a view.
 void redoChanged(CommandManager commandManager, String property, boolean oldValue, boolean newValue)
          Called if the command manager changes.
protected  void refresh(org.openpermis.policy.bean.PolicyBean policy, PolicyContext context)
          Notifies all registered tools that the policy and the dispatcher have changed.
 void setPolicyPresenter(PolicyPresenter policyPresenter)
          Sets the policy presenter of this holder.
 void showStatusError(String message)
          Shows an error message.
 void undoChanged(CommandManager commandManager, String property, boolean oldValue, boolean newValue)
          Called if the command manager changes.
 
Methods inherited from class org.openpermis.editor.policy.view.ContextView
activateEditor, addViewContextListener, closeView, createContentPane, getEditorViews, openView, removeViewContextListener, updateViewTitle, viewActivated, viewClosed, viewDeactivated, viewOpened
 
Methods inherited from class org.openpermis.editor.policy.view.AbstractView
attach, contentPaneCreated, createFormBuilder, createTranslationConverter, detach, getAction, getActionMap, getAdapteeTrader, getApplicationContext, getContentPane, getControlFactory, getDefaultFocusComponent, getIcon, getParentView, getResourceMap, getTitle, getTitleParameters, getViewContext, isEmbedded, setEnabled, setParentView, updateTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyView

public PolicyView(Application application,
                  Adapter trader,
                  org.jdesktop.swingx.JXFrame frame,
                  Configuration configuration)
Creates a policy view for the specified application context.

Parameters:
application - the application that this policy view belongs to.
trader - the adaptee trader of this view class.
frame - the frame to attach this policy view to.
configuration - the configuration this view operates on.
Since:
0.1.0
Method Detail

editRedo

@Action
public void editRedo()
Redo one action.

Since:
0.1.0

editUndo

@Action
public void editUndo()
Undo one action.

Since:
0.1.0

fileClose

@Action
public void fileClose()
Closes the currently edited policy.

Since:
0.1.0

fileNew

@Action
public void fileNew()
Creates a new policy.

Since:
0.1.0

fileOpen

@Action
public void fileOpen()
Opens an existing policy.

Since:
0.1.0

fileSave

@Action
public void fileSave()
Saves the policy editor.

Since:
0.1.0

fileSaveAs

@Action
public void fileSaveAs()
Saves the policy editor.

Since:
0.1.0

fileQuit

@Action
public void fileQuit()
Quits the policy editor.

Since:
0.1.0

getLocation

protected String getLocation(View view)
Description copied from class: ContextView
Retrieves the location specification for a view.

Specified by:
getLocation in class ContextView
Parameters:
view - the view for which to determine its placement.
Returns:
the location requested or null if unknown.
Since:
0.9.0

createEditor

public Editor createEditor(org.openpermis.policy.bean.PartBean part)
Description copied from interface: ViewContext
Creates an editor suitable for embedding in another view.

Specified by:
createEditor in interface ViewContext
Specified by:
createEditor in class ContextView
Parameters:
part - the part to edit.
Returns:
the editor created.
Since:
0.9.0

editPart

public 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
Specified by:
editPart in class ContextView
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 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
Specified by:
canEditPart in class ContextView
Parameters:
part - the part to test.
Returns:
true if the part can be edited, false otherwise.
Since:
0.3.0

refresh

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

In contrast to the superclass version this method will update the tools regardless if they are showing or not.

Overrides:
refresh in class ContextView
Parameters:
policy - the new policy that is active.
context - the policy context to use.
Since:
0.3.0

showStatusError

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

Specified by:
showStatusError in interface ErrorReporter
Overrides:
showStatusError in class AbstractView
Parameters:
message - the message to display.
Since:
0.1.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
Overrides:
canClose in class AbstractView
Returns:
true if the view may be closed, false otherwise.
Since:
0.1.0

canReplacePolicyPresenter

public boolean canReplacePolicyPresenter()
Description copied from interface: PolicyHolder
Check if the current policy presenter can be replaces.

Calling this method may trigger a save warning. Use it to determine if the presenter may be set prior to letting the user make choices about the policy to be loaded.

Specified by:
canReplacePolicyPresenter in interface PolicyHolder
Returns:
true if the current policy presenter may be replaced, false otherwise.
Since:
0.9.0

setPolicyPresenter

public void setPolicyPresenter(PolicyPresenter policyPresenter)
Description copied from interface: PolicyHolder
Sets the policy presenter of this holder.

Specified by:
setPolicyPresenter in interface PolicyHolder
Parameters:
policyPresenter - the presenter to set, null to discard the active presenter.
Since:
0.1.0

undoChanged

public void undoChanged(CommandManager commandManager,
                        String property,
                        boolean oldValue,
                        boolean newValue)
Called if the command manager changes.

Since:
0.1.0

redoChanged

public void redoChanged(CommandManager commandManager,
                        String property,
                        boolean oldValue,
                        boolean newValue)
Called if the command manager changes.

Since:
0.1.0

customizeMenu

public void customizeMenu(String placeholder,
                          MenuBarFactory.Customizer customizer)
Description copied from interface: MenuBarFactory.Resolver
Called once a placeholder is read to resolve its customization.

Specified by:
customizeMenu in interface MenuBarFactory.Resolver
Parameters:
placeholder - the placeholder key to resolve.
customizer - the customizer to use for adding custom menu entries.
Since:
0.9.0

customizeToolBar

public void customizeToolBar(String placeholder,
                             ToolBarFactory.Customizer customizer)
Description copied from interface: ToolBarFactory.Resolver
Called once a placeholder is read to resolve its customization.

Specified by:
customizeToolBar in interface ToolBarFactory.Resolver
Parameters:
placeholder - the placeholder key to resolve.
customizer - the customizer to use for adding custom tool bar entries.
Since:
0.9.0

configure

public org.jdesktop.application.FrameView configure(org.jdesktop.application.FrameView frameView)
Description copied from interface: ApplicationView
Configures the specified frame view for displaying this view.

Specified by:
configure in interface ApplicationView
Parameters:
frameView - the frame view to configure.
Returns:
the frame view passed in to allow fluent style usage.
Since:
0.9.0


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