|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfig.commands.Command jfig.commands.DeleteObjectCommand
delete one or multiple jfig objects.
DeleteObjectCommand allows to delete a single object or all objects contained inside a user-specified region from a jfig drawing, with optional undo.
To delete a single object, simply click on/near one of its control points, e.g. a rectangle corner. To avoid deleting the wrong objects, the DeleteObjectCommand is quite strict about the mouse position, and it will only delete objects nearer than one snap-distance to the mouse position.
To delete a region of objects, click the "right" mouse button or use "alt"+"left". The DeleteObjectCommand will use the mouse position as the first corner of the selection rectangle and will prompt for the opposition corner.
Field Summary | |
protected java.awt.Point |
endPoint
|
protected int |
n_points
|
protected FigObject |
object
|
protected java.awt.Point |
startPoint
|
protected java.util.Stack |
victims
|
Fields inherited from class jfig.commands.Command |
editor, objectCanvas, ready |
Constructor Summary | |
DeleteObjectCommand(FigBasicEditor editor,
FigCanvas objectCanvas)
|
Method Summary | |
void |
execute()
execute the current editor command |
java.lang.String |
getDescription()
one-line description of this command |
FigObject[] |
getModifiedObjects()
return an array with all objects (to be) deleted by this command. |
void |
mousePressed(FigCanvasEvent evt)
select the object to delete (at position startPoint), or the region of objects to delete. |
java.lang.String |
toString()
return a (possibly verbose) description of this Command object |
void |
undo()
undo this command |
Methods inherited from class jfig.commands.Command |
cancel, isReady, message, notifyEditor, statusMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int n_points
protected FigObject object
protected java.awt.Point startPoint
protected java.awt.Point endPoint
protected java.util.Stack victims
Constructor Detail |
public DeleteObjectCommand(FigBasicEditor editor, FigCanvas objectCanvas)
Method Detail |
public FigObject[] getModifiedObjects()
getModifiedObjects
in class Command
public void execute()
Command
This method is empty for class Command.
execute
in class Command
public void undo()
Command
Try to undo this command as far as possible. Don't try to undo() a command that has never been execute()d before. This method is empty for class Command.
undo
in class Command
public void mousePressed(FigCanvasEvent evt)
To allow for selection of stacked objects at/near startPoint, we use the following algorithm: If the users holds down the SHIFT-key while clicking the mouse, we use editor.findObjectAt() to find and select the topmost object at or near startPoint. If the user clicks again on/near startPoint - and with the SHIFT-key hold down, the editor.findNextObjectAt() method is called repeatedly, to find the next objects.
On the next mouse click without the SHIFT-modifier key, the selected object, if any, is deleted.
If this command is initiated with the RIGHT-mouse button (ALT modifier), the user is prompted to mark the opposite corner of the region of objects to delete.
mousePressed
in class Command
public java.lang.String getDescription()
Command
return a one-line desription of this command, e.g. to label the undo/redo buttons, if any
getDescription
in class Command
public java.lang.String toString()
Command
toString
in class Command
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |