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.BasicTabbedPaneUI
UI for tabbed panes in Radiance look and feel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
RadianceTabbedPaneUI.MouseRolloverHandler
Listener for rollover animation effects.private class
RadianceTabbedPaneUI.TabbedContainerListener
Tracks changes to the tabbed pane contents.class
RadianceTabbedPaneUI.TabbedPaneLayout
Layout for the tabbed pane.private static class
RadianceTabbedPaneUI.TabbedPaneScrollButton
protected class
RadianceTabbedPaneUI.TabRepaintCallback
Implementation 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 int
currSelectedIndex
Currently selected index (for selection animations).private java.util.Map<java.awt.Component,Timeline>
modifiedTimelines
Key - tab component.private BladeColorScheme
mutableBorderColorScheme
private BladeColorScheme
mutableFillColorScheme
private BladeColorScheme
mutableMarkColorScheme
private RadianceTabbedPaneUI.TabbedContainerListener
radianceContainerListener
Tracks changes to the tabbed pane contents.private boolean
radianceContentOpaque
private java.awt.Point
radianceMouseLocation
Current mouse location.private RadianceTabbedPaneUI.MouseRolloverHandler
radianceRolloverHandler
Mouse handler for rollover effects.private javax.swing.event.ChangeListener
radianceSelectionListener
Listener for animation effects on tab selection.private StateTransitionMultiTracker<java.lang.Integer>
stateTransitionMultiTracker
private java.util.Map<java.lang.Integer,java.awt.Color>
tabTextColorMap
private 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 protected
RadianceTabbedPaneUI()
Creates the new UI delegate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
calculateMaxTabHeight(int tabPlacement)
protected int
calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
protected int
calculateTabWidth(int tabPlacement, int tabIndex, java.awt.FontMetrics metrics)
protected java.awt.LayoutManager
createLayoutManager()
protected java.awt.event.MouseListener
createMouseListener()
protected javax.swing.JButton
createScrollButton(int direction)
static javax.swing.plaf.ComponentUI
createUI(javax.swing.JComponent comp)
protected void
ensureCurrentLayout()
Ensures the current layout.protected java.awt.Rectangle
getCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height)
Retrieves the close button rectangle for drawing purposes.protected java.awt.Rectangle
getCloseButtonRectangleForEvents(int tabIndex, int x, int y, int w, int h)
Retrieves the close button rectangle for event handling.protected java.awt.Insets
getContentBorderInsets(int tabPlacement)
private StateTransitionTracker.ModelStateInfo
getModelStateInfo(int tabIndex)
int
getRolloverTabIndex()
Returns the index of the tab currently being rolled-over.java.awt.Insets
getTabAreaInsets()
Returns tab area insets.java.awt.Rectangle
getTabBounds(javax.swing.JTabbedPane pane, int i)
protected int
getTabExtraWidth(int tabIndex)
Returns extra width for the specified tab.protected int
getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
protected int
getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
java.awt.Rectangle
getTabRectangle(int tabIndex)
Returns the tab rectangle for the specified tab.protected int
getTabRunOverlay(int tabPlacement)
protected ComponentState
getTabState(int tabIndex, boolean toAllowIgnoringSelectedState)
Returns the current state for the specified tab.private StateTransitionTracker
getTracker(int tabIndex, boolean initialRollover, boolean initialSelected)
protected void
installComponents()
protected void
installDefaults()
protected void
installListeners()
void
installUI(javax.swing.JComponent c)
void
paint(java.awt.Graphics g, javax.swing.JComponent c)
private void
paintCloseButtonImage(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int width, int height, boolean toPaintBorder, RadianceColorScheme fillScheme, RadianceColorScheme markScheme)
Retrieves the image of the close button.protected void
paintContentBorder(java.awt.Graphics g, int tabPlacement, int selectedIndex)
protected void
paintContentBorderBottomEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void
paintContentBorderLeftEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void
paintContentBorderRightEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void
paintContentBorderTopEdge(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
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)
protected void
paintIcon(java.awt.Graphics g, int tabPlacement, int tabIndex, javax.swing.Icon icon, java.awt.Rectangle iconRect, boolean isSelected)
private void
paintRotationAwareTabBackground(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int tabIndex, int width, int height, int tabPlacement, RadianceColorScheme colorScheme, RadianceColorScheme borderScheme)
protected void
paintTab(java.awt.Graphics g, int tabPlacement, java.awt.Rectangle[] rects, int tabIndex, java.awt.Rectangle iconRect, java.awt.Rectangle textRect)
protected void
paintTabArea(java.awt.Graphics g, int tabPlacement, int selectedIndex)
protected void
paintTabBackground(java.awt.Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
private static void
paintTabBackgroundAt1X(java.awt.Graphics2D graphics1X, javax.swing.JTabbedPane tabPane, int tabIndex, double scaleFactor, int width, int height, RadianceColorScheme fillScheme, RadianceColorScheme borderScheme, java.awt.Color tabColor)
protected void
paintTabBorder(java.awt.Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
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)
void
setTabAreaInsets(java.awt.Insets insets)
Sets new value for tab area insets.protected boolean
shouldPadTabRun(int tabPlacement, int run)
protected boolean
toRotateTabsOnPlacement(int tabPlacement)
Extension point to allow horizontal orientation of left / right placed tabs.private void
trackTabModification(int tabIndex, java.awt.Component tabComponent)
protected void
tryCloseTab(int tabIndex)
Tries closing a single tab.protected void
tryCloseTabs(int tabIndex, RadianceThemingSlices.TabCloseKind tabCloseKind)
Tries closing tabs based on the specified tab index and tab close kind.protected void
tryCloseTabs(java.util.Set<java.lang.Integer> tabIndexes)
Tries closing the specified tabs.protected void
uninstallComponents()
protected void
uninstallDefaults()
protected void
uninstallListeners()
void
uninstallUI(javax.swing.JComponent c)
void
update(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, 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_MODIFIED
property).
-
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_MODIFIED
property.
-
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
-
mutableFillColorScheme
private BladeColorScheme mutableFillColorScheme
-
mutableBorderColorScheme
private BladeColorScheme mutableBorderColorScheme
-
mutableMarkColorScheme
private BladeColorScheme mutableMarkColorScheme
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)
-
installUI
public void installUI(javax.swing.JComponent c)
- Overrides:
installUI
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUI
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
installListeners
protected void installListeners()
- Overrides:
installListeners
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListeners
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaults
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallDefaults
protected void uninstallDefaults()
- Overrides:
uninstallDefaults
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
installComponents
protected void installComponents()
- Overrides:
installComponents
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
uninstallComponents
protected void uninstallComponents()
- Overrides:
uninstallComponents
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintTabBackgroundAt1X
private static void paintTabBackgroundAt1X(java.awt.Graphics2D graphics1X, javax.swing.JTabbedPane tabPane, int tabIndex, double scaleFactor, int width, int height, RadianceColorScheme fillScheme, RadianceColorScheme borderScheme, java.awt.Color tabColor)
-
paintRotationAwareTabBackground
private void paintRotationAwareTabBackground(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int tabIndex, int width, int height, int tabPlacement, RadianceColorScheme colorScheme, RadianceColorScheme borderScheme)
-
paintCloseButtonImage
private void paintCloseButtonImage(java.awt.Graphics2D g, javax.swing.JTabbedPane tabPane, int width, int height, boolean toPaintBorder, RadianceColorScheme fillScheme, RadianceColorScheme markScheme)
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:
paintTabBackground
in 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:
paintFocusIndicator
in 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:
paintTabBorder
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
createScrollButton
protected javax.swing.JButton createScrollButton(int direction)
- Overrides:
createScrollButton
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
- Overrides:
calculateTabHeight
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
calculateTabWidth
protected int calculateTabWidth(int tabPlacement, int tabIndex, java.awt.FontMetrics metrics)
- Overrides:
calculateTabWidth
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement)
- Overrides:
calculateMaxTabHeight
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabRunOverlay
protected int getTabRunOverlay(int tabPlacement)
- Overrides:
getTabRunOverlay
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
- Overrides:
paint
in 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:
paintTab
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintTabArea
protected void paintTabArea(java.awt.Graphics g, int tabPlacement, int selectedIndex)
- Overrides:
paintTabArea
in 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:
getTabLabelShiftX
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
- Overrides:
getTabLabelShiftY
in 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:
shouldPadTabRun
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
createLayoutManager
protected java.awt.LayoutManager createLayoutManager()
- Overrides:
createLayoutManager
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getContentBorderInsets
protected java.awt.Insets getContentBorderInsets(int tabPlacement)
- Overrides:
getContentBorderInsets
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
paintContentBorder
protected void paintContentBorder(java.awt.Graphics g, int tabPlacement, int selectedIndex)
- Overrides:
paintContentBorder
in 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:
paintContentBorderBottomEdge
in 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:
paintContentBorderLeftEdge
in 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:
paintContentBorderRightEdge
in 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:
paintContentBorderTopEdge
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
getTabBounds
public java.awt.Rectangle getTabBounds(javax.swing.JTabbedPane pane, int i)
- Overrides:
getTabBounds
in 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:
paintText
in 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:
paintIcon
in classjavax.swing.plaf.basic.BasicTabbedPaneUI
-
createMouseListener
protected java.awt.event.MouseListener createMouseListener()
- Overrides:
createMouseListener
in 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:
update
in classjavax.swing.plaf.ComponentUI
-
-