|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kiwi.ui.WorkspaceManager
This class represents a workspace manager. The manager controls a set of
WorkspaceEditor
s and their relationship to a
JDesktopPane
. Each WorkspaceEditor
is associated
with an arbitrary user object (the object that it is editing) and is
represented by a JInternalFrame
in the desktop. The manager's
duties include saving unsaved changes in editors when their windows are
closed and providing a high-level interface for retrieving information
about the editors in the desktop.
WorkspaceEditor
,
JDesktopPane
Constructor Summary | |
WorkspaceManager(JDesktopPane desktop)
Construct a new WorkspaceManager . |
Method Summary | |
void |
activateEditor(WorkspaceEditor editor)
Activate a specific editor. |
void |
addEditor(WorkspaceEditor editor)
Add an editor to the workspace. |
void |
addWorkspaceListener(WorkspaceListener listener)
Register a WorkspaceListener with this
WorkspaceManager . |
boolean |
areUnsavedEditors()
Determine if there are any editors in the workspace that have unsaved changes. |
boolean |
closeAllEditors()
Close all of the editors in the workspace. |
boolean |
closeEditor(WorkspaceEditor editor)
Close an editor. |
protected void |
fireEditorClosed(WorkspaceEditor editor)
Notify listeners that an editor has been closed in the workspace. |
protected void |
fireEditorDeselected(WorkspaceEditor editor)
Notify listeners that an editor has been deselected in the workspace. |
protected void |
fireEditorIconified(WorkspaceEditor editor)
Notify listeners that an editor has been minimized (iconified) in the workspace. |
protected void |
fireEditorRestored(WorkspaceEditor editor)
Notify listeners that an editor has been maximized in the workspace. |
protected void |
fireEditorSelected(WorkspaceEditor editor)
Notify listeners that an editor has been selected in the workspace. |
protected void |
fireEditorStateChanged(WorkspaceEditor editor)
Notify listeners that an editor's state has changed. |
WorkspaceEditor |
getActiveEditor()
Get the currently active editor. |
int |
getEditorCount()
Count the editors in the workspace. |
WorkspaceEditor |
getEditorForObject(Object object)
Get the editor for a specific object. |
JMenu |
getMenu(String name)
Get a reference to a JMenu associated with this
WorkspaceManager . |
void |
notifyStateChanged(WorkspaceEditor editor)
Notify the manager that an editor's state has changed. |
void |
registerMenu(String name,
JMenu menu)
Register a menu with this WorkspaceManager . |
void |
removeAllEditors()
Remove all editors from the workspace. |
void |
removeEditor(WorkspaceEditor editor)
Remove an editor from the workspace. |
void |
removeWorkspaceListener(WorkspaceListener listener)
Unregister a WorkspaceListener from this
WorkspaceManager . |
void |
unregisterMenu(String name)
Unregister a menu from this WorkspaceManager . |
void |
updateLookAndFeel()
Update the look and feel of all of the components being managed by this WorkspaceManager . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public WorkspaceManager(JDesktopPane desktop)
WorkspaceManager
.desktop
- The JDesktopPane
that is associated with this
workspace. This JDesktopPane
must have already been added to
the application's component hierarchy before this constructor is called.Method Detail |
public WorkspaceEditor getActiveEditor()
public void addEditor(WorkspaceEditor editor)
editor
- The WorkspaceEditor
to add to the workspace.removeEditor(kiwi.ui.WorkspaceEditor)
,
closeEditor(kiwi.ui.WorkspaceEditor)
public void activateEditor(WorkspaceEditor editor)
startEditing()
method.editor
- The editor to activate.WorkspaceEditor.startEditing()
public void removeEditor(WorkspaceEditor editor)
stopEditing()
method is
called before it is removed.editor
- The WorkspaceEditor
to remove from the
workspace.addEditor(kiwi.ui.WorkspaceEditor)
,
closeEditor(kiwi.ui.WorkspaceEditor)
,
removeAllEditors()
,
WorkspaceEditor.stopEditing()
public boolean areUnsavedEditors()
public WorkspaceEditor getEditorForObject(Object object)
Object.equals()
, not by comparing
references.object
- The object whose editor is desired.object
, or null if
there is no editor for this object in the workspace.Object.equals(java.lang.Object)
public void addWorkspaceListener(WorkspaceListener listener)
WorkspaceListener
with this
WorkspaceManager
. Listeners are notified about events
relating to the editors currently being managed by this manager.listener
- The listener to register.removeWorkspaceListener(kiwi.event.WorkspaceListener)
public void removeWorkspaceListener(WorkspaceListener listener)
WorkspaceListener
from this
WorkspaceManager
.listener
- The listener to unregister.addWorkspaceListener(kiwi.event.WorkspaceListener)
protected void fireEditorSelected(WorkspaceEditor editor)
editor
- The editor that was selected.protected void fireEditorDeselected(WorkspaceEditor editor)
editor
- The editor that was deselected.protected void fireEditorRestored(WorkspaceEditor editor)
editor
- The editor that was maximized.protected void fireEditorIconified(WorkspaceEditor editor)
editor
- The editor that was minimized.protected void fireEditorClosed(WorkspaceEditor editor)
editor
- The editor that was closed.protected void fireEditorStateChanged(WorkspaceEditor editor)
editor
- The editor whose state has changed.public int getEditorCount()
WorkspaceManager
).public boolean closeEditor(WorkspaceEditor editor)
stopEditing()
method is called before it is
closed.editor
- The editor to close.removeEditor(kiwi.ui.WorkspaceEditor)
,
closeAllEditors()
,
WorkspaceEditor.stopEditing()
public void removeAllEditors()
closeAllEditors()
public boolean closeAllEditors()
removeAllEditors()
public void notifyStateChanged(WorkspaceEditor editor)
WorkspaceEditor
uses this method to broadcast a change event
to all WorkspaceListener
s.editor
- The editor whose state has changed.public void updateLookAndFeel()
WorkspaceManager
.public void registerMenu(String name, JMenu menu)
WorkspaceManager
. This convenience
method provides a means for a WorkspaceEditor
to manipulate
one or more menus in an external menubar (such as the main application's
menubar).name
- A symbolic name for the menu.menu
- The JMenu
to register.unregisterMenu(java.lang.String)
,
getMenu(java.lang.String)
public void unregisterMenu(String name)
WorkspaceManager
.name
- The name of the menu to unregister.registerMenu(java.lang.String, javax.swing.JMenu)
public JMenu getMenu(String name)
JMenu
associated with this
WorkspaceManager
.name
- The name under which the menu was registered.JMenu
reference, or null if there is
no menu registered under the specified name.registerMenu(java.lang.String, javax.swing.JMenu)
,
unregisterMenu(java.lang.String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |