fdda.graphics
Interface Component

All Superinterfaces:
Cloneable
All Known Subinterfaces:
Container, Line, Message, Node
All Known Implementing Classes:
Component, Container, Line, Message, Node

public interface Component
extends Cloneable

Abstract superclass of all graphical components in the model. Subclasses include Nodes and Lines.

Author:
Jörg Rüdenauer

Field Summary
static int SEL_ALL
          Indicates that this component may be selected together with any other component.
static int SEL_EQUALS
          Indicates that this component may only be selected with components of the same type.
static int SEL_MOVABLES
          Indicates that this component may be selected together with all movable components.
static int SEL_NOTHING
          Indicates that this component may only be selected alone.
 
Method Summary
 Object clone()
          Clones the component
 void deselect()
          Deselects the component.
 GraphicalSystem getGraphicalSystem()
          Returns the system which includes the component.
 Shape getShape()
          Returns the shape of the component.
 double getX()
          Returns the x coordinate of the component (or its most prominent point).
 double getY()
          Returns the y coordinate of the component (or its most prominent point).
 boolean isMovable()
          Can this component be moved directly by the user?
 boolean isSelected()
          Returns whether the component is currently selected.
 void move(double xOffset, double yOffset)
          Move the component (or its most prominent point).
 void recalculateShape()
          Recalculates the shape of the component.
 void select()
          Selects the component.
 int selectableWith()
          Returns with which class of components this component can be selected.
 void setGraphicalSystem(GraphicalSystem graphicalSystem)
          Sets the system which includes the component
 void setXY(double x, double y)
          Sets the coordinates of the component (or of its most prominent point).
 Object visit(ComponentVisitor visitor)
          Visitor-pattern: visits this component.
 

Field Detail

SEL_NOTHING

public static final int SEL_NOTHING
Indicates that this component may only be selected alone.

See Also:
Constant Field Values

SEL_EQUALS

public static final int SEL_EQUALS
Indicates that this component may only be selected with components of the same type.

See Also:
Constant Field Values

SEL_MOVABLES

public static final int SEL_MOVABLES
Indicates that this component may be selected together with all movable components.

See Also:
Constant Field Values

SEL_ALL

public static final int SEL_ALL
Indicates that this component may be selected together with any other component.

See Also:
Constant Field Values
Method Detail

isMovable

public boolean isMovable()
Can this component be moved directly by the user?

Returns:
true, iff the user can move the component

move

public void move(double xOffset,
                 double yOffset)
Move the component (or its most prominent point).

Parameters:
xOffset - offset for move in x direction
yOffset - offset for move in y direction

selectableWith

public int selectableWith()
Returns with which class of components this component can be selected. One of the SEL_XXX constants.

Returns:
constant indicating the selection class

select

public void select()
Selects the component.


deselect

public void deselect()
Deselects the component.


isSelected

public boolean isSelected()
Returns whether the component is currently selected.

Returns:
the selection state.

getX

public double getX()
Returns the x coordinate of the component (or its most prominent point).

Returns:
the x coordinate

getY

public double getY()
Returns the y coordinate of the component (or its most prominent point).

Returns:
the y coordinate

setXY

public void setXY(double x,
                  double y)
Sets the coordinates of the component (or of its most prominent point).

Parameters:
x - the x coordinate
y - the y coordinate

getShape

public Shape getShape()
Returns the shape of the component. This may actually be bigger than the shape seen on screen. It is the shape that is redrawn by the graphic system.

Returns:
the shape of the component

recalculateShape

public void recalculateShape()
Recalculates the shape of the component. Needs not be called explicitly if the change of the shape is made by other member functions.


getGraphicalSystem

public GraphicalSystem getGraphicalSystem()
Returns the system which includes the component.

Returns:
the graphical system

setGraphicalSystem

public void setGraphicalSystem(GraphicalSystem graphicalSystem)
Sets the system which includes the component

Parameters:
graphicalSystem - the graphical system

visit

public Object visit(ComponentVisitor visitor)
Visitor-pattern: visits this component.

Parameters:
visitor - the visitor
Returns:
specific to subclass

clone

public Object clone()
Clones the component

Returns:
the clone


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.