- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
DockableWindowManagerImpl
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, thedockableName.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.
- Since:
- jEdit 2.6pre3
- Version:
- $Id: DockableWindowManager.java 23222 2013-09-29 20:43:34Z shlomy $
- Author:
- Slava Pestov, John Gellene (API documentation), Shlomy Reinstein (refactoring into a base and an impl)
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
Objects of DockingLayout class describe which dockables are docked where, which ones are floating, and their sizes/positions for saving/loading perspectives.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Bottom position.protected DockableWindowFactory
static final String
Floating position.static final String
Left position.static final String
Right position.static final String
Top position.protected View
protected Map<String,
JComponent> Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionDockableWindowManager
(View view, DockableWindowFactory instance, View.ViewConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDockableWindow
(String name) Opens the specified dockable window.protected void
applyAlternateLayout
(boolean alternateLayout) void
void
close()
abstract void
closeListener
(String dockableName) The actionEvent "close-docking-area" by default only works on dockable windows that have no special keyboard handling.protected JComponent
createDockable
(String name) abstract void
disposeDockableWindow
(String name) Completely dispose of a dockable - called when a plugin is unloaded, to remove all references to the its dockables.protected void
dockableLoaded
(String dockableName, String position) void
dockableTitleChanged
(String dockable, String newTitle) protected void
dockingPositionChanged
(String dockableName, String oldPosition, String newPosition) abstract JComponent
floatDockableWindow
(String name) protected void
focusDockable
(String name) protected boolean
abstract DockableWindowManager.DockingArea
getDockable
(String name) protected String
getDockablePosition
(String name) getDockableTitle
(String name) Returns the title of the specified dockable window.getDockableWindow
(String name) Returns the specified dockable window.static String
abstract DockableWindowManager.DockingLayout
getDockingLayout
(View.ViewConfig config) abstract DockableWindowManager.DockingArea
protected String
getLongTitlePropertyName
(String dockableName) static String[]
abstract DockableWindowManager.DockingArea
abstract DockableWindowManager.DockingArea
getView()
Returns this dockable window manager's view.void
void
void
abstract void
hideDockableWindow
(String name) void
init()
abstract boolean
isDockableWindowDocked
(String name) abstract boolean
protected void
void
removeDockableWindow
(String name) Hides the specified dockable window.void
setDockableTitle
(String dockable, String title) Changes the .longtitle property of a dockable window, which corresponds to the title shown when it is floating (not docked).void
abstract void
setMainPanel
(JPanel panel) shortTitle
(String name) abstract void
showDockableWindow
(String name) void
toggleDockableWindow
(String name) Toggles the visibility of the specified dockable window.void
Hides all visible dock areas, or shows them again, if the last time it was a hide.boolean
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
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
Methods inherited from class java.awt.Container
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
Methods inherited from class java.awt.Component
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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
FLOATING
Floating position.- Since:
- jEdit 2.6pre3
- See Also:
-
TOP
Top position.- Since:
- jEdit 2.6pre3
- See Also:
-
LEFT
Left position.- Since:
- jEdit 2.6pre3
- See Also:
-
BOTTOM
Bottom position.- Since:
- jEdit 2.6pre3
- See Also:
-
RIGHT
Right position.- Since:
- jEdit 2.6pre3
- See Also:
-
view
-
factory
-
windows
-
-
Constructor Details
-
DockableWindowManager
-
-
Method Details
-
setMainPanel
-
showDockableWindow
-
hideDockableWindow
-
disposeDockableWindow
Completely dispose of a dockable - called when a plugin is unloaded, to remove all references to the its dockables. -
floatDockableWindow
-
isDockableWindowDocked
-
isDockableWindowVisible
-
closeCurrentArea
public abstract void closeCurrentArea() -
getDockingLayout
-
getLeftDockingArea
-
getRightDockingArea
-
getTopDockingArea
-
getBottomDockingArea
-
init
public void init() -
close
public void close() -
applyDockingLayout
-
addDockableWindow
Opens the specified dockable window. As of jEdit 4.0pre1, has the same effect as calling showDockableWindow().- Parameters:
name
- The dockable window name- Since:
- jEdit 2.6pre3
-
removeDockableWindow
Hides the specified dockable window. As of jEdit 4.2pre1, has the same effect as calling hideDockableWindow().- Parameters:
name
- The dockable window name- Since:
- jEdit 4.2pre1
-
toggleDockableWindow
Toggles the visibility of the specified dockable window.- Parameters:
name
- The dockable window name
-
getDockableWindow
Returns the specified dockable window. Note that this method will return null if the dockable has not been added yet. Make sure you calladdDockableWindow(String)
first.- Parameters:
name
- The name of the dockable window- Since:
- jEdit 4.1pre2
-
toggleDockAreas
public void toggleDockAreas()Hides all visible dock areas, or shows them again, if the last time it was a hide.- Since:
- jEdit 4.3pre16
-
willToggleHide
public boolean willToggleHide()- Returns:
- true if the next invocation of "toggle docked areas" will hide the dockables. false otherwise.
-
dockableTitleChanged
-
closeListener
The actionEvent "close-docking-area" by default only works on dockable windows that have no special keyboard handling. If you have dockable widgets with input widgets and/or other fancy keyboard handling, those components may not respond to close docking area. You can add key listeners to each keyboard-handling component in your dockable that usually has keyboard focus. This function creates and returns a key listener which does exactly that. It is also used by FloatingWindowContainer when creating new floating windows.- Parameters:
dockableName
- the name of your dockable- Returns:
- a KeyListener you can add to that plugin's component.
- Since:
- jEdit 4.3pre6
-
getView
Returns this dockable window manager's view.- Since:
- jEdit 4.0pre2
-
getDockable
- Since:
- jEdit 4.3pre2
-
getDockableTitle
Returns the title of the specified dockable window.- Parameters:
name
- The name of the dockable window.- Since:
- jEdit 4.1pre5
-
setDockableTitle
Changes the .longtitle property of a dockable window, which corresponds to the title shown when it is floating (not docked). Fires a change event that makes sure all floating dockables change their title.- Parameters:
dockable
- the name of the dockable, as specified in the dockables.xmltitle
- the new .longtitle you want to see above it.- Since:
- 4.3pre5
-
getRegisteredDockableWindows
-
getDockableWindowPluginName
-
setDockingLayout
-
handleDockableWindowUpdate
-
handlePropertiesChanged
-
handlePluginUpdate
-
longTitle
-
shortTitle
-
applyAlternateLayout
protected void applyAlternateLayout(boolean alternateLayout) -
dockableLoaded
-
dockingPositionChanged
-
getAlternateLayoutProp
protected boolean getAlternateLayoutProp() -
propertiesChanged
protected void propertiesChanged() -
createDockable
-
getDockablePosition
-
focusDockable
-
getLongTitlePropertyName
-