package org.simantics.scenegraph.g2d.events;
import java.awt.Component;
+import java.awt.GraphicsEnvironment;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDragBegin;
import org.simantics.scenegraph.g2d.events.adapter.AWTMouseEventAdapter;
import org.simantics.scenegraph.g2d.events.command.CommandEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Delivers events (mouse, key, focus, command, time) to scene graph nodes that
*/
public class NodeEventHandler implements IEventHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(NodeEventHandler.class);
+
private static final boolean DEBUG_EVENTS = false;
private static final boolean DEBUG_HANDLER_SORT = false;
*/
protected G2DSceneGraph sg;
- /**
- * For proper initiation of native DnD operations within this AWT-based
- * scenegraph system.
- */
- protected DragSource ds = new DragSource();
-
public NodeEventHandler(G2DSceneGraph sg) {
this.sg = sg;
}
}
public void setRootPane(Component rootPane) {
+ if (GraphicsEnvironment.isHeadless()) {
+ LOGGER.info("Disabling DragSource in headless environments");
+ return;
+ }
+ final DragSource ds = new DragSource();
final DragSourceListener dsl = new DragSourceListener() {
@Override
public void dropActionChanged(DragSourceDragEvent dsde) {