bibliothek.extension.gui.dock.theme.bubble
Class BubbleTab

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by bibliothek.extension.gui.dock.theme.bubble.BubbleTab
All Implemented Interfaces:
DockElementRepresentative, DockableFocusListener, CombinedTab, Tab, TabPaneComponent, ImageObserver, MenuContainer, Serializable, Runnable, EventListener, Accessible, ChangeListener

@ColorCodes(value={"stack.tab.background.top.mouse","stack.tab.background.bottom.mouse","stack.tab.border.mouse","stack.tab.foreground.mouse","stack.tab.background.top","stack.tab.background.bottom","stack.tab.border","stack.tab.foreground","stack.tab.background.top.selected.mouse","stack.tab.background.bottom.selected.mouse","stack.tab.border.selected.mouse","stack.tab.foreground.selected.mouse","stack.tab.background.top.selected","stack.tab.background.bottom.selected","stack.tab.border.selected","stack.tab.foreground.selected","stack.tab.background.top.focused.mouse","stack.tab.background.bottom.focused.mouse","stack.tab.border.focused.mouse","stack.tab.foreground.focused.mouse","stack.tab.background.top.focused","stack.tab.background.bottom.focused","stack.tab.border.focused","stack.tab.foreground.focused"})
public class BubbleTab
extends JPanel
implements CombinedTab, ChangeListener, Runnable, DockableFocusListener

A Tab used by the BubbleStackDockComponent.

Author:
Benjamin Sigg
See Also:
Serialized Form

Nested Class Summary
protected  class BubbleTab.BubbleTabColor
          Some color needed on a Tab.
protected  class BubbleTab.BubbleTabFont
          Some font needed on a Tab
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
BubbleTab(BubbleStackDockComponent parent, Dockable dockable)
          Creates a new tab
 
Method Summary
 void addMouseInputListener(MouseInputListener listener)
          Adds a listener to this representative, it is not defined what to do with that listener, but most subclasses would just add the listener to their component.
 void dockableFocused(DockableFocusEvent event)
          Invoked when dockable has gained the focus.
 void doLayout()
           
 JComponent getComponent()
          Gets the Component which represents the element.
 Dockable getDockable()
          Gets the element that is associated with this tab.
 DockElement getElement()
          Gets the element which is represented by this.
 Dimension getMinimumSize()
          Gets the minimal size this component should have
 Dimension getMinimumSize(Tab[] tabs)
          Gets the minimum size of this tab under the assumption that this tab is displayed together with tabs.
 Insets getOverlap(TabPaneComponent other)
          Tells how much of this component may be overlapped by another component other.
 Point getPopupLocation(Point click, boolean popupTrigger)
          Tells whether a popup menu should be opened when the user clicks at click with the mouse.
 Dimension getPreferredSize()
          Gets the preferred size of this component
 Dimension getPreferredSize(Tab[] tabs)
          Gets the preferred size of this tab under the assumption that this tab is displayed together with tabs.
 int getState()
           
 TabPane getTabParent()
          Gets the parent of this component.
 int getZOrder()
          Gets the value of the z order.
 boolean isPaneVisible()
          Tells whether this component is visible or not.
 boolean isUsedAsTitle()
          Tells whether this DockElementRepresentative is used as title.
protected  void paintChildren(Graphics g)
           
 void paintComponent(Graphics g)
           
 void removeMouseInputListener(MouseInputListener listener)
          Removes a listener from this representative.
 void run()
           
 void setController(DockController controller)
           
 void setIcon(Icon icon)
          Sets the image of this tab.
 void setOrientation(TabPlacement orientation)
          Tells this component how to paint itself.
 void setPaneVisible(boolean visible)
          Changes the visibility state of this component.
 void setText(String text)
          Sets the text of this tab.
 void setTooltip(String tooltip)
          Sets the tooltip of this tab.
 void setZOrder(int order)
          Sets the z order of this component.
 void stateChanged(ChangeEvent e)
           
 void stopAnimation()
          Stops the animation of this tab.
 void updateFonts()
          Ensures that the correct font modifier is used.
 
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, 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, 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
 
Methods inherited from interface bibliothek.gui.dock.station.stack.tab.TabPaneComponent
getBounds, getMaximumSize, setBounds
 

Constructor Detail

BubbleTab

public BubbleTab(BubbleStackDockComponent parent,
                 Dockable dockable)
Creates a new tab

Parameters:
parent - the owner of this tab
dockable - the element whose title will be shown on this tab
Method Detail

getTabParent

public TabPane getTabParent()
Description copied from interface: TabPaneComponent
Gets the parent of this component.

Specified by:
getTabParent in interface TabPaneComponent
Returns:
the parent

getDockable

public Dockable getDockable()
Description copied from interface: Tab
Gets the element that is associated with this tab.

Specified by:
getDockable in interface Tab
Returns:
the element

getPopupLocation

public Point getPopupLocation(Point click,
                              boolean popupTrigger)
Description copied from interface: DockElementRepresentative
Tells whether a popup menu should be opened when the user clicks at click with the mouse. If yes, then the top left edge of the popup should be returned, otherwise null should be returned.

Specified by:
getPopupLocation in interface DockElementRepresentative
Parameters:
click - the location where the user clicked with the mouse
popupTrigger - whether the invocation is the systems popup trigger or not. Many implementations of this method will return click in case of true, and null in case of false
Returns:
the preferred location of a popup or null if no popup-menu should be opened

setTooltip

public void setTooltip(String tooltip)
Description copied from interface: CombinedTab
Sets the tooltip of this tab.

Specified by:
setTooltip in interface CombinedTab
Parameters:
tooltip - the tooltip text, can be null

setPaneVisible

public void setPaneVisible(boolean visible)
Description copied from interface: TabPaneComponent
Changes the visibility state of this component. Invisible components should be removed from any parent.

Specified by:
setPaneVisible in interface TabPaneComponent
Parameters:
visible - the new state

isPaneVisible

public boolean isPaneVisible()
Description copied from interface: TabPaneComponent
Tells whether this component is visible or not.

Specified by:
isPaneVisible in interface TabPaneComponent
Returns:
true if visible, false otherwise

setOrientation

public void setOrientation(TabPlacement orientation)
Description copied from interface: TabPaneComponent
Tells this component how to paint itself.

Specified by:
setOrientation in interface TabPaneComponent
Parameters:
orientation - the orientation, not null

getState

public int getState()

setController

public void setController(DockController controller)

setZOrder

public void setZOrder(int order)
Description copied from interface: TabPaneComponent
Sets the z order of this component. The z order tells which component to paint first, as lower the order as earlier a component is to be painted. If two components overlap, then the one with the higher z order appears in front of the one with the lower z order. If two components have the same z order, then it is unspecified which component is painted first.
A z-order is at least 0 and must not exceed the number of TabPaneComponents on the parent TabPane. The implementation may increase or decrease z-orders to prevent collisions between components with the same order.

Specified by:
setZOrder in interface TabPaneComponent
Parameters:
order - the order, can be any integer.

getZOrder

public int getZOrder()
Description copied from interface: TabPaneComponent
Gets the value of the z order.

Specified by:
getZOrder in interface TabPaneComponent
Returns:
the z order
See Also:
TabPaneComponent.setZOrder(int)

getOverlap

public Insets getOverlap(TabPaneComponent other)
Description copied from interface: TabPaneComponent
Tells how much of this component may be overlapped by another component other.

Specified by:
getOverlap in interface TabPaneComponent
Parameters:
other - another component which may be painted over this component
Returns:
the border of this component that may not be visible, not null

dockableFocused

public void dockableFocused(DockableFocusEvent event)
Description copied from interface: DockableFocusListener
Invoked when dockable has gained the focus.

Specified by:
dockableFocused in interface DockableFocusListener
Parameters:
event - an event that contains the new owner of the focus

run

public void run()
Specified by:
run in interface Runnable

getPreferredSize

public Dimension getPreferredSize(Tab[] tabs)
Description copied from interface: Tab
Gets the preferred size of this tab under the assumption that this tab is displayed together with tabs.

Specified by:
getPreferredSize in interface Tab
Parameters:
tabs - the displayed tabs, exactly one entry is this and no entry is null
Returns:
the preferred size of this tab

getPreferredSize

public Dimension getPreferredSize()
Description copied from interface: TabPaneComponent
Gets the preferred size of this component

Specified by:
getPreferredSize in interface TabPaneComponent
Overrides:
getPreferredSize in class JComponent
Returns:
the preferred size

getMinimumSize

public Dimension getMinimumSize(Tab[] tabs)
Description copied from interface: Tab
Gets the minimum size of this tab under the assumption that this tab is displayed together with tabs.

Specified by:
getMinimumSize in interface Tab
Parameters:
tabs - the displayed tabs, exactly one entry is this and no entry is null
Returns:
the minimum size of this tab

getMinimumSize

public Dimension getMinimumSize()
Description copied from interface: TabPaneComponent
Gets the minimal size this component should have

Specified by:
getMinimumSize in interface TabPaneComponent
Overrides:
getMinimumSize in class JComponent
Returns:
the minimal size

doLayout

public void doLayout()
Overrides:
doLayout in class Container

paintComponent

public void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

paintChildren

protected void paintChildren(Graphics g)
Overrides:
paintChildren in class JComponent

getComponent

public JComponent getComponent()
Description copied from interface: DockElementRepresentative
Gets the Component which represents the element. The result of this method must not change.

Specified by:
getComponent in interface DockElementRepresentative
Specified by:
getComponent in interface CombinedTab
Returns:
the component, never null

getElement

public DockElement getElement()
Description copied from interface: DockElementRepresentative
Gets the element which is represented by this. The result of this method must not change.

Specified by:
getElement in interface DockElementRepresentative
Returns:
the element, never null

isUsedAsTitle

public boolean isUsedAsTitle()
Description copied from interface: DockElementRepresentative
Tells whether this DockElementRepresentative is used as title.
Some modules grant more rights to titles than to non-titles, i.e. a DockRelocator can allow drag & drop only for titles.
Normally a Dockable should have only one element that is a title, so if in doubt return false.

Specified by:
isUsedAsTitle in interface DockElementRepresentative
Returns:
true if this representative should be seen as title

addMouseInputListener

public void addMouseInputListener(MouseInputListener listener)
Description copied from interface: DockElementRepresentative
Adds a listener to this representative, it is not defined what to do with that listener, but most subclasses would just add the listener to their component. It is valid to do nothing.

Specified by:
addMouseInputListener in interface DockElementRepresentative
Parameters:
listener - the new listener

removeMouseInputListener

public void removeMouseInputListener(MouseInputListener listener)
Description copied from interface: DockElementRepresentative
Removes a listener from this representative.

Specified by:
removeMouseInputListener in interface DockElementRepresentative
Parameters:
listener - the listener to remove

stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener

updateFonts

public void updateFonts()
Ensures that the correct font modifier is used.


setIcon

public void setIcon(Icon icon)
Description copied from interface: CombinedTab
Sets the image of this tab.

Specified by:
setIcon in interface CombinedTab
Parameters:
icon - an icon that should be shown, can be null

setText

public void setText(String text)
Description copied from interface: CombinedTab
Sets the text of this tab.

Specified by:
setText in interface CombinedTab
Parameters:
text - the text to display

stopAnimation

public void stopAnimation()
Stops the animation of this tab.