Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit.gui
Class DockableWindowManager  view DockableWindowManager download DockableWindowManager.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.gjt.sp.jedit.gui.DockableWindowManager
All Implemented Interfaces:
javax.accessibility.Accessible, org.gjt.sp.jedit.EBComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DockableWindowManager
extends javax.swing.JPanel
implements org.gjt.sp.jedit.EBComponent

The DockableWindowManager keeps track of dockable windows. Each org.gjt.sp.jedit.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 org.gjt.sp.jedit.BeanShell), along with a variable position whose value is one of FLOATING 55 , TOP 55 , LEFT 55 , BOTTOM 55 , and RIGHT 55 .

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 org.gjt.sp.jedit.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.87 2003/10/22 04:38:22 spestov Exp $

Nested Class Summary
 class DockableWindowManager.DockableLayout
           
(package private) static class DockableWindowManager.DockableListHandler
           
(package private)  class DockableWindowManager.Entry
           
(package private) static class DockableWindowManager.Factory
           
 
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
private  boolean alternateLayout
           
private  PanelWindowContainer bottom
           
static java.lang.String BOTTOM
          Bottom position.
private  java.util.ArrayList clones
           
private static java.util.HashMap dockableWindowFactories
           
static java.lang.String FLOATING
          Floating position.
private  PanelWindowContainer left
           
static java.lang.String LEFT
          Left position.
(package private)  int resizePos
           
(package private)  java.awt.Rectangle resizeRect
           
private  PanelWindowContainer right
           
static java.lang.String RIGHT
          Right position.
private  PanelWindowContainer top
           
static java.lang.String TOP
          Top position.
private  org.gjt.sp.jedit.View view
           
private  java.util.Hashtable windows
           
 
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.Container
 
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(org.gjt.sp.jedit.View view, org.gjt.sp.jedit.View.ViewConfig config)
          Creates a new dockable window manager.
 
Method Summary
 void addDockableWindow(java.lang.String name)
          Opens the specified dockable window.
private  void addEntry(DockableWindowManager.Factory factory)
           
static void cacheDockableWindows(org.gjt.sp.jedit.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)
           
(package private)  void finishResizing()
           
 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()
           
 org.gjt.sp.jedit.View getView()
          Returns this dockable window manager's view.
 void handleMessage(org.gjt.sp.jedit.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(org.gjt.sp.jedit.PluginJAR plugin, java.net.URL uri, org.gjt.sp.jedit.PluginJAR.PluginCacheEntry cache)
          Plugins shouldn't need to call this method.
 void paintChildren(java.awt.Graphics g)
          Paint the component's children.
private  void propertiesChanged()
           
static void registerDockableWindow(org.gjt.sp.jedit.PluginJAR plugin, java.lang.String name, java.lang.String code, boolean actions)
           
 void removeDockableWindow(java.lang.String name)
          Hides the specified dockable window.
(package private)  void setResizePos(PanelWindowContainer resizing)
           
 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(org.gjt.sp.jedit.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, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, 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, 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, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, 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, 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
 
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

dockableWindowFactories

private static java.util.HashMap dockableWindowFactories

resizePos

int resizePos

resizeRect

java.awt.Rectangle resizeRect

view

private org.gjt.sp.jedit.View view

windows

private java.util.Hashtable windows

alternateLayout

private boolean alternateLayout

left

private PanelWindowContainer left

right

private PanelWindowContainer right

top

private PanelWindowContainer top

bottom

private PanelWindowContainer bottom

clones

private java.util.ArrayList clones
Constructor Detail

DockableWindowManager

public DockableWindowManager(org.gjt.sp.jedit.View view,
                             org.gjt.sp.jedit.View.ViewConfig config)
Creates a new dockable window manager.

Since:
jEdit 2.6pre3
Method Detail

loadDockableWindows

public static void loadDockableWindows(org.gjt.sp.jedit.PluginJAR plugin,
                                       java.net.URL uri,
                                       org.gjt.sp.jedit.PluginJAR.PluginCacheEntry cache)
Plugins shouldn't need to call this method.

Since:
jEdit 4.2pre1

unloadDockableWindows

public static void unloadDockableWindows(org.gjt.sp.jedit.PluginJAR plugin)
Plugins shouldn't need to call this method.

Since:
jEdit 4.2pre1

cacheDockableWindows

public static void cacheDockableWindows(org.gjt.sp.jedit.PluginJAR plugin,
                                        java.lang.String[] name,
                                        boolean[] actions)
Since:
jEdit 4.2pre1

registerDockableWindow

public static void registerDockableWindow(org.gjt.sp.jedit.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 org.gjt.sp.jedit.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.

Since:
jEdit 4.1pre2

showDockableWindow

public void showDockableWindow(java.lang.String name)
Opens the specified dockable window.

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().

Since:
jEdit 2.6pre3

hideDockableWindow

public void hideDockableWindow(java.lang.String name)
Hides the specified dockable window.

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().

Since:
jEdit 4.2pre1

toggleDockableWindow

public void toggleDockableWindow(java.lang.String name)
Toggles the visibility of the specified dockable window.


getDockableWindow

public javax.swing.JComponent getDockableWindow(java.lang.String name)
Returns the specified dockable window.

Since:
jEdit 4.1pre2

getDockable

public javax.swing.JComponent getDockable(java.lang.String name)
Returns the specified dockable window. For historical reasons, this does the same thing as getDockableWindow(String) 55 .

Since:
jEdit 4.0pre1

getDockableTitle

public java.lang.String getDockableTitle(java.lang.String name)
Returns the title of the specified dockable window.

Since:
jEdit 4.1pre5

isDockableWindowVisible

public boolean isDockableWindowVisible(java.lang.String name)
Returns if the specified dockable window is visible.


isDockableWindowDocked

public boolean isDockableWindowDocked(java.lang.String name)
Returns if the specified dockable window is docked into the view.

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)
Description copied from class: javax.swing.JComponent
Paint the component's children. This usually means calling Container.paint(java.awt.Graphics)>Container.paint(java.awt.Graphics) 55 , which recursively calls JComponent.paint(java.awt.Graphics)>JComponent.paint(java.awt.Graphics) 55 on any of the component's children, with appropriate changes to coordinate space and clipping region. You may override this if you wish to customize children painting behavior. The children are painted after the component's body and border.


handleMessage

public void handleMessage(org.gjt.sp.jedit.EBMessage msg)
Description copied from interface: org.gjt.sp.jedit.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 org.gjt.sp.jedit.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 org.gjt.sp.jedit.EBComponent

setResizePos

void setResizePos(PanelWindowContainer resizing)

finishResizing

void finishResizing()

propertiesChanged

private void propertiesChanged()

addEntry

private void addEntry(DockableWindowManager.Factory factory)