|
||||||||||
| 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.JLabel
net.xoetrope.swing.docking.XDockableHeader
public class XDockableHeader
A header like panel that paints a gradient fill and displays a caption. The header also contains a minimize button that initiates docking. The header may also be double clicked to zoom in on the owner XDockingPanel and the header may also be dragged from one docking panel to another.
The colours of the header are controlled with the dockingHeader
style and dockingHeader/active for the active tab colours
Copyright: Xoetrope Ltd. (c) 2003-2006
License: see license.txt
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JLabel |
|---|
javax.swing.JLabel.AccessibleJLabel |
| 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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
BUTTON_SIZE
The default header button size |
static int |
CLOSE
|
static int |
MINIMIZE
|
static int |
NUM_IMAGE_TYPES
|
static int |
RESTORE
|
static int |
ZOOM
|
| Fields inherited from class javax.swing.JLabel |
|---|
labelFor |
| 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 javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
XDockableHeader(XDockable dockable,
java.awt.Color[] colors,
java.lang.String[] tooltips)
Creates a new instance of XDockableHeader |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Respond to the 'minimize' button and dock this panel. |
static java.awt.Color |
brightenColor(java.awt.Color color,
int percentage)
Get an brighter version of a color |
java.lang.String |
clipStringIfNecessary(javax.swing.JComponent c,
java.awt.FontMetrics fm,
java.lang.String caption,
int availTextWidth)
|
void |
endDock()
End the drag and drop operation by removing the drop site preview indicator |
boolean |
getCanClose()
Determine if the docking component can close |
boolean |
getCanDock()
Determine if the docking component can dock |
boolean |
getCanDrag()
Determine if the docking component can be dragged |
boolean |
getCanMinimize()
Determine if the docking component can minimize |
boolean |
getCanZoom()
Determine if the docking component can be zoomed |
XDockable |
getDockable()
Get the dockable object that this header is associated with. |
java.awt.Insets |
getInsets()
If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets. |
java.awt.Dimension |
getPreferredSize()
If the preferredSize has been set to a
non-null value just returns it. |
boolean |
isZoomed()
Is the panel zoomed? |
void |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component. |
void |
mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed. |
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. |
void |
paintComponent(java.awt.Graphics g)
Paint the component, drawing the background gradient and the active indicator if the header is active/selected |
void |
setActive(boolean state)
Mark this header as active or inactive. |
protected void |
setButtonProperties(javax.swing.JButton headerBtn,
int itemId,
java.lang.String tooltip,
boolean isVisible)
Configure the header buttons |
void |
setCanClose(boolean state)
Control the docking component's ability to close |
void |
setCanDockClose(boolean state)
Control the docking component's ability to dock. |
void |
setCanDrag(boolean state)
Control the docking component's ability to be dragged and dropped. |
void |
setCanMinimize(boolean state)
Control the docking component's ability to minimize |
void |
setCanZoom(boolean state)
Control the docking component's ability to be zoomed. |
static void |
setUseGradientHeaders(boolean state)
Toggle the drawing of gradients in the headers |
void |
setZoomState(int newState)
Set the state of the zoome/restore button |
void |
showDock(javax.swing.JComponent c,
java.awt.Container target)
Adjust the position of the drop area preview during a drag operation |
void |
zoomPanel()
Zoom in on this panel, maximizing it so that it consumes the entire dockin apnel |
| Methods inherited from class javax.swing.JLabel |
|---|
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, 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, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, 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 int BUTTON_SIZE
public static final int MINIMIZE
public static final int ZOOM
public static final int CLOSE
public static final int RESTORE
public static final int NUM_IMAGE_TYPES
| Constructor Detail |
|---|
public XDockableHeader(XDockable dockable,
java.awt.Color[] colors,
java.lang.String[] tooltips)
dockable - the dockable object that to which this header contributes.translator - the translator component or null if the tooltips are not translatedcolors - the header colors: background, text color, active background, active text colortooltips - the tooltip text for the minimize and close buttons| Method Detail |
|---|
protected void setButtonProperties(javax.swing.JButton headerBtn,
int itemId,
java.lang.String tooltip,
boolean isVisible)
headerBtn - the buttonitemId - the item indextooltip - the tooltip textisVisible - true if the button is visiblepublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - the mouse eventpublic XDockable getDockable()
public void setActive(boolean state)
public void setCanClose(boolean state)
state - true to allow closing, false to prevent closingpublic boolean getCanClose()
public void setCanMinimize(boolean state)
state - true to allow closing, false to prevent minimizingpublic boolean getCanMinimize()
public void setCanDockClose(boolean state)
false
state - true to allow closing, false to prevent dockingpublic boolean getCanDock()
public void setCanDrag(boolean state)
false
state - true to allow dragging, false to prevent draggingpublic boolean getCanDrag()
public void setCanZoom(boolean state)
false
state - true to allow zooming, false to prevent zoomingpublic boolean getCanZoom()
public java.awt.Insets getInsets()
super.getInsets.
getInsets in class javax.swing.JComponentJComponent.setBorder(javax.swing.border.Border)public void setZoomState(int newState)
newState - the ZOOM or RESTORE statepublic void zoomPanel()
public boolean isZoomed()
public java.awt.Dimension getPreferredSize()
preferredSize has been set to a
non-null value just returns it.
If the UI delegate's getPreferredSize
method returns a non null value then return that;
otherwise defer to the component's layout manager.
getPreferredSize in class javax.swing.JComponentpreferredSize propertyJComponent.setPreferredSize(java.awt.Dimension),
ComponentUIpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the graphics contextpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
MOUSE_DRAGGED events will continue to be
delivered to the component where the drag originated until the
mouse button is released (regardless of whether the mouse position
is within the bounds of the component).
Initiates a drag of the docked panel
Due to platform-dependent Drag&Drop implementations,MOUSE_DRAGGED events may not be delivered during a native
Drag&Drop operation.
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListener
public void showDock(javax.swing.JComponent c,
java.awt.Container target)
target - the potential drop sitepublic void endDock()
public static void setUseGradientHeaders(boolean state)
state - false to turn off gradient painting
public static java.awt.Color brightenColor(java.awt.Color color,
int percentage)
color - the original colorpercentage - the percentage of the original color brightness to return
public java.lang.String clipStringIfNecessary(javax.swing.JComponent c,
java.awt.FontMetrics fm,
java.lang.String caption,
int availTextWidth)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||