com.sas.visuals
Class BaseBorder

com.sas.visuals.BaseBorder
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.lang.StringDataInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.PublicClonable, com.sas.ViewInterface, BorderInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class BaseBorder
implements com.sas.lang.StringDataInterface

BaseBorder is a subclass of Border capable of drawing several different styles of borders. Those styles include: BEZEL, SIMPLE, EMBOSS, and BUTTON. Each of these border styles can be drawn using either the RAISED or LOWERED lightSources. Text can also be displayed on the top area of all of the borders.

Notes:


See Also:
BorderInterface, Serialized Form

Field Summary
static int ALL_SIDES
          All sides flags On (combination of com.sas.geometry.Orientations TOP,BOTTOM,LEFT, and RIGHT flags
static int BEZEL
          A BEZEL style border, also the DEFAULT border for the BaseBorder class
static int BUTTON
          A BUTTON style border, uses the java.awt.SystemColor class control colors
static int CENTER
          Text CENTER alignment
static int EMBOSS
          A EMBOSS style border
static int LEFT
          Text LEFT alignment
static java.lang.String RB_KEY
           
static int RIGHT
          Text RIGHT alignment
static int SIMPLE
          A SIMPLE style single color border
 
Fields inherited from class com.sas.visuals.Border
baseColor, baseColorJ, borderWidth, lightSource, style
 
Fields inherited from interface com.sas.visuals.BorderInterface
BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, LOWERED, NONE, RAISED, TOP_LEFT, TOP_RIGHT
 
Constructor Summary
BaseBorder()
          Default Constructor.
BaseBorder(int style)
          Constructor to create a BaseBorder with the specified style.
BaseBorder(int style, int ltSrc)
          Constructor to create a BaseBorder with the specified style and lightSource.
BaseBorder(int style, int ltSrc, int width)
          Constructor to create a BaseBorder with the specified style, lightSource and width.
BaseBorder(int style, int ltSrc, int width, java.awt.Color base)
          Constructor to create a BaseBorder with the specified style, lightSource, width, and base color.
BaseBorder(int style, int ltSrc, int width, java.awt.Color base, java.awt.Color highlight, java.awt.Color shadow)
          Constructor to create a BaseBorder with the specified style, lightSource, width, base color, highlight color, and shadow color.
BaseBorder(int style, int ltSrc, int width, java.awt.Color base, java.awt.Color highlight, java.awt.Color shadow, java.lang.String txt, int align, int margin, java.awt.Font f)
          Constructor to create a BaseBorder with the specified style, lightSource, width, base color, highlight color, and shadow color.
 
Method Summary
static void drawBezel(java.awt.Graphics g, int x, int y, int width, int height, java.awt.Color top, java.awt.Color left, java.awt.Color bottom, java.awt.Color right, int borderWidth, int sides)
          Convenience method for drawing a bezel with the specified colors and border width.
static void drawBezel(java.awt.Graphics g, int x, int y, int width, int height, java.awt.Color topLeft, java.awt.Color bottomRight, int borderWidth)
          Convenience method for drawing a bezel with the specified colors and border width.
static void drawEmboss(java.awt.Graphics g, int x, int y, int width, int height, java.awt.Color top, java.awt.Color bottom, int borderWidth)
          Convenience method for drawing an embossed border with the specified top and bottom colors and border width.
static void drawEmboss(java.awt.Graphics g, int x, int y, int width, int height, java.awt.Color top, java.awt.Color bottom, int borderWidth, int sides)
          Convenience method for drawing an embossed border with the specified top and bottom colors and border width.
 void drawInRect(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
          Draw the Border within the specified rectangle on the specified component.
 boolean equals(java.lang.Object item)
          Check if an object is equal to this BaseBorder.
 java.awt.Color getBackgroundColor()
          Get the background Color used for this BaseBorder when text is drawn.
 int getBorderWidth()
          Get the width of the BaseBorder
 java.awt.Component getComponent()
          Get the component the border is drawn on.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this BaseBorder.
 java.awt.Font getFont()
          Get the font used to display the border text.
 java.awt.Color getForegroundColor()
          Get the foreground Color used for this BaseBorder when text is drawn.
 java.awt.Color getHighlightColor()
          Get the highlight Color used for this BaseBorder.
 java.awt.Insets getInsets(java.awt.Component comp)
          Get the Insets of the Border on the specified component.
 java.awt.Color getShadowColor()
          Get the shadow Color used for this BaseBorder.
 int getSidesPainted()
          Get the ORed bit flags indicating which sides will be painted by the border.
 java.lang.String getText()
          Get the text to be displayed in the border.
 int getTextAlignment()
          Get the alignment of the text on the top line of the border: LEFT, RIGHT, or CENTER.
 int getTextGap()
          Get the gap between the text and the border line.
 int getTextMargin()
          Get the pixel margin for the text when it is aligned to the LEFT or the RIGHT side.
 int hashCode()
           
static void paintBorder(java.awt.Graphics g, int x, int y, int width, int height, java.awt.Color highlight, java.awt.Color shadow, int style, int bWidth, int lSource, int sides)
          Paint the border given all the major parameters to describe the border.
protected  java.lang.String paramString()
          Used in the toString() method
 void setBackgroundColor(java.awt.Color c)
          Set the background Color for this BaseBorder, used as background for the text.
 void setBaseColor(java.awt.Color c)
          Set the base Color for this BaseBorder.
 void setBorderWidth(int width)
          Set the border width for this BaseBorder.
 void setComponent(java.awt.Component comp)
          Set the component used to find the backgroundColor, foregroundColor, or font if they are not set.
 void setFont(java.awt.Font f)
          Set the font to be used to display the text on the border.
 void setForegroundColor(java.awt.Color c)
          Set the foreground Color for this BaseBorder, used as foreground for the text.
 void setHighlightColor(java.awt.Color c)
          Set the highlight Color for this BaseBorder.
 void setShadowColor(java.awt.Color c)
          Set the shadow Color for this BaseBorder.
 void setSidesPainted(int sides)
          Set the ORed bit flags indicating which sides to paint.
 void setText(java.lang.String txt)
          Set the text to be displayed on the top area of the border.
 void setTextAlignment(int a)
          Set the text alignment to CENTER, LEFT, or RIGHT for display on the top area of the border.
 void setTextGap(int g)
          Set the gap between the text and the border line.
 void setTextMargin(int m)
          Set the margin between the edge of the border the text is aligned to and the text when the alignment is LEFT or RIGHT.
 java.lang.String toString()
          Returns a string with all this BaseBorder information, inccluding style, alignment, and entire border structure.
 
Methods inherited from class com.sas.visuals.Border
clone, drawInRect, drawInRect, drawInRect, getBaseColor, getBottomMargin, getInsets, getInteriorBounds, getInteriorBounds, getLeftMargin, getLightSource, getRightMargin, getStyle, getTopMargin, setLightSource, setStyle
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

CENTER

public static final int CENTER
Text CENTER alignment

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Text RIGHT alignment

See Also:
Constant Field Values

LEFT

public static final int LEFT
Text LEFT alignment

See Also:
Constant Field Values

ALL_SIDES

public static final int ALL_SIDES
All sides flags On (combination of com.sas.geometry.Orientations TOP,BOTTOM,LEFT, and RIGHT flags

See Also:
Constant Field Values

BEZEL

public static final int BEZEL
A BEZEL style border, also the DEFAULT border for the BaseBorder class

See Also:
Constant Field Values

SIMPLE

public static final int SIMPLE
A SIMPLE style single color border

See Also:
Constant Field Values

EMBOSS

public static final int EMBOSS
A EMBOSS style border

See Also:
Constant Field Values

BUTTON

public static final int BUTTON
A BUTTON style border, uses the java.awt.SystemColor class control colors

See Also:
Constant Field Values
Constructor Detail

BaseBorder

public BaseBorder()
Default Constructor. Uses the Border.DEFAULT style, Border.RAISED lightSource, and 2 for the default borderWidth


BaseBorder

public BaseBorder(int style)
Constructor to create a BaseBorder with the specified style. Uses the Border.RAISED lightSource and 2 for the default borderWidth.

Parameters:
style - the style border to be drawn

BaseBorder

public BaseBorder(int style,
                  int ltSrc)
Constructor to create a BaseBorder with the specified style and lightSource. Uses 2 for the default borderWidth.

Parameters:
style - the style border to be drawn
ltSrc - the lightSource to draw the border with

BaseBorder

public BaseBorder(int style,
                  int ltSrc,
                  int width)
Constructor to create a BaseBorder with the specified style, lightSource and width. Border colors will be from the java.awt.SystemColor object.

Parameters:
style - the style border to be drawn
ltSrc - the lightSource to draw the border with
width - border width

BaseBorder

public BaseBorder(int style,
                  int ltSrc,
                  int width,
                  java.awt.Color base)
Constructor to create a BaseBorder with the specified style, lightSource, width, and base color. The Border colors will be created by using the brighter() and darker() methods on the base color.

Parameters:
style - the style border to be drawn
ltSrc - the lightSource to draw the border with
width - border width
base - base color for highlight and shadow colors of the border

BaseBorder

public BaseBorder(int style,
                  int ltSrc,
                  int width,
                  java.awt.Color base,
                  java.awt.Color highlight,
                  java.awt.Color shadow)
Constructor to create a BaseBorder with the specified style, lightSource, width, base color, highlight color, and shadow color.

Parameters:
style - the style border to be drawn
ltSrc - the lightSource to draw the border with
width - border width
base - color for when the simple style is used
highlight - the top/left color when the border is RAISED; the bottom/right color when the border is LOWERED.
shadow - the top/left color when the border is LOWERED; the bottom/right color when the border is RAISED.

BaseBorder

public BaseBorder(int style,
                  int ltSrc,
                  int width,
                  java.awt.Color base,
                  java.awt.Color highlight,
                  java.awt.Color shadow,
                  java.lang.String txt,
                  int align,
                  int margin,
                  java.awt.Font f)
Constructor to create a BaseBorder with the specified style, lightSource, width, base color, highlight color, and shadow color.

Parameters:
style - the style border to be drawn
ltSrc - the lightSource to draw the border with
width - border width
base - color for when the simple style is used
highlight - the top/left color when the border is RAISED; the bottom/right color when the border is LOWERED.
shadow - the top/left color when the border is LOWERED; the bottom/right color when the border is RAISED.
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this BaseBorder.

Returns:
the ExtendedBeanInfo for this class

getSidesPainted

public int getSidesPainted()
Get the ORed bit flags indicating which sides will be painted by the border.

Returns:
the ORed bit flags for the sides that will be painted.

setSidesPainted

public void setSidesPainted(int sides)
Set the ORed bit flags indicating which sides to paint.

Parameters:
sides - the ORed bit flags of the sides that will be painted.

drawBezel

public static void drawBezel(java.awt.Graphics g,
                             int x,
                             int y,
                             int width,
                             int height,
                             java.awt.Color topLeft,
                             java.awt.Color bottomRight,
                             int borderWidth)
Convenience method for drawing a bezel with the specified colors and border width.

Parameters:
g - the Graphics context
x - the x position of the border rectangle
y - the y position of the border rectangle
width - the width of the border rectangle
height - the height of the border rectangle
topLeft - the color used on the top and left sides
bottomRight - the color used on the bottom and right sides
borderWidth - the width of the bezel sides.

drawBezel

public static void drawBezel(java.awt.Graphics g,
                             int x,
                             int y,
                             int width,
                             int height,
                             java.awt.Color top,
                             java.awt.Color left,
                             java.awt.Color bottom,
                             java.awt.Color right,
                             int borderWidth,
                             int sides)
Convenience method for drawing a bezel with the specified colors and border width.

Parameters:
g - the Graphics context
x - the x position of the border rectangle
y - the y position of the border rectangle
width - the width of the border rectangle
height - the height of the border rectangle
top - the color used on the top sides
left - the color used on the left sides
bottom - the color used on the bottom sides
right - the color used on the right sides
borderWidth - the width of the bezel sides.
sides - the sides to be drawn.

drawEmboss

public static void drawEmboss(java.awt.Graphics g,
                              int x,
                              int y,
                              int width,
                              int height,
                              java.awt.Color top,
                              java.awt.Color bottom,
                              int borderWidth)
Convenience method for drawing an embossed border with the specified top and bottom colors and border width.

Parameters:
g - the Graphics context
x - the x position of the border rectangle
y - the y position of the border rectangle
width - the width of the border rectangle
height - the height of the border rectangle
top - the color used on the top part of the emboss
bottom - the color used on the bottom part of the emboss
borderWidth - the width of the bezel sides.

drawEmboss

public static void drawEmboss(java.awt.Graphics g,
                              int x,
                              int y,
                              int width,
                              int height,
                              java.awt.Color top,
                              java.awt.Color bottom,
                              int borderWidth,
                              int sides)
Convenience method for drawing an embossed border with the specified top and bottom colors and border width.

Parameters:
g - the Graphics context
x - the x position of the border rectangle
y - the y position of the border rectangle
width - the width of the border rectangle
height - the height of the border rectangle
top - the color used on the top part of the emboss
bottom - the color used on the bottom part of the emboss
borderWidth - the width of the bezel sides.
sides - the sides to be drawn.

drawInRect

public void drawInRect(java.awt.Component comp,
                       java.awt.Graphics g,
                       int x,
                       int y,
                       int width,
                       int height)
Draw the Border within the specified rectangle on the specified component.

Specified by:
drawInRect in interface BorderInterface
Specified by:
drawInRect in class Border
Parameters:
comp - the java.awt.Component to draw the border on, can be null
g - the Graphics context
x - the x position of the border rectangle
y - the y position of the border rectangle
width - the width of the border rectangle
height - the height of the border rectangle
See Also:
BorderInterface

getBorderWidth

public int getBorderWidth()
Get the width of the BaseBorder

Specified by:
getBorderWidth in interface BorderInterface
Overrides:
getBorderWidth in class Border
Returns:
int value of the border width
See Also:
setBorderWidth(int)

getComponent

public java.awt.Component getComponent()
Get the component the border is drawn on. This is used only to find the font if one is not set.

Returns:
the component the border is drawn on
See Also:
setComponent(java.awt.Component)

getFont

public java.awt.Font getFont()
Get the font used to display the border text. Font may be null, in which case the border text will use the current font from the component passed in to the drawInRect() method.

Returns:
the font used in the border text
See Also:
setFont(java.awt.Font)

getInsets

public java.awt.Insets getInsets(java.awt.Component comp)
Get the Insets of the Border on the specified component.

Specified by:
getInsets in interface BorderInterface
Specified by:
getInsets in class Border
Parameters:
comp - the component to draw the border on, can be null.
Returns:
the Insets of the Border.

getText

public java.lang.String getText()
Get the text to be displayed in the border.

Specified by:
getText in interface com.sas.lang.StringDataInterface
Returns:
the text that is displayed in the border
See Also:
setText(java.lang.String)

getTextAlignment

public int getTextAlignment()
Get the alignment of the text on the top line of the border: LEFT, RIGHT, or CENTER.

Returns:
the int value representing the orientation of text on the border
See Also:
setTextAlignment(int), Orientations

getTextGap

public int getTextGap()
Get the gap between the text and the border line.

Returns:
gap at the start and end of the text where the border is not drawn.
See Also:
setTextGap(int)

getTextMargin

public int getTextMargin()
Get the pixel margin for the text when it is aligned to the LEFT or the RIGHT side.

Returns:
the int value ot the text margin
See Also:
setTextMargin(int)

getBackgroundColor

public java.awt.Color getBackgroundColor()
Get the background Color used for this BaseBorder when text is drawn.

Returns:
the background color of the text
See Also:
setBackgroundColor(java.awt.Color)

getForegroundColor

public java.awt.Color getForegroundColor()
Get the foreground Color used for this BaseBorder when text is drawn.

Returns:
the foreground color of the text
See Also:
setForegroundColor(java.awt.Color)

getHighlightColor

public java.awt.Color getHighlightColor()
Get the highlight Color used for this BaseBorder.

Returns:
the highlight color of the base border
See Also:
setHighlightColor(java.awt.Color)

getShadowColor

public java.awt.Color getShadowColor()
Get the shadow Color used for this BaseBorder.

Returns:
the shadow color for this BaseBorder
See Also:
setShadowColor(java.awt.Color)

paintBorder

public static void paintBorder(java.awt.Graphics g,
                               int x,
                               int y,
                               int width,
                               int height,
                               java.awt.Color highlight,
                               java.awt.Color shadow,
                               int style,
                               int bWidth,
                               int lSource,
                               int sides)
Paint the border given all the major parameters to describe the border.

Parameters:
g - the Graphics context
x - the x position of the border
y - the y position of the border
width - the width of the border
height - the height of the border
highlight - the highlight color of the border
shadow - the shadow color of the border
style - the style of the border
bWidth - the border width of the border
lSource - the lightSource of the border
sides - the sides to be drawn on the border NOT IMPLEMENTED

setBorderWidth

public void setBorderWidth(int width)
Set the border width for this BaseBorder.

Specified by:
setBorderWidth in interface BorderInterface
Overrides:
setBorderWidth in class Border
Parameters:
width - desired width in pixels
See Also:
getBorderWidth()

setComponent

public void setComponent(java.awt.Component comp)
Set the component used to find the backgroundColor, foregroundColor, or font if they are not set.

Parameters:
comp - the component the border is to be drawn on
See Also:
getComponent()

setFont

public void setFont(java.awt.Font f)
Set the font to be used to display the text on the border. normal size. If the font is set to null, the font from the component passed to drawInRect() will be used. If that component is null the font from the component property will be used.

Parameters:
f - the font that the text is to be displayed in
See Also:
getFont()

setText

public void setText(java.lang.String txt)
Set the text to be displayed on the top area of the border.

Specified by:
setText in interface com.sas.lang.StringDataInterface
Parameters:
txt - text to be displayed on this BaseBorder
See Also:
getText()

setTextAlignment

public void setTextAlignment(int a)
Set the text alignment to CENTER, LEFT, or RIGHT for display on the top area of the border.

Parameters:
a - the int value CENTER, LEFT, or RIGHT to set the text alignment on border
See Also:
getTextAlignment()

setTextGap

public void setTextGap(int g)
Set the gap between the text and the border line.

Parameters:
g - the gap at the start and end of the text where the border is not drawn.
See Also:
getTextGap()

setTextMargin

public void setTextMargin(int m)
Set the margin between the edge of the border the text is aligned to and the text when the alignment is LEFT or RIGHT.

Parameters:
m - the desired int value in pixels for the border width
See Also:
getTextMargin()

setBackgroundColor

public void setBackgroundColor(java.awt.Color c)
Set the background Color for this BaseBorder, used as background for the text. If the backgroundColor is set to null, the backgroundColor from the component passed to drawInRect() will be used. If that component is null the backgroundColor from the component property will be used.

Parameters:
c - color to set background with
See Also:
getBackgroundColor()

setForegroundColor

public void setForegroundColor(java.awt.Color c)
Set the foreground Color for this BaseBorder, used as foreground for the text. If the foregroundColor is set to null, the foregroundColor from the component passed to drawInRect() will be used. If that component is null the foregroundColor from the component property will be used.

Parameters:
c - color to set the foreground with
See Also:
getForegroundColor()

setBaseColor

public void setBaseColor(java.awt.Color c)
Set the base Color for this BaseBorder. This will also set the highlightColor to baseColor.brighter() and the shadowColor to baseColor.darker().

Overrides:
setBaseColor in class Border
Parameters:
c - base color for this BaseBorder
See Also:
Border.getBaseColor()

setHighlightColor

public void setHighlightColor(java.awt.Color c)
Set the highlight Color for this BaseBorder. The use of the highlight color depends on the lightSource for this BaseBorder.

Parameters:
c - color represent the highlight color of the light source
See Also:
getHighlightColor()

setShadowColor

public void setShadowColor(java.awt.Color c)
Set the shadow Color for this BaseBorder. The use of the shadow color depends on the lightSource for this BaseBorder.

Parameters:
c - color of the shadow color of the BaseBorder
See Also:
getShadowColor()

paramString

protected java.lang.String paramString()
Used in the toString() method

Overrides:
paramString in class Border
See Also:
toString()

toString

public java.lang.String toString()
Returns a string with all this BaseBorder information, inccluding style, alignment, and entire border structure.

Overrides:
toString in class Border
Returns:
string with all this BaseBorder information

hashCode

public int hashCode()
Overrides:
hashCode in class Border

equals

public boolean equals(java.lang.Object item)
Check if an object is equal to this BaseBorder. All the properties of the BaseBorder are checked for equality except the component property. The component property will be different for almost all BaseBorder objects and doesn't change how the border is painted so it isn't checked. The component is now passed into the drawInRect() method so the property isn't needed.

Overrides:
equals in class Border



Copyright © 2009 SAS Institute Inc. All Rights Reserved.