de.fhg.igd.ui
Class DropZone

java.lang.Object
  extended byjavax.swing.border.AbstractBorder
      extended byjavax.swing.border.LineBorder
          extended byde.fhg.igd.ui.DropZone
All Implemented Interfaces:
Border, DropTargetListener, EventListener, Serializable

public class DropZone
extends LineBorder
implements DropTargetListener

A generic drop zone for object selections. This DropZone inherits from Border and can be added to existing components easily. Whenever a drag enter is recognized the border is highlighted until the drop is complete or aborted or a drag exit is recognized.

Version:
"$Id: DropZone.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Volker Roth
See Also:
Serialized Form

Field Summary
protected  DropDelegate delegate_
          The delegate that receives dropped data.
static DataFlavor DROPZONE_FLAVOR
          The DataFlavor supported by this drop zone.
protected  DropTarget dtarget_
          The DropTarget of this label.
protected  Color off_
          The color in passive "off" mode.
protected  Color on_
          The color in active "on" mode.
protected  JComponent parent_
          The parent component that must be redrawn when the state of the drop zone changes.
 
Fields inherited from class javax.swing.border.LineBorder
lineColor, roundedCorners, thickness
 
Constructor Summary
DropZone(Color on, Color off, int thickness)
          Creates an instance with the given colors and thickness.
DropZone(int thickness)
          Creates a default drop zone with gray color in passive mode and white in active mode.
 
Method Summary
private  Object deserialize(InputStream in)
           
 void dragEnter(DropTargetDragEvent dtde)
           
 void dragExit(DropTargetEvent dte)
           
 void dragOver(DropTargetDragEvent dtde)
           
 void drop(DropTargetDropEvent dtde)
           
 void dropActionChanged(DropTargetDragEvent dtde)
           
 void setColor(Color color)
          Sets the line color.
 void setDelegate(DropDelegate delegate)
           
 void setParentComponent(JComponent parent)
          Sets the parent component of this drop zone.
 
Methods inherited from class javax.swing.border.LineBorder
createBlackLineBorder, createGrayLineBorder, getBorderInsets, getBorderInsets, getLineColor, getRoundedCorners, getThickness, isBorderOpaque, paintBorder
 
Methods inherited from class javax.swing.border.AbstractBorder
getInteriorRectangle, getInteriorRectangle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DROPZONE_FLAVOR

public static final DataFlavor DROPZONE_FLAVOR
The DataFlavor supported by this drop zone.


parent_

protected JComponent parent_
The parent component that must be redrawn when the state of the drop zone changes.


dtarget_

protected DropTarget dtarget_
The DropTarget of this label.


delegate_

protected DropDelegate delegate_
The delegate that receives dropped data.


on_

protected Color on_
The color in active "on" mode.


off_

protected Color off_
The color in passive "off" mode.

Constructor Detail

DropZone

public DropZone(int thickness)
Creates a default drop zone with gray color in passive mode and white in active mode.


DropZone

public DropZone(Color on,
                Color off,
                int thickness)
Creates an instance with the given colors and thickness.

Method Detail

setDelegate

public void setDelegate(DropDelegate delegate)
Returns:
The DropDelegate that receives dropped data.

setColor

public void setColor(Color color)
Sets the line color.

Parameters:
color - The line color.

setParentComponent

public void setParentComponent(JComponent parent)
Sets the parent component of this drop zone. The parent component is the component that must be redrawn when the state of this drop zone changes.

Parameters:
parent - The parent component.

dragEnter

public void dragEnter(DropTargetDragEvent dtde)
Specified by:
dragEnter in interface DropTargetListener

dragOver

public void dragOver(DropTargetDragEvent dtde)
Specified by:
dragOver in interface DropTargetListener

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dtde)
Specified by:
dropActionChanged in interface DropTargetListener

dragExit

public void dragExit(DropTargetEvent dte)
Specified by:
dragExit in interface DropTargetListener

drop

public void drop(DropTargetDropEvent dtde)
Specified by:
drop in interface DropTargetListener

deserialize

private Object deserialize(InputStream in)


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.