|
||||||||||
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
bibliothek.gui.dock.title.AbstractDockTitle
public class AbstractDockTitle
An abstract implementation of DockTitle
. This title can have
an icon, a title-text and some small buttons to display actions
.
The icon is at the top or left edge, the text in the middle, and the actions
at the lower or the right edge of the title. If the orientation of the
title is set to vertical
, the text will be rotated
by 90 degrees.
This title has also an ActionPopup
which will appear when the user
presses the right mouse-button. The popup shows a list of all actions known
to this title.
The whole logic a DockTitle
needs is implemented in this class,
but subclasses may add graphical features - like a border or another
background.
Subclasses may override getInnerInsets()
to add a space between
border and contents of this title.
Nested Class Summary | |
---|---|
private class |
AbstractDockTitle.ItemPanel
Panel that shows the items. |
private class |
AbstractDockTitle.Listener
A listener to the Dockable and the DockActionSource
of this title. |
private class |
AbstractDockTitle.OrientedLabel
A label which draws some text, and can change the layout of the text between horizontal and vertical. |
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 |
Nested classes/interfaces inherited from interface bibliothek.gui.dock.title.DockTitle |
---|
DockTitle.Orientation |
Field Summary | |
---|---|
private java.util.List<DockAction> |
actions
A list of all actions that are on this title |
private boolean |
active
true if this title is currently selected, false otherwise |
private boolean |
bind
true if this title is currently binded to a Dockable |
private Dockable |
dockable
The Dockable for which this title is shown |
private javax.swing.Icon |
icon
The icon which is shown on this title |
private javax.swing.JPanel |
itemPanel
A panel that displays the action-buttons of this title |
private java.util.Map<DockAction,BasicTitleViewItem<javax.swing.JComponent>> |
items
The buttons of this title, each of them represents one action |
private AbstractDockTitle.OrientedLabel |
label
A label for the title-text |
private AbstractDockTitle.Listener |
listener
A listener added to the owned Dockable . |
private static java.awt.Insets |
NULL_INSETS
Insets of the size 0,0,0,0 |
private DockTitle.Orientation |
orientation
Whether the layout should be horizontal or vertical |
private DockTitleVersion |
origin
The creator of this title |
private boolean |
showMiniButtons
Tells whether small buttons for each action should be created and shown, or not |
private DockActionSource |
source
A list of actions that should be shown on this title |
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 | |
---|---|
AbstractDockTitle(Dockable dockable,
DockTitleVersion origin)
Constructs a new title |
|
AbstractDockTitle(Dockable dockable,
DockTitleVersion origin,
boolean showMiniButtons)
Standard constructor |
Method Summary | |
---|---|
void |
addMouseInputListener(javax.swing.event.MouseInputListener listener)
Adds a listener to all Components of this title
which are visible and which may be "grabbed" by the mouse. |
void |
bind()
Called before the title is displayed. |
void |
changed(DockTitleEvent event)
Called if a property (of this title, of the owner or anything else) has changed. |
protected BasicTitleViewItem<javax.swing.JComponent> |
createItemFor(DockAction action,
Dockable dockable)
Creates a new item for action which will be shown on this title. |
void |
doLayout()
|
java.awt.Component |
getComponent()
Gets a Component which represents the DockTitle . |
Dockable |
getDockable()
Gets the owner of this title. |
protected javax.swing.Icon |
getIcon()
Gets the icon of this title. |
java.awt.Rectangle |
getIconBounds()
Gets the location and the size of the icon. |
protected java.awt.Insets |
getInnerInsets()
Gets the insets that have to be applied between the border and the content of this title. |
java.awt.Dimension |
getMinimumSize()
|
DockTitle.Orientation |
getOrientation()
Gets the current orientation. |
DockTitleVersion |
getOrigin()
Gets the version which was used to create this title. |
java.awt.Point |
getPopupLocation(java.awt.Point click)
Tells whether a popup menu should be opened when the user clicks at click with the mouse. |
java.awt.Dimension |
getPreferredSize()
|
protected java.lang.String |
getText()
Gets the text which is shown on this title. |
boolean |
isActive()
Tells whether this title is selected (active) or not. |
boolean |
isBinded()
Tells whether this title is binded to a Dockable or not. |
protected void |
paintBackground(java.awt.Graphics g,
javax.swing.JComponent component)
Paints the whole background of this title. |
void |
paintComponent(java.awt.Graphics g)
|
void |
removeMouseInputListener(javax.swing.event.MouseInputListener listener)
Removes a listener. |
void |
setActive(boolean active)
Sets whether this title should be painted as focused or not. |
void |
setBackground(java.awt.Color fg)
|
void |
setForeground(java.awt.Color fg)
|
protected void |
setIcon(javax.swing.Icon icon)
Sets the icon of this title. |
void |
setOrientation(DockTitle.Orientation orientation)
Sets the orientation of this title. |
protected void |
setText(java.lang.String text)
Sets the text of this title. |
private java.awt.Insets |
titleInsets()
|
void |
unbind()
The reverse of DockTitle.bind() . |
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, getNextFocusableComponent, getPopupLocation, 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, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, 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, 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 |
---|
private static final java.awt.Insets NULL_INSETS
private Dockable dockable
Dockable
for which this title is shown
private AbstractDockTitle.OrientedLabel label
private javax.swing.JPanel itemPanel
private java.util.Map<DockAction,BasicTitleViewItem<javax.swing.JComponent>> items
private java.util.List<DockAction> actions
private AbstractDockTitle.Listener listener
Dockable
. The listener changes the
title-text and the icon of this title.
private DockActionSource source
private DockTitleVersion origin
private boolean active
true
if this title is currently selected, false
otherwise
private boolean bind
true
if this title is currently binded to a Dockable
private boolean showMiniButtons
private DockTitle.Orientation orientation
private javax.swing.Icon icon
Constructor Detail |
---|
public AbstractDockTitle(Dockable dockable, DockTitleVersion origin)
dockable
- the Dockable which is the owner of this titleorigin
- the version which was used to create this titlepublic AbstractDockTitle(Dockable dockable, DockTitleVersion origin, boolean showMiniButtons)
dockable
- The Dockable whose title this will beorigin
- The version which was used to create this titleshowMiniButtons
- true
if the actions of the Dockable
should be shown, false
if they should not be visibleMethod Detail |
---|
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public java.awt.Rectangle getIconBounds()
null
if no icon is registeredprotected void paintBackground(java.awt.Graphics g, javax.swing.JComponent component)
component
.
g
- the graphics context used to paintcomponent
- the Component which represents this titleprotected void setIcon(javax.swing.Icon icon)
icon
- the icon, can be null
protected javax.swing.Icon getIcon()
null
setIcon(Icon)
protected void setText(java.lang.String text)
text
- the text or nullprotected java.lang.String getText()
public void setOrientation(DockTitle.Orientation orientation)
DockTitle
setOrientation
in interface DockTitle
orientation
- the orientationpublic DockTitle.Orientation getOrientation()
getOrientation
in interface DockTitle
setOrientation(bibliothek.gui.dock.title.DockTitle.Orientation)
public DockTitleVersion getOrigin()
DockTitle
null
. However, some features will only work correctly
if this value is not null
.
getOrigin
in interface DockTitle
null
public void setForeground(java.awt.Color fg)
setForeground
in class javax.swing.JComponent
public void setBackground(java.awt.Color fg)
setBackground
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
protected java.awt.Insets getInnerInsets()
null
private java.awt.Insets titleInsets()
public void doLayout()
doLayout
in class java.awt.Container
public java.awt.Component getComponent()
DockTitle
DockTitle
.
The Component is displayed aside the owner of this title.
This method must always return the same Component.
getComponent
in interface DockTitle
public void addMouseInputListener(javax.swing.event.MouseInputListener listener)
DockTitle
Components
of this title
which are visible and which may be "grabbed" by the mouse.
addMouseInputListener
in interface DockTitle
listener
- the new listenerpublic void removeMouseInputListener(javax.swing.event.MouseInputListener listener)
DockTitle
removeMouseInputListener
in interface DockTitle
listener
- the listener to removepublic java.awt.Point getPopupLocation(java.awt.Point click)
DockTitle
click
with the mouse. If yes, then the top left edge
of the popup should be returned, otherwise null
should be
returned.
getPopupLocation
in interface DockTitle
click
- the location where the user clicked with the mouse
null
if no
popup-menu should be openedpublic Dockable getDockable()
DockTitle
getDockable
in interface DockTitle
public void setActive(boolean active)
active
- true
if the Dockable
of this title
has the focus.public void changed(DockTitleEvent event)
DockTitle
changed
in interface DockTitle
event
- information about the current statepublic boolean isActive()
DockTitle
changed
.
isActive
in interface DockTitle
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
protected BasicTitleViewItem<javax.swing.JComponent> createItemFor(DockAction action, Dockable dockable)
action
which will be shown on this title.
action
- The action which will be triggered by the buttondockable
- The Dockable
which will be affected by the action
public void bind()
DockTitle
DockActions
(see the method
DockController.listOffers(Dockable)
), then this method
should bind
them too.Dockable
.Dockable.bind(DockTitle)
. The DockController
will call the bind-method, as soon as the Dockable knows the controller.
bind
in interface DockTitle
public void unbind()
DockTitle
DockTitle.bind()
. The title should remove any connections
to other objects and unbind
its
DockActions.Dockable
.Dockable.unbind(DockTitle)
. The DockController
will call the unbind-method before the Dockable looses the controller.
unbind
in interface DockTitle
public boolean isBinded()
Dockable
or not.
binded
, false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |