summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/java/awt/dnd/DragSourceContext.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-14 23:12:35 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-14 23:12:35 +0000
commitffde862e033a0825e1e9972a89c0f1f80b261a8e (patch)
tree97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/java/awt/dnd/DragSourceContext.java
parentb415ff10527e977c3758234fd930e2c027bfa17d (diff)
downloadppe42-gcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.tar.gz
ppe42-gcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.zip
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/awt/dnd/DragSourceContext.java')
-rw-r--r--libjava/classpath/java/awt/dnd/DragSourceContext.java191
1 files changed, 172 insertions, 19 deletions
diff --git a/libjava/classpath/java/awt/dnd/DragSourceContext.java b/libjava/classpath/java/awt/dnd/DragSourceContext.java
index 88607b090ea..1fee5c0c304 100644
--- a/libjava/classpath/java/awt/dnd/DragSourceContext.java
+++ b/libjava/classpath/java/awt/dnd/DragSourceContext.java
@@ -70,8 +70,8 @@ public class DragSourceContext
private Transferable transferable;
private DragGestureEvent trigger;
private DragSourceListener dragSourceListener;
- private boolean useCustomCursor; // FIXME: currently unused but needed for serialization.
- private int sourceActions; // FIXME: currently unused but needed for serialization.
+ private boolean useCustomCursor;
+ private int sourceActions;
private Image image;
private Point offset;
@@ -82,16 +82,17 @@ public class DragSourceContext
* are null, the drag action for the trigger event is DnDConstants.ACTION_NONE
* or if the source actions for the DragGestureRecognizer associated with the
* trigger event are equal to DnDConstants.ACTION_NONE.
- * @exception NullPointerException If peer or trigger is null.
+ * @exception NullPointerException If peer, trans or trigger is null or if the
+ * image is not null but the offset is.
*/
public DragSourceContext (DragSourceContextPeer peer,
DragGestureEvent trigger, Cursor cursor,
Image image, Point offset, Transferable trans,
DragSourceListener dsl)
- throws NotImplementedException
- {
+ {
if (peer == null
- || trigger == null)
+ || trigger == null || trans == null
+ || (image != null && offset == null))
throw new NullPointerException ();
if (trigger.getComponent () == null
@@ -108,37 +109,77 @@ public class DragSourceContext
this.offset = offset;
this.transferable = trans;
this.dragSourceListener = dsl;
+ this.sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions();
- throw new Error ("not implemented");
+ setCursor(cursor);
+ updateCurrentCursor(trigger.getDragAction(), sourceActions, DEFAULT);
}
+ /**
+ * Returns the DragSource object associated with the
+ * DragGestureEvent.
+ *
+ * @return the DragSource associated with the trigger.
+ */
public DragSource getDragSource()
{
return trigger.getDragSource ();
}
+ /**
+ * Returns the component associated with this.
+ *
+ * @return the component associated with the trigger.
+ */
public Component getComponent()
{
return trigger.getComponent ();
}
+ /**
+ * Gets the trigger associated with this.
+ *
+ * @return the trigger.
+ */
public DragGestureEvent getTrigger()
{
return trigger;
}
+ /**
+ * Returns the source actions for the DragGestureRecognizer.
+ *
+ * @return the source actions for DragGestureRecognizer.
+ */
public int getSourceActions()
{
- return trigger.getSourceAsDragGestureRecognizer ().getSourceActions ();
+ if (sourceActions == 0)
+ sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions();
+ return sourceActions;
}
- public void setCursor (Cursor cursor)
- throws NotImplementedException
+ /**
+ * Sets the cursor for this drag operation to the specified cursor.
+ *
+ * @param cursor c - the Cursor to use, or null to use the default drag
+ * cursor.
+ */
+ public void setCursor(Cursor cursor)
{
+ if (cursor == null)
+ useCustomCursor = false;
+ else
+ useCustomCursor = true;
this.cursor = cursor;
- // FIXME: Check if we need to do more here
+ peer.setCursor(cursor);
}
+ /**
+ * Returns the current cursor or null if the default
+ * drag cursor is used.
+ *
+ * @return the current cursor or null.
+ */
public Cursor getCursor()
{
return cursor;
@@ -165,48 +206,160 @@ public class DragSourceContext
dragSourceListener = null;
}
+ /**
+ * This function tells the peer that the DataFlavors have been modified.
+ */
public void transferablesFlavorsChanged()
- throws NotImplementedException
{
+ peer.transferablesFlavorsChanged();
}
+ /**
+ * Calls dragEnter on the listeners registered with this
+ * and with the DragSource.
+ *
+ * @param e - the DragSourceDragEvent
+ */
public void dragEnter(DragSourceDragEvent e)
- throws NotImplementedException
{
+ if (dragSourceListener != null)
+ dragSourceListener.dragEnter(e);
+
+ DragSource ds = getDragSource();
+ DragSourceListener[] dsl = ds.getDragSourceListeners();
+ for (int i = 0; i < dsl.length; i++)
+ dsl[i].dragEnter(e);
+
+ updateCurrentCursor(e.getDropAction(), e.getTargetActions(), ENTER);
}
+ /**
+ * Calls dragOver on the listeners registered with this
+ * and with the DragSource.
+ *
+ * @param e - the DragSourceDragEvent
+ */
public void dragOver(DragSourceDragEvent e)
- throws NotImplementedException
{
+ if (dragSourceListener != null)
+ dragSourceListener.dragOver(e);
+
+ DragSource ds = getDragSource();
+ DragSourceListener[] dsl = ds.getDragSourceListeners();
+ for (int i = 0; i < dsl.length; i++)
+ dsl[i].dragOver(e);
+
+ updateCurrentCursor(e.getDropAction(), e.getTargetActions(), OVER);
}
-
+
+ /**
+ * Calls dragExit on the listeners registered with this
+ * and with the DragSource.
+ *
+ * @param e - the DragSourceEvent
+ */
public void dragExit(DragSourceEvent e)
- throws NotImplementedException
{
+ if (dragSourceListener != null)
+ dragSourceListener.dragExit(e);
+
+ DragSource ds = getDragSource();
+ DragSourceListener[] dsl = ds.getDragSourceListeners();
+ for (int i = 0; i < dsl.length; i++)
+ dsl[i].dragExit(e);
+
+ updateCurrentCursor(0, 0, DEFAULT);
}
+ /**
+ * Calls dropActionChanged on the listeners registered with this
+ * and with the DragSource.
+ *
+ * @param e - the DragSourceDragEvent
+ */
public void dropActionChanged(DragSourceDragEvent e)
- throws NotImplementedException
{
+ if (dragSourceListener != null)
+ dragSourceListener.dropActionChanged(e);
+
+ DragSource ds = getDragSource();
+ DragSourceListener[] dsl = ds.getDragSourceListeners();
+ for (int i = 0; i < dsl.length; i++)
+ dsl[i].dropActionChanged(e);
+
+ updateCurrentCursor(e.getDropAction(), e.getTargetActions(), CHANGED);
}
+ /**
+ * Calls dragDropEnd on the listeners registered with this
+ * and with the DragSource.
+ *
+ * @param e - the DragSourceDropEvent
+ */
public void dragDropEnd(DragSourceDropEvent e)
- throws NotImplementedException
{
+ if (dragSourceListener != null)
+ dragSourceListener.dragDropEnd(e);
+
+ DragSource ds = getDragSource();
+ DragSourceListener[] dsl = ds.getDragSourceListeners();
+ for (int i = 0; i < dsl.length; i++)
+ dsl[i].dragDropEnd(e);
}
+ /**
+ * Calls dragMouseMoved on the listeners registered with the DragSource.
+ *
+ * @param e - the DragSourceDragEvent
+ */
public void dragMouseMoved(DragSourceDragEvent e)
- throws NotImplementedException
{
+ DragSource ds = getDragSource();
+ DragSourceMotionListener[] dsml = ds.getDragSourceMotionListeners();
+ for (int i = 0; i < dsml.length; i++)
+ dsml[i].dragMouseMoved(e);
}
+ /**
+ * Returns the Transferable set with this object.
+ *
+ * @return the transferable.
+ */
public Transferable getTransferable()
{
return transferable;
}
+ /**
+ * This function sets the drag cursor for the specified operation, actions and
+ * status if the default drag cursor is active. Otherwise, the cursor is not
+ * updated in any way.
+ *
+ * @param dropOp - the current operation.
+ * @param targetAct - the supported actions.
+ * @param status - the status of the cursor (constant).
+ */
protected void updateCurrentCursor(int dropOp, int targetAct, int status)
throws NotImplementedException
{
+ // FIXME: Not implemented fully
+ if (!useCustomCursor)
+ {
+ Cursor cursor = null;
+ switch (status)
+ {
+ case ENTER:
+ break;
+ case CHANGED:
+ break;
+ case OVER:
+ break;
+ default:
+ break;
+ }
+
+ this.cursor = cursor;
+ peer.setCursor(cursor);
+ }
}
} // class DragSourceContext
OpenPOWER on IntegriCloud