org.diylc.components
Class AbstractComponent<T>

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

public abstract class AbstractComponent<T>
extends java.lang.Object
implements IDIYComponent<T>

Abstract implementation of IDIYComponent that contains component name and toString. IMPORTANT: to improve performance, all fields except for Point and Point arrays should be immutable. Failing to comply with this can result in annoying and hard to trace bugs.

Author:
Branislav Stojkovic
See Also:
Serialized Form

Field Summary
static java.awt.Color LABEL_COLOR
           
static java.awt.Color LABEL_COLOR_SELECTED
           
static java.awt.Font LABEL_FONT
           
static java.awt.Color METAL_COLOR
           
static java.awt.Color SELECTION_COLOR
           
 
Fields inherited from interface org.diylc.core.IDIYComponent
BOARD, CHASSIS, COMPONENT, TEXT, TRACE
 
Constructor Summary
AbstractComponent()
           
 
Method Summary
 boolean canControlPointOverlap(int index)
           
 IDIYComponent<T> clone()
          Clones the component.
 boolean equalsTo(IDIYComponent<?> other)
          Checks if two components are equal.
 java.lang.String getName()
           
 java.lang.String getValueForDisplay()
           
 void setName(java.lang.String name)
          Updates component instance name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.diylc.core.IDIYComponent
draw, drawIcon, getControlPoint, getControlPointCount, getControlPointVisibilityPolicy, getValue, isControlPointSticky, setControlPoint, setValue
 

Field Detail

SELECTION_COLOR

public static java.awt.Color SELECTION_COLOR

LABEL_COLOR

public static java.awt.Color LABEL_COLOR

LABEL_COLOR_SELECTED

public static java.awt.Color LABEL_COLOR_SELECTED

LABEL_FONT

public static java.awt.Font LABEL_FONT

METAL_COLOR

public static java.awt.Color METAL_COLOR
Constructor Detail

AbstractComponent

public AbstractComponent()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface IDIYComponent<T>
Returns:
component instance name.

setName

public void setName(java.lang.String name)
Description copied from interface: IDIYComponent
Updates component instance name.

Specified by:
setName in interface IDIYComponent<T>

canControlPointOverlap

public boolean canControlPointOverlap(int index)
Specified by:
canControlPointOverlap in interface IDIYComponent<T>
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.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getValueForDisplay

public java.lang.String getValueForDisplay()
Specified by:
getValueForDisplay in interface IDIYComponent<T>
Returns:
full value for BOM.

clone

public IDIYComponent<T> clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: IDIYComponent
Clones the component.

Specified by:
clone in interface IDIYComponent<T>
Overrides:
clone in class java.lang.Object
Returns:
Throws:
java.lang.CloneNotSupportedException

equalsTo

public boolean equalsTo(IDIYComponent<?> other)
Description copied from interface: IDIYComponent
Checks if two components are equal.

Specified by:
equalsTo in interface IDIYComponent<T>
Returns: