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

Method Index

 o confirmDelete()
Called before deleting an object.
 o connectionCoord(Point)
Get coordinates for connecting an edge towards destination.
 o draw(Graphics, int, int)
Draw object at position set with setCoordinates().
 o erase(Graphics, int, int)
Erase object at position set with setCoordinates().
 o execute(Frame)
Execute object specific routines, e.g.
 o getObjectID()
Returns a String describing the object.
 o getX()
Get x coordinate.
 o getY()
Get y coordinate.
 o hasFocus(int, int)
Determine if the mouse cursor is located above the object.
 o highlight(Graphics, int, int, boolean)
Turn object highlight on or off.
 o initImage(Component, MediaTracker)
Load image if not yet loaded
This function is called by DragDrop immediately after object creation.
 o isHighlight()
Check if object is highlighted.
 o setCoordinates(int, int)
Set new virtual object coordinates.
 o userAction(Frame, Graphics, int, int)
Called when editing is disabled and user clicks on an object.

Methods

 o 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
 o 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)
 o 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
 o getX
  public abstract int getX()
Get x coordinate.
Returns:
x coordinate
 o getY
  public abstract int getY()
Get y coordinate.
Returns:
y coordinate
 o 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
 o 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
 o 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
 o 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
 o isHighlight
  public abstract boolean isHighlight()
Check if object is highlighted.
Returns:
true if object is highlighted, false otherwise
 o 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.
 o confirmDelete
  public abstract boolean confirmDelete()
Called before deleting an object.
Returns:
true if object deletion may proceed
 o 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)
 o 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