|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.Observable
|
+--mvp.Model
|
+--jdraw.jdraw.Canvas
Class Canvas is the top-level Model class for the drawing canvas.
| Field Summary | |
protected java.lang.String |
filename
Canvas objects also have a filename object. |
protected java.util.Vector |
graphics
Canvas contains a vector of graphic objects. |
protected java.util.Vector |
groups
A Vector which stores groups (Vectors) of indices. |
protected int |
id
A local int value to store this Canvas' id. |
protected boolean |
needSave
A boolean value indicating whether this file has been changed. |
protected java.util.Vector |
selectedGraphics
A Vector which stores indices to GraphicObject's in Vector graphics. |
| Fields inherited from class mvp.Model |
view |
| Constructor Summary | |
Canvas(mvp.View view,
int thisID)
Construct this with the given View component. |
|
Canvas(mvp.View view,
int thisID,
java.lang.String filename)
|
|
Canvas(mvp.View view,
int thisID,
java.lang.String filename,
java.util.Vector graphics,
java.util.Vector groups)
Second Constructor is for opening files ... |
|
| Method Summary | |
void |
addGraphicObject(GraphicObject gObj)
Adds the passed in GraphicObject to the Vector graphics. |
void |
addGraphicObject(java.util.Vector junkBundle)
Adds the GraphicObject, defined by the Vector junkBundle to the Canvas. |
void |
bringSelectedToFront()
Makes calls to bring each selected graphic towards the front. |
void |
bringToFront(int newFrontIndex)
Rearranges the graphics list such that the item previously at index, newBackIndex is now first in the list. |
java.lang.Object |
clone()
|
void |
decrementID()
Decrease this.id by one. |
java.lang.String |
getFilename()
|
GraphicObject |
getGraphic(int i)
Returns the GraphicObject found in Vector graphics at index i. |
java.util.Vector |
getGraphics()
Returns the Vector stored in graphics. |
java.util.Vector |
getGroups()
|
int |
getID()
Returns the int value in this.id. |
boolean |
getNeedSave()
|
int |
getNumberOfGraphics()
|
java.awt.Rectangle |
getSelectedBoundingRectangle()
Returns the smallest Rectangle which contains all the shapes referenced in selectedGraphics. |
java.util.Vector |
getSelectedGraphics()
Returns the Vector stored in selectedGraphics. |
java.util.Vector |
getSelectedShapes()
|
java.util.Vector |
getTouchedGroup(java.awt.Point pt)
Method getTouchedGroup(Point pt) returns the closest graphic (or the group with the closest graphic) to the point passed. |
void |
groupSelected()
If the Vector in selectedGraphics does not equal one of the groups, then add a new group which contains everything in selectedGraphics. |
void |
rotateSelectedFromPoints(java.awt.Point a,
java.awt.Point b)
|
void |
selectAll()
Selects all graphics in this Canvas. |
void |
sendSelectedToBack()
Makes calls to send each selected graphic towards the back. |
void |
sendToBack(int newBackIndex)
Rearranges the graphics list such that the item previously at index, newBackIndex is now last in the list. |
void |
setFilename(java.lang.String newFilename)
|
void |
setNeedSave(boolean trueOrFalse)
|
void |
setSelectedGraphics(java.util.Vector newSelected)
Sets the passed in Vector to selectedGraphics. |
void |
ungroupSelected()
If any Group Vector contains everything in selectedGraphics, then remove that group from groups. |
| 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 |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Vector graphics
protected java.lang.String filename
protected int id
protected java.util.Vector selectedGraphics
protected java.util.Vector groups
protected boolean needSave
| Constructor Detail |
public Canvas(mvp.View view,
int thisID)
view - - The View object to be passed to the parent constructor.thisID - - The int value to be used as this.id.
public Canvas(mvp.View view,
int thisID,
java.lang.String filename)
view - - The View object to be passed to the parent constructor.thisID - - The int value to be used as this.id.filename - - The String to be set as this.filename.
public Canvas(mvp.View view,
int thisID,
java.lang.String filename,
java.util.Vector graphics,
java.util.Vector groups)
view - - The View object to be passed to the parent constructor.thisID - - The int value to be used as this.id.filename - - The String to be set as this.filename.graphics - - A Vector of graphics to be placed in this.groups - - A Vector of Vectors of Integers, defining group affiliations.| Method Detail |
public java.util.Vector getGroups()
public int getID()
public java.awt.Rectangle getSelectedBoundingRectangle()
public void setSelectedGraphics(java.util.Vector newSelected)
newSelected - - The Vector to be set in selectedGraphics.public java.util.Vector getSelectedGraphics()
public int getNumberOfGraphics()
public java.lang.String getFilename()
public void setFilename(java.lang.String newFilename)
newFilename - - String to be stored in this.filename.public void setNeedSave(boolean trueOrFalse)
trueOrFalse - - A boolean value indicating whether the file has been changed.public boolean getNeedSave()
public java.util.Vector getGraphics()
public GraphicObject getGraphic(int i)
i - - The int representing an index in graphics.public java.lang.Object clone()
clone in class java.lang.Objectpublic java.util.Vector getTouchedGroup(java.awt.Point pt)
pt - - The Point object whose containment we want to determine.public void groupSelected()
public void ungroupSelected()
public void selectAll()
public void rotateSelectedFromPoints(java.awt.Point a,
java.awt.Point b)
public java.util.Vector getSelectedShapes()
public void addGraphicObject(GraphicObject gObj)
gObj - - The GraphicObject to be added to Vector graphics.public void addGraphicObject(java.util.Vector junkBundle)
junkBundle - - The Vector containing all the necessary
information to rebuild the shape.public void decrementID()
public void bringSelectedToFront()
public void sendSelectedToBack()
public void bringToFront(int newFrontIndex)
public void sendToBack(int newBackIndex)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||