public abstract class DockableWindowManager
extends javax.swing.JPanel
Keeps track of all dockable windows for a single View, and provides an API for getting/showing/hiding them.
Each View
has an instance of this class.
dockables.xml:
Dockable window definitions are read from dockables.xml
files
contained inside plugin JARs. A dockable definition file has the following
form:
<?xml version="1.0"?> <!DOCTYPE DOCKABLES SYSTEM "dockables.dtd"> <DOCKABLES> <DOCKABLE NAME="dockableName" MOVABLE="TRUE|FALSE"> // Code to create the dockable </DOCKABLE> </DOCKABLES>
The MOVABLE attribute specifies the behavior when the docking position of
the dockable window is changed. If MOVABLE is TRUE, the existing instance of
the dockable window is moved to the new docking position, and if the dockable
window implements the DockableWindow interface (see DockableWindow
),
it is also notified about the change in docking position before it is moved.
If MOVABLE is FALSE, the BeanShell code is invoked to get the instance of
the dockable window to put in the new docking position. Typically, the
BeanShell code returns a new instance of the dockable window, and the state
of the existing instance is not preserved after the change. It is therefore
recommended to set MOVABLE to TRUE for all dockables in order to make them
preserve their state when they are moved. For backward compatibility reasons,
this attribute is set to FALSE by default.
More than one <DOCKABLE>
tag may be present. The code that
creates the dockable can reference any BeanShell built-in variable
(see BeanShell
), along with a variable
position
whose value is one of
FLOATING
, TOP
, LEFT
, BOTTOM
,
and RIGHT
.
The following properties must be defined for each dockable window:
dockableName.title
- the string to show on the dockable
button. dockableName.label
- The string to use for generating
menu items and action names. dockableName.longtitle
- (optional) the string to use
in the dockable's floating window title (when it is floating).
If not specified, the dockableName.title
property is used. dockableName
- opens the dockable window.dockableName-toggle
- toggles the dockable window's visibility.dockableName-float
- opens the dockable window in a new
floating window.label
property, the
rest have automatically-generated labels.
Implementation details:
When an instance of this class is initialized by the View
class, it
iterates through the list of registered dockable windows (from jEdit itself,
and any loaded plugins) and
examines options supplied by the user in the Global
Options dialog box. Any plugins designated for one of the
four docking positions are displayed.
To create an instance of a dockable window, the DockableWindowManager
finds and executes the BeanShell code extracted from the appropriate
dockables.xml
file. This code will typically consist of a call
to the constructor of the dockable window component. The result of the
BeanShell expression, typically a newly constructed component, is placed
in a window managed by this class.
View.getDockableWindowManager()
,
Serialized FormModifier and Type | Class and Description |
---|---|
static interface |
DockableWindowManager.DockingArea |
static class |
DockableWindowManager.DockingLayout
Objects of DockingLayout class describe which dockables are docked where,
which ones are floating, and their sizes/positions for saving/loading perspectives.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BOTTOM
Bottom position.
|
protected DockableWindowFactory |
factory |
static java.lang.String |
FLOATING
Floating position.
|
static java.lang.String |
LEFT
Left position.
|
static java.lang.String |
RIGHT
Right position.
|
static java.lang.String |
TOP
Top position.
|
protected View |
view |
protected java.util.Map<java.lang.String,javax.swing.JComponent> |
windows |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
DockableWindowManager(View view,
DockableWindowFactory instance,
View.ViewConfig config) |
Modifier and Type | Method and Description |
---|---|
void |
addDockableWindow(java.lang.String name)
Opens the specified dockable window.
|
protected void |
applyAlternateLayout(boolean alternateLayout) |
void |
applyDockingLayout(DockableWindowManager.DockingLayout docking) |
void |
close() |
abstract void |
closeCurrentArea() |
java.awt.event.KeyListener |
closeListener(java.lang.String dockableName)
The actionEvent "close-docking-area" by default only works on
dockable windows that have no special keyboard handling.
|
protected javax.swing.JComponent |
createDockable(java.lang.String name) |
abstract void |
disposeDockableWindow(java.lang.String name)
Completely dispose of a dockable - called when a plugin is
unloaded, to remove all references to the its dockables.
|
protected void |
dockableLoaded(java.lang.String dockableName,
java.lang.String position) |
void |
dockableTitleChanged(java.lang.String dockable,
java.lang.String newTitle) |
protected void |
dockingPositionChanged(java.lang.String dockableName,
java.lang.String oldPosition,
java.lang.String newPosition) |
abstract javax.swing.JComponent |
floatDockableWindow(java.lang.String name) |
protected void |
focusDockable(java.lang.String name) |
protected boolean |
getAlternateLayoutProp() |
abstract DockableWindowManager.DockingArea |
getBottomDockingArea() |
javax.swing.JComponent |
getDockable(java.lang.String name) |
protected java.lang.String |
getDockablePosition(java.lang.String name) |
java.lang.String |
getDockableTitle(java.lang.String name)
Returns the title of the specified dockable window.
|
javax.swing.JComponent |
getDockableWindow(java.lang.String name)
Returns the specified dockable window.
|
static java.lang.String |
getDockableWindowPluginName(java.lang.String name) |
abstract DockableWindowManager.DockingLayout |
getDockingLayout(View.ViewConfig config) |
abstract DockableWindowManager.DockingArea |
getLeftDockingArea() |
protected java.lang.String |
getLongTitlePropertyName(java.lang.String dockableName) |
static java.lang.String[] |
getRegisteredDockableWindows() |
abstract DockableWindowManager.DockingArea |
getRightDockingArea() |
abstract DockableWindowManager.DockingArea |
getTopDockingArea() |
View |
getView()
Returns this dockable window manager's view.
|
void |
handleDockableWindowUpdate(DockableWindowUpdate msg) |
void |
handlePluginUpdate(PluginUpdate pmsg) |
void |
handlePropertiesChanged(PropertiesChanged msg) |
abstract void |
hideDockableWindow(java.lang.String name) |
void |
init() |
abstract boolean |
isDockableWindowDocked(java.lang.String name) |
abstract boolean |
isDockableWindowVisible(java.lang.String name) |
java.lang.String |
longTitle(java.lang.String name) |
protected void |
propertiesChanged() |
void |
removeDockableWindow(java.lang.String name)
Hides the specified dockable window.
|
void |
setDockableTitle(java.lang.String dockable,
java.lang.String title)
Changes the .longtitle property of a dockable window, which corresponds to the
title shown when it is floating (not docked).
|
void |
setDockingLayout(DockableWindowManager.DockingLayout docking) |
abstract void |
setMainPanel(javax.swing.JPanel panel) |
java.lang.String |
shortTitle(java.lang.String name) |
abstract void |
showDockableWindow(java.lang.String name) |
void |
toggleDockableWindow(java.lang.String name)
Toggles the visibility of the specified dockable window.
|
void |
toggleDockAreas()
Hides all visible dock areas, or shows them again,
if the last time it was a hide.
|
boolean |
willToggleHide() |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String FLOATING
public static final java.lang.String TOP
public static final java.lang.String LEFT
public static final java.lang.String BOTTOM
public static final java.lang.String RIGHT
protected View view
protected DockableWindowFactory factory
protected java.util.Map<java.lang.String,javax.swing.JComponent> windows
public DockableWindowManager(View view, DockableWindowFactory instance, View.ViewConfig config)
public abstract void setMainPanel(javax.swing.JPanel panel)
public abstract void showDockableWindow(java.lang.String name)
public abstract void hideDockableWindow(java.lang.String name)
public abstract void disposeDockableWindow(java.lang.String name)
public abstract javax.swing.JComponent floatDockableWindow(java.lang.String name)
public abstract boolean isDockableWindowDocked(java.lang.String name)
public abstract boolean isDockableWindowVisible(java.lang.String name)
public abstract void closeCurrentArea()
public abstract DockableWindowManager.DockingLayout getDockingLayout(View.ViewConfig config)
public abstract DockableWindowManager.DockingArea getLeftDockingArea()
public abstract DockableWindowManager.DockingArea getRightDockingArea()
public abstract DockableWindowManager.DockingArea getTopDockingArea()
public abstract DockableWindowManager.DockingArea getBottomDockingArea()
public void init()
public void close()
public void applyDockingLayout(DockableWindowManager.DockingLayout docking)
public void addDockableWindow(java.lang.String name)
name
- The dockable window namepublic void removeDockableWindow(java.lang.String name)
name
- The dockable window namepublic void toggleDockableWindow(java.lang.String name)
name
- The dockable window namepublic javax.swing.JComponent getDockableWindow(java.lang.String name)
addDockableWindow(String)
first.name
- The name of the dockable windowpublic void toggleDockAreas()
public boolean willToggleHide()
public void dockableTitleChanged(java.lang.String dockable, java.lang.String newTitle)
public java.awt.event.KeyListener closeListener(java.lang.String dockableName)
dockableName
- the name of your dockablepublic View getView()
public javax.swing.JComponent getDockable(java.lang.String name)
public java.lang.String getDockableTitle(java.lang.String name)
name
- The name of the dockable window.public void setDockableTitle(java.lang.String dockable, java.lang.String title)
dockable
- the name of the dockable, as specified in the dockables.xmltitle
- the new .longtitle you want to see above it.public static java.lang.String[] getRegisteredDockableWindows()
public static java.lang.String getDockableWindowPluginName(java.lang.String name)
public void setDockingLayout(DockableWindowManager.DockingLayout docking)
public void handleDockableWindowUpdate(DockableWindowUpdate msg)
public void handlePropertiesChanged(PropertiesChanged msg)
public void handlePluginUpdate(PluginUpdate pmsg)
public java.lang.String longTitle(java.lang.String name)
public java.lang.String shortTitle(java.lang.String name)
protected void applyAlternateLayout(boolean alternateLayout)
protected void dockableLoaded(java.lang.String dockableName, java.lang.String position)
protected void dockingPositionChanged(java.lang.String dockableName, java.lang.String oldPosition, java.lang.String newPosition)
protected boolean getAlternateLayoutProp()
protected void propertiesChanged()
protected javax.swing.JComponent createDockable(java.lang.String name)
protected java.lang.String getDockablePosition(java.lang.String name)
protected void focusDockable(java.lang.String name)
protected java.lang.String getLongTitlePropertyName(java.lang.String dockableName)