Interface sfclasses.DragDropObj
All Packages Class Hierarchy This Package Previous Next Index
Interface sfclasses.DragDropObj
- public interface DragDropObj
- extends Object
Interface for drag-and-drop objects used by class DragDrop
- See Also:
- DragDrop
-
confirmDelete()
- Called before deleting an object.
-
connectionCoord(Point)
- Get coordinates for connecting an edge towards destination.
-
draw(Graphics, int, int)
- Draw object at position set with setCoordinates().
-
erase(Graphics, int, int)
- Erase object at position set with setCoordinates().
-
execute(Frame)
- Execute object specific routines, e.g.
-
getObjectID()
- Returns a String describing the object.
-
getX()
- Get x coordinate.
-
getY()
- Get y coordinate.
-
hasFocus(int, int)
- Determine if the mouse cursor is located above the object.
-
highlight(Graphics, int, int, boolean)
- Turn object highlight on or off.
-
initImage(Component, MediaTracker)
- Load image if not yet loaded
This function is called by DragDrop immediately after object creation.
-
isHighlight()
- Check if object is highlighted.
-
setCoordinates(int, int)
- Set new virtual object coordinates.
-
userAction(Frame, Graphics, int, int)
- Called when editing is disabled and user clicks on an object.
initImage
public abstract void initImage(Component target,
MediaTracker mt)
- Load image if not yet loaded
This function is called by DragDrop immediately after object creation.
- Parameters:
- target - component where image is to be drawn
- mt - MediaTracker: DragDrop waits for all images in mt to be loaded
hasFocus
public abstract boolean hasFocus(int x,
int y)
- Determine if the mouse cursor is located above the object.
- Parameters:
- x - virtual x coordinate
- y - virtual y coordinate
- Returns:
- true if the object covers (x,y)
setCoordinates
public abstract void setCoordinates(int x,
int y)
- Set new virtual object coordinates.
This should be called after erase() and before draw()
- Parameters:
- x - virtual x coordinate
- y - virtual y coordinate
- See Also:
- draw, erase
getX
public abstract int getX()
- Get x coordinate.
- Returns:
- x coordinate
getY
public abstract int getY()
- Get y coordinate.
- Returns:
- y coordinate
connectionCoord
public abstract Point connectionCoord(Point destination)
- Get coordinates for connecting an edge towards destination.
- Parameters:
- destination - coordinates of destination vertex
- Returns:
- coordinates on the border of the object
draw
public abstract void draw(Graphics g,
int x_offset,
int y_offset)
- Draw object at position set with setCoordinates().
- Parameters:
- g - Graphics object for drawing routines
- x_offset - virtual x offset of canvas origin (due to scrolling)
- y_offset - virtual y offset of canvas origin (due to scrolling)
- See Also:
- setCoordinates
erase
public abstract void erase(Graphics g,
int x_offset,
int y_offset)
- Erase object at position set with setCoordinates().
- Parameters:
- g - Graphics object for drawing routines
- x_offset - virtual x offset of canvas origin (due to scrolling)
- y_offset - virtual y offset of canvas origin (due to scrolling)
- See Also:
- setCoordinates
highlight
public abstract void highlight(Graphics g,
int x_offset,
int y_offset,
boolean highlight)
- Turn object highlight on or off.
- Parameters:
- g - Graphics object for drawing routines
- x_offset - virtual x offset of canvas origin (due to scrolling)
- y_offset - virtual y offset of canvas origin (due to scrolling)
- highlight - true: turn highlight on, false: turn highlight off
isHighlight
public abstract boolean isHighlight()
- Check if object is highlighted.
- Returns:
- true if object is highlighted, false otherwise
execute
public abstract void execute(Frame parent)
- Execute object specific routines, e.g. property setting dialog.
execute() is called when the user double-clicks on the object and
edit mode is enabled.
- Parameters:
- parent - Parent frame for execute() to be able to use dialog
boxes or to create child frames.
confirmDelete
public abstract boolean confirmDelete()
- Called before deleting an object.
- Returns:
- true if object deletion may proceed
userAction
public abstract void userAction(Frame parent,
Graphics g,
int x_offset,
int y_offset)
- Called when editing is disabled and user clicks on an object.
- Parameters:
- g - Graphics object for drawing routines
- x_offset - virtual x offset of canvas origin (due to scrolling)
- y_offset - virtual y offset of canvas origin (due to scrolling)
getObjectID
public abstract String getObjectID()
- Returns a String describing the object. This string is displayed in
the status line when the object is selected.
- Returns:
- objectID string
All Packages Class Hierarchy This Package Previous Next Index