Revision: 3926
Author: [email protected]
Date: Thu Aug 26 08:51:58 2010
Log: Fixed some errors that occured when operating in a headless environment.
http://code.google.com/p/power-architect/source/detail?r=3926

Modified:
/trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingSessionContextImpl.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingSessionContextImpl.java Wed Aug 25 13:13:44 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingSessionContextImpl.java Thu Aug 26 08:51:58 2010
@@ -166,7 +166,6 @@
         // of ASUtils can still have the correct icon
         SPSUtils.setMasterIcon(new ImageIcon(ASUtils.getFrameIconImage()));

- logger.debug("toolkit has system clipboard " + Toolkit.getDefaultToolkit().getSystemClipboard());
         clipboard.setContents(dummyTransferable, this);

     }
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java Tue Aug 17 10:13:50 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java Thu Aug 26 08:51:58 2010
@@ -19,6 +19,7 @@
 package ca.sqlpower.architect.swingui;

 import java.awt.Cursor;
+import java.awt.GraphicsEnvironment;
 import java.awt.datatransfer.Transferable;
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.DragGestureEvent;
@@ -97,7 +98,6 @@
        // actionCommand identifier for actions shared by DBTree
        public static final String ACTION_COMMAND_SRC_DBTREE = "DBTree";

-       protected DragSource ds;
        protected JPopupMenu popup;
        protected JMenu dbcsMenu;
        protected JDBCDataSourcePanel spDataSourcePanel;
@@ -154,9 +154,11 @@
                setUI(new MultiDragTreeUI());
                setRootVisible(false);
                setShowsRootHandles(true);
-               ds = new DragSource();
-               ds.createDefaultDragGestureRecognizer
-                       (this, DnDConstants.ACTION_COPY, new 
DBTreeDragGestureListener());
+               if (!GraphicsEnvironment.isHeadless()) {
+                   //XXX See 
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=3036
+                   new DragSource().createDefaultDragGestureRecognizer
+ (this, DnDConstants.ACTION_COPY, new DBTreeDragGestureListener());
+               }

         setConnAsTargetDB = new SetConnAsTargetDB(null);
                newDBCSAction = new NewDataSourceAction(session);
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java Mon Aug 23 15:29:34 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java Thu Aug 26 08:51:58 2010
@@ -28,6 +28,7 @@
 import java.awt.Font;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
 import java.awt.Insets;
 import java.awt.MouseInfo;
 import java.awt.Point;
@@ -462,12 +463,6 @@
            return contentPane.getToolTipText(zoomedEvent);
        }

-       /**
-        * Links this PlayPen with an instance of PlayPenDropListener so
-        * users can drop stuff on the playpen.
-        */
-       protected DropTarget dt;
-
        /**
* The factory responsible for setting up popup menu contents for this playpen.
         */
@@ -578,9 +573,6 @@
      */
     private boolean paintingEnabled = true;

-       private TablePaneDragGestureListener dgl;
-       private DragSource ds;
-
        private boolean normalizing;

     /**
@@ -639,7 +631,13 @@
                contentPane.setPlayPen(this);
                this.setName("Play Pen"); //$NON-NLS-1$
                this.setMinimumSize(new Dimension(1,1));
-               dt = new DropTarget(this, new PlayPenDropListener());
+               if (!GraphicsEnvironment.isHeadless()) {
+                   //XXX See 
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=3036
+                   new DropTarget(this, new PlayPenDropListener());
+ new DragSource().createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, new TablePaneDragGestureListener());
+                   logger.debug("DragGestureRecognizer motion threshold: " +
+ this.getToolkit().getDesktopProperty("DnD.gestureMotionThreshold")); //$NON-NLS-1$ //$NON-NLS-2$
+               }
                bringToFrontAction = new BringToFrontAction(this);
                sendToBackAction = new SendToBackAction(this);
                ppMouseListener = new PPMouseListener();
@@ -647,11 +645,6 @@
                this.addMouseMotionListener(ppMouseListener);

                cursorManager = new CursorManager(this);
-               dgl = new TablePaneDragGestureListener();
-               ds = new DragSource();
- ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, dgl);
-               logger.debug("DragGestureRecognizer motion threshold: " +
- this.getToolkit().getDesktopProperty("DnD.gestureMotionThreshold")); //$NON-NLS-1$ //$NON-NLS-2$
                fontRenderContext = null;
        }

Reply via email to