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:
SwingConstants
UI for tabbed panes in Radiance look and feel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classListener for rollover animation effects.private final classTracks changes to the tabbed pane contents.classLayout for the tabbed pane.private static classprivate static classprivate static classprotected classImplementation of the fade tracker callback that repaints a single tab.Nested classes/interfaces inherited from class BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabSelectionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intCurrently selected index (for selection animations).Key - tab component.private BladeContainerColorTokensTracks changes to the tabbed pane contents.private booleanprivate PointCurrent mouse location.Mouse handler for rollover effects.private ChangeListenerListener for animation effects on tab selection.private StateTransitionMultiTracker<Integer> private Set<RadianceThemingWidget<JComponent>> Fields inherited from class 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, upKeyFields inherited from interface 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intcalculateMaxTabHeight(int tabPlacement) protected intcalculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) protected intcalculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) protected LayoutManagerprotected MouseListenerprotected JButtoncreateScrollButton(int direction) static ComponentUIcreateUI(JComponent comp) protected voidEnsures the current layout.protected RectanglegetCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height) Retrieves the close button rectangle for drawing purposes.protected RectanglegetCloseButtonRectangleForEvents(int tabIndex, int x, int y, int w, int h) Retrieves the close button rectangle for event handling.protected InsetsgetContentBorderInsets(int tabPlacement) getModelStateInfo(int tabIndex) private static RadianceOutlinePaintergetOutlinePainter(JTabbedPane tabPane, ContainerColorTokens colorTokens) intReturns the index of the tab currently being rolled-over.Returns tab area insets.getTabBounds(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) getTabRectangle(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 voidprotected voidprotected voidvoidvoidpaint(Graphics g, JComponent c) private voidpaintCloseButtonImage(Graphics2D g, JTabbedPane tabPane, int width, int height, boolean toPaintBorder, ContainerColorTokens colorTokens) Retrieves the image of the close button.protected voidpaintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected voidpaintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected voidpaintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected voidpaintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected voidpaintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) protected voidpaintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) private voidpaintRotationAwareTabBackground(Graphics2D g, JTabbedPane tabPane, int tabIndex, int width, int height, int tabPlacement, ContainerColorTokens colorTokens) protected voidpaintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) protected voidpaintTabArea(Graphics g, int tabPlacement, int selectedIndex) protected voidpaintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) private static voidpaintTabBackgroundAt1X(Graphics2D graphics1X, JTabbedPane tabPane, int tabIndex, double scaleFactor, int width, int height, ContainerColorTokens colorTokens, Color tabColor) protected voidpaintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) protected voidpaintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) voidsetTabAreaInsets(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, 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(Set<Integer> tabIndexes) Tries closing the specified tabs.protected voidprotected voidprotected voidvoidvoidupdate(Graphics g, JComponent c) Methods inherited from class 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, uninstallKeyboardActionsMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize
-
Field Details
-
radianceMouseLocation
Current mouse location. -
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 currSelectedIndexCurrently selected index (for selection animations). -
stateTransitionMultiTracker
-
themingWidgets
-
radianceRolloverHandler
Mouse handler for rollover effects. -
radianceContainerListener
Tracks changes to the tabbed pane contents. Each tab component is tracked for changes on theRadianceSynapse.CONTENTS_MODIFIEDproperty. -
radianceSelectionListener
Listener for animation effects on tab selection. -
radianceContentOpaque
private boolean radianceContentOpaque -
tabTextColorMap
-
mutableColorTokens
-
-
Constructor Details
-
RadianceTabbedPaneUI
protected RadianceTabbedPaneUI()Creates the new UI delegate.
-
-
Method Details
-
createUI
-
installUI
- Overrides:
installUIin classBasicTabbedPaneUI
-
uninstallUI
- Overrides:
uninstallUIin classBasicTabbedPaneUI
-
installListeners
protected void installListeners()- Overrides:
installListenersin classBasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()- Overrides:
uninstallListenersin classBasicTabbedPaneUI
-
installDefaults
protected void installDefaults()- Overrides:
installDefaultsin classBasicTabbedPaneUI
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaultsin classBasicTabbedPaneUI
-
installComponents
protected void installComponents()- Overrides:
installComponentsin classBasicTabbedPaneUI
-
uninstallComponents
protected void uninstallComponents()- Overrides:
uninstallComponentsin classBasicTabbedPaneUI
-
getOutlinePainter
private static RadianceOutlinePainter getOutlinePainter(JTabbedPane tabPane, ContainerColorTokens colorTokens) -
paintTabBackgroundAt1X
private static void paintTabBackgroundAt1X(Graphics2D graphics1X, JTabbedPane tabPane, int tabIndex, double scaleFactor, int width, int height, ContainerColorTokens colorTokens, Color tabColor) -
paintRotationAwareTabBackground
private void paintRotationAwareTabBackground(Graphics2D g, JTabbedPane tabPane, int tabIndex, int width, int height, int tabPlacement, ContainerColorTokens colorTokens) -
paintCloseButtonImage
private void paintCloseButtonImage(Graphics2D g, JTabbedPane tabPane, int width, int height, boolean toPaintBorder, ContainerColorTokens colorTokens) Retrieves the image of the close button. -
paintTabBackground
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) - Overrides:
paintTabBackgroundin classBasicTabbedPaneUI
-
paintFocusIndicator
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) - Overrides:
paintFocusIndicatorin classBasicTabbedPaneUI
-
paintTabBorder
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) - Overrides:
paintTabBorderin classBasicTabbedPaneUI
-
createScrollButton
- Overrides:
createScrollButtonin classBasicTabbedPaneUI
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) - Overrides:
calculateTabHeightin classBasicTabbedPaneUI
-
calculateTabWidth
- Overrides:
calculateTabWidthin classBasicTabbedPaneUI
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement) - Overrides:
calculateMaxTabHeightin classBasicTabbedPaneUI
-
getTabRunOverlay
protected int getTabRunOverlay(int tabPlacement) - Overrides:
getTabRunOverlayin classBasicTabbedPaneUI
-
paint
- Overrides:
paintin classBasicTabbedPaneUI
-
paintTab
-
paintTabArea
- Overrides:
paintTabAreain classBasicTabbedPaneUI
-
getCloseButtonRectangleForDraw
protected 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
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
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
-
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) - Overrides:
getTabLabelShiftXin classBasicTabbedPaneUI
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) - Overrides:
getTabLabelShiftYin classBasicTabbedPaneUI
-
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
Sets new value for tab area insets.- Parameters:
insets- Tab area insets.
-
getTabAreaInsets
-
getTabRectangle
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 classBasicTabbedPaneUI
-
createLayoutManager
- Overrides:
createLayoutManagerin classBasicTabbedPaneUI
-
getContentBorderInsets
- Overrides:
getContentBorderInsetsin classBasicTabbedPaneUI
-
paintContentBorderBottomEdge
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderBottomEdgein classBasicTabbedPaneUI
-
paintContentBorderLeftEdge
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderLeftEdgein classBasicTabbedPaneUI
-
paintContentBorderRightEdge
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderRightEdgein classBasicTabbedPaneUI
-
paintContentBorderTopEdge
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderTopEdgein classBasicTabbedPaneUI
-
getTabBounds
- Overrides:
getTabBoundsin classBasicTabbedPaneUI
-
getModelStateInfo
-
getTabState
Returns the current state for the specified tab.- Parameters:
tabIndex- Tab index.- Returns:
- The current state for the specified tab.
-
paintText
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) - Overrides:
paintTextin classBasicTabbedPaneUI
-
paintIcon
protected void paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) - Overrides:
paintIconin classBasicTabbedPaneUI
-
createMouseListener
- Overrides:
createMouseListenerin classBasicTabbedPaneUI
-
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
-
update
- Overrides:
updatein classComponentUI
-