com.alee.extended.breadcrumb
Class BreadcrumbUtils

java.lang.Object
  extended by com.alee.extended.breadcrumb.BreadcrumbUtils

public final class BreadcrumbUtils
extends java.lang.Object

This class provides a set of utilities for breadcrumbs. This is a library utility class and its not intended for use outside of the breadcrumbs.

Author:
Mikle Garin

Field Summary
static java.awt.Color[] progressFillColors
           
static float[] progressFractions
          Breadcrumb element background paint constants.
static java.awt.Color[] progressLineColors
           
static java.awt.Color progressSideColor
           
static java.awt.Color[] selectedProgressFillColors
           
static java.awt.Color[] shadeColors
           
static float[] shadeFractions
           
 
Constructor Summary
BreadcrumbUtils()
           
 
Method Summary
static boolean contains(javax.swing.JComponent element, int x, int y)
          Returns whether breadcrumb element contains specified point or not.
static java.awt.geom.GeneralPath createBorderShape(int w, int h, int overlap, int shadeWidth, boolean ltr)
          Returns element border shape.
static java.awt.Shape createFillShape(javax.swing.JComponent element, BreadcrumbElementType type, int w, int h, int overlap, int shadeWidth, int round, boolean encloseLast, boolean ltr)
          Returns element fill shape.
static java.awt.Shape getBorderShape(javax.swing.JComponent element, int w, int h, int overlap, int shadeWidth, boolean ltr)
          Returns cached element border shape.
static java.awt.Insets getElementMargin(javax.swing.JComponent element)
          Returns breadcrumb element margin.
static java.awt.Shape getFillShape(javax.swing.JComponent element, BreadcrumbElementType type, int w, int h, int overlap, int shadeWidth, int round, boolean encloseLast, boolean ltr)
          Returns cached element fill shape.
static java.awt.Shape getProgressFillShape(java.awt.Shape fillShape, float progress, boolean ltr)
          Returns progress fill shape.
static java.awt.LinearGradientPaint getProgressLinePaint(int h)
          Returns progress line paint.
static java.awt.LinearGradientPaint getProgressPaint(javax.swing.JComponent element, int h)
          Returns progress paint.
static void paintElementBackground(java.awt.Graphics2D g2d, javax.swing.JComponent element)
          Paints breadcrumb element background.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

progressFractions

public static final float[] progressFractions
Breadcrumb element background paint constants.


progressSideColor

public static final java.awt.Color progressSideColor

progressFillColors

public static final java.awt.Color[] progressFillColors

selectedProgressFillColors

public static final java.awt.Color[] selectedProgressFillColors

progressLineColors

public static final java.awt.Color[] progressLineColors

shadeFractions

public static final float[] shadeFractions

shadeColors

public static final java.awt.Color[] shadeColors
Constructor Detail

BreadcrumbUtils

public BreadcrumbUtils()
Method Detail

getElementMargin

public static java.awt.Insets getElementMargin(javax.swing.JComponent element)
Returns breadcrumb element margin.

Parameters:
element - element to provide margin for
Returns:
breadcrumb element margin

paintElementBackground

public static void paintElementBackground(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent element)
Paints breadcrumb element background.

Parameters:
g2d - graphics context
element - breadcrumb element

getBorderShape

public static java.awt.Shape getBorderShape(javax.swing.JComponent element,
                                            int w,
                                            int h,
                                            int overlap,
                                            int shadeWidth,
                                            boolean ltr)
Returns cached element border shape.

Parameters:
element - breadcrumb element
w - element width
h - element height
overlap - breadcrumb element overlap
shadeWidth - breadcrumb shade width
ltr - whether element has LTR orientation or not
Returns:
cached element border shape

createBorderShape

public static java.awt.geom.GeneralPath createBorderShape(int w,
                                                          int h,
                                                          int overlap,
                                                          int shadeWidth,
                                                          boolean ltr)
Returns element border shape.

Parameters:
w - element width
h - element height
overlap - breadcrumb element overlap
shadeWidth - breadcrumb shade width
ltr - whether element has LTR orientation or not
Returns:
element border shape

getFillShape

public static java.awt.Shape getFillShape(javax.swing.JComponent element,
                                          BreadcrumbElementType type,
                                          int w,
                                          int h,
                                          int overlap,
                                          int shadeWidth,
                                          int round,
                                          boolean encloseLast,
                                          boolean ltr)
Returns cached element fill shape.

Parameters:
element - breadcrumb element
type - element type
w - element width
h - element height
overlap - breadcrumb element overlap
shadeWidth - breadcrumb shade width
round - breadcrumb corners rounding
encloseLast - whether last breadcrumb element should be enclosed or not
ltr - whether element has LTR orientation or not
Returns:
cached element fill shape

createFillShape

public static java.awt.Shape createFillShape(javax.swing.JComponent element,
                                             BreadcrumbElementType type,
                                             int w,
                                             int h,
                                             int overlap,
                                             int shadeWidth,
                                             int round,
                                             boolean encloseLast,
                                             boolean ltr)
Returns element fill shape.

Parameters:
element - breadcrumb element
type - element type
w - element width
h - element height
overlap - breadcrumb element overlap
shadeWidth - breadcrumb shade width
round - breadcrumb corners rounding
encloseLast - whether last breadcrumb element should be enclosed or not
ltr - whether element has LTR orientation or not
Returns:
element fill shape

getProgressFillShape

public static java.awt.Shape getProgressFillShape(java.awt.Shape fillShape,
                                                  float progress,
                                                  boolean ltr)
Returns progress fill shape.

Parameters:
fillShape - element fill shape
progress - progress value
ltr - whether element has LTR orientation or not
Returns:
progress fill shape

getProgressPaint

public static java.awt.LinearGradientPaint getProgressPaint(javax.swing.JComponent element,
                                                            int h)
Returns progress paint.

Parameters:
element - breadcrumb element
h - element height
Returns:
progress paint

getProgressLinePaint

public static java.awt.LinearGradientPaint getProgressLinePaint(int h)
Returns progress line paint.

Parameters:
h - element height
Returns:
progress line paint

contains

public static boolean contains(javax.swing.JComponent element,
                               int x,
                               int y)
Returns whether breadcrumb element contains specified point or not.

Parameters:
element - breadcrumb element
x - point X coordinate
y - point Y coordinate
Returns:
true if breadcrumb element contains specified point, false otherwise