Compiere Looks 1.2.1

org.compiere.plaf
Class CompiereTabbedPaneUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--javax.swing.plaf.TabbedPaneUI
              |
              +--javax.swing.plaf.basic.BasicTabbedPaneUI
                    |
                    +--javax.swing.plaf.metal.MetalTabbedPaneUI
                          |
                          +--org.compiere.plaf.CompiereTabbedPaneUI
All Implemented Interfaces:
SwingConstants

public class CompiereTabbedPaneUI
extends MetalTabbedPaneUI

Same implementation detail as in CompierePanelUI. Additional handling of dwawing tabs.

Version:
$Id: CompiereTabbedPaneUI.java,v 1.12 2002/09/17 02:25:43 jjanke Exp $
Author:
Jorg Janke
See Also:
CompierePanelUI

Nested Class Summary
 class CompiereTabbedPaneUI.TabbedPaneLayout
          Layout Manager to overwrite TabRect size
 
Field Summary
 
Fields inherited from class javax.swing.plaf.metal.MetalTabbedPaneUI
minTabWidth, selectColor, selectHighlight, tabAreaBackground
 
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
CompiereTabbedPaneUI()
           
 
Method Summary
protected  int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
          Calculate TabHeight
protected  int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
          Calculate Tab Width.
protected  LayoutManager createLayoutManager()
          Create Layout Manager to size & position tabs
static ComponentUI createUI(JComponent c)
          Static Create UI
protected  void installDefaults()
          Install Defaults
protected  void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
          Layout Label
 void paint(Graphics g, JComponent c)
          Paint it
protected  void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
          Paint Content Border (overwriting BasicTabbedPanelUI) Uses Color from actual Tab (not from TabbedPane)
protected  void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
          Paint bottom content area edge
protected  void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
          Paint left content border edge
protected  void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
          Paint right Contenr border edge
protected  void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
          Paint Border of Left Tab.
protected  void paintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
          Paint Border of Right Tab.
protected  void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
          Paint the actual Tab Background.
protected  void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)
          Paint Tab
protected  void paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
          Paint Top Tab Border
protected  boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)
          Fill Tab gap triangle (no)
 void update(Graphics g, JComponent c)
          Update - This method is invoked by JComponent when the specified component is being painted.
 
Methods inherited from class javax.swing.plaf.metal.MetalTabbedPaneUI
calculateMaxTabHeight, getColorForGap, getTabLabelShiftX, getTabLabelShiftY, getTabRunOverlay, paintBottomTabBorder, paintContentBorderTopEdge, paintFocusIndicator, paintHighlightBelowTab, paintTabBorder, shouldPadTabRun, shouldRotateTabRuns
 
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, createChangeListener, createFocusListener, createMouseListener, createPropertyChangeListener, expandTabRunsArray, getContentBorderInsets, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreferredSize, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabBounds, getTabInsets, getTabRunCount, getTabRunIndent, getTabRunOffset, getTextViewForTab, getVisibleComponent, installComponents, installKeyboardActions, installListeners, installUI, lastTabInRun, navigateSelectedTab, paintIcon, paintTab, paintTabArea, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setVisibleComponent, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompiereTabbedPaneUI

public CompiereTabbedPaneUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent c)
Static Create UI

Parameters:
c - Component
Returns:
Compiere TabbedPaneUI

installDefaults

protected void installDefaults()
Install Defaults

Overrides:
installDefaults in class MetalTabbedPaneUI

update

public void update(Graphics g,
                   JComponent c)
Update - This method is invoked by JComponent when the specified component is being painted. By default this method will fill the specified component with its background color (if its opaque property is true) and then immediately call paint.

Overrides:
update in class MetalTabbedPaneUI
Parameters:
g - the Graphics context in which to paint
c - the component being painted
See Also:
paint(java.awt.Graphics, javax.swing.JComponent), JComponent.paintComponent(java.awt.Graphics)

paint

public void paint(Graphics g,
                  JComponent c)
Paint it

Overrides:
paint in class MetalTabbedPaneUI
Parameters:
g - graphics
c - component

paintTabBackground

protected void paintTabBackground(Graphics g,
                                  int tabPlacement,
                                  int tabIndex,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  boolean isSelected)
Paint the actual Tab Background. Called from Basic.PaintTab (<- Basic.paintTabArea <- Basic.paint)

Based on MetalTabbedPaneUI.paintTabBackground: Differences: - Color based on primary Background of Tab - Selected Tab is painted

          selected    not sel
  top     //////////  //////////  (lighter)
                      ++++++++++  (flat/darker)

  bottom              //////////  (flat/lighter)
          ++++++++++  ++++++++++  (darker)

  sides               //////////  (flat/ligher)
                      ++++++++++  (flat/darker)
  

Overrides:
paintTabBackground in class MetalTabbedPaneUI
Parameters:
g - graphics
tabPlacement - tab placement
tabIndex - tab index
x - x
y - y
w - width
h - height
isSelected - selected

paintContentBorder

protected void paintContentBorder(Graphics g,
                                  int tabPlacement,
                                  int selectedIndex)
Paint Content Border (overwriting BasicTabbedPanelUI) Uses Color from actual Tab (not from TabbedPane)

Overrides:
paintContentBorder in class BasicTabbedPaneUI
Parameters:
g - graphics
tabPlacement - tab placement
selectedIndex - index

paintContentBorderLeftEdge

protected void paintContentBorderLeftEdge(Graphics g,
                                          int tabPlacement,
                                          int selectedIndex,
                                          int x,
                                          int y,
                                          int w,
                                          int h)
Paint left content border edge

Overrides:
paintContentBorderLeftEdge in class MetalTabbedPaneUI
Parameters:
g - graphics
tabPlacement - tab placement
selectedIndex - index
x - x
y - y
w - width
h - height

paintContentBorderBottomEdge

protected void paintContentBorderBottomEdge(Graphics g,
                                            int tabPlacement,
                                            int selectedIndex,
                                            int x,
                                            int y,
                                            int w,
                                            int h)
Paint bottom content area edge

Overrides:
paintContentBorderBottomEdge in class MetalTabbedPaneUI
Parameters:
g - graphics
tabPlacement - tab placement
selectedIndex - index
x - x
y - y
w - width
h - height

paintContentBorderRightEdge

protected void paintContentBorderRightEdge(Graphics g,
                                           int tabPlacement,
                                           int selectedIndex,
                                           int x,
                                           int y,
                                           int w,
                                           int h)
Paint right Contenr border edge

Overrides:
paintContentBorderRightEdge in class MetalTabbedPaneUI
Parameters:
g - graphics
tabPlacement - tab placement
selectedIndex - index
x - x
y - y
w - width
h - height

shouldFillGap

protected boolean shouldFillGap(int currentRun,
                                int tabIndex,
                                int x,
                                int y)
Fill Tab gap triangle (no)

Overrides:
shouldFillGap in class MetalTabbedPaneUI
Parameters:
currentRun - current run
tabIndex - tab index
x - x
y - y
Returns:
false

paintTopTabBorder

protected void paintTopTabBorder(int tabIndex,
                                 Graphics g,
                                 int x,
                                 int y,
                                 int w,
                                 int h,
                                 int btm,
                                 int rght,
                                 boolean isSelected)
Paint Top Tab Border

Overrides:
paintTopTabBorder in class MetalTabbedPaneUI
Parameters:
tabIndex - index
g - graphics
x - x
y - y
w - width
h - height
btm - bottom
rght - right
isSelected - selected

paintLeftTabBorder

protected void paintLeftTabBorder(int tabIndex,
                                  Graphics g,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  int btm,
                                  int rght,
                                  boolean isSelected)
Paint Border of Left Tab. Does not fill triangle

Overrides:
paintLeftTabBorder in class MetalTabbedPaneUI
Parameters:
tabIndex - index
g - graphics
x - x
y - y
w - width
h - height
btm - bottom
rght - right
isSelected - selected

paintRightTabBorder

protected void paintRightTabBorder(int tabIndex,
                                   Graphics g,
                                   int x,
                                   int y,
                                   int w,
                                   int h,
                                   int btm,
                                   int rght,
                                   boolean isSelected)
Paint Border of Right Tab. Does not fill triangle

Overrides:
paintRightTabBorder in class MetalTabbedPaneUI
Parameters:
tabIndex - index
g - graphics
x - x
y - y
w - width
h - height
btm - bottom
rght - right
isSelected - selected

calculateTabWidth

protected int calculateTabWidth(int tabPlacement,
                                int tabIndex,
                                FontMetrics metrics)
Calculate Tab Width. We may have to overwrite to adjust width for TabHirarchyLevel

Overrides:
calculateTabWidth in class BasicTabbedPaneUI
Parameters:
tabPlacement - tab placement
tabIndex - tab index
metrics - metcics
Returns:
tab width

calculateTabHeight

protected int calculateTabHeight(int tabPlacement,
                                 int tabIndex,
                                 int fontHeight)
Calculate TabHeight

Overrides:
calculateTabHeight in class BasicTabbedPaneUI
Parameters:
tabPlacement - tab placement
tabIndex - tab index
fontHeight - font height
Returns:
tab height

layoutLabel

protected void layoutLabel(int tabPlacement,
                           FontMetrics metrics,
                           int tabIndex,
                           String title,
                           Icon icon,
                           Rectangle tabRect,
                           Rectangle iconRect,
                           Rectangle textRect,
                           boolean isSelected)
Layout Label

Overrides:
layoutLabel in class BasicTabbedPaneUI
Parameters:
tabPlacement - tab placement
metrics - fint metrics
tabIndex - tab index
title - title
icon - icon
tabRect - tab bounds
iconRect - icon bounds
textRect - text bounds
isSelected - selected

paintText

protected void paintText(Graphics g,
                         int tabPlacement,
                         Font font,
                         FontMetrics metrics,
                         int tabIndex,
                         String title,
                         Rectangle textRect,
                         boolean isSelected)
Paint Tab

Overrides:
paintText in class BasicTabbedPaneUI
Parameters:
g - graphics
tabPlacement - tab placement
font - font
metrics - font metrics
tabIndex - tab index
title - title
textRect - text bounds
isSelected - selected

createLayoutManager

protected LayoutManager createLayoutManager()
Create Layout Manager to size & position tabs

Overrides:
createLayoutManager in class MetalTabbedPaneUI
Returns:
Layout Manager

Compiere Looks 1.2.1

Copyright (c) 1999-2003 ComPiere, Inc. - Author: Jorg Janke