net.infonode.gui.shaped.border
Class AbstractPolygonBorder

java.lang.Object
  extended by net.infonode.gui.shaped.border.AbstractShapedBorder
      extended by net.infonode.gui.shaped.border.AbstractPolygonBorder
All Implemented Interfaces:
java.io.Serializable, javax.swing.border.Border, ShapedBorder
Direct Known Subclasses:
PolygonBorder, SlopedTabLineBorder

public abstract class AbstractPolygonBorder
extends AbstractShapedBorder

Author:
johan
See Also:
Serialized Form

Field Summary
private static java.awt.Insets HIGHLIGHT_INSETS
           
private  ColorProvider highlightColor
           
private  ColorProvider lineColor
           
private  ColorProvider middleColor
           
private static long serialVersionUID
           
private  ColorProvider shadowColor
           
 
Constructor Summary
protected AbstractPolygonBorder(ColorProvider lineColor)
           
protected AbstractPolygonBorder(ColorProvider lineColor, ColorProvider highlightColor)
           
protected AbstractPolygonBorder(ColorProvider lineColor, ColorProvider highlightColor, ColorProvider middleColor, ColorProvider shadowColor)
           
 
Method Summary
protected  java.awt.Polygon createPolygon(java.awt.Component c, int width, int height)
           
private  void fixGraphicsOffset(java.awt.Component c, java.awt.Polygon polygon, int x, int y)
           
private  void flipPolygon(java.awt.Component c, java.awt.Polygon polygon, int width, int height)
           
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
protected  int getHighlightOffsetX(int deltaX, int deltaY)
           
protected  int getHighlightOffsetY(int deltaX, int deltaY)
           
private  java.awt.Polygon getPolygon(java.awt.Component c, int x, int y, int width, int height)
           
 java.awt.Shape getShape(java.awt.Component c, int x, int y, int width, int height)
          Gets the shape of this border.
protected  java.awt.Insets getShapedBorderHighlightInsets(java.awt.Component c)
           
protected  java.awt.Insets getShapedBorderInsets(java.awt.Component c)
           
 boolean isBorderOpaque()
           
protected  boolean isHighlightable(int deltaX, int deltaY)
           
protected  boolean isPointsClockwise(java.awt.Component c)
           
protected  boolean lineIsDrawn(int index, java.awt.Polygon polygon)
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
           
protected  void paintHighlight(java.awt.Component c, java.awt.Graphics2D g, java.awt.Polygon polygon, int width, int height)
           
protected  void paintPolygon(java.awt.Component c, java.awt.Graphics2D g, java.awt.Polygon polygon, int width, int height)
           
private  void rotatePolygon(java.awt.Component c, java.awt.Polygon polygon, int width, int height)
           
protected  void setPoint(java.awt.Polygon polygon, int x, int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

HIGHLIGHT_INSETS

private static final java.awt.Insets HIGHLIGHT_INSETS

lineColor

private ColorProvider lineColor

highlightColor

private ColorProvider highlightColor

middleColor

private ColorProvider middleColor

shadowColor

private ColorProvider shadowColor
Constructor Detail

AbstractPolygonBorder

protected AbstractPolygonBorder(ColorProvider lineColor)

AbstractPolygonBorder

protected AbstractPolygonBorder(ColorProvider lineColor,
                                ColorProvider highlightColor)

AbstractPolygonBorder

protected AbstractPolygonBorder(ColorProvider lineColor,
                                ColorProvider highlightColor,
                                ColorProvider middleColor,
                                ColorProvider shadowColor)
Method Detail

getShape

public java.awt.Shape getShape(java.awt.Component c,
                               int x,
                               int y,
                               int width,
                               int height)
Description copied from interface: ShapedBorder

Gets the shape of this border.

Parameters:
c - the component to create a shape for
x - the x offset
y - the y offset
width - the width
height - the height
Returns:
the Shape for this border or null if there is no shape and the normal rectangle bounds should be used

isBorderOpaque

public boolean isBorderOpaque()

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)

getShapedBorderInsets

protected java.awt.Insets getShapedBorderInsets(java.awt.Component c)

getShapedBorderHighlightInsets

protected java.awt.Insets getShapedBorderHighlightInsets(java.awt.Component c)

createPolygon

protected java.awt.Polygon createPolygon(java.awt.Component c,
                                         int width,
                                         int height)

paintPolygon

protected void paintPolygon(java.awt.Component c,
                            java.awt.Graphics2D g,
                            java.awt.Polygon polygon,
                            int width,
                            int height)

paintHighlight

protected void paintHighlight(java.awt.Component c,
                              java.awt.Graphics2D g,
                              java.awt.Polygon polygon,
                              int width,
                              int height)

lineIsDrawn

protected boolean lineIsDrawn(int index,
                              java.awt.Polygon polygon)

isHighlightable

protected boolean isHighlightable(int deltaX,
                                  int deltaY)

isPointsClockwise

protected boolean isPointsClockwise(java.awt.Component c)

getHighlightOffsetX

protected int getHighlightOffsetX(int deltaX,
                                  int deltaY)

getHighlightOffsetY

protected int getHighlightOffsetY(int deltaX,
                                  int deltaY)

setPoint

protected void setPoint(java.awt.Polygon polygon,
                        int x,
                        int y)

getPolygon

private java.awt.Polygon getPolygon(java.awt.Component c,
                                    int x,
                                    int y,
                                    int width,
                                    int height)

flipPolygon

private void flipPolygon(java.awt.Component c,
                         java.awt.Polygon polygon,
                         int width,
                         int height)

rotatePolygon

private void rotatePolygon(java.awt.Component c,
                           java.awt.Polygon polygon,
                           int width,
                           int height)

fixGraphicsOffset

private void fixGraphicsOffset(java.awt.Component c,
                               java.awt.Polygon polygon,
                               int x,
                               int y)