This interface is the main entry point to manage MyDoggy. Using this interface
the user can register/unregister toolwindows, groups and so on.
Furthermore, the user can obtain the content manager and type descriptor templates.
ToolWindowManagerDescriptor
This interface is used to modify the behaviours of the ToolWindowManager.
You can now change the push-away mode of toolwindows and set corner components.
See Using page for how to.
A Tool Window is a secondary window used to organize the user interface.
To register a tool window use the following: ToolWindowManager toolWindowManager = new...; ToolWindow toolwindow = toolWindowManager.registerToolWindow( "Debug", // Tool Window identifier "Debugging", // Tool Window Title icon, // Tool Window Icon component, // Tool Window Component ToolWindowAnchor.LEFT // Tool Window Anchor ) When you register a toolwindow you obtain an instance of the ToolWindow interface. This interface is the main entry point to modify toolwindow's properties. Moreover there are methods to make the tool available, visible and active. |
Every toolwindow can be considered as a special JTabbedPane and so it can contain more than one
component.
Every tab is described by a title, an icon and a component. A tab can be selected or not.
The above image shows two tabs for the same toolwindow. The first one is declared when the tool
is registered, for the second one use the following:
ToolWindowTab profilingTab = toolwindow.addToolWindowTab( "Profiling", // Tab Title profilingCmp, // Tab Component )
Also, the user can add a toolwindow to another tool as a tab. Use the following
ToolWindowTab profilingTab = toolwindow.addToolWindowTab(profilingToolWindow)
A toolwindow can be shown in several ways depending on the toolwindow type set. Furthermore, using the ToolWindowTypeDescriptor interfaces it is possible to modify the behaviours of a specific toolwindow type. Let's describe the types provided by mydoggy.
When DOCKED type is used, the toolwindow shares frame space and fixes to a docking
area along one of the tool window bars (the one containing the corresponding representative
button).
To set
ToolWindowType.DOCKED
type use the following:
toolWindow.setType(ToolWindowType.DOCKED);
To get a DockedTypeDescriptor instance use the following:
DockedTypeDescriptor descriptor = toolWindow.getTypeDescriptor(DockedTypeDescriptor.class);
When SLIDING type is used, the tool window overlaps the main frame and/or other tool
windows.
When it loses focus, the tool window hides itself.
To set
ToolWindowType.SLIDING
type use the following:
toolWindow.setType(ToolWindowType.SLIDING);
To get a SlidingTypeDescriptor instance use the following:
SlidingTypeDescriptor descriptor = toolWindow.getTypeDescriptor(SlidingTypeDescriptor.class);
This type enables a tool window to be detached from the main window frame.
When Floating type is used, the tool window detaches to the position where it was last
floated
(or screen center or location used in toolwindow's
FloatingTypeDescriptor
, if never before floated)
To set
ToolWindowType.FLOATING
type use the following:
toolWindow.setType(ToolWindowType.FLOATING);
To get a FloatingTypeDescriptor instance use the following:
FloatingTypeDescriptor typeDescriptor = (FloatingTypeDescriptor) toolWindow.getTypeDescriptor(ToolWindowType.FLOATING);
toolWindow.setType(ToolWindowType.FLOATING_FREE);
toolWindow.setType(ToolWindowType.FLOATING_LIVE);
FloatingLiveTypeDescriptor typeDescriptor = (FloatingLiveTypeDescriptor) toolWindow.getTypeDescriptor(ToolWindowType.FLOATING_LIVE);
The idea is to provide the same mechanism of the prospectives from eclipse ide for toolwindows. The typical usage is to retrieve a group from the tool window manager and to add any toolwindows one wants. After that we can show or hide all tools registered in that group.
To obtain an instance of ToolWindowGroup interface use the following: ToolWindowManager toolWindowManager = new ...; ToolWindowGroup group = toolWindowManager .getToolWindowGroup( "main" // ToolWindowGroup name );
If the manager contains no mapping for name passed to the
getToolWindowGroup
method then
the manager create a new instance of ToolWindowGroup and associate the group created
with the specified name in the manager.
mainGroup.addToolWindow( toolWindowManager.getToolWindow(0) ); To show or hide a group use the following: mainGroup.setVisible( true // true to show, false to hide ); |
This interface provides useful methods to save and load the tool window manager's workspace. When you request to save the workspace, all settings of ToolWindows with relative descriptors are saved. To obtain an instance of PersistenceDelegate you have to invoke the method getPersistenceDelegate of ToolWindowManager interface. So you can obtain a persistence delegate specific to a particular tool window manager.
When you request to save the workspace, all settings of toolwindows, and not only, with relative descriptors are saved.
See the specific DTD, relative to the version of mydoggy that you are using, to know all information saved.
To obtain the instance of the PersistenceDelegate for a specific ToolWindowManager use the following:
PersistenceDelegate pstDelegate = twManager.getPersistenceDelegate();
MyDoggy arrives with a default implementation provided by
org.noos.xing.mydoggy.plaf.persistence.xml.XMLPersistenceDelegate
This implementation use the xml format to store all necessary data.