## org.gjt.sp.jedit.gui
Class DockableWindowManager

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      org.gjt.sp.jedit.gui.DockableWindowManager

All Implemented Interfaces:
  javax.accessibility.Accessible, EBComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DockableWindowManager
extends javax.swing.JPanel
implements EBComponent

The `DockableWindowManager` keeps track of dockable windows. 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="name">
            // Code to create the dockable
        </DOCKABLE>
    </DOCKABLES>

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:

- `name.title` - the string to show in the title bar of the dockable.
- `name.label` - the dockable's menu item label.

A number of actions are automatically created for each dockable window:

- `name` - opens the dockable window.
- `name-toggle` - toggles the dockable window's visibility.
- `name-float` - opens the dockable window in a new floating window.

Note that only the first action needs a `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,v 1.98 2004/06/09 16:48:40 spestov Exp $
Author:
  Slava Pestov, John Gellene (API documentation)
See Also:
  `View.getDockableWindowManager()`, Serialized Form

Nested Class Summary
`class` `DockableWindowManager.DockableLayout`

Nested classes inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`static java.lang.String` `BOTTOM` Bottom position.
`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.

Fields inherited from class javax.swing.JComponent
`accessibleContext, 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
`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
`DockableWindowManager(View view, View.ViewConfig config)` Creates a new dockable window manager.

Method Summary
`void` `addDockableWindow(java.lang.String name)` Opens the specified dockable window.
`static void` `cacheDockableWindows(PluginJAR plugin, java.lang.String[] name, boolean[] actions)`
`void` `close()` Called when the view is being closed.
`void` `closeCurrentArea()` Closes the currently focused docking area.
`javax.swing.JPopupMenu` `createPopupMenu(DockableWindowContainer container, java.lang.String dockable, boolean clone)`
`javax.swing.JComponent` `floatDockableWindow(java.lang.String name)` Opens a new instance of the specified dockable window in a floating container.
`PanelWindowContainer` `getBottomDockingArea()`
`javax.swing.JComponent` `getDockable(java.lang.String name)` Returns the specified dockable window.
`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.
`PanelWindowContainer` `getLeftDockingArea()`
`static java.lang.String[]` `getRegisteredDockableWindows()`
`PanelWindowContainer` `getRightDockingArea()`
`PanelWindowContainer` `getTopDockingArea()`
`View` `getView()` Returns this dockable window manager's view.
`void` `handleMessage(EBMessage msg)` Handles a message sent on the EditBus.
`void` `hideDockableWindow(java.lang.String name)` Hides the specified dockable window.
`void` `init()` Initialises dockable window manager.
`boolean` `isDockableWindowDocked(java.lang.String name)` Returns if the specified dockable window is docked into the view.
`boolean` `isDockableWindowVisible(java.lang.String name)` Returns if the specified dockable window is visible.
`static void` `loadDockableWindows(PluginJAR plugin, java.net.URL uri, PluginJAR.PluginCacheEntry cache)` Plugins shouldn't need to call this method.
`void` `paintChildren(java.awt.Graphics g)`
`static void` `registerDockableWindow(PluginJAR plugin, java.lang.String name, java.lang.String code, boolean actions)`
`void` `removeDockableWindow(java.lang.String name)` Hides the specified dockable window.
`void` `showDockableWindow(java.lang.String name)` Opens the specified dockable window.
`void` `toggleDockableWindow(java.lang.String name)` Toggles the visibility of the specified dockable window.
`static void` `unloadDockableWindows(PluginJAR plugin)` Plugins shouldn't need to call this method.

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### FLOATING

    public static final java.lang.String FLOATING

  Floating position.

  Since:
    jEdit 2.6pre3
  See Also:
    Constant Field Values

### TOP

    public static final java.lang.String TOP

  Top position.

  Since:
    jEdit 2.6pre3
  See Also:
    Constant Field Values

### LEFT

    public static final java.lang.String LEFT

  Left position.

  Since:
    jEdit 2.6pre3
  See Also:
    Constant Field Values

### BOTTOM

    public static final java.lang.String BOTTOM

  Bottom position.

  Since:
    jEdit 2.6pre3
  See Also:
    Constant Field Values

### RIGHT

    public static final java.lang.String RIGHT

  Right position.

  Since:
    jEdit 2.6pre3
  See Also:
    Constant Field Values

Constructor Detail

### DockableWindowManager

    public DockableWindowManager(View view,
                                 View.ViewConfig config)

  Creates a new dockable window manager.

Parameters:
  `view` - The view
Since:
  jEdit 2.6pre3

Method Detail

### loadDockableWindows

    public static void loadDockableWindows(PluginJAR plugin,
                                           java.net.URL uri,
                                           PluginJAR.PluginCacheEntry cache)

  Plugins shouldn't need to call this method.

  Since:
    jEdit 4.2pre1

### unloadDockableWindows

    public static void unloadDockableWindows(PluginJAR plugin)

  Plugins shouldn't need to call this method.

  Since:
    jEdit 4.2pre1

### cacheDockableWindows

    public static void cacheDockableWindows(PluginJAR plugin,
                                            java.lang.String[] name,
                                            boolean[] actions)

  Since:
    jEdit 4.2pre1

### registerDockableWindow

    public static void registerDockableWindow(PluginJAR plugin,
                                              java.lang.String name,
                                              java.lang.String code,
                                              boolean actions)

### getRegisteredDockableWindows

    public static java.lang.String[] getRegisteredDockableWindows()

### init

    public void init()

  Initialises dockable window manager. Do not call this method directly.

### getView

    public View getView()

  Returns this dockable window manager's view.

  Since:
    jEdit 4.0pre2

### floatDockableWindow

    public javax.swing.JComponent floatDockableWindow(java.lang.String name)

  Opens a new instance of the specified dockable window in a floating container.

  Parameters:
    `name` - The dockable window name
  Returns:
    The new dockable window instance
  Since:
    jEdit 4.1pre2

### showDockableWindow

    public void showDockableWindow(java.lang.String name)

  Opens the specified dockable window.

  Parameters:
    `name` - The dockable window name
  Since:
    jEdit 2.6pre3

### addDockableWindow

    public void addDockableWindow(java.lang.String name)

  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

### hideDockableWindow

    public void hideDockableWindow(java.lang.String name)

  Hides the specified dockable window.

  Parameters:
    `name` - The dockable window name
  Since:
    jEdit 2.6pre3

### removeDockableWindow

    public void removeDockableWindow(java.lang.String name)

  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

    public void toggleDockableWindow(java.lang.String name)

  Toggles the visibility of the specified dockable window.

  Parameters:
    `name` - The dockable window name

### getDockableWindow

    public javax.swing.JComponent getDockableWindow(java.lang.String name)

  Returns the specified dockable window. Note that this method will return null if the dockable has not been added yet. Make sure you call `addDockableWindow(String)` first.

  Parameters:
    `name` - The name of the dockable window
  Since:
    jEdit 4.1pre2

### getDockable

    public javax.swing.JComponent getDockable(java.lang.String name)

  Returns the specified dockable window. Note that this method will return null if the dockable has not been added yet. Make sure you call `addDockableWindow(String)` first. For historical reasons, this does the same thing as `getDockableWindow(String)`.

  Parameters:
    `name` - The name of the dockable window
  Since:
    jEdit 4.0pre1

### getDockableTitle

    public java.lang.String getDockableTitle(java.lang.String name)

  Returns the title of the specified dockable window.

  Parameters:
    `name` - The name of the dockable window.
  Since:
    jEdit 4.1pre5

### isDockableWindowVisible

    public boolean isDockableWindowVisible(java.lang.String name)

  Returns if the specified dockable window is visible.

  Parameters:
    `name` - The dockable window name

### isDockableWindowDocked

    public boolean isDockableWindowDocked(java.lang.String name)

  Returns if the specified dockable window is docked into the view.

  Parameters:
    `name` - The dockable's name
  Since:
    jEdit 4.0pre2

### closeCurrentArea

    public void closeCurrentArea()

  Closes the currently focused docking area.

  Since:
    jEdit 4.1pre3

### close

    public void close()

  Called when the view is being closed.

  Since:
    jEdit 2.6pre3

### getTopDockingArea

    public PanelWindowContainer getTopDockingArea()

### getLeftDockingArea

    public PanelWindowContainer getLeftDockingArea()

### getBottomDockingArea

    public PanelWindowContainer getBottomDockingArea()

### getRightDockingArea

    public PanelWindowContainer getRightDockingArea()

### createPopupMenu

    public javax.swing.JPopupMenu createPopupMenu(DockableWindowContainer container,
                                                  java.lang.String dockable,
                                                  boolean clone)

### paintChildren

    public void paintChildren(java.awt.Graphics g)

### handleMessage

    public void handleMessage(EBMessage msg)

  Description copied from interface: `EBComponent`
  Handles a message sent on the EditBus. This method must specify the type of responses the plugin will have for various subclasses of the `EBMessage` class. Typically this is done with one or more `if` blocks that test whether the message is an instance of a derived message class in which the component has an interest. For example:

       if(msg instanceof BufferUpdate) {
           // a buffer's state has changed!
       }
       else if(msg instanceof ViewUpdate) {
           // a view's state has changed!
       }
       // ... and so on

  Specified by:
    `handleMessage` in interface `EBComponent`
  Parameters:
    `msg` - The message

``