jdraw.jdraw
Class Tools

java.lang.Object
  |
  +--java.util.Observable
        |
        +--mvp.Model
              |
              +--jdraw.jdraw.Tools
All Implemented Interfaces:
java.io.Serializable

public class Tools
extends mvp.Model

Class Tools is the top-level Model class for the apps ToolBar. It contains instances of all necessary Model classes for access to methods. It contains methods for all ToolBar operations.

See Also:
Serialized Form

Field Summary
protected  int activeTool
          An index to the active Canvas object.
protected  java.util.Vector canvasList
          A local reference to the list of canvases.
protected  int currentArrows
           
protected  java.awt.Color currentBackgroundColor
          A Color value to store the current background color.
protected  java.awt.Color currentColor
          A Color value to store the current color.
protected  java.util.Vector currentFillType
          An int to store the current fill type.
protected  java.awt.BasicStroke currentStroke
          A BasicStroke to store the current stroke.
protected  java.util.Vector graphicsBuffer
          A Vector to store graphics which are copied or cut.
protected  JDraw jdraw
          A local reference to the top-level JDraw object.
 
Fields inherited from class mvp.Model
view
 
Constructor Summary
Tools(mvp.View view, JDraw jdraw)
          Construct this with the given View component.
 
Method Summary
 void drawCurve()
          Set drawCurve as the activeTool.
 void drawEllipse()
          Set drawEllipse as the activeTool.
 void drawLine()
          Set drawLine as the activeTool.
 void drawMultiLine()
          Set drawMultiLine as the activeTool.
 void drawPolygon()
          Set drawPolygon as the activeTool.
 void drawRectangle()
          Set drawRectangle as the activeTool.
 void drawShape()
          Set drawShape as the activeTool.
 void drawText()
          Set drawText as the activeTool.
 int getActiveTool()
          Returns the int value in activeTool.
 int getActiveWindowIndex()
          Returns the activeWindowIndex.
 int getCurrentArrows()
           
 java.awt.Color getCurrentBackgroundColor()
          Returns the Color object stored in currentBackgroundColor.
 java.awt.Color getCurrentColor()
          Returns the Color value in currentColor.
 java.util.Vector getCurrentFillType()
          Returns the int value stored in currentFillType.
 java.awt.BasicStroke getCurrentStroke()
          Returns the BasicStroke currently stored in currentStroke.
 void move()
          Set Move as the activeTool.
 void reshape()
          Set Reshape as the activeTool.
 void rotate()
          Set Rotate as the activeTool.
 void scale()
          Set Scale as the activeTool.
 void select()
          Set Selection as the activeTool.
 void setActiveTool(int toolIndex)
          Sets the given integer as activeTool.
 void setActiveWindowIndex(int newIndex)
          Set the activeWindowIndex given the parameter int.
 void setCanvasList(java.util.Vector cList)
          Set the canvasList as the given Vector.
 void setCurrentBackgroundColor(java.awt.Color c)
          Sets the currentBackgroundColor value given the parameter Color.
 void setCurrentColor(java.awt.Color c)
          Sets the currentColor value given the parameter Color.
 void setCurrentFillType(java.util.Vector p)
          Sets currentFillType as the passed in int value.
 void setCurrentStroke(java.awt.BasicStroke bs, int arrows)
          Sets currentStroke as the passed in BasicStroke.
 void stretch()
          Set Stretch as the activeTool.
 
Methods inherited from class mvp.Model
getView, setView
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvasList

protected java.util.Vector canvasList
A local reference to the list of canvases.

activeTool

protected int activeTool
An index to the active Canvas object.

currentColor

protected java.awt.Color currentColor
A Color value to store the current color.

currentBackgroundColor

protected java.awt.Color currentBackgroundColor
A Color value to store the current background color.

currentFillType

protected java.util.Vector currentFillType
An int to store the current fill type.

currentStroke

protected java.awt.BasicStroke currentStroke
A BasicStroke to store the current stroke.

jdraw

protected JDraw jdraw
A local reference to the top-level JDraw object.

graphicsBuffer

protected java.util.Vector graphicsBuffer
A Vector to store graphics which are copied or cut.

currentArrows

protected int currentArrows
Constructor Detail

Tools

public Tools(mvp.View view,
             JDraw jdraw)
Construct this with the given View component. Invoke the Vector and set index = 0.
Parameters:
view - - The View object to be passed to the parent constructor.
jdraw - - The JDraw object to be set as this.jdraw.
Method Detail

select

public void select()
Set Selection as the activeTool.

move

public void move()
Set Move as the activeTool.

scale

public void scale()
Set Scale as the activeTool.

stretch

public void stretch()
Set Stretch as the activeTool.

rotate

public void rotate()
Set Rotate as the activeTool.

reshape

public void reshape()
Set Reshape as the activeTool.

drawText

public void drawText()
Set drawText as the activeTool.

drawLine

public void drawLine()
Set drawLine as the activeTool.

drawMultiLine

public void drawMultiLine()
Set drawMultiLine as the activeTool.

drawCurve

public void drawCurve()
Set drawCurve as the activeTool.

drawEllipse

public void drawEllipse()
Set drawEllipse as the activeTool.

drawRectangle

public void drawRectangle()
Set drawRectangle as the activeTool.

drawPolygon

public void drawPolygon()
Set drawPolygon as the activeTool.

drawShape

public void drawShape()
Set drawShape as the activeTool.

setCanvasList

public void setCanvasList(java.util.Vector cList)
Set the canvasList as the given Vector.
Parameters:
cList - - The Vector to be set as canvasList.

getActiveWindowIndex

public int getActiveWindowIndex()
Returns the activeWindowIndex.
Returns:
- The int returned by jdraw.getActiveWindowIndex().

setActiveWindowIndex

public void setActiveWindowIndex(int newIndex)
Set the activeWindowIndex given the parameter int.
Parameters:
newIndex - - The int value to be stored as the ActiveWindowIndex.

setActiveTool

public void setActiveTool(int toolIndex)
Sets the given integer as activeTool.
Parameters:
toolIndex - - The int value to be stored in toolIndex.

getActiveTool

public int getActiveTool()
Returns the int value in activeTool.
Returns:
- The int value stored in activeTool.

getCurrentColor

public java.awt.Color getCurrentColor()
Returns the Color value in currentColor.
Returns:
- The Color object stored in currentColor.

setCurrentColor

public void setCurrentColor(java.awt.Color c)
Sets the currentColor value given the parameter Color.
Parameters:
c - - The Color object to be stored as currentColor.

setCurrentBackgroundColor

public void setCurrentBackgroundColor(java.awt.Color c)
Sets the currentBackgroundColor value given the parameter Color.
Parameters:
c - - The Color object to be stored as currentBackgroundColor.

getCurrentBackgroundColor

public java.awt.Color getCurrentBackgroundColor()
Returns the Color object stored in currentBackgroundColor.
Returns:
- The Color object stored in currentBackgroundColor.

getCurrentFillType

public java.util.Vector getCurrentFillType()
Returns the int value stored in currentFillType.
Returns:
- The int value stored in currentFillType.

setCurrentFillType

public void setCurrentFillType(java.util.Vector p)
Sets currentFillType as the passed in int value.
Parameters:
f - - The int value to be stored in currentFillType.

setCurrentStroke

public void setCurrentStroke(java.awt.BasicStroke bs,
                             int arrows)
Sets currentStroke as the passed in BasicStroke.
Parameters:
bs - - The BasicStroke to be stored in currentStroke.

getCurrentStroke

public java.awt.BasicStroke getCurrentStroke()
Returns the BasicStroke currently stored in currentStroke.
Returns:
- The BasicStroke currently stored in currentStroke.

getCurrentArrows

public int getCurrentArrows()