org.diylc.components
Class AbstractLeadedComponent<T>

java.lang.Object
  extended by org.diylc.components.AbstractComponent<T>
      extended by org.diylc.components.AbstractTransparentComponent<T>
          extended by org.diylc.components.AbstractLeadedComponent<T>
All Implemented Interfaces:
java.io.Serializable, IDIYComponent<T>
Direct Known Subclasses:
AbstractRadialComponent, AbstractSchematicLeadedSymbol

public abstract class AbstractLeadedComponent<T>
extends AbstractTransparentComponent<T>

Base class for all leaded components such as resistors or capacitors. Has two control points and draws leads between them. Also, it positions and draws the shape of the component as specified by a child class.

Author:
Branislav Stojkovic
See Also:
Serialized Form

Field Summary
static Size DEFAULT_SIZE
           
static java.awt.Color LEAD_COLOR
           
static java.awt.Color LEAD_COLOR_ICON
           
static Size LEAD_THICKNESS
           
 
Fields inherited from class org.diylc.components.AbstractTransparentComponent
MAX_ALPHA
 
Fields inherited from class org.diylc.components.AbstractComponent
LABEL_COLOR, LABEL_COLOR_SELECTED, LABEL_FONT, METAL_COLOR, SELECTION_COLOR
 
Fields inherited from interface org.diylc.core.IDIYComponent
BOARD, CHASSIS, COMPONENT, TEXT, TRACE
 
Method Summary
 void draw(java.awt.Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, IDrawingObserver drawingObserver)
          Draws the component onto the Graphics2D.
 java.awt.Color getBodyColor()
           
 java.awt.Color getBorderColor()
           
 java.awt.Point getControlPoint(int index)
           
 int getControlPointCount()
           
 VisibilityPolicy getControlPointVisibilityPolicy(int index)
           
 Display getDisplay()
           
 boolean getFlipStanding()
          Override this method with @EditableProperty annotation in child classes where standing mode is supported
 java.awt.Color getLabelColor()
           
 java.awt.Color getLeadColor()
           
 Size getLength()
           
 java.awt.Color getStandingBodyColor()
           
 Size getWidth()
           
 boolean isControlPointSticky(int index)
           
 void setBodyColor(java.awt.Color bodyColor)
           
 void setBorderColor(java.awt.Color borderColor)
           
 void setControlPoint(java.awt.Point point, int index)
          Updates the control point at the specified index.
 void setDisplay(Display display)
           
 void setFlipStanding(boolean flipStanding)
           
 void setLabelColor(java.awt.Color labelColor)
           
 void setLeadColor(java.awt.Color leadColor)
           
 void setLength(Size length)
           
 void setWidth(Size width)
           
 
Methods inherited from class org.diylc.components.AbstractTransparentComponent
getAlpha, setAlpha
 
Methods inherited from class org.diylc.components.AbstractComponent
canControlPointOverlap, clone, equalsTo, getName, getValueForDisplay, setName, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.diylc.core.IDIYComponent
drawIcon, getValue, setValue
 

Field Detail

LEAD_COLOR

public static java.awt.Color LEAD_COLOR

LEAD_COLOR_ICON

public static java.awt.Color LEAD_COLOR_ICON

LEAD_THICKNESS

public static Size LEAD_THICKNESS

DEFAULT_SIZE

public static Size DEFAULT_SIZE
Method Detail

draw

public void draw(java.awt.Graphics2D g2d,
                 ComponentState componentState,
                 boolean outlineMode,
                 Project project,
                 IDrawingObserver drawingObserver)
Description copied from interface: IDIYComponent
Draws the component onto the Graphics2D.


getLeadColor

public java.awt.Color getLeadColor()

setLeadColor

public void setLeadColor(java.awt.Color leadColor)

getControlPointCount

public int getControlPointCount()
Returns:
number of control points for this component instance. May vary between two instances of the same type, e.g. DIL IC with 8 and 16 pins will have 8 or 16 pins although they are of the same type.

getControlPoint

public java.awt.Point getControlPoint(int index)
Returns:
control point at the specified index.

isControlPointSticky

public boolean isControlPointSticky(int index)
Returns:
true, if the specified control point may stick to control points of other components.

getControlPointVisibilityPolicy

public VisibilityPolicy getControlPointVisibilityPolicy(int index)

setControlPoint

public void setControlPoint(java.awt.Point point,
                            int index)
Description copied from interface: IDIYComponent
Updates the control point at the specified index.


getBodyColor

public java.awt.Color getBodyColor()

setBodyColor

public void setBodyColor(java.awt.Color bodyColor)

getStandingBodyColor

public java.awt.Color getStandingBodyColor()

getBorderColor

public java.awt.Color getBorderColor()

setBorderColor

public void setBorderColor(java.awt.Color borderColor)

getLength

public Size getLength()

setLength

public void setLength(Size length)

getWidth

public Size getWidth()

setWidth

public void setWidth(Size width)

getDisplay

public Display getDisplay()

setDisplay

public void setDisplay(Display display)

getLabelColor

public java.awt.Color getLabelColor()

setLabelColor

public void setLabelColor(java.awt.Color labelColor)

getFlipStanding

public boolean getFlipStanding()
Override this method with @EditableProperty annotation in child classes where standing mode is supported

Returns:

setFlipStanding

public void setFlipStanding(boolean flipStanding)