com.openindex.openestate.tool.utils.tabs
Class CloseTabPaneUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.TabbedPaneUI
          extended by javax.swing.plaf.basic.BasicTabbedPaneUI
              extended by com.openindex.openestate.tool.utils.tabs.CloseTabPaneUI
All Implemented Interfaces:
SwingConstants
Direct Known Subclasses:
CloseTabPaneEclipseUI, CloseTabPaneEnhancedUI

public class CloseTabPaneUI
extends BasicTabbedPaneUI

UI for CloseAndMaxTabbedPane.
$Id: CloseTabPaneUI.java 1829 2012-10-14 14:24:52Z andy $

Author:
Amy Fowler, Philip Milne, Steve Wilson, Tom Santos, Dave Moore, David Bismut, davidou@mageos.com, Andreas Rudolph

Nested Class Summary
protected  class CloseTabPaneUI.ScrollableTabButton
           
 class CloseTabPaneUI.TabSelectionHandler
          This inner class is marked "public" due to a compiler bug.
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabbedPaneLayout
 
Field Summary
protected  JPopupMenu actionPopupMenu
           
protected static int BUTTONSIZE
           
protected  JMenuItem closeItem
           
protected  JMenuItem maxItem
           
protected  com.openindex.openestate.tool.utils.tabs.CloseTabPaneUI.MyMouseMotionListener motionListener
           
protected  com.openindex.openestate.tool.utils.tabs.CloseTabPaneUI.ScrollableTabSupport tabScroller
           
protected static int WIDTHDELTA
           
 
Fields inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
calcRect, contentBorderInsets, darkShadow, downKey, focus, focusListener, highlight, leftKey, lightHighlight, maxTabHeight, maxTabWidth, mouseListener, propertyChangeListener, rects, rightKey, runCount, selectedRun, selectedTabPadInsets, shadow, tabAreaInsets, tabChangeListener, tabInsets, tabPane, tabRunOverlay, tabRuns, textIconGap, upKey
 
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
 
Constructor Summary
CloseTabPaneUI()
           
 
Method Summary
protected  int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
           
protected  int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
           
protected  ChangeListener createChangeListener()
           
protected  LayoutManager createLayoutManager()
          Invoked by installUI to create a layout manager object to manage the JTabbedPane.
protected  MouseListener createMouseListener()
           
protected  CloseTabPaneUI.ScrollableTabButton createScrollableTabButton(int direction)
           
static ComponentUI createUI(JComponent c)
           
protected  Insets getContentBorderInsets(int tabPlacement)
           
 int getOverTabIndex()
           
protected  String getShortTitle(String title)
           
protected  Rectangle getTabBounds(int tabIndex, Rectangle dest)
          Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component.
protected  void installComponents()
          Creates and installs any required subcomponents for the JTabbedPane.
protected  void installKeyboardActions()
           
protected  void installListeners()
           
 boolean isCloseEnabled()
           
 boolean isMaxEnabled()
           
protected  boolean isOneActionButtonEnabled()
           
protected  void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
           
protected  Rectangle newCloseRect(Rectangle rect)
           
protected  Rectangle newMaxRect(Rectangle rect)
           
 void paint(Graphics g, JComponent c)
           
protected  void paintActionButton(Graphics g, int dx, int dy, int status, boolean isOver, JButton button, BufferedImage image)
           
protected  void paintCloseIcon(Graphics g, int dx, int dy, boolean isOver)
           
protected  void paintMaxIcon(Graphics g, int dx, int dy, boolean isOver)
           
protected  void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
           
 void scroll(int tab)
           
 void setCloseIcon(boolean b)
           
 void setCloseIconImage(BufferedImage img)
           
 void setMaxIcon(boolean b)
           
 void setMaxIconImage(BufferedImage img)
           
protected  void uninstallComponents()
          Removes any installed subcomponents from the JTabbedPane.
protected  void uninstallKeyboardActions()
           
protected  void uninstallListeners()
           
protected  void updateCloseIcon(int x, int y)
           
protected  void updateMaxIcon(int x, int y)
           
protected  void updateOverTab(int x, int y)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabHeight, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, createFocusListener, createPropertyChangeListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineOffset, getBaselineResizeBehavior, getFocusIndex, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabInsets, getTabLabelShiftX, getTabLabelShiftY, getTabRunCount, getTabRunIndent, getTabRunOffset, getTabRunOverlay, getTextViewForTab, getVisibleComponent, installDefaults, installUI, lastTabInRun, navigateSelectedTab, paintContentBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintFocusIndicator, paintIcon, paintTabArea, paintTabBackground, paintTabBorder, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldPadTabRun, shouldRotateTabRuns, tabForCoordinate, uninstallDefaults, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tabScroller

protected com.openindex.openestate.tool.utils.tabs.CloseTabPaneUI.ScrollableTabSupport tabScroller

motionListener

protected com.openindex.openestate.tool.utils.tabs.CloseTabPaneUI.MyMouseMotionListener motionListener

BUTTONSIZE

protected static final int BUTTONSIZE
See Also:
Constant Field Values

WIDTHDELTA

protected static final int WIDTHDELTA
See Also:
Constant Field Values

actionPopupMenu

protected JPopupMenu actionPopupMenu

maxItem

protected JMenuItem maxItem

closeItem

protected JMenuItem closeItem
Constructor Detail

CloseTabPaneUI

public CloseTabPaneUI()
Method Detail

getContentBorderInsets

protected Insets getContentBorderInsets(int tabPlacement)
Overrides:
getContentBorderInsets in class BasicTabbedPaneUI

isOneActionButtonEnabled

protected boolean isOneActionButtonEnabled()

isCloseEnabled

public boolean isCloseEnabled()

isMaxEnabled

public boolean isMaxEnabled()

scroll

public void scroll(int tab)

setCloseIcon

public void setCloseIcon(boolean b)

setCloseIconImage

public void setCloseIconImage(BufferedImage img)

setMaxIcon

public void setMaxIcon(boolean b)

setMaxIconImage

public void setMaxIconImage(BufferedImage img)

calculateTabWidth

protected int calculateTabWidth(int tabPlacement,
                                int tabIndex,
                                FontMetrics metrics)
Overrides:
calculateTabWidth in class BasicTabbedPaneUI

calculateTabHeight

protected int calculateTabHeight(int tabPlacement,
                                 int tabIndex,
                                 int fontHeight)
Overrides:
calculateTabHeight in class BasicTabbedPaneUI

layoutLabel

protected void layoutLabel(int tabPlacement,
                           FontMetrics metrics,
                           int tabIndex,
                           String title,
                           Icon icon,
                           Rectangle tabRect,
                           Rectangle iconRect,
                           Rectangle textRect,
                           boolean isSelected)
Overrides:
layoutLabel in class BasicTabbedPaneUI

createMouseListener

protected MouseListener createMouseListener()
Overrides:
createMouseListener in class BasicTabbedPaneUI

createScrollableTabButton

protected CloseTabPaneUI.ScrollableTabButton createScrollableTabButton(int direction)

newCloseRect

protected Rectangle newCloseRect(Rectangle rect)

newMaxRect

protected Rectangle newMaxRect(Rectangle rect)

updateOverTab

protected void updateOverTab(int x,
                             int y)

updateCloseIcon

protected void updateCloseIcon(int x,
                               int y)

updateMaxIcon

protected void updateMaxIcon(int x,
                             int y)

createUI

public static ComponentUI createUI(JComponent c)

createLayoutManager

protected LayoutManager createLayoutManager()
Invoked by installUI to create a layout manager object to manage the JTabbedPane.

Overrides:
createLayoutManager in class BasicTabbedPaneUI
Returns:
a layout manager object
See Also:
TabbedPaneLayout, JTabbedPane.getTabLayoutPolicy()

installComponents

protected void installComponents()
Creates and installs any required subcomponents for the JTabbedPane. Invoked by installUI.

Overrides:
installComponents in class BasicTabbedPaneUI
Since:
1.4

uninstallComponents

protected void uninstallComponents()
Removes any installed subcomponents from the JTabbedPane. Invoked by uninstallUI.

Overrides:
uninstallComponents in class BasicTabbedPaneUI
Since:
1.4

installListeners

protected void installListeners()
Overrides:
installListeners in class BasicTabbedPaneUI

uninstallListeners

protected void uninstallListeners()
Overrides:
uninstallListeners in class BasicTabbedPaneUI

createChangeListener

protected ChangeListener createChangeListener()
Overrides:
createChangeListener in class BasicTabbedPaneUI

installKeyboardActions

protected void installKeyboardActions()
Overrides:
installKeyboardActions in class BasicTabbedPaneUI

uninstallKeyboardActions

protected void uninstallKeyboardActions()
Overrides:
uninstallKeyboardActions in class BasicTabbedPaneUI

paint

public void paint(Graphics g,
                  JComponent c)
Overrides:
paint in class BasicTabbedPaneUI

paintTab

protected void paintTab(Graphics g,
                        int tabPlacement,
                        Rectangle[] rects,
                        int tabIndex,
                        Rectangle iconRect,
                        Rectangle textRect)
Overrides:
paintTab in class BasicTabbedPaneUI

paintCloseIcon

protected void paintCloseIcon(Graphics g,
                              int dx,
                              int dy,
                              boolean isOver)

paintMaxIcon

protected void paintMaxIcon(Graphics g,
                            int dx,
                            int dy,
                            boolean isOver)

paintActionButton

protected void paintActionButton(Graphics g,
                                 int dx,
                                 int dy,
                                 int status,
                                 boolean isOver,
                                 JButton button,
                                 BufferedImage image)

getShortTitle

protected String getShortTitle(String title)

getTabBounds

protected Rectangle getTabBounds(int tabIndex,
                                 Rectangle dest)
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component. This is required because the tab rects are by default defined in the coordinate space of the component where they are rendered, which could be the JTabbedPane (for WRAP_TAB_LAYOUT) or a ScrollableTabPanel (SCROLL_TAB_LAYOUT). This method should be used whenever the tab rectangle must be relative to the JTabbedPane itself and the result should be placed in a designated Rectangle object (rather than instantiating and returning a new Rectangle each time). The tab index parameter must be a valid tabbed pane tab index (0 to tab count - 1, inclusive). The destination rectangle parameter must be a valid Rectangle instance. The handling of invalid parameters is unspecified.

Overrides:
getTabBounds in class BasicTabbedPaneUI
Parameters:
tabIndex - the index of the tab
dest - the rectangle where the result should be placed
Returns:
the resulting rectangle
Since:
1.4

getOverTabIndex

public int getOverTabIndex()


Copyright © 2012 OpenEstate. All Rights Reserved.