Class 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.
    • 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
      • Methods inherited from class javax.swing.plaf.ComponentUI

        contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 (with RadianceSynapse.CONTENTS_MODIFIED property).
      • currSelectedIndex

        private int currSelectedIndex
        Currently selected index (for selection animations).
      • 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
    • Constructor Detail

      • RadianceTabbedPaneUI

        protected RadianceTabbedPaneUI()
        Creates the new UI delegate.
    • 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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • uninstallUI

        public void uninstallUI​(javax.swing.JComponent c)
        Overrides:
        uninstallUI in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • installListeners

        protected void installListeners()
        Overrides:
        installListeners in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • uninstallListeners

        protected void uninstallListeners()
        Overrides:
        uninstallListeners in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • installDefaults

        protected void installDefaults()
        Overrides:
        installDefaults in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • uninstallDefaults

        protected void uninstallDefaults()
        Overrides:
        uninstallDefaults in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • installComponents

        protected void installComponents()
        Overrides:
        installComponents in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • uninstallComponents

        protected void uninstallComponents()
        Overrides:
        uninstallComponents in class javax.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 class javax.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 class javax.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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • createScrollButton

        protected javax.swing.JButton createScrollButton​(int direction)
        Overrides:
        createScrollButton in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • calculateTabHeight

        protected int calculateTabHeight​(int tabPlacement,
                                         int tabIndex,
                                         int fontHeight)
        Overrides:
        calculateTabHeight in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • calculateTabWidth

        protected int calculateTabWidth​(int tabPlacement,
                                        int tabIndex,
                                        java.awt.FontMetrics metrics)
        Overrides:
        calculateTabWidth in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • calculateMaxTabHeight

        protected int calculateMaxTabHeight​(int tabPlacement)
        Overrides:
        calculateMaxTabHeight in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • getTabRunOverlay

        protected int getTabRunOverlay​(int tabPlacement)
        Overrides:
        getTabRunOverlay in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • paint

        public void paint​(java.awt.Graphics g,
                          javax.swing.JComponent c)
        Overrides:
        paint in class javax.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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • paintTabArea

        protected void paintTabArea​(java.awt.Graphics g,
                                    int tabPlacement,
                                    int selectedIndex)
        Overrides:
        paintTabArea in class javax.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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • getTabLabelShiftY

        protected int getTabLabelShiftY​(int tabPlacement,
                                        int tabIndex,
                                        boolean isSelected)
        Overrides:
        getTabLabelShiftY in class javax.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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • createLayoutManager

        protected java.awt.LayoutManager createLayoutManager()
        Overrides:
        createLayoutManager in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • getContentBorderInsets

        protected java.awt.Insets getContentBorderInsets​(int tabPlacement)
        Overrides:
        getContentBorderInsets in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • paintContentBorder

        protected void paintContentBorder​(java.awt.Graphics g,
                                          int tabPlacement,
                                          int selectedIndex)
        Overrides:
        paintContentBorder in class javax.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 class javax.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 class javax.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 class javax.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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • getTabBounds

        public java.awt.Rectangle getTabBounds​(javax.swing.JTabbedPane pane,
                                               int i)
        Overrides:
        getTabBounds in class javax.swing.plaf.basic.BasicTabbedPaneUI
      • 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 class javax.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 class javax.swing.plaf.basic.BasicTabbedPaneUI
      • createMouseListener

        protected java.awt.event.MouseListener createMouseListener()
        Overrides:
        createMouseListener in class javax.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 class javax.swing.plaf.ComponentUI