public class DefaultDnDCatcher extends DnDListener implements java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.beans.PropertyChangeListener, java.io.Serializable, ProjectionListener, LayerListener, java.awt.event.ActionListener
Modifier and Type | Field and Description |
---|---|
protected java.beans.beancontext.BeanContextChildSupport |
beanContextChildSupport
BeanContextChildSupport object provides helper functions for
BeanContextChild interface.
|
protected java.awt.Point |
dropLocation |
protected java.util.Hashtable |
layers
Hashtable for keeping references to potential drop targets
|
protected MouseDelegator |
md |
protected java.beans.PropertyChangeSupport |
pcSupport
PropertyChangeSupport for handling listeners.
|
protected Projection |
proj |
protected java.lang.Object |
transferData |
default_action, startDrag
Constructor and Description |
---|
DefaultDnDCatcher()
Constructs a new DefaultDnDCatcher.
|
DefaultDnDCatcher(java.awt.dnd.DragSource ds)
Constructs a new DefaultDnDCatcher given the DragSource for the
Component.
|
DefaultDnDCatcher(java.awt.dnd.DragSource ds,
java.awt.Component c)
Construct a new DefaultDnDCatcher given the DragSource for the Component
c, and the Component to observe.
|
DefaultDnDCatcher(java.awt.dnd.DragSource ds,
java.awt.Component c,
int act) |
DefaultDnDCatcher(java.awt.dnd.DragSource ds,
java.awt.Component c,
int act,
java.awt.dnd.DragGestureListener dgl) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action from the popup menu occurs.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener in_pcl)
Method for BeanContextChild interface.
|
void |
addVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface.
|
void |
childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method.
|
void |
childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method.
|
boolean |
consume(java.awt.event.MouseEvent e)
The method is invoked on mousePressed, mouseReleased, and mouseDragged
events that come from the MapBean through DropListenerSupport.
|
void |
drop(java.awt.dnd.DropTargetDropEvent dtde)
The drag operation has terminated with a drop on this
DropTarget . |
void |
findAndInit(java.util.Iterator it)
Eventually gets called when the DefaultDnDCatcher is added to the
BeanContext, and when other objects are added to the BeanContext anytime
after that.
|
void |
findAndInit(java.lang.Object someObj)
Called when an object should be evaluated by the DefaultDnDCatcher to see
if it is needed.
|
void |
findAndUndo(java.lang.Object someObj)
Called by childrenRemoved.
|
void |
firePropertyChange(java.lang.String property,
java.lang.Object oldObj,
java.lang.Object newObj) |
void |
fireVetoableChange(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
Report a vetoable property update to any registered listeners.
|
java.beans.beancontext.BeanContext |
getBeanContext() |
Projection |
getProjection()
Gets current projection.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
The mouseDragged event gets interpreted as DragGestureRecognized when
startDrag boolean is true.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
On mouseReleased, set startDrag to true in order to enable dragging.
|
void |
projectionChanged(ProjectionEvent e)
Invoked when there has been a fundamental change to the Map.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method gets called when a bound property is changed.
|
void |
removePropertyChangeListener(java.lang.String name,
java.beans.PropertyChangeListener pcl)
remove a property change listener to this bean child
|
void |
removeVetoableChangeListener(java.lang.String name,
java.beans.VetoableChangeListener vcl)
remove a vetoable change listener to this child
|
void |
setBeanContext(java.beans.beancontext.BeanContext in_bc)
A change in the value of the nesting BeanContext property of this
BeanContextChild may be vetoed by throwing the appropriate exception.
|
void |
setLayers(Layer[] allLayers)
DefaultDnDCatcher adds itself to each layer as the DropTargetListener.
|
void |
setLayers(LayerEvent evt)
The method is invoked when there is a change in layers property in the
LayerHandler.
|
void |
setProjection(Projection projection)
Sets the current projection.
|
Projection |
setProjection(ProjectionEvent projEvent)
This method lets you take the ProjectionEvent received from the MapBean,
and lets you know if you should do something with it.
|
void |
startDragAction(java.awt.dnd.DragGestureEvent dge,
java.awt.dnd.DragSourceListener dsl)
Invoked on dragGestureRecognized in the ComponentDragGestureListener
class.
|
dragDropEnd, dragEnter, dragEnter, dragExit, dragExit, dragOver, dragOver, dropActionChanged, dropActionChanged, getCursor, getDefaultAction, setCursor, setDefaultAction
mouseClicked, mouseEntered, mouseExited, mouseMoved, mousePressed, registerListeners, unregisterListeners
protected java.beans.PropertyChangeSupport pcSupport
protected java.beans.beancontext.BeanContextChildSupport beanContextChildSupport
protected java.util.Hashtable layers
protected transient MouseDelegator md
protected transient Projection proj
protected java.lang.Object transferData
protected java.awt.Point dropLocation
public DefaultDnDCatcher()
public DefaultDnDCatcher(java.awt.dnd.DragSource ds)
ds
- the DragSource for the Componentpublic DefaultDnDCatcher(java.awt.dnd.DragSource ds, java.awt.Component c)
ds
- the DragSource for the Component cc
- the Component to observepublic DefaultDnDCatcher(java.awt.dnd.DragSource ds, java.awt.Component c, int act)
public DefaultDnDCatcher(java.awt.dnd.DragSource ds, java.awt.Component c, int act, java.awt.dnd.DragGestureListener dgl)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener in_pcl)
addPropertyChangeListener
in interface java.beans.beancontext.BeanContextChild
public void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
addVetoableChangeListener
in interface java.beans.beancontext.BeanContextChild
public void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
childrenAdded
in interface java.beans.beancontext.BeanContextMembershipListener
bcme
- event that contains an iterator that can be used to go
through the new objects.public void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
childrenRemoved
in interface java.beans.beancontext.BeanContextMembershipListener
bcme
- event that contains an iterator that can be used to go
through the removed objects.public boolean consume(java.awt.event.MouseEvent e)
e
- java.awt.event.MouseEventpublic void drop(java.awt.dnd.DropTargetDropEvent dtde)
DropTarget
. This method is responsible for undertaking the
transfer of the data associated with the gesture. The
DropTargetDropEvent
provides a means to obtain a
Transferable
object that represents the data object(s) to be
transfered.
From this method, the DropTargetListener
shall accept or
reject the drop via the acceptDrop(int dropAction) or rejectDrop()
methods of the DropTargetDropEvent
parameter.
Subsequent to acceptDrop(), but not before,
DropTargetDropEvent
's getTransferable() method may be
invoked, and data transfer may be performed via the returned
Transferable
's getTransferData() method.
At the completion of a drop, an implementation of this method is required
to signal the success/failure of the drop by passing an appropriate
boolean
to the DropTargetDropEvent
's
dropComplete(boolean success) method.
Note: The actual processing of the data transfer is not required to finish before this method returns. It may be deferred until later.
drop
in interface java.awt.dnd.DropTargetListener
drop
in class DnDListener
dtde
- the DropTargetDropEvent
public void findAndInit(java.lang.Object someObj)
public void findAndInit(java.util.Iterator it)
it
- iterator to use to go through the new objects in the
BeanContext.public void findAndUndo(java.lang.Object someObj)
public void firePropertyChange(java.lang.String property, java.lang.Object oldObj, java.lang.Object newObj)
public void fireVetoableChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue) throws java.beans.PropertyVetoException
No event is fired if old and new are equal and non-null.
name
- The programmatic name of the property that is about to changeoldValue
- The old value of the propertynewValue
- - The new value of the propertyjava.beans.PropertyVetoException
- if the recipient wishes the property change
to be rolled back.public java.beans.beancontext.BeanContext getBeanContext()
getBeanContext
in interface java.beans.beancontext.BeanContextChild
public Projection getProjection()
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class java.awt.dnd.MouseDragGestureRecognizer
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class java.awt.dnd.MouseDragGestureRecognizer
public void projectionChanged(ProjectionEvent e)
Layers are expected to recompute their graphics (if this makes sense),
and then repaint()
themselves.
projectionChanged
in interface ProjectionListener
e
- ProjectionEventpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
evt
- A PropertyChangeEvent object describing the event source and
the property that has changed.public void removePropertyChangeListener(java.lang.String name, java.beans.PropertyChangeListener pcl)
removePropertyChangeListener
in interface java.beans.beancontext.BeanContextChild
public void removeVetoableChangeListener(java.lang.String name, java.beans.VetoableChangeListener vcl)
removeVetoableChangeListener
in interface java.beans.beancontext.BeanContextChild
public void setBeanContext(java.beans.beancontext.BeanContext in_bc) throws java.beans.PropertyVetoException
setBeanContext
in interface java.beans.beancontext.BeanContextChild
in_bc
- the new BeanContext for this objectjava.beans.PropertyVetoException
public void setLayers(Layer[] allLayers)
public void setLayers(LayerEvent evt)
setLayers
in interface LayerListener
public Projection setProjection(ProjectionEvent projEvent)
projEvent
- the ProjectionEvent from the ProjectionListener method.public void setProjection(Projection projection)
public void startDragAction(java.awt.dnd.DragGestureEvent dge, java.awt.dnd.DragSourceListener dsl)
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details