jdraw.edit
Class Edit

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

public class Edit
extends mvp.Model

Class Edit is the Model class for editing options: Undo, Redo, Cut, Copy, Paste, Duplicate, Delete, SelectAll, Flip Horizontal, Flip Vertical, Rotate 90 degrees Clockwise, Rotate 90 degrees Counter-Clockwise, Precise Move, Precise Scale, Precise Rotate.

See Also:
Serialized Form

Field Summary
protected static java.util.Vector graphicsBuffer
          A Vector in which to store graphics temporarily.
protected static JDraw jdraw
          A local reference to the top-level JDraw object.
 
Fields inherited from class mvp.Model
view
 
Constructor Summary
Edit(mvp.View view, JDraw jdraw)
          Construct this with the given View object.
 
Method Summary
static void copy()
          Copy the selected graphic(s) into the buffer.
static void cut()
          Cut the selected graphic(s) into the buffer, removing it/them from the picture.
static void delete()
          Remove the selected graphic(s) from the Canvas.
static void duplicate()
          Create a copy of the selected graphic(s) and paste it/them onto the active Canvas.
static void flipHorizontal()
          Flip the active picture Horizontally.
static void flipVertical()
          Flip the currently selected graphics on the Active Canvas Vertically.
static java.awt.Rectangle getBoundingRectangle(java.util.Vector graphics, java.util.Vector selectedIndices)
          Returns the smallest Rectangle which contains all selected graphics.
static void paste()
          Paste the buffered graphic(s) onto the active Canvas.
static void preciseMove(int deltaX, int deltaY)
          Bring up a dialog to select move parameters.
static void preciseRotate(int deltaDegrees)
          Bring up a dialog to select rotate parameters.
static void preciseScale()
          Bring up a dialog to select scale parameters.
static void redo()
          Redo the last undone action.
static void redrawActiveCanvasWindow()
          Calls the redrawPage method of the currently active CanvasWindow.
static void rotateClockwise()
          Rotate the active picture 90 degrees Clockwise.
static void rotateCounter()
          Rotate the active picture 90 degress counter-clockwise.
static void saveActiveWindowState()
          Saves the state of the Active Canvas.
static void selectAll()
          Set all graphics in the current Canvas as Selected.
static void undo()
          Undo last action.
 
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

jdraw

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

graphicsBuffer

protected static java.util.Vector graphicsBuffer
A Vector in which to store graphics temporarily.
Constructor Detail

Edit

public Edit(mvp.View view,
            JDraw jdraw)
Construct this with the given View object.
Parameters:
view - - The View object to be passed to parent constructor.
Method Detail

undo

public static void undo()
Undo last action. Can be used in series.

redo

public static void redo()
Redo the last undone action. Can be used in series.

cut

public static void cut()
Cut the selected graphic(s) into the buffer, removing it/them from the picture.

copy

public static void copy()
Copy the selected graphic(s) into the buffer.

paste

public static void paste()
Paste the buffered graphic(s) onto the active Canvas.

duplicate

public static void duplicate()
Create a copy of the selected graphic(s) and paste it/them onto the active Canvas.

delete

public static void delete()
Remove the selected graphic(s) from the Canvas.

selectAll

public static void selectAll()
Set all graphics in the current Canvas as Selected.

flipHorizontal

public static void flipHorizontal()
Flip the active picture Horizontally.

flipVertical

public static void flipVertical()
Flip the currently selected graphics on the Active Canvas Vertically.

rotateClockwise

public static void rotateClockwise()
Rotate the active picture 90 degrees Clockwise.

rotateCounter

public static void rotateCounter()
Rotate the active picture 90 degress counter-clockwise.

preciseMove

public static void preciseMove(int deltaX,
                               int deltaY)
Bring up a dialog to select move parameters.

preciseScale

public static void preciseScale()
Bring up a dialog to select scale parameters.

preciseRotate

public static void preciseRotate(int deltaDegrees)
Bring up a dialog to select rotate parameters.

redrawActiveCanvasWindow

public static void redrawActiveCanvasWindow()
Calls the redrawPage method of the currently active CanvasWindow.

saveActiveWindowState

public static void saveActiveWindowState()
Saves the state of the Active Canvas.

getBoundingRectangle

public static java.awt.Rectangle getBoundingRectangle(java.util.Vector graphics,
                                                      java.util.Vector selectedIndices)
Returns the smallest Rectangle which contains all selected graphics.
Parameters:
graphics - - The Vector containing all the graphic objects.
selectedIndices - - The Vector containing the indices of all selected graphics.