org.openpermis.editor.policy.gui.dock
Class DockControl

java.lang.Object
  extended by org.openpermis.editor.policy.gui.dock.DockControl

public class DockControl
extends Object

Control that manages all dockables and the swing components of the main frame.

Since:
0.1.0

Nested Class Summary
private  class DockControl.ViewMonitor<T extends bibliothek.gui.dock.common.intern.DefaultCDockable>
          Monitor for views and dockables.
 
Field Summary
private  bibliothek.gui.dock.common.CControl control
          The common control of the docking framework wrapped by this class.
private  Map<Editor,DockControl.ViewMonitor<EditorDockable>> editors
          The editors managed by this control.
private  EventSupport<DockControlListener> eventSupport
          The event support of this dock control.
private  EditorFactory factory
          Factory used to create new editor dockables.
private  Map<Tool,DockControl.ViewMonitor<ToolDockable>> tools
          The tools managed by this control.
private static String WORKING_AREA
          Unique string identifier for the working area.
private  bibliothek.gui.dock.common.CWorkingArea workingArea
          The working area used by this dock control.
 
Constructor Summary
DockControl(JFrame frame)
          Creates a new dock control for the specified owner frame.
 
Method Summary
 void addDockControlListener(DockControlListener listener)
          Adds a listener for dock control events.
private  boolean closeEditorView(Editor view, boolean force)
          Removes the dockable responsible for the view specified.
private  boolean closeToolView(Tool view, boolean force)
          Removes the dockable responsible for the view specified.
 boolean closeView(View view, boolean force)
          Removes the dockable responsible for the view specified.
private  bibliothek.gui.dock.common.CControl createControl(JFrame frame)
          Creates a new control that is used internally to manage dockables.
private  EditorFactory createFactory()
          Creates the factory used to create new editor dockables.
private  bibliothek.gui.dock.common.CWorkingArea createWorkingArea(bibliothek.gui.dock.common.CControl ccontrol, EditorFactory editorFactory)
          Creates a new working area at the specified control for the given factory.
private  void fireViewActivated(View view)
          Fires an event that the specified view has been activated.
private  void fireViewClosed(View view)
          Fires an event that the specified view has been closed.
private  void fireViewDeactivated(View view)
          Fires an event that the specified view has been deactivated.
private  void fireViewOpened(View view)
          Fires an event that the specified view has been opened.
 JComponent getContentArea()
          Returns the content area of this dock control.
 Set<Editor> getEditorViews()
          Returns a set of all editor views currently attached to this dock control.
 Set<Tool> getToolViews()
          Returns a set of all tool views currently attached to this dock control.
 Set<View> getViews()
          Returns all view currently attached to this dock control.
 boolean isViewOpen(View view)
          Checks if a view is open.
private  void openEditorView(Editor view)
          Creates a new editor dockable for the specified view and displays the view in the center of the working area.
private  void openToolView(Tool view)
          Creates a new tool dockable for the specified view and displays the view at the given location.
 void openView(View view)
          Creates a dockable of appropriate type for the specified view and displays it.
 void removeDockControlListener(DockControlListener listener)
          Removes a listener from this dock control.
 void updateViewTitle(View view)
          Updates the title of the dockable this view is attached to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORKING_AREA

private static final String WORKING_AREA
Unique string identifier for the working area.

Constant Field Value:
"WorkingArea"
See Also:
CWorkingArea, Constant Field Values
Since:
0.1.0

control

private final bibliothek.gui.dock.common.CControl control
The common control of the docking framework wrapped by this class.

Since:
0.1.0

factory

private final EditorFactory factory
Factory used to create new editor dockables.

Since:
0.1.0

workingArea

private final bibliothek.gui.dock.common.CWorkingArea workingArea
The working area used by this dock control.

Since:
0.1.0

eventSupport

private final EventSupport<DockControlListener> eventSupport
The event support of this dock control.

Since:
0.1.0

editors

private final Map<Editor,DockControl.ViewMonitor<EditorDockable>> editors
The editors managed by this control.

Since:
0.1.0

tools

private final Map<Tool,DockControl.ViewMonitor<ToolDockable>> tools
The tools managed by this control.

Since:
0.1.0
Constructor Detail

DockControl

public DockControl(JFrame frame)
Creates a new dock control for the specified owner frame.

Parameters:
frame - the frame used as owner for externally opened views.
Since:
0.1.0
Method Detail

addDockControlListener

public void addDockControlListener(DockControlListener listener)
Adds a listener for dock control 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.

Parameters:
listener - the listener to add, may be null.
Since:
0.1.0

removeDockControlListener

public void removeDockControlListener(DockControlListener listener)
Removes a listener from this dock control.

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.

Parameters:
listener - the listener to be removed, may be null.

fireViewOpened

private void fireViewOpened(View view)
Fires an event that the specified view has been opened.

Parameters:
view - the view that has been opened.
Since:
0.1.0

fireViewClosed

private void fireViewClosed(View view)
Fires an event that the specified view has been closed.

Parameters:
view - the view that has been closed.
Since:
0.1.0

fireViewActivated

private void fireViewActivated(View view)
Fires an event that the specified view has been activated.

Parameters:
view - the view that has been activated.
Since:
0.1.0

fireViewDeactivated

private void fireViewDeactivated(View view)
Fires an event that the specified view has been deactivated.

Parameters:
view - the view that has been deactivated.
Since:
0.1.0

createFactory

private EditorFactory createFactory()
Creates the factory used to create new editor dockables.

Returns:
the factory requested.
Since:
0.1.0

createControl

private bibliothek.gui.dock.common.CControl createControl(JFrame frame)
Creates a new control that is used internally to manage dockables.

Parameters:
frame - the frame used as owner for externally opened views.
Returns:
the control requested.
Since:
0.1.0

createWorkingArea

private bibliothek.gui.dock.common.CWorkingArea createWorkingArea(bibliothek.gui.dock.common.CControl ccontrol,
                                                                  EditorFactory editorFactory)
Creates a new working area at the specified control for the given factory.

Parameters:
ccontrol - the control at which to create the working area.
editorFactory - the editor factory to use.
Returns:
the working area requested.
Since:
0.1.0

getContentArea

public JComponent getContentArea()
Returns the content area of this dock control.

The content area contains all tool and editor dockables and serves as the main content of the editor window.

Returns:
the content area requested.
Since:
0.1.0

updateViewTitle

public void updateViewTitle(View view)
Updates the title of the dockable this view is attached to.

Parameters:
view - the view for which to update the title.
Since:
0.1.0

openView

public void openView(View view)
Creates a dockable of appropriate type for the specified view and displays it.

If the view is already open it is activated.

Supports Tool and Editor views.

Parameters:
view - the view to display.
Throws:
IllegalArgumentException - if the view type is not supported.
Since:
0.1.0

openEditorView

private void openEditorView(Editor view)
Creates a new editor dockable for the specified view and displays the view in the center of the working area.

Parameters:
view - the view for which to create the editor dockable.
Since:
0.1.0

openToolView

private void openToolView(Tool view)
Creates a new tool dockable for the specified view and displays the view at the given location.

Parameters:
view - the view to display as a tool dockable.
Since:
0.1.0

getViews

public Set<View> getViews()
Returns all view currently attached to this dock control.

Returns:
the set of views requested, never null.
Since:
0.1.0

isViewOpen

public boolean isViewOpen(View view)
Checks if a view is open.

Parameters:
view - the view to check.
Returns:
true if the view is open.
Since:
0.1.0

getToolViews

public Set<Tool> getToolViews()
Returns a set of all tool views currently attached to this dock control.

Returns:
the set requested, never null.
Since:
0.1.0

getEditorViews

public Set<Editor> getEditorViews()
Returns a set of all editor views currently attached to this dock control.

Returns:
the set requested, never null.
Since:
0.1.0

closeView

public boolean closeView(View view,
                         boolean force)
Removes the dockable responsible for the view specified.

Parameters:
view - the view to remove.
force - true to force closing the view.
Returns:
true if the dockable was removed.
Since:
0.1.0

closeEditorView

private boolean closeEditorView(Editor view,
                                boolean force)
Removes the dockable responsible for the view specified.

Parameters:
view - the view to remove.
force - true to force closing the view.
Returns:
true if the dockable was removed.
Since:
0.1.0

closeToolView

private boolean closeToolView(Tool view,
                              boolean force)
Removes the dockable responsible for the view specified.

Parameters:
view - the view to remove.
force - true to force closing the view.
Returns:
true if the dockable was removed.
Since:
0.1.0


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