|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.gjt.sp.jedit.gui.DockableWindowManager
public class DockableWindowManager
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 FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces 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. |
java.util.Stack |
showStack
|
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,
DockableWindowFactory factory,
View.ViewConfig config)
Creates a new dockable window manager. |
Method Summary | |
---|---|
void |
addDockableWindow(java.lang.String name)
Opens the specified dockable window. |
void |
close()
Called when the view is being closed. |
void |
closeCurrentArea()
Closes the most recently focused dockable. |
java.awt.event.KeyListener |
closeListener(java.lang.String dockableName)
The actionEvent "close-docking-area" by default only works on windows that are docked. |
javax.swing.JPopupMenu |
createPopupMenu(org.gjt.sp.jedit.gui.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. |
void |
paintChildren(java.awt.Graphics g)
|
void |
removeDockableWindow(java.lang.String name)
Hides the specified dockable window. |
void |
setDockableTitle(java.lang.String dockableName,
java.lang.String newTitle)
Changes the .longtitle property of a dockable window, which corresponds to the title shown when it is floating (not docked). |
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. |
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, 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, 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, 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, hide, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
public java.util.Stack showStack
Constructor Detail |
---|
public DockableWindowManager(View view, DockableWindowFactory factory, View.ViewConfig config)
view
- The viewfactory
- A DockableWindowFactory
, usually
DockableWindowFactory.getInstance()
.config
- A docking configurationMethod Detail |
---|
public static java.lang.String[] getRegisteredDockableWindows()
public void init()
public java.awt.event.KeyListener closeListener(java.lang.String dockableName)
dockableName
- the name of your dockable
public View getView()
public javax.swing.JComponent floatDockableWindow(java.lang.String name)
name
- The dockable window name
public void showDockableWindow(java.lang.String name)
name
- The dockable window namepublic void addDockableWindow(java.lang.String name)
name
- The dockable window namepublic void hideDockableWindow(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 javax.swing.JComponent getDockable(java.lang.String name)
addDockableWindow(String)
first.
For historical reasons, this
does the same thing as getDockableWindow(String)
.
name
- The name of the dockable windowpublic java.lang.String getDockableTitle(java.lang.String name)
name
- The name of the dockable window.public void setDockableTitle(java.lang.String dockableName, java.lang.String newTitle)
dockableName
- the name of the dockable, as specified in the dockables.xmlnewTitle
- the new .longtitle you want to see above it.public boolean isDockableWindowVisible(java.lang.String name)
name
- The dockable window namepublic boolean isDockableWindowDocked(java.lang.String name)
name
- The dockable's namepublic void closeCurrentArea()
public void close()
public PanelWindowContainer getTopDockingArea()
public PanelWindowContainer getLeftDockingArea()
public PanelWindowContainer getBottomDockingArea()
public PanelWindowContainer getRightDockingArea()
public javax.swing.JPopupMenu createPopupMenu(org.gjt.sp.jedit.gui.DockableWindowContainer container, java.lang.String dockable, boolean clone)
public void paintChildren(java.awt.Graphics g)
paintChildren
in class javax.swing.JComponent
public void handleMessage(EBMessage msg)
EBComponent
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
handleMessage
in interface EBComponent
msg
- The message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |