public abstract class WindowManager extends Object implements Serializable
Mode
s, TopComponentGroup
s
and provides handling of operations provided over TopComponent
s.
Important note: Do not provide implementation of this abstract class unless you are window system provider!
Modifier and Type | Class and Description |
---|---|
protected static interface |
WindowManager.Component
Deprecated.
Do not use anymore. This interface is replaced by bunch of protected methods
which name starts with topComponent prefix, i.e.
WindowManager.topComponentOpen(org.openide.windows.TopComponent) , WindowManager.topComponentClose(org.openide.windows.TopComponent) etc. |
Modifier and Type | Field and Description |
---|---|
static String |
PROP_CURRENT_WORKSPACE
Deprecated.
Do not use. Workspaces are not supported anymore.
|
static String |
PROP_MODES
Name of property for modes in the workspace.
|
static String |
PROP_WORKSPACES
Deprecated.
Do not use. Workspaces are not supported anymore.
|
Constructor and Description |
---|
WindowManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
activateComponent(TopComponent tc)
Activate a component.
|
abstract void |
addPropertyChangeListener(PropertyChangeListener l)
Attaches a listener for changes in workspaces.
|
void |
addWindowSystemListener(WindowSystemListener listener)
Register window system listener to receive notifications when the window
system loads or saves.
|
protected void |
componentCloseNotify(TopComponent tc)
Notifies component that it was closed (and is not opened on any
workspace anymore).
|
protected void |
componentHidden(TopComponent tc)
Notifies
TopComponent it was hidden. |
protected void |
componentOpenNotify(TopComponent tc)
Notifies component that it was opened (and wasn't opened on any
workspace before).
|
protected TopComponent.Registry |
componentRegistry()
Access method for registry of all components in the system.
|
protected void |
componentShowing(TopComponent tc)
Notifies
TopComponent it is about to be shown. |
Mode |
createModeFromXml(String xml)
Given some XML, attempts to create a Mode that can
subsequently be used to dock a TopComponent into.
|
protected abstract WindowManager.Component |
createTopComponentManager(TopComponent c)
Create a component manager for the given top component.
|
Workspace |
createWorkspace(String name)
Deprecated.
Do not use. Workspaces are not supported anymore.
|
abstract Workspace |
createWorkspace(String name,
String displayName)
Deprecated.
Do not use. Workspaces are not supported anymore.
|
protected static WindowManager.Component |
findComponentManager(TopComponent tc)
Deprecated.
Do not use anymore.
See
WindowManager.Component deprecation. |
abstract Mode |
findMode(String name)
Finds mode of specified name.
|
abstract Mode |
findMode(TopComponent tc)
Finds mode which contains specified
TopComponent . |
abstract TopComponent |
findTopComponent(String tcID)
Returns
TopComponent for given unique ID. |
abstract TopComponentGroup |
findTopComponentGroup(String name)
Finds
TopComponentGroup of given name. |
String |
findTopComponentID(TopComponent tc)
Returns unique ID for specified
TopComponent . |
abstract Workspace |
findWorkspace(String name)
Deprecated.
Do not use. Workspaces are not supported anymore.
|
abstract Workspace |
getCurrentWorkspace()
Deprecated.
Do not use. Workspaces are not supported anymore.
|
static WindowManager |
getDefault()
Singleton instance accessor method for window manager.
|
abstract Frame |
getMainWindow()
Gets the NetBeans Main Window.
|
abstract Set<? extends Mode> |
getModes()
Gets set of all
Mode S added into window system. |
TopComponent[] |
getOpenedTopComponents(Mode mode)
Convenience method to retrieve the list of all opened TopComponents for
given mode.
|
TopComponent.Registry |
getRegistry()
Getter for component registry.
|
String |
getRole() |
abstract Workspace[] |
getWorkspaces()
Deprecated.
Do not use. Workspaces are not supported anymore.
|
void |
invokeWhenUIReady(Runnable run)
Provides support for executing a piece of code when UI of the window
system is ready.
|
boolean |
isEditorMode(Mode mode)
Check whether the given Mode holds editor windows.
|
boolean |
isEditorTopComponent(TopComponent tc)
Check whether the given TopComponent will be/is docked into an 'editor' Mode.
|
boolean |
isOpenedEditorTopComponent(TopComponent tc)
Check whether the given TopComponent is opened and docked into an 'editor' Mode.
|
boolean |
isTopComponentFloating(TopComponent tc)
Checks the floating status of given TopComponent.
|
boolean |
isTopComponentMinimized(TopComponent tc)
Checks the minimized status of given TopComponent.
|
boolean |
removeMode(Mode mode)
Before restoring a whole bunch of Modes (for example with XML that has been
previously saved somewhere and now loaded), it is useful to remove the
anonymous modes from the system.
|
abstract void |
removePropertyChangeListener(PropertyChangeListener l)
Removes a listener for changes in workspaces.
|
void |
removeWindowSystemListener(WindowSystemListener listener)
Remove window system listener.
|
void |
setRole(String roleName)
Switches the window system to a new role (perspective).
|
void |
setTopComponentFloating(TopComponent tc,
boolean floating)
Floats the given TopComponent or docks it back to the main window.
|
void |
setTopComponentMinimized(TopComponent tc,
boolean minimize)
Minimizes the given TopComponent.
|
abstract void |
setWorkspaces(Workspace[] workspaces)
Deprecated.
Do not use. Workspaces are not supported anymore.
|
protected abstract void |
topComponentActivatedNodesChanged(TopComponent tc,
Node[] activatedNodes)
Informs about change of activated nodes of specified
TopComponent . |
protected void |
topComponentAttentionHighlight(TopComponent tc,
boolean highlight)
Highlights the tab of the given TopComponent until user activates it.
|
protected void |
topComponentCancelRequestAttention(TopComponent tc)
Stop this TopComponent's tab from flashing if it is flashing.
|
protected abstract void |
topComponentClose(TopComponent tc)
Provides closing of specified
TopComponent . |
protected abstract Action[] |
topComponentDefaultActions(TopComponent tc)
Gets default list of actions which appear in popup menu of TopComponent.
|
protected abstract void |
topComponentDisplayNameChanged(TopComponent tc,
String displayName)
Informs about change of display name of specified
TopComponent . |
protected int |
topComponentGetTabPosition(TopComponent tc)
Gives position index of given TopComponent in the mode.
|
protected abstract void |
topComponentHtmlDisplayNameChanged(TopComponent tc,
String htmlDisplayName)
Informs about change of html display name of specified
TopComponent . |
protected abstract void |
topComponentIconChanged(TopComponent tc,
Image icon)
Informs about chagne of icon of specified
TopComponent . |
protected abstract String |
topComponentID(TopComponent tc,
String preferredID)
Returns unique ID for specified
TopComponent . |
protected abstract boolean |
topComponentIsOpened(TopComponent tc)
Indicates whether specified
TopComponent is opened. |
protected void |
topComponentMakeBusy(TopComponent tc,
boolean busy)
Notifies the user that some process is running in the given TopComponent,
for example by drawing an animated "wait" icon in TopComponent's header.
The default implementation does nothing. |
protected abstract void |
topComponentOpen(TopComponent tc)
Provides opening of specified
TopComponent . |
protected void |
topComponentOpenAtTabPosition(TopComponent tc,
int position)
Opens given TopComponent at given position in the mode.
|
protected abstract void |
topComponentRequestActive(TopComponent tc)
Provides activation of specified
TopComponent . |
protected void |
topComponentRequestAttention(TopComponent tc)
Cause this TopComponent's tab to flash or otherwise draw the users' attention
to it.
|
protected abstract void |
topComponentRequestVisible(TopComponent tc)
Provides selection of specfied
TopComponent . |
protected void |
topComponentToFront(TopComponent tc)
Attempts to bring the parent
Window of the given TopComponent
to front of other windows. |
protected abstract void |
topComponentToolTipChanged(TopComponent tc,
String toolTip)
Informs about change of tooltip of specified
TopComponent . |
boolean |
updateModeConstraintsFromXml(String xml)
Before restoring anonymous Modes, it is useful to update whatever defined Modes
may exist like editor, explorer etc., so that all the Modes will eventually
re-appear in the desired locations.
|
abstract void |
updateUI()
Called after a Look&Feel change to update the NetBeans UI.
|
@Deprecated public static final String PROP_WORKSPACES
@Deprecated public static final String PROP_CURRENT_WORKSPACE
public static final String PROP_MODES
public static final WindowManager getDefault()
public abstract Mode findMode(String name)
Mode
whith the specified name is or null
if there does not exist such Mode
inside window system.public abstract Mode findMode(TopComponent tc)
TopComponent
.Mode
which contains specified TopComponent
or null
if the TopComponent
is not added into any Mode
inside window system.public abstract Set<? extends Mode> getModes()
Mode
S added into window system.public abstract Frame getMainWindow()
public abstract void updateUI()
JComponent.updateUI()
on all opened windows.protected abstract WindowManager.Component createTopComponentManager(TopComponent c)
c
- the componentprotected TopComponent.Registry componentRegistry()
public TopComponent.Registry getRegistry()
@Deprecated public final Workspace createWorkspace(String name)
name
- the name of the workspace@Deprecated public abstract Workspace createWorkspace(String name, String displayName)
WindowManager.setWorkspaces(org.openide.windows.Workspace[])
is called
with an array containing the new workspace.name
- the code name (used for internal purposes)displayName
- the display name@Deprecated public abstract Workspace findWorkspace(String name)
name
- the (code) name of workspace to find@Deprecated public abstract Workspace[] getWorkspaces()
@Deprecated public abstract void setWorkspaces(Workspace[] workspaces)
WindowManager.getWorkspaces()
, this may be used to reorder
workspaces, or add or remove workspaces.workspaces
- An array consisting of new workspaces.@Deprecated public abstract Workspace getCurrentWorkspace()
Workspace.activate()
public abstract TopComponentGroup findTopComponentGroup(String name)
TopComponentGroup
of given name.public abstract void addPropertyChangeListener(PropertyChangeListener l)
l
- the new listenerpublic abstract void removePropertyChangeListener(PropertyChangeListener l)
l
- the listener to remove@Deprecated protected static final WindowManager.Component findComponentManager(TopComponent tc)
WindowManager.Component
deprecation.tc
- top component to find manager for.protected void activateComponent(TopComponent tc)
tc
- the top component to activate;
or null
to deactivate all top componentsprotected void componentOpenNotify(TopComponent tc)
tc
- the top component to be notifiedprotected void componentCloseNotify(TopComponent tc)
tc
- the top component to be notifiedprotected void componentShowing(TopComponent tc)
TopComponent
it is about to be shown.tc
- TopComponent
to be notifiedTopComponent.componentShowing()
protected void componentHidden(TopComponent tc)
TopComponent
it was hidden.tc
- TopComponent
to be notifiedTopComponent.componentHidden()
protected abstract void topComponentOpen(TopComponent tc)
TopComponent
.tc
- TopComponent
to openprotected void topComponentOpenAtTabPosition(TopComponent tc, int position)
tc
- TopComponent which is opened.position
- Index of the requested position.protected int topComponentGetTabPosition(TopComponent tc)
tc
- TopComponent for which position is returned.protected abstract void topComponentClose(TopComponent tc)
TopComponent
.tc
- TopComponent
to closeprotected abstract void topComponentRequestActive(TopComponent tc)
TopComponent
.tc
- TopComponent
to activateprotected abstract void topComponentRequestVisible(TopComponent tc)
TopComponent
.tc
- TopComponent
to set visible (select)protected abstract void topComponentDisplayNameChanged(TopComponent tc, String displayName)
TopComponent
.tc
- TopComponent
which display name has changeddisplayName
- newly changed display name valueprotected abstract void topComponentHtmlDisplayNameChanged(TopComponent tc, String htmlDisplayName)
TopComponent
.tc
- TopComponent
which display name has changedhtmlDisplayName
- newly changed html display name valueprotected abstract void topComponentToolTipChanged(TopComponent tc, String toolTip)
TopComponent
.tc
- TopComponent
which tooltip has changedtoolTip
- newly changed tooltip valueprotected abstract void topComponentIconChanged(TopComponent tc, Image icon)
TopComponent
.tc
- TopComponent
which icon has changedicon
- newly chaned icon valueprotected abstract void topComponentActivatedNodesChanged(TopComponent tc, Node[] activatedNodes)
TopComponent
.tc
- TopComponent
which activated nodes has chagnedactivatedNodes
- newly chaged activated nodes valueprotected abstract boolean topComponentIsOpened(TopComponent tc)
TopComponent
is opened.tc
- specified TopComponent
protected abstract Action[] topComponentDefaultActions(TopComponent tc)
tc
- TopComponent
for which the default actions to provideprotected abstract String topComponentID(TopComponent tc, String preferredID)
TopComponent
.tc
- TopComponent
the component for which is ID returnedpreferredID
- first approximation used for IDTopComponent
IDprotected void topComponentRequestAttention(TopComponent tc)
tc
- A TopComponentprotected void topComponentMakeBusy(TopComponent tc, boolean busy)
tc
- busy
- True to start 'busy' notification, false to stop it.protected void topComponentToFront(TopComponent tc)
Window
of the given TopComponent
to front of other windows.Window.toFront()
protected void topComponentCancelRequestAttention(TopComponent tc)
tc
- A TopComponentprotected void topComponentAttentionHighlight(TopComponent tc, boolean highlight)
tc
- highlight
- True to highlight the tab, false to switch the highlight off.public String findTopComponentID(TopComponent tc)
TopComponent
.tc
- TopComponent
the component for which is ID returnedTopComponent
IDpublic abstract TopComponent findTopComponent(String tcID)
TopComponent
for given unique ID.tcID
- unique TopComponent
IDTopComponent
instance corresponding to unique IDpublic void invokeWhenUIReady(Runnable run)
EventQueue.invokeLater(java.lang.Runnable)
moreover it is guaranteed that only one Runnable runs at given time.
This method can be invoked from any thread.
The typical usecase is to call this method during startup of NetBeans based application. The default manager then waits till the main window is opened and then executes all the registered methods one by one.
Usage:// some initialization method public static void init () { WindowManager.getDefault().invokeWhenUIReady(new Runnable() { public void run() { // code to be invoked when system UI is ready } ); }Note to WindowManager providers: This method is not abstract for backward compatibility reasons, please override and provide implementation.
run
- the runnable that executes piece of code when UI of the system is readypublic boolean isEditorTopComponent(TopComponent tc)
Check whether the given TopComponent will be/is docked into an 'editor' Mode.
Please note that some TopComponents may be docked into 'editor' modes as well as 'view' modes, see method isTopComponentAllowedToMoveAnywhere().
tc
- TopComponent to check.public boolean isOpenedEditorTopComponent(TopComponent tc)
Check whether the given TopComponent is opened and docked into an 'editor' Mode. It is safe to call this method outside the event dispatch thread.
Please note that some TopComponents may be docked into 'editor' modes as well as 'view' modes, see method isTopComponentAllowedToMoveAnywhere().
tc
- TopComponent to check.public TopComponent[] getOpenedTopComponents(Mode mode)
mode
- Mode to get the list of TopComponents from.public boolean isEditorMode(Mode mode)
Check whether the given Mode holds editor windows.
Please note that some TopComponents may be docked into 'editor' modes as well as 'view' modes, see method isTopComponentAllowedToMoveAnywhere().
mode
- Mode to check.public void addWindowSystemListener(WindowSystemListener listener)
public void removeWindowSystemListener(WindowSystemListener listener)
public void setRole(String roleName)
Switches the window system to a new role (perspective).
A role may customize the default window layout by adding/removing TopComponents,
changing window positions and/or sizes etc. Roles are defined in XML
layers in folder Window2/Roles
. Each role has a unique name corresponding
to a sub-folder in Window2/Roles
. The content of a role sub-folder has
the same syntax and meaning as the default window layout in Windows2
folder.
The content of role sub-folder is merged with the defaults in Windows2 folder
when the window system loads. User's changes to the window layout are persisted
per role. So user's customizations in role A are not propagated to
role B and vice versa.
The default implementation of this method in core.windows module does the following:
Windows that were opened in previous role but are not opened or present
in the new role will receive TopComponent.componentClosed()
notification.
Note: To keep the main window showing while switching the role, use the following branding:
org.netbeans.core.windows.WinSys.Show.Hide.MainWindow.While.Switching.Role=false
Note: Action org.netbeans.core.windows.actions.SwitchRoleKeepDocumentsAction
in Actions/Window
layer folder can change the role too but it
also attempts to keep documents from previous role opened in the new role as well.
The new role name is ActionEvent.getActionCommand()
argument.
If the window system has been already loaded then the method must be
called from EDT thread, otherwise it's safe to set the initial startup
role in e.g. ModuleInstall.restored()
method.
roleName
- Name of the new role to switch to or null to switch
to the default window layout.WindowManager.getRole()
public boolean isTopComponentMinimized(TopComponent tc)
tc
- public void setTopComponentMinimized(TopComponent tc, boolean minimize)
tc
- minimize
- True to minimize (slide-out) given TopComponent, false
to pin it back to the main window.public boolean isTopComponentFloating(TopComponent tc)
public void setTopComponentFloating(TopComponent tc, boolean floating)
tc
- floating
- True to separate the given TopComponent from the main window,
false to dock it back to the main window.public String getRole()
WindowManager.setRole(java.lang.String)
public Mode createModeFromXml(String xml)
xml
- ModeConfig XML that was originally produced by ModeUtilities.toXml(org.openide.windows.Mode)
ModeUtilities
public boolean removeMode(Mode mode)
public boolean updateModeConstraintsFromXml(String xml)
xml
- ModeConfig XML that was originally produced by ModeUtilities.toXml(org.openide.windows.Mode)
ModeUtilities