org.jhotdraw.samples.pert.figures
Class TaskFigure

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractFigure
          extended by org.jhotdraw.draw.AbstractCompositeFigure
              extended by org.jhotdraw.draw.GraphicalCompositeFigure
                  extended by org.jhotdraw.samples.pert.figures.TaskFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CompositeFigure, Figure, DOMStorable

public class TaskFigure
extends GraphicalCompositeFigure

TaskFigure.

Version:
$Id: TaskFigure.java 647 2010-01-24 22:52:59Z rawcoder $
Author:
Werner Randelshofer.
See Also:
Serialized Form

Nested Class Summary
private static class TaskFigure.DurationAdapter
           
private static class TaskFigure.NameAdapter
          This adapter is used, to connect a TextFigure with the name of the TaskFigure model.
 
Nested classes/interfaces inherited from class org.jhotdraw.draw.AbstractCompositeFigure
AbstractCompositeFigure.EventHandler
 
Field Summary
private  java.util.HashSet<DependencyFigure> dependencies
           
 
Fields inherited from class org.jhotdraw.draw.GraphicalCompositeFigure
attributes
 
Fields inherited from class org.jhotdraw.draw.AbstractCompositeFigure
cachedBounds, cachedDrawingArea, children, eventHandler, layouter
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Fields inherited from interface org.jhotdraw.draw.CompositeFigure
LAYOUT_INSETS
 
Fields inherited from interface org.jhotdraw.draw.Figure
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
 
Constructor Summary
TaskFigure()
          Creates a new instance.
 
Method Summary
 void addDependency(DependencyFigure f)
           
private  void applyAttributes(Figure f)
           
 TaskFigure clone()
          Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators.
 java.util.Collection<Handle> createHandles(int detailLevel)
          Return default handles from the presentation figure.
 java.util.Set<DependencyFigure> getDependencies()
           
 int getDuration()
           
private  TextFigure getDurationFigure()
           
 int getLayer()
          AbstractFigure always returns 0.
 java.lang.String getName()
           
private  TextFigure getNameFigure()
           
 java.util.List<TaskFigure> getPredecessors()
          Returns predecessor PertTasks which are directly connected via a PertDependency to this TaskFigure.
 int getStartTime()
           
private  TextFigure getStartTimeFigure()
           
 java.util.List<TaskFigure> getSuccessors()
          Returns dependent PertTasks which are directly connected via a PertDependency to this TaskFigure.
 boolean isDependentOf(TaskFigure t)
          Returns true, if the current task is a direct or indirect dependent of the specified task.
 void read(DOMInput in)
           
 void removeDependency(DependencyFigure f)
           
 void setDuration(int newValue)
           
 void setName(java.lang.String newValue)
           
 java.lang.String toString()
           
 void updateStartTime()
           
 void write(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.GraphicalCompositeFigure
addNotify, applyAttributesTo, basicSetPresentationFigureBounds, chop, contains, draw, drawPresentationFigure, get, getAttributeKey, getAttributes, getBounds, getDrawingArea, getPresentationFigure, readAttributes, remap, removeNotify, set, setAttributeEnabled, setBounds, setPresentationFigure, superBasicSetBounds, transform, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractCompositeFigure
add, add, addAll, addAll, addCompositeFigureListener, basicAdd, basicAdd, basicAddAll, basicRemove, basicRemoveAll, basicRemoveAllChildren, basicRemoveChild, bringToFront, changed, contains, createEventHandler, findChild, findChildIndex, findFigureInside, fireFigureAdded, fireFigureRemoved, getAttributesRestoreData, getChild, getChildCount, getChildren, getChildrenFrontToBack, getDecomposition, getLayouter, getPreferredSize, getTransformRestoreData, indexOf, invalidate, layout, remove, removeAll, removeAllChildren, removeChild, removeCompositeFigureListener, restoreAttributesTo, restoreTransformTo, sendToBack, setLayouter, validate, willChange
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, basicClone, findCompatibleConnector, findConnector, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDrawing, getEndPoint, getFontRenderContext, getLock, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isChanging, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, requestRemove, setBounds, setConnectable, setRemovable, setSelectable, setTransformable, setVisible
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addPropertyChangeListener, findCompatibleConnector, findConnector, getActions, getConnectors, getCursor, getEndPoint, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removePropertyChangeListener, requestRemove
 

Field Detail

dependencies

private java.util.HashSet<DependencyFigure> dependencies
Constructor Detail

TaskFigure

public TaskFigure()
Creates a new instance.

Method Detail

createHandles

public java.util.Collection<Handle> createHandles(int detailLevel)
Description copied from class: GraphicalCompositeFigure
Return default handles from the presentation figure.

Specified by:
createHandles in interface Figure
Overrides:
createHandles in class GraphicalCompositeFigure
Parameters:
detailLevel - The detail level of the handles. Usually this is 0 for bounding box handles and 1 for point handles. The value -1 is used by the SelectAreaTracker and the HandleTracker to highlight figures, over which the mouse pointer is hovering.
Returns:
a Collection of handles
See Also:
Handle

setName

public void setName(java.lang.String newValue)

getName

public java.lang.String getName()

setDuration

public void setDuration(int newValue)

getDuration

public int getDuration()

updateStartTime

public void updateStartTime()

getStartTime

public int getStartTime()

getNameFigure

private TextFigure getNameFigure()

getDurationFigure

private TextFigure getDurationFigure()

getStartTimeFigure

private TextFigure getStartTimeFigure()

applyAttributes

private void applyAttributes(Figure f)

clone

public TaskFigure clone()
Description copied from interface: Figure
Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators. The cloned figure does not clone the list of FigureListeners from its original.

Specified by:
clone in interface Figure
Overrides:
clone in class GraphicalCompositeFigure

read

public void read(DOMInput in)
          throws java.io.IOException
Specified by:
read in interface DOMStorable
Overrides:
read in class GraphicalCompositeFigure
Throws:
java.io.IOException

write

public void write(DOMOutput out)
           throws java.io.IOException
Specified by:
write in interface DOMStorable
Overrides:
write in class GraphicalCompositeFigure
Throws:
java.io.IOException

getLayer

public int getLayer()
Description copied from class: AbstractFigure
AbstractFigure always returns 0. Override this method if your figure needs to be on a different layer.

Specified by:
getLayer in interface Figure
Overrides:
getLayer in class AbstractFigure

getDependencies

public java.util.Set<DependencyFigure> getDependencies()

addDependency

public void addDependency(DependencyFigure f)

removeDependency

public void removeDependency(DependencyFigure f)

getSuccessors

public java.util.List<TaskFigure> getSuccessors()
Returns dependent PertTasks which are directly connected via a PertDependency to this TaskFigure.


getPredecessors

public java.util.List<TaskFigure> getPredecessors()
Returns predecessor PertTasks which are directly connected via a PertDependency to this TaskFigure.


isDependentOf

public boolean isDependentOf(TaskFigure t)
Returns true, if the current task is a direct or indirect dependent of the specified task. If the dependency is cyclic, then this method returns true if this is passed as a parameter and for every other task in the cycle.


toString

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