Class DragSession
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class DragSession

public class netscape.application.DragSession
    extends java.lang.Object
{
    /* Fields
     */
    public final static int ALT_MASK;
    public final static int CONTROL_MASK;
    public final static int META_MASK;
    public final static int SHIFT_MASK;

    /* Constructors
     */
    public DragSession(DragSource, Image, int, int, int, int, String, Object);

    /* Methods
     */
    public Rect absoluteBounds();
    public Point absoluteMousePoint();
    public Object data();
    public String dataType();
    public DragDestination destination();
    public Rect destinationBounds();
    public Point destinationMousePoint();
    public View destinationView();
    public int dragModifiers();
    public boolean isAltKeyDown();
    public boolean isControlKeyDown();
    public boolean isMetaKeyDown();
    public boolean isShiftKeyDown();
    public void setData(Object);
    public void setDataType(String);
    public DragSource source();
}
Object subclass that implements "drag-and-drop" within the IFC. A DragSession allows an Image to represent some data, and the user can drag that Image from one View to another. For example, in the case of dragging Colors, a red square Image would visually represent the red Color instance, declared as the DragSession's data.

A drag-and-drop session begins with a mouse down event in a View. That View's mouseDown() creates a DragSession, and from then on the DragSession's Image moves as the user moves the mouse. All Views it passes over receive acceptsDrag() messages allowing them to return an object to act as the DragSession's DragDestination. A DragSession receives dragEntered(), dragMoved() and dragExited() messages as the Image traverses the View. On release, the current DragDestination receives a dragDropped() message, in which it should accept the DragSession's data by returning true, or reject it by returning false. If rejected, the DragSession Image optionally animates back to its origin. Ultimately, the DragSource receives a notification that the drag session has completed.

Fields

SHIFT_MASK

  public final static int SHIFT_MASK
Drag session modifier flag.

CONTROL_MASK

  public final static int CONTROL_MASK
Drag session modifier flag.

META_MASK

  public final static int META_MASK
Drag session modifier flag.

ALT_MASK

  public final static int ALT_MASK
Drag session modifier flag.

Constructors

DragSession

  public DragSession(DragSource source,
                     Image image,
                     int initialX,
                     int initialY,
                     int mouseDownX,
                     int mouseDownY,
                     String dataType,
                     Object data)
Constructs a DragSession, represented visually by image. initialX and initialY specify the Image's initial location, and mouseDownX and mouseDownY specify the mouse's initial location. Both points should be expressed in terms of the coordinate system of the View returned by source. This source View also determines the RootView in which the DragSession's Image appears. dataType allows for additional information about the drag data data.

Methods

data

  public Object data()
Returns the DragSession's data.
See Also:
setData

setData

  public void setData(Object data)
Sets the DragSession's data, the data being dragged in the drag session.

dataType

  public String dataType()
Returns the DragSession's data's type.
See Also:
setDataType

setDataType

  public void setDataType(String dataType)
Sets the DragSession's data type information to dataType. The data type allows for additional information about the drag data.

source

  public DragSource source()
Returns the DragSession's "source." A session's drag source cannot change once a session has begun.

destination

  public DragDestination destination()
Returns the DragSession's current DragDestination. The DragSession determines the current destination by calling the acceptsDrag() method of the View under the mouse.
See Also:
acceptsDrag

dragModifiers

  public int dragModifiers()
Returns an integer representing the modifier keys (Shift, Control, Meta, Alternate) held down during the most recent mouse event. Bitwise AND this value with one of the class' modifier flags, or call one of the explicit methods such as isShiftKeyDown().
See Also:
isShiftKeyDown, isControlKeyDown, isMetaKeyDown, isAltKeyDown

isShiftKeyDown

  public boolean isShiftKeyDown()
Returns true if the Shift Key was held down during the most recent mouse event.

isControlKeyDown

  public boolean isControlKeyDown()
Returns true if the Control Key was held down during the most recent mouse event.

isMetaKeyDown

  public boolean isMetaKeyDown()
Returns true if the Meta Key was held down during the most recent mouse event.

isAltKeyDown

  public boolean isAltKeyDown()
Returns true if the Alternate Key was held down during the most recent mouse event.

destinationView

  public View destinationView()
Returns the View currently designated the DragSession's destination, or null if there is no such View.

destinationBounds

  public Rect destinationBounds()
Returns the bounds of the dragged Image, in the current destination View's coordinate system.

absoluteBounds

  public Rect absoluteBounds()
Returns the bounds of the dragged Image, in the DragSession's RootView's coordinate system.

absoluteMousePoint

  public Point absoluteMousePoint()
Returns the mouse's location, in the DragSession's RootView's coordinate system.

destinationMousePoint

  public Point destinationMousePoint()
Returns the mouse's location, in the current destination View's coordinate system.

All Packages  Class Hierarchy  This Package  Previous  Next  Index