org.diylc.core
Interface IDIYComponent<T>

Type Parameters:
T - type of component values, e.g. Resistance for resistors or String for transistors.
All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractComponent, AbstractCurvedComponent, AbstractLeadedComponent, AbstractRadialComponent, AbstractSchematicLeadedSymbol, AbstractTransparentComponent

public interface IDIYComponent<T>
extends java.io.Serializable

Interface for component instance. Implementation classes of this interface will be instantiated by the application when component is added to the canvas.

Implementing classes should meet the following:

Author:
Branislav Stojkovic

Field Summary
static int BOARD
           
static int CHASSIS
           
static int COMPONENT
           
static int TEXT
           
static int TRACE
           
 
Method Summary
 boolean canControlPointOverlap(int index)
           
 IDIYComponent<T> clone()
          Clones the component.
 void draw(java.awt.Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, IDrawingObserver drawingObserver)
          Draws the component onto the Graphics2D.
 void drawIcon(java.awt.Graphics2D g2d, int width, int height)
          Draws icon representation of the component.
 boolean equalsTo(IDIYComponent<?> other)
          Checks if two components are equal.
 java.awt.Point getControlPoint(int index)
           
 int getControlPointCount()
           
 VisibilityPolicy getControlPointVisibilityPolicy(int index)
           
 java.lang.String getName()
           
 T getValue()
           
 java.lang.String getValueForDisplay()
           
 boolean isControlPointSticky(int index)
           
 void setControlPoint(java.awt.Point point, int index)
          Updates the control point at the specified index.
 void setName(java.lang.String name)
          Updates component instance name.
 void setValue(T value)
          Updates component value.
 

Field Detail

CHASSIS

static final int CHASSIS
See Also:
Constant Field Values

BOARD

static final int BOARD
See Also:
Constant Field Values

TRACE

static final int TRACE
See Also:
Constant Field Values

COMPONENT

static final int COMPONENT
See Also:
Constant Field Values

TEXT

static final int TEXT
See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns:
component instance name.

setName

void setName(java.lang.String name)
Updates component instance name.

Parameters:
name -

getValue

T getValue()
Returns:
component value.

setValue

void setValue(T value)
Updates component value.

Parameters:
value -

getControlPointCount

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

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

setControlPoint

void setControlPoint(java.awt.Point point,
                     int index)
Updates the control point at the specified index.

Parameters:
point -
index -

isControlPointSticky

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

canControlPointOverlap

boolean canControlPointOverlap(int index)
Parameters:
index -
Returns:
true, if the specified control point may overlap with other control points of the same component. The other control point must be able to overlap too.

getControlPointVisibilityPolicy

VisibilityPolicy getControlPointVisibilityPolicy(int index)

draw

void draw(java.awt.Graphics2D g2d,
          ComponentState componentState,
          boolean outlineMode,
          Project project,
          IDrawingObserver drawingObserver)
Draws the component onto the Graphics2D.

Parameters:
g2d -
componentState -
outlineMode -
project -
drawingObserver -

drawIcon

void drawIcon(java.awt.Graphics2D g2d,
              int width,
              int height)
Draws icon representation of the component. This should not depend on component state, i.e. it should be treated as a static method.

Parameters:
g2d -
width -
height -

clone

IDIYComponent<T> clone()
                       throws java.lang.CloneNotSupportedException
Clones the component.

Returns:
Throws:
java.lang.CloneNotSupportedException

getValueForDisplay

java.lang.String getValueForDisplay()
Returns:
full value for BOM.

equalsTo

boolean equalsTo(IDIYComponent<?> other)
Checks if two components are equal.

Parameters:
other -
Returns: