com.sas.visuals
Class Part

com.sas.visuals.Part
All Implemented Interfaces:
com.sas.visuals.PainterInterface, VisualAspects, java.awt.Shape, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Wallpaper

public class Part
implements VisualAspects, com.sas.visuals.PainterInterface, java.io.Serializable

Part is an extension of Rectangle that provides a notion of ultra-lightweight components. The functionality mimics Component as close as possible.

See Also:
Serialized Form

Field Summary
protected  java.awt.Color _bg
          the background color of the Part
protected  BorderInterface _border
           
protected  int _borderStyle
          the border style of the Part
protected  java.awt.Color _fg
          the foreground color of the Part
protected  java.awt.Font _font
          the font associated with the Part
protected  java.awt.Component _parent
          the parent of the Part
protected  java.lang.Boolean _transparent
           
protected  boolean _visible
          the visibility flag of the Part
 
Fields inherited from interface com.sas.visuals.VisualAspects
BDR_BUMP, BDR_BUTTON_NORMAL, BDR_BUTTON_PRESSED, BDR_BUTTON_SELECTED, BDR_DIP, BDR_FIELD_BORDER, BDR_FLAT, BDR_FLAT_BORDER, BDR_GROUP_BORDER, BDR_NONE, BDR_RAISED, BDR_RAISED_INNER, BDR_RAISED_OUTER, BDR_STATUSFIELD_BORDER, BDR_SUNKEN, BDR_SUNKEN_INNER, BDR_SUNKEN_OUTER, BDR_WINDOW_BORDER, BS_NONE, BS_NORMAL, BS_PRESSED, BS_ROUND_NORMAL, BS_ROUND_PRESSED, BS_ROUND_SELECTED, BS_ROUNDEDGE_NORMAL, BS_ROUNDEDGE_PRESSED, BS_ROUNDEDGE_SELECTED, BS_SELECTED, CENTER, CONTENTS_CENTER, CONTENTS_LEFT, CONTENTS_RIGHT, DEVELOPMENT, DOUBLE_BUFFERED, DT_CENTER, DT_LEFT, DT_OPAQUE, DT_RIGHT, DT_UNDERLINE, EAST, HORIZONTAL, NORTH, NORTH_EAST, NORTH_WEST, SHOW_IMAGE, SHOW_NONE, SHOW_TEXT, SOUTH, SOUTH_EAST, SOUTH_WEST, TEXT_CENTER, TEXT_EAST, TEXT_LEFT, TEXT_NORTH, TEXT_RIGHT, TEXT_SOUTH, TEXT_WEST, VERTICAL, WEST
 
Constructor Summary
protected Part()
          The default constructor of the Part
  Part(java.awt.Component parent)
          Creates an Part with the specified parent
  Part(java.awt.Component parent, java.awt.Dimension size)
          Creates an Part with the specified parent and Dimension
  Part(java.awt.Component parent, java.awt.Rectangle size)
          Creates an Part with the specified parent and Rectangle
  Part(Part p)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Two Parts are only equal if they are ==
 java.awt.Color getBackground()
          Gets the background color of the Part.
 BorderInterface getBorder()
           
 java.awt.Font getFont()
          Gets the font associated with the Part.
 java.awt.Color getForeground()
          Gets the foreground color of the Part.
 java.awt.Insets getInsets()
          Gets the insets of the Part.
 java.awt.Dimension getMaximumSize()
          Gets the maximum size of the Part
 java.awt.Dimension getMinimumSize()
          Gets the minimum size of the Part
 java.awt.Component getParent()
          Gets the parent of the Part
 java.awt.Dimension getPreferredSize()
          Gets the preferred size for the Part
 java.awt.Dimension getPreferredSize(java.awt.Graphics g)
          Gets the preferred size for the Part
 int getWindowBorderStyle()
           
 int hashCode()
          Returns a hash code value for the object
 boolean isTransparent()
           
 boolean isVisible()
          Gets the visible attribute of the Part
 void paint(java.awt.Component component, java.awt.Graphics g, int x, int y, int width, int height)
           
 void paint(java.awt.Graphics g)
          Called to paint the properties of the Part.
protected  void paintBackground(java.awt.Graphics g)
           
protected  void paintView(java.awt.Graphics g)
          Called to paint the properties of the Part.
protected  void printView(java.awt.PrintGraphics g)
          Called to print the properties of the Part.
 void repaint()
          Repaints the Part
 void setBackground(java.awt.Color c)
          Sets the background color of the Part
 void setBorder(BorderInterface border)
           
 void setFont(java.awt.Font font)
          Sets the font for the Part
 void setForeground(java.awt.Color c)
          Sets the foreground color of the Part
 void setParent(java.awt.Component parent)
          Sets the Part to have the specified parent
 void setTransparent(boolean transparent)
           
 void setVisible(boolean visible)
          Sets the visible attribute of the Part
 void setWindowBorderStyle(int s)
           
 

Field Detail

_parent

protected java.awt.Component _parent
the parent of the Part


_borderStyle

protected int _borderStyle
the border style of the Part


_fg

protected java.awt.Color _fg
the foreground color of the Part


_bg

protected java.awt.Color _bg
the background color of the Part


_font

protected java.awt.Font _font
the font associated with the Part


_visible

protected boolean _visible
the visibility flag of the Part


_transparent

protected java.lang.Boolean _transparent

_border

protected BorderInterface _border
Constructor Detail

Part

protected Part()
The default constructor of the Part.


Part

public Part(java.awt.Component parent)
Creates an Part with the specified parent.

Parameters:
parent - the parent of the Part

Part

public Part(java.awt.Component parent,
            java.awt.Dimension size)
Creates an Part with the specified parent and Dimension.

Parameters:
parent - the parent of the Part
size - the initial size of the Part

Part

public Part(java.awt.Component parent,
            java.awt.Rectangle size)
Creates an Part with the specified parent and Rectangle.

Parameters:
parent - the parent of the Part
size - the initial size of the Part

Part

public Part(Part p)
Method Detail

getParent

public java.awt.Component getParent()
Gets the parent of the Part


setParent

public void setParent(java.awt.Component parent)
Sets the Part to have the specified parent.

Parameters:
parent - the parent of the Part

repaint

public void repaint()
Repaints the Part.


paint

public void paint(java.awt.Graphics g)
Called to paint the properties of the Part. This function is explicitly called by the parent of the Part. In addition, components extending this class should overide protected void paintView(Graphics g) to draw their specific properties.

Parameters:
g - the Graphics associated with the Part

paint

public void paint(java.awt.Component component,
                  java.awt.Graphics g,
                  int x,
                  int y,
                  int width,
                  int height)
Specified by:
paint in interface com.sas.visuals.PainterInterface

paintView

protected void paintView(java.awt.Graphics g)
Called to paint the properties of the Part. Components extending this class should overide this function to draw their specific properties.

Parameters:
g - the Graphics associated with the Part

paintBackground

protected void paintBackground(java.awt.Graphics g)

printView

protected void printView(java.awt.PrintGraphics g)
Called to print the properties of the Part. Components extending this class should overide this function to print their specific properties. THIS HAS NOT BEEN TESTED.

Parameters:
g - the PrintGraphics associated with the Part

setWindowBorderStyle

public void setWindowBorderStyle(int s)

getWindowBorderStyle

public int getWindowBorderStyle()

getBorder

public BorderInterface getBorder()

setBorder

public void setBorder(BorderInterface border)

getInsets

public java.awt.Insets getInsets()
Gets the insets of the Part. This function was added for consistency between ATKComponent and Part. By default, the insets are based upon the border style of the Part.

Specified by:
getInsets in interface com.sas.visuals.PainterInterface
Returns:
Insets containing the insets of the Part

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size for the Part.

Returns:
Dimension containing the prefered size of the Part.

getPreferredSize

public java.awt.Dimension getPreferredSize(java.awt.Graphics g)
Gets the preferred size for the Part.

Parameters:
g - the Graphics associated with the Part
Returns:
Dimension containing the prefered size of the Part.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Gets the minimum size of the Part.

Returns:
Dimension containing the minimum size of the Part

getMaximumSize

public java.awt.Dimension getMaximumSize()
Gets the maximum size of the Part.

Returns:
Dimension containing the maximum size of the Part

setBackground

public void setBackground(java.awt.Color c)
Sets the background color of the Part.

Parameters:
c - the background color

getBackground

public java.awt.Color getBackground()
Gets the background color of the Part. If the background color is not set then Part uses its parent's background color.


setForeground

public void setForeground(java.awt.Color c)
Sets the foreground color of the Part.

Parameters:
c - the foreground color

getForeground

public java.awt.Color getForeground()
Gets the foreground color of the Part. If the background color is not set then Part uses its parent's foreground color.


setFont

public void setFont(java.awt.Font font)
Sets the font for the Part.

Parameters:
font - the desired font

getFont

public java.awt.Font getFont()
Gets the font associated with the Part. If the font is not set, then Part uses its parent's font.


setVisible

public void setVisible(boolean visible)
Sets the visible attribute of the Part.

Parameters:
visible - the visible attribute

isVisible

public boolean isVisible()
Gets the visible attribute of the Part.


setTransparent

public void setTransparent(boolean transparent)

isTransparent

public boolean isTransparent()

equals

public boolean equals(java.lang.Object obj)
Two Parts are only equal if they are ==.

Overrides:
equals in class java.awt.Rectangle
Parameters:
obj - the object to compare to.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.awt.geom.Rectangle2D
Returns:
The hashcode for this object



Copyright © 2009 SAS Institute Inc. All Rights Reserved.