|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--mvp.View
|
+--jdraw.jdraw_ui.CanvasWindow
Class CanvasWindow is the companion View class for the Canvas Model. It consists of a simple JScrollPane.
| Field Summary | |
protected java.awt.Color |
backgroundColor
Color object backgroundColor holds the value of this Canvas' background color. |
protected Canvas |
canvas
A local reference to the companion Model object. |
protected CanvasPage |
canvasPage
CanvasPage object canvasPage is the JPanel in this.window where the graphics are actually displayed. |
protected int |
currentControlObject
An int which stores the index of the graphic whose control point is currently being reshaped. |
protected int |
currentControlPoint
An int which stores the index of the control point which is currently being reshaped. |
protected java.awt.Point |
currentPoint
Point object currentPoint is needed to hold the position of the mouse when a button is first clicked. |
protected GraphicObject |
graphicObject
A GraphicObject instance where graphics are stored as they're being created. |
protected int |
graphicType
int object graphicType holds the integer representation of the active Graphic Tool. |
protected JDraw |
jdraw
A local reference to the top-level JDraw object. |
protected JDrawKeyListener |
keyListener
The overall Key Listener. |
protected java.util.Vector |
redoBuffer
A Vector to store Canvas objects for redo purposes. |
protected Tools |
tools
A local reference to the upper-level Tools object. |
protected java.util.Vector |
undoBuffer
A Vector to store Canvas objects for undo purposes. |
protected javax.swing.JScrollPane |
windowPane
A JScrollPane in which to put our CanvasPage. |
protected float |
zoom
A float value to store this window's current zoom factor. |
| Fields inherited from class mvp.View |
editable, model, screen, shown, widget, window |
| Constructor Summary | |
CanvasWindow(mvp.Screen screen,
Canvas canvas,
Tools tools,
JDrawKeyListener keyListener)
Construct this with the given Screen, Canvas, and Tools components. |
|
| Method Summary | |
void |
closeWindow()
|
java.awt.Component |
compose()
Compose this by creating a new window. |
void |
dragLeft(java.awt.event.MouseEvent e)
Method leftDrag(MouseEvent) is called by CanvasMouseListener when appropriate. |
Canvas |
getCanvas()
Method getCanvas() returns the current Canvas object in this.canvas. |
CanvasPage |
getCanvasPage()
|
java.awt.Point |
getCurrentPoint()
Method getCurrentPoint() returns the current Point object. |
GraphicObject |
getGraphicObject()
|
int |
getGraphicType()
Method getGraphicType() returns the current integer value in this.graphicType. |
JDraw |
getJDraw()
|
boolean |
getNeedSave()
Method getNeedSave() returns this.needSave. |
java.util.Vector |
getSelectedGraphics()
|
mvp.Window |
getWindow()
|
java.awt.Dimension |
getWindowSize()
|
float |
getZoom()
|
void |
leftPress(java.awt.event.MouseEvent e)
Method leftPress(MouseEvent) is called by CanvasMouseListener when appropriate. |
void |
leftRelease(java.awt.event.MouseEvent e)
Method leftRelease(MouseEvent) is called by CanvasMouseListener when appropriate. |
void |
middleDrag(java.awt.event.MouseEvent e)
This method should be just like the move item ... |
void |
middlePress(java.awt.event.MouseEvent e)
This method should be just like the move item ... |
void |
normalDrag(java.awt.event.MouseEvent e)
Method normalDrag(MouseEvent) is called by CanvasMouseListener when appropriate. |
void |
passKeyEvent(java.awt.event.KeyEvent e)
|
void |
redoLastUndo()
Loads the last element of the redo buffer into this.canvas. |
void |
redrawPage()
Calls the redraw method of this.canvasPage. |
void |
rightPress(java.awt.event.MouseEvent e)
Method rightPress(MouseEvent) is called by CanvasMouseListener when appropriate. |
void |
saveCanvasState()
Copies this.canvas into the undo buffer. |
void |
setAllSelected()
Calls selectAll on this.canvas. |
void |
setJDraw(JDraw jDraw)
Method setJDraw(JDraw) sets this.jdraw to the parameter JDraw object. |
void |
setNeedSave(boolean trueorfalse)
Method setNeedSave(boolean) sets this.needSave to the boolean parameter. |
void |
setToHome()
Method setToHome adjusts this.windowPane so that it's upper left corner is the upper left corner of the entire Canvas. |
void |
setWindow(int x)
Offset a window given the number of current windows. |
void |
setWindowTitle(java.lang.String title)
Method setWindowTitle(String) sets the current window's Title to the parameter String object. |
void |
setZoom(float zoom)
|
void |
undoLastAction()
Loads the last element of the undo buffer into this.canvas. |
| Methods inherited from class mvp.View |
getModel, getWidget, hide, isEditable, isShown, run, setEditable, setModel, show, show, update |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Canvas canvas
protected JDraw jdraw
protected Tools tools
protected java.awt.Point currentPoint
protected CanvasPage canvasPage
protected int graphicType
protected java.awt.Color backgroundColor
protected int currentControlObject
protected int currentControlPoint
protected javax.swing.JScrollPane windowPane
protected GraphicObject graphicObject
protected java.util.Vector undoBuffer
protected java.util.Vector redoBuffer
protected JDrawKeyListener keyListener
protected float zoom
| Constructor Detail |
public CanvasWindow(mvp.Screen screen,
Canvas canvas,
Tools tools,
JDrawKeyListener keyListener)
screen - - Screen object on which to write.canvas - - Corresponding Model object.tools - - Top-Level Tools object.| Method Detail |
public java.awt.Component compose()
compose in class mvp.Viewpublic mvp.Window getWindow()
getWindow in class mvp.Viewpublic CanvasPage getCanvasPage()
public void leftPress(java.awt.event.MouseEvent e)
e - - The MouseEvent object which has been passed from the window listener.public void leftRelease(java.awt.event.MouseEvent e)
e - - The MouseEvent object which has been passed from the window listener.public void dragLeft(java.awt.event.MouseEvent e)
e - - The MouseEvent object which has been passed from the window listener.public void normalDrag(java.awt.event.MouseEvent e)
e - - The MouseEvent object which has been passed from the window listener.public void rightPress(java.awt.event.MouseEvent e)
e - - The MouseEvent object which has been passed from the window listener.public void middlePress(java.awt.event.MouseEvent e)
public void middleDrag(java.awt.event.MouseEvent e)
public void saveCanvasState()
public void undoLastAction()
public void redoLastUndo()
public void setAllSelected()
public java.util.Vector getSelectedGraphics()
public int getGraphicType()
public GraphicObject getGraphicObject()
public Canvas getCanvas()
public boolean getNeedSave()
public java.awt.Point getCurrentPoint()
public void setJDraw(JDraw jDraw)
public JDraw getJDraw()
public void setNeedSave(boolean trueorfalse)
public void setWindow(int x)
public void setWindowTitle(java.lang.String title)
public void closeWindow()
public void redrawPage()
public java.awt.Dimension getWindowSize()
public void passKeyEvent(java.awt.event.KeyEvent e)
public void setToHome()
public void setZoom(float zoom)
zoom - - The float value to be stored in this.zoom.public float getZoom()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||