Class RadianceTabbedPaneUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TabbedPaneUI
-
- javax.swing.plaf.basic.BasicTabbedPaneUI
-
- org.pushingpixels.radiance.theming.internal.ui.RadianceTabbedPaneUI
-
- All Implemented Interfaces:
javax.swing.SwingConstants
public class RadianceTabbedPaneUI extends javax.swing.plaf.basic.BasicTabbedPaneUIUI for tabbed panes in Radiance look and feel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRadianceTabbedPaneUI.MouseRolloverHandlerListener for rollover animation effects.private classRadianceTabbedPaneUI.TabbedContainerListenerTracks changes to the tabbed pane contents.classRadianceTabbedPaneUI.TabbedPaneLayoutLayout for the tabbed pane.private static classRadianceTabbedPaneUI.TabbedPaneScrollButtonprivate static classRadianceTabbedPaneUI.TabOutlinePainterDarkprivate static classRadianceTabbedPaneUI.TabOutlinePainterLightprotected classRadianceTabbedPaneUI.TabRepaintCallbackImplementation of the fade tracker callback that repaints a single tab.-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
javax.swing.plaf.basic.BasicTabbedPaneUI.FocusHandler, javax.swing.plaf.basic.BasicTabbedPaneUI.MouseHandler, javax.swing.plaf.basic.BasicTabbedPaneUI.PropertyChangeHandler, javax.swing.plaf.basic.BasicTabbedPaneUI.TabSelectionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private intcurrSelectedIndexCurrently selected index (for selection animations).private java.util.Map<java.awt.Component,Timeline>modifiedTimelinesKey - tab component.private BladeContainerColorTokensmutableColorTokensprivate RadianceTabbedPaneUI.TabbedContainerListenerradianceContainerListenerTracks changes to the tabbed pane contents.private booleanradianceContentOpaqueprivate java.awt.PointradianceMouseLocationCurrent mouse location.private RadianceTabbedPaneUI.MouseRolloverHandlerradianceRolloverHandlerMouse handler for rollover effects.private javax.swing.event.ChangeListenerradianceSelectionListenerListener for animation effects on tab selection.private StateTransitionMultiTracker<java.lang.Integer>stateTransitionMultiTrackerprivate java.util.Map<java.lang.Integer,java.awt.Color>tabTextColorMapprivate java.util.Set<RadianceThemingWidget<javax.swing.JComponent>>themingWidgets-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRadianceTabbedPaneUI()Creates the new UI delegate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcalculateMaxTabHeight(int tabPlacement)protected intcalculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)protected intcalculateTabWidth(int tabPlacement, int tabIndex, java.awt.FontMetrics metrics)protected java.awt.LayoutManagercreateLayoutManager()protected java.awt.event.MouseListenercreateMouseListener()protected javax.swing.JButtoncreateScrollButton(int direction)static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent comp)protected voidensureCurrentLayout()Ensures the current layout.protected java.awt.RectanglegetCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height)Retrieves the close button rectangle for drawing purposes.protected java.awt.RectanglegetCloseButtonRectangleForEvents(int tabIndex, int x, int y, int w, int h)Retrieves the close button rectangle for event handling.protected java.awt.InsetsgetContentBorderInsets(int tabPlacement)private StateTransitionTracker.ModelStateInfogetModelStateInfo(int tabIndex)private static RadianceOutlinePaintergetOutlinePainter(javax.swing.JTabbedPane tabPane, ContainerColorTokens colorTokens)intgetRolloverTabIndex()Returns the index of the tab currently being rolled-over.java.awt.InsetsgetTabAreaInsets()Returns tab area insets.java.awt.RectanglegetTabBounds(javax.swing.JTabbedPane pane, int i)protected intgetTabExtraWidth(int tabIndex)Returns extra width for the specified tab.protected intgetTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)protected intgetTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)java.awt.RectanglegetTabRectangle(int tabIndex)Returns the tab rectangle for the specified tab.protected intgetTabRunOverlay(int tabPlacement)protected ComponentStategetTabState(int tabIndex, boolean toAllowIgnoringSelectedState)Returns the current state for the specified tab.private StateTransitionTrackergetTracker(int tabIndex, boolean initialRollover, boolean initialSelected)protected voidinstallComponents()protected voidinstallDefaults()protected voidinstallListeners()voidinstallUI(javax.swing.JComponent c)voidpaint(java.awt.Graphics g, javax.swing.JComponent c)private voidpaintCloseButtonImage(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int width, int height, boolean toPaintBorder, ContainerColorTokens colorTokens)Retrieves the image of the close button.protected voidpaintContentBorderBottomEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)protected voidpaintContentBorderLeftEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)protected voidpaintContentBorderRightEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)protected voidpaintContentBorderTopEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)protected voidpaintFocusIndicator(java.awt.Graphics g, int tabPlacement, java.awt.Rectangle[] rects, int tabIndex, java.awt.Rectangle iconRect, java.awt.Rectangle textRect, boolean isSelected)protected voidpaintIcon(java.awt.Graphics g, int tabPlacement, int tabIndex, javax.swing.Icon icon, java.awt.Rectangle iconRect, boolean isSelected)private voidpaintRotationAwareTabBackground(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int tabIndex, int width, int height, int tabPlacement, ContainerColorTokens colorTokens)protected voidpaintTab(java.awt.Graphics g, int tabPlacement, java.awt.Rectangle[] rects, int tabIndex, java.awt.Rectangle iconRect, java.awt.Rectangle textRect)protected voidpaintTabArea(java.awt.Graphics g, int tabPlacement, int selectedIndex)protected voidpaintTabBackground(java.awt.Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)private static voidpaintTabBackgroundAt1X(java.awt.Graphics2D graphics1X, javax.swing.JTabbedPane tabPane, int tabIndex, double scaleFactor, int width, int height, ContainerColorTokens colorTokens, java.awt.Color tabColor)protected voidpaintTabBorder(java.awt.Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)protected voidpaintText(java.awt.Graphics g, int tabPlacement, java.awt.Font font, java.awt.FontMetrics metrics, int tabIndex, java.lang.String title, java.awt.Rectangle textRect, boolean isSelected)voidsetTabAreaInsets(java.awt.Insets insets)Sets new value for tab area insets.protected booleanshouldPadTabRun(int tabPlacement, int run)protected booleantoRotateTabsOnPlacement(int tabPlacement)Extension point to allow horizontal orientation of left / right placed tabs.private voidtrackTabModification(int tabIndex, java.awt.Component tabComponent)protected voidtryCloseTab(int tabIndex)Tries closing a single tab.protected voidtryCloseTabs(int tabIndex, RadianceThemingSlices.TabCloseKind tabCloseKind)Tries closing tabs based on the specified tab index and tab close kind.protected voidtryCloseTabs(java.util.Set<java.lang.Integer> tabIndexes)Tries closing the specified tabs.protected voiduninstallComponents()protected voiduninstallDefaults()protected voiduninstallListeners()voiduninstallUI(javax.swing.JComponent c)voidupdate(java.awt.Graphics g, javax.swing.JComponent c)-
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, createChangeListener, createFocusListener, createPropertyChangeListener, expandTabRunsArray, getBaseline, getBaseline, getBaselineOffset, getBaselineResizeBehavior, getFocusIndex, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabInsets, getTabRunCount, getTabRunIndent, getTabRunOffset, getTextViewForTab, getVisibleComponent, installKeyboardActions, lastTabInRun, layoutLabel, navigateSelectedTab, paintContentBorder, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldRotateTabRuns, tabForCoordinate, uninstallKeyboardActions
-
-
-
-
Field Detail
-
radianceMouseLocation
private java.awt.Point radianceMouseLocation
Current mouse location.
-
modifiedTimelines
private java.util.Map<java.awt.Component,Timeline> modifiedTimelines
Key - tab component. Value - the looping timeline that animates the tab component when it's marked as modified (withRadianceSynapse.CONTENTS_MODIFIEDproperty).
-
currSelectedIndex
private int currSelectedIndex
Currently selected index (for selection animations).
-
stateTransitionMultiTracker
private StateTransitionMultiTracker<java.lang.Integer> stateTransitionMultiTracker
-
themingWidgets
private java.util.Set<RadianceThemingWidget<javax.swing.JComponent>> themingWidgets
-
radianceRolloverHandler
private RadianceTabbedPaneUI.MouseRolloverHandler radianceRolloverHandler
Mouse handler for rollover effects.
-
radianceContainerListener
private RadianceTabbedPaneUI.TabbedContainerListener radianceContainerListener
Tracks changes to the tabbed pane contents. Each tab component is tracked for changes on theRadianceSynapse.CONTENTS_MODIFIEDproperty.
-
radianceSelectionListener
private javax.swing.event.ChangeListener radianceSelectionListener
Listener for animation effects on tab selection.
-
radianceContentOpaque
private boolean radianceContentOpaque
-
tabTextColorMap
private java.util.Map<java.lang.Integer,java.awt.Color> tabTextColorMap
-
mutableColorTokens
private BladeContainerColorTokens mutableColorTokens
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)
-
installUI
public void installUI(javax.swing.JComponent c)
- Overrides:
installUIin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUIin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
installListeners
protected void installListeners()
- Overrides:
installListenersin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListenersin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaultsin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallDefaults
protected void uninstallDefaults()
- Overrides:
uninstallDefaultsin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
installComponents
protected void installComponents()
- Overrides:
installComponentsin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallComponents
protected void uninstallComponents()
- Overrides:
uninstallComponentsin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getOutlinePainter
private static RadianceOutlinePainter getOutlinePainter(javax.swing.JTabbedPane tabPane, ContainerColorTokens colorTokens)
-
paintTabBackgroundAt1X
private static void paintTabBackgroundAt1X(java.awt.Graphics2D graphics1X, javax.swing.JTabbedPane tabPane, int tabIndex, double scaleFactor, int width, int height, ContainerColorTokens colorTokens, java.awt.Color tabColor)
-
paintRotationAwareTabBackground
private void paintRotationAwareTabBackground(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int tabIndex, int width, int height, int tabPlacement, ContainerColorTokens colorTokens)
-
paintCloseButtonImage
private void paintCloseButtonImage(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int width, int height, boolean toPaintBorder, ContainerColorTokens colorTokens)Retrieves the image of the close button.
-
paintTabBackground
protected void paintTabBackground(java.awt.Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)- Overrides:
paintTabBackgroundin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintFocusIndicator
protected void paintFocusIndicator(java.awt.Graphics g, int tabPlacement, java.awt.Rectangle[] rects, int tabIndex, java.awt.Rectangle iconRect, java.awt.Rectangle textRect, boolean isSelected)- Overrides:
paintFocusIndicatorin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintTabBorder
protected void paintTabBorder(java.awt.Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)- Overrides:
paintTabBorderin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
createScrollButton
protected javax.swing.JButton createScrollButton(int direction)
- Overrides:
createScrollButtonin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)- Overrides:
calculateTabHeightin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
calculateTabWidth
protected int calculateTabWidth(int tabPlacement, int tabIndex, java.awt.FontMetrics metrics)- Overrides:
calculateTabWidthin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement)
- Overrides:
calculateMaxTabHeightin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabRunOverlay
protected int getTabRunOverlay(int tabPlacement)
- Overrides:
getTabRunOverlayin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)- Overrides:
paintin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintTab
protected void paintTab(java.awt.Graphics g, int tabPlacement, java.awt.Rectangle[] rects, int tabIndex, java.awt.Rectangle iconRect, java.awt.Rectangle textRect)- Overrides:
paintTabin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintTabArea
protected void paintTabArea(java.awt.Graphics g, int tabPlacement, int selectedIndex)- Overrides:
paintTabAreain classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getCloseButtonRectangleForDraw
protected java.awt.Rectangle getCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height)Retrieves the close button rectangle for drawing purposes.- Parameters:
tabIndex- Tab index.x- X coordinate of the tab.y- Y coordinate of the tab.width- The tab width.height- The tab height.- Returns:
- The close button rectangle.
-
getCloseButtonRectangleForEvents
protected java.awt.Rectangle getCloseButtonRectangleForEvents(int tabIndex, int x, int y, int w, int h)Retrieves the close button rectangle for event handling.- Parameters:
tabIndex- Tab index.x- X coordinate of the tab.y- Y coordinate of the tab.w- The tab width.h- The tab height.- Returns:
- The close button rectangle.
-
ensureCurrentLayout
protected void ensureCurrentLayout()
Ensures the current layout.
-
tryCloseTabs
protected void tryCloseTabs(int tabIndex, RadianceThemingSlices.TabCloseKind tabCloseKind)Tries closing tabs based on the specified tab index and tab close kind.- Parameters:
tabIndex- Tab index.tabCloseKind- Tab close kind.
-
tryCloseTab
protected void tryCloseTab(int tabIndex)
Tries closing a single tab.- Parameters:
tabIndex- Tab index.
-
tryCloseTabs
protected void tryCloseTabs(java.util.Set<java.lang.Integer> tabIndexes)
Tries closing the specified tabs.- Parameters:
tabIndexes- Tab indexes.
-
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)- Overrides:
getTabLabelShiftXin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)- Overrides:
getTabLabelShiftYin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabExtraWidth
protected int getTabExtraWidth(int tabIndex)
Returns extra width for the specified tab.- Parameters:
tabIndex- Tab index.- Returns:
- Extra width for the specified tab.
-
getRolloverTabIndex
public int getRolloverTabIndex()
Returns the index of the tab currently being rolled-over.- Returns:
- Index of the tab currently being rolled-over.
-
setTabAreaInsets
public void setTabAreaInsets(java.awt.Insets insets)
Sets new value for tab area insets.- Parameters:
insets- Tab area insets.
-
getTabAreaInsets
public java.awt.Insets getTabAreaInsets()
Returns tab area insets.- Returns:
- Tab area insets.
-
getTabRectangle
public java.awt.Rectangle getTabRectangle(int tabIndex)
Returns the tab rectangle for the specified tab.- Parameters:
tabIndex- Index of a tab.- Returns:
- The tab rectangle for the specified parameters.
-
shouldPadTabRun
protected boolean shouldPadTabRun(int tabPlacement, int run)- Overrides:
shouldPadTabRunin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
createLayoutManager
protected java.awt.LayoutManager createLayoutManager()
- Overrides:
createLayoutManagerin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getContentBorderInsets
protected java.awt.Insets getContentBorderInsets(int tabPlacement)
- Overrides:
getContentBorderInsetsin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintContentBorderBottomEdge
protected void paintContentBorderBottomEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)- Overrides:
paintContentBorderBottomEdgein classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintContentBorderLeftEdge
protected void paintContentBorderLeftEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)- Overrides:
paintContentBorderLeftEdgein classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintContentBorderRightEdge
protected void paintContentBorderRightEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)- Overrides:
paintContentBorderRightEdgein classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintContentBorderTopEdge
protected void paintContentBorderTopEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)- Overrides:
paintContentBorderTopEdgein classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabBounds
public java.awt.Rectangle getTabBounds(javax.swing.JTabbedPane pane, int i)- Overrides:
getTabBoundsin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getModelStateInfo
private StateTransitionTracker.ModelStateInfo getModelStateInfo(int tabIndex)
-
getTabState
protected ComponentState getTabState(int tabIndex, boolean toAllowIgnoringSelectedState)
Returns the current state for the specified tab.- Parameters:
tabIndex- Tab index.- Returns:
- The current state for the specified tab.
-
paintText
protected void paintText(java.awt.Graphics g, int tabPlacement, java.awt.Font font, java.awt.FontMetrics metrics, int tabIndex, java.lang.String title, java.awt.Rectangle textRect, boolean isSelected)- Overrides:
paintTextin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintIcon
protected void paintIcon(java.awt.Graphics g, int tabPlacement, int tabIndex, javax.swing.Icon icon, java.awt.Rectangle iconRect, boolean isSelected)- Overrides:
paintIconin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
createMouseListener
protected java.awt.event.MouseListener createMouseListener()
- Overrides:
createMouseListenerin classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
toRotateTabsOnPlacement
protected boolean toRotateTabsOnPlacement(int tabPlacement)
Extension point to allow horizontal orientation of left / right placed tabs.- Parameters:
tabPlacement- Tab placement.- Returns:
- Indication whether the tabs in the specified placement should be rotated.
-
getTracker
private StateTransitionTracker getTracker(int tabIndex, boolean initialRollover, boolean initialSelected)
-
trackTabModification
private void trackTabModification(int tabIndex, java.awt.Component tabComponent)
-
update
public void update(java.awt.Graphics g, javax.swing.JComponent c)- Overrides:
updatein classjavax.swing.plaf.ComponentUI
-
-