Java 类java.awt.dnd.DragGestureEvent 实例源码

项目:incubator-netbeans    文件:DragAndDropFeedbackVisualizer.java   
public void start(final DragGestureEvent e) {
    originalLocationOnScreen = source.getComponent().getLocationOnScreen();
    final Rectangle tabRect = source.getTabBounds(tabIndex);
    if( prefs.getBoolean(WinSysPrefs.DND_SMALLWINDOWS, true) ) {
        originalLocationOnScreen.x += tabRect.x;
    }

    DragWindow tmp = createDragWindow( tabIndex );
    if( null != tmp ) {
        dragOffset = new Point( 0, 0 );
        Point loc = new Point( e.getDragOrigin() );
        SwingUtilities.convertPointToScreen(loc, e.getComponent());
        tmp.setLocation( loc.x-dragOffset.x, loc.y-dragOffset.y );
        //let the JNA transparency stuff to kick in
        try {
            tmp.setVisible( true );
            //make drag window visible, i.e. move to proper location,
            //dragImage.setLocation( startingPoint );
            dragWindow = tmp;
        } catch( UnsatisfiedLinkError ulE ) {
            Logger.getLogger(DragAndDropFeedbackVisualizer.class.getName()).log(Level.INFO, null, ulE);
        } catch( Throwable ex ) {
            Logger.getLogger(DragAndDropFeedbackVisualizer.class.getName()).log(Level.FINE, null, ex);
        }
    }
}
项目:VASSAL-src    文件:PieceMover.java   
protected void beginDragging(DragGestureEvent dge) {
  // this call is needed to instantiate the boundingBox object
 final BufferedImage bImage = makeDragImage(dragPieceOffCenterZoom);

  final Point dragPointOffset = new Point(
    getOffsetMult() * (boundingBox.x + currentPieceOffsetX - EXTRA_BORDER),
    getOffsetMult() * (boundingBox.y + currentPieceOffsetY - EXTRA_BORDER)
  );

  dge.startDrag(
    Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
    bImage,
    dragPointOffset,
    new StringSelection(""),
    this
  );

  dge.getDragSource().addDragSourceMotionListener(this);
}
项目:freecol    文件:DefaultTransferHandler.java   
/**
 * {@inheritDoc}
 */
public void dragGestureRecognized(DragGestureEvent dge) {
    JComponent c = (JComponent)dge.getComponent();
    DefaultTransferHandler th
        = (DefaultTransferHandler)c.getTransferHandler();
    Transferable t = th.createTransferable(c);
    if (t == null) {
        logger.warning("Unable to create transferable for: " + dge);
        th.exportDone(c, null, NONE);
        return;
    }

    this.scrolls = c.getAutoscrolls();
    c.setAutoscrolls(false);
    try {
        Cursor cursor = getCursor(c);
        dge.startDrag(cursor, t, this);
    } catch (RuntimeException re) {
        c.setAutoscrolls(this.scrolls);
    }
}
项目:FreeCol    文件:DefaultTransferHandler.java   
/**
 * {@inheritDoc}
 */
public void dragGestureRecognized(DragGestureEvent dge) {
    JComponent c = (JComponent)dge.getComponent();
    DefaultTransferHandler th
        = (DefaultTransferHandler)c.getTransferHandler();
    Transferable t = th.createTransferable(c);
    if (t == null) {
        logger.warning("Unable to create transferable for: " + dge);
        th.exportDone(c, null, NONE);
        return;
    }

    this.scrolls = c.getAutoscrolls();
    c.setAutoscrolls(false);
    try {
        Cursor cursor = getCursor(c);
        dge.startDrag(cursor, t, this);
    } catch (RuntimeException re) {
        c.setAutoscrolls(this.scrolls);
    }
}
项目:pumpernickel    文件:CustomizedToolbar.java   
public void dragGestureRecognized(DragGestureEvent dge) {
    Point p = dge.getDragOrigin();
    Component c = dge.getComponent();
    JFrame f = (JFrame)SwingUtilities.getWindowAncestor(c);
    p = SwingUtilities.convertPoint(c, p, f);

    for(int a = 0; a<componentList.length; a++) {
        if(triggerDrag(f,p,dge,componentList[a]))
            return;
    }
    //double-check for separators & gaps:
    for(int a = 0; a<getComponentCount(); a++) {
        if(triggerDrag(f,p,dge,(JComponent)getComponent(a)))
            return;
    }

}
项目:pumpernickel    文件:CustomizedToolbar.java   
private boolean triggerDrag(JFrame f,Point p,DragGestureEvent dge,JComponent c) {
    Rectangle r = new Rectangle(0,0,c.getWidth(),c.getHeight());
    r = SwingUtilities.convertRectangle(c, 
            r, 
            f);

    if(r.contains(p)) {
        draggingFromToolbar = true;
            draggingDefaults = false;
        draggingComponent = c.getName();
        MockComponent mc = new MockComponent(c);
        Transferable transferable = new MockComponentTransferable(mc);
        BufferedImage bi = mc.getBufferedImage();
        dge.startDrag(DragSource.DefaultMoveDrop, 
                bi, 
                new Point(r.x-p.x, r.y-p.y), 
                transferable, 
                dragSourceListener);
        return true;
    }
    return false;
}
项目:pumpernickel    文件:CustomizedToolbarOptions.java   
public void dragGestureRecognized(DragGestureEvent dge) {

    Point p = dge.getDragOrigin();
    MockComponent mc = (MockComponent)dge.getComponent();
    Transferable transferable = new MockComponentTransferable(mc);
    BufferedImage bi = mc.getBufferedImage();
    if(mc instanceof MockDefaultToolbar) {
        toolbar.draggingComponent = "";
    } else if(mc.getName().equals("-")) {
        toolbar.draggingComponent = toolbar.getNewSeparatorName();
    } else if(mc.getName().equals(" ")) {
        toolbar.draggingComponent = toolbar.getNewSpaceName();
    } else if(mc.getName().equals("\t")) {
        toolbar.draggingComponent = toolbar.getNewFlexibleSpaceName();
    } else {
        toolbar.draggingComponent = mc.getName();
    }
    toolbar.draggingDefaults = (mc instanceof MockDefaultToolbar);
    toolbar.draggingFromToolbar = false;
    dge.startDrag(DragSource.DefaultMoveDrop, 
            bi, 
            new Point(-p.x, -p.y), 
            transferable, 
            dragSourceListener);
}
项目:javify    文件:TransferHandler.java   
public void dragGestureRecognized(DragGestureEvent e)
{
  JComponent c = (JComponent) e.getComponent();
  TransferHandler th = c.getTransferHandler();
  Transferable t = th.createTransferable(c);
  if (t != null)
    {
      autoscrolls = c.getAutoscrolls();
      c.setAutoscrolls(false);
      try
        {
          e.startDrag(null, t, this);
          return;
        }
      finally
        {
          c.setAutoscrolls(autoscrolls);
        }
    }
  th.exportDone(c, t, NONE);
}
项目:keystore-explorer    文件:KeyStoreEntryDragGestureListener.java   
/**
 * Drag gesture recognized. Start the drag off if valid.
 *
 * @param evt
 *            Drag gesture event
 */
@Override
public void dragGestureRecognized(DragGestureEvent evt) {
    DragEntry dragEntry = kseFrame.dragSelectedEntry();

    if (dragEntry == null) {
        return;
    }

    ImageIcon icon = dragEntry.getImage();

    // Draw image as drag cursor
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Dimension dim = toolkit.getBestCursorSize(icon.getIconWidth(), icon.getIconHeight());
    BufferedImage buffImage = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB_PRE);
    icon.paintIcon(evt.getComponent(), buffImage.getGraphics(), 0, 0);
    cursor = toolkit.createCustomCursor(buffImage, new Point(0, 0), "keystore-entry");

    evt.startDrag(cursor, new KeyStoreEntryTransferable(dragEntry), this);
}
项目:PivotSlice    文件:HistoryPanel.java   
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
    if (dge.getDragAction() == DnDConstants.ACTION_COPY) {
        Point p = dge.getDragOrigin();

        for (int i = 0; i < constraints.size(); i++) {
            Component cmp = operationPanel.getComponent(i);
            if (cmp.getBounds().contains(p)) {
                rootFrame.glassPane.setImage(PivotSlice.getScreenShot(cmp));
                dge.startDrag(DragSource.DefaultCopyDrop, new Constraint.TransferableConstraint(constraints.get(i)));

                rootFrame.logger.logAction("historypanel-drag attribute");
                break;
            }
        }
    }
}
项目:PivotSlice    文件:SearchPanel.java   
@Override
public void dragGestureRecognized(DragGestureEvent e) {
    dragRecogonized = true;
    if (e.getDragAction() == DnDConstants.ACTION_COPY) {
        if (timer.isRunning())
            timer.stop();

        String text = searchBox.getText().toLowerCase();
        if (text.startsWith("/")) {
            for (int i = 0; i < facetSearchTags.length; i++) {
                if (text.startsWith(facetSearchTags[i])) {
                    Constraint.ConstraintData cdata = generateConstraintData(i, text);
                    if (cdata == null)
                        return;

                    rootFrame.glassPane.setImage(PivotSlice.getScreenShot(searchBox));
                    e.startDrag(DragSource.DefaultCopyDrop, new Constraint.TransferableConstraint(cdata));

                    rootFrame.logger.logAction("searchpanel-drag attribute");
                    break;
                }
            }
        }
    }
}
项目:jvm-stm    文件:TransferHandler.java   
public void dragGestureRecognized(DragGestureEvent e)
{
  JComponent c = (JComponent) e.getComponent();
  TransferHandler th = c.getTransferHandler();
  Transferable t = th.createTransferable(c);
  if (t != null)
    {
      autoscrolls = c.getAutoscrolls();
      c.setAutoscrolls(false);
      try
        {
          e.startDrag(null, t, this);
          return;
        }
      finally
        {
          c.setAutoscrolls(autoscrolls);
        }
    }
  th.exportDone(c, t, NONE);
}
项目:MIDI-Automator    文件:ItemListDragGestureListener.java   
@Override
public void dragGestureRecognized(DragGestureEvent dge) {

    Component component = dge.getComponent();

    @SuppressWarnings("unchecked")
    JList<IToolTipItem> fileList = (JList<IToolTipItem>) component;

    IToolTipItem item = fileList.getSelectedValue();
    int index = fileList.getSelectedIndex();

    if (item != null) {
        dge.startDrag(null, new TransferableJListToolTipItem(item, index));
        log.debug("Dragging \"" + item.getValue() + "\"");
    }
}
项目:tellervo    文件:BargraphFrame.java   
public void dragGestureRecognized(DragGestureEvent event) {
    // ignore right-click-drags
    if (((MouseEvent) event.getTriggerEvent()).isPopupTrigger())
        return;

    // figure out what's being dragged
    Point p = event.getDragOrigin();
    BaseSample bar = bgp.getBar(p);

    // this only makes sense with Files...
    if(bar.getLoader() instanceof FileElement) {
        // make a Transferable to send
        Transferable transfer = new Tree.TransferableFile(
                ((FileElement)bar.getLoader()).getFilename());

        // let the drag begin!
        event.startDrag(DragSource.DefaultCopyDrop, transfer, this);
    }
}
项目:Desktop    文件:JhromeTabbedPaneUI.java   
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
    if (!tabbedPane.isEnabled()) {
        return;
    }

    dragOrigin = dge.getDragOrigin();

    Tab draggedTab = getDraggableTabAt(dragOrigin);
    if (draggedTab != null) {
        Window window = SwingUtilities.getWindowAncestor(tabbedPane);
        Dimension sourceWindowSize = null;
        if (window != null) {
            sourceWindowSize = window.getSize();
        }
        Point p = SwingUtilities.convertPoint(tabbedPane, dragOrigin, draggedTab);
        double grabX = p.x / (double) draggedTab.getWidth();

        dragInfo = new TabDragInfo(draggedTab, dragOrigin, grabX, floatingTabHandler, sourceWindowSize);
        source.startDrag(dge, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR), transferableStore.createTransferable(dragInfo), this);
    }
}
项目:triple-triad-ai    文件:CardDragHandler.java   
@Override
public void dragGestureRecognized(DragGestureEvent dge)
{
    if (this.canDrag)
    {
        this.oldParent = (CardCollection)this.card.getParent();
        this.location = this.oldParent.getCardLocation(this.card);
        this.card.cardLocation = this.location;
        this.oldParent.setCard(new CardWindow(), this.location);
        this.oldParent.validate();
        this.oldParent.repaint();

        DragSource source = dge.getDragSource();
        source.startDrag(dge, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR), this.card, this);
    }
}
项目:vassal    文件:PieceMover.java   
protected void beginDragging(DragGestureEvent dge) {
  // this call is needed to instantiate the boundingBox object
 final BufferedImage bImage = makeDragImage(dragPieceOffCenterZoom);

  final Point dragPointOffset = new Point(
    getOffsetMult() * (boundingBox.x + currentPieceOffsetX - EXTRA_BORDER),
    getOffsetMult() * (boundingBox.y + currentPieceOffsetY - EXTRA_BORDER)
  );

  dge.startDrag(
    Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
    bImage,
    dragPointOffset,
    new StringSelection(""),
    this
  );

  dge.getDragSource().addDragSourceMotionListener(this);
}
项目:rplib    文件:ImagePanel.java   
public void dragGestureRecognized(DragGestureEvent dge) {
    if (model == null || !isDraggingEnabled) {
        return;
    }
    int index = getImageIndexAt(dge.getDragOrigin().x, dge.getDragOrigin().y);
    if (index < 0) {
        return;
    }
    Transferable transferable = model.getTransferable(index);
    if (transferable == null) {
        return;
    }
    //dge.startDrag(Toolkit.getDefaultToolkit().createCustomCursor(model.getImage(index), new Point(0, 0), "Thumbnail"), transferable, this);
    dge.startDrag(getDragCursor(), transferable, this);
    DragSource.getDefaultDragSource().addDragSourceMotionListener(this);
}
项目:spicy    文件:TreeDragSource.java   
public void dragGestureRecognized(DragGestureEvent dge) {
    TreePath path = sourceTree.getSelectionPath();
    if ((path == null) || (path.getPathCount() <= 0) ) {
        return;
    }


    oldNode = (DefaultMutableTreeNode) path.getLastPathComponent();
    TreeTopComponentAdapter adapter = (TreeTopComponentAdapter) oldNode.getUserObject();
    Scenario scenarioTreeSelected = adapter.getScenario();
    if(scenarioTreeSelected == null) {
        this.sourceTree.setCursor(Cursor.getDefaultCursor());
        return;
    }
    transferable = new TransferableTreeNode(scenarioTreeSelected);

    source.startDrag(dge, Toolkit.getDefaultToolkit().createCustomCursor(Costanti.IMAGE_DND_DENIED, new Point(0, 0), "DND_DENIED"), transferable, this);

}
项目:incubator-netbeans    文件:DragManager.java   
public void dragGestureRecognized(DragGestureEvent dge) {
    Point gesturePoint = dge.getDragOrigin();
    DragItem item = getDragItem(transformMousePoint(gesturePoint));
    if (item != null) {
        activeDragItem = item;
        activeDragItem.setGesturePoint(gesturePoint);
        Cursor curs = activeDragItem.getCursor();
        assert curs != null;
        dge.startDrag(curs,new StringSelection(""),this);
        component.repaint();
    }

}
项目:incubator-netbeans    文件:DnDSupport.java   
public void dragGestureRecognized( DragGestureEvent dge ) {
    Transferable t = null;

    if( dge.getComponent() instanceof CategoryButton ) {
        //trying to drag a palette category
        CategoryButton button = (CategoryButton)dge.getComponent();
        draggingCategory = button.getCategory();
        t = draggingCategory.getTransferable();

    } else if( dge.getComponent() instanceof CategoryList ) {
        //trying to drag a palette item
        CategoryList list = (CategoryList)dge.getComponent();
        int selIndex = list.locationToIndex( dge.getDragOrigin() );
        draggingItem = list.getItemAt( selIndex );
        if( null == draggingItem ) {
            return;
        }
        t = draggingItem.drag();
        dragSourceCategoryList = list;
    }
    if( null != t ) {
        dge.getDragSource().addDragSourceListener( getDragSourceListener() );
        try {
            dge.startDrag( null, t );
        } catch( InvalidDnDOperationException idndE ) {
            //attempt to fix #110670
            try {
                dge.startDrag( null, t );
            } catch( InvalidDnDOperationException e ) {
                ERR.log( Level.INFO, idndE.getMessage(), e );
            }
        }
    }
}
项目:incubator-netbeans    文件:IndexedCustomizer.java   
/** Initiating the drag */
public void dragGestureRecognized(DragGestureEvent dge) {
    // check allowed actions
    if ((dge.getDragAction() & DnDConstants.ACTION_MOVE) == 0) {
        return;
    }

    // prepare transferable and start the drag
    int index = comp.locationToIndex(dge.getDragOrigin());

    // no index, then no dragging...
    if (index < 0) {
        return;
    }

    //      System.out.println("Starting drag..."); // NOI18N
    // create our flavor for transferring the index
    myFlavor = new DataFlavor(
            String.class, NbBundle.getBundle(IndexedCustomizer.class).getString("IndexedFlavor")
        );

    try {
        dge.startDrag(DragSource.DefaultMoveDrop, new IndexTransferable(myFlavor, index), this);

        // remember the gesture
        this.dge = dge;
    } catch (InvalidDnDOperationException exc) {
        Logger.getLogger(IndexedCustomizer.class.getName()).log(Level.WARNING, null, exc);

        // PENDING notify user - cannot start the drag
    }
}
项目:VASSAL-src    文件:SetupStack.java   
public void dragGestureRecognized(DragGestureEvent dge) {

      Point mousePosition = dge.getDragOrigin();
      Point piecePosition = new Point(myStack.pos);

      // Check drag starts inside piece
      Rectangle r = myStack.stackConfigurer.getPieceBoundingBox();
      r.translate(piecePosition.x, piecePosition.y);
      if (!r.contains(mousePosition)) {
        return;
      }

      originalPieceOffsetX = piecePosition.x - mousePosition.x;
      originalPieceOffsetY = piecePosition.y - mousePosition.y;

      drawWin = null;

      makeDragCursor();
      setDragCursor();

      SwingUtilities.convertPointToScreen(mousePosition, drawWin);
      moveDragCursor(mousePosition.x, mousePosition.y);

      // begin dragging
      try {
        dge.startDrag(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
                      new StringSelection(""), this); // DEBUG
        dge.getDragSource().addDragSourceMotionListener(this);
      }
      catch (InvalidDnDOperationException e) {
        ErrorDialog.bug(e);
      }
    }
项目:VASSAL-src    文件:RegionGrid.java   
public void dragGestureRecognized(DragGestureEvent dge) {

        final Point mousePosition = dge.getDragOrigin();
        dragStart = new Point(mousePosition);
        final Region r = grid.getRegion(mousePosition);
        if (r == null) {
          return;
        }

        Point piecePosition = new Point(r.getOrigin());

        originalPieceOffsetX = piecePosition.x - mousePosition.x;
        originalPieceOffsetY = piecePosition.y - mousePosition.y;

        drawWin = null;

        makeDragCursor();
        setDragCursor();

        SwingUtilities.convertPointToScreen(drawOffset, drawWin);
        SwingUtilities.convertPointToScreen(mousePosition, drawWin);
        moveDragCursor(mousePosition.x, mousePosition.y);

        // begin dragging
        try {
          dge.startDrag(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
                        new StringSelection(""), this); //$NON-NLS-1$
          dge.getDragSource().addDragSourceMotionListener(this);
        }
        catch (InvalidDnDOperationException e) {
          ErrorDialog.bug(e);
        }
      }
项目:VASSAL-src    文件:PieceMover.java   
/** Fires after user begins moving the mouse several pixels over a map. */
public void dragGestureRecognized(DragGestureEvent dge) {
  try {
    beginDragging(dge);
  }
  // FIXME: Fix by replacing AWT Drag 'n Drop with Swing DnD.
  // Catch and ignore spurious DragGestures
  catch (InvalidDnDOperationException e) {
  }
}
项目:VASSAL-src    文件:PieceMover.java   
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
  final Point mousePosition = dragGestureRecognizedPrep(dge);
  if (mousePosition == null) return;

  makeDragCursor(dragPieceOffCenterZoom);
  setDrawWinToOwnerOf(dragWin);
  SwingUtilities.convertPointToScreen(mousePosition, drawWin);
  moveDragCursor(mousePosition.x, mousePosition.y);

  super.dragGestureRecognized(dge);
}
项目:VASSAL-src    文件:PieceSlot.java   
public void addTo(Buildable parent) {
  panel.setDropTarget(AbstractDragHandler.makeDropTarget(panel, DnDConstants.ACTION_MOVE, null));

  DragGestureListener dragGestureListener = new DragGestureListener() {
    public void dragGestureRecognized(DragGestureEvent dge) {
      startDrag();
      AbstractDragHandler.getTheDragHandler().dragGestureRecognized(dge);
    }
  };
  DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(panel, DnDConstants.ACTION_MOVE, dragGestureListener);
}
项目:KernelHive    文件:RepositoryViewerDragGestureListener.java   
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
    Cursor cursor = null;
    if(dge.getComponent() instanceof RepositoryViewer){
        RepositoryViewer rv = (RepositoryViewer) dge.getComponent();
        KernelRepositoryEntry kre = (KernelRepositoryEntry) rv.getSelectedValue();

        if(dge.getDragAction()==DnDConstants.ACTION_COPY){
            cursor = DragSource.DefaultCopyDrop;
        }

        dge.startDrag(cursor, new TransferableKernelRepositoryEntry(kre));
    }
}
项目:Equella    文件:FileListPanel.java   
private void registerDndHandlers()
{
    new DragSource().createDefaultDragGestureRecognizer(list, DnDConstants.ACTION_COPY, new DragGestureListener()
    {
        @Override
        public void dragGestureRecognized(DragGestureEvent dge)
        {
            Transferable t = new FileInfoTransferable(getSelectedFile());
            dge.startDrag(DragSource.DefaultMoveDrop, t);
        }
    });

    DnDUtils.registerDropHandler(this, dropHandlers, new HoverHandler()
    {
        @Override
        public void hovering(DropTargetDragEvent e)
        {
            FileInfo fi = getFileUnderMouseCursor();
            if( fi == null )
            {
                int i = getListIndexUnderPoint(e.getLocation());
                if( i >= 0 )
                {
                    fi = model.get(i);
                }
            }

            if( fi != null && fi.isDirectory() )
            {
                list.setSelectedValue(fi, true);
            }
            else
            {
                list.getSelectionModel().clearSelection();
            }
        }
    });
}
项目:OpenJSharp    文件:SunDragSourceContextPeer.java   
/**
 * construct a new SunDragSourceContextPeer
 */

public SunDragSourceContextPeer(DragGestureEvent dge) {
    trigger = dge;
    if (trigger != null) {
        component = trigger.getComponent();
    } else {
        component = null;
    }
}
项目:OpenJSharp    文件:SunDragSourceContextPeer.java   
protected synchronized void setTrigger(DragGestureEvent dge) {
    trigger = dge;
    if (trigger != null) {
        component = trigger.getComponent();
    } else {
        component = null;
    }
}
项目:OpenJSharp    文件:WToolkit.java   
/**
 * create the peer for a DragSourceContext
 */

@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
项目:OpenJSharp    文件:XToolkit.java   
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
项目:Tarski    文件:mxGraphHandler.java   
/**
 * 
 */
protected void installDragGestureHandler() {
  DragGestureListener dragGestureListener = new DragGestureListener() {
    public void dragGestureRecognized(DragGestureEvent e) {
      if (graphComponent.isDragEnabled() && first != null) {
        final TransferHandler th = graphComponent.getTransferHandler();

        if (th instanceof mxGraphTransferHandler) {
          final mxGraphTransferable t = (mxGraphTransferable) ((mxGraphTransferHandler) th)
              .createTransferable(graphComponent);

          if (t != null) {
            e.startDrag(null, mxSwingConstants.EMPTY_IMAGE, new Point(), t,
                new DragSourceAdapter() {

                  /**
                   * 
                   */
                  public void dragDropEnd(DragSourceDropEvent dsde) {
                    ((mxGraphTransferHandler) th).exportDone(graphComponent, t,
                        TransferHandler.NONE);
                    first = null;
                  }
                });
          }
        }
      }
    }
  };

  DragSource dragSource = new DragSource();
  dragSource.createDefaultDragGestureRecognizer(graphComponent.getGraphControl(),
      (isCloneEnabled()) ? DnDConstants.ACTION_COPY_OR_MOVE : DnDConstants.ACTION_MOVE,
      dragGestureListener);
}
项目:jdk8u-jdk    文件:SunDragSourceContextPeer.java   
/**
 * construct a new SunDragSourceContextPeer
 */

public SunDragSourceContextPeer(DragGestureEvent dge) {
    trigger = dge;
    if (trigger != null) {
        component = trigger.getComponent();
    } else {
        component = null;
    }
}
项目:jdk8u-jdk    文件:SunDragSourceContextPeer.java   
protected synchronized void setTrigger(DragGestureEvent dge) {
    trigger = dge;
    if (trigger != null) {
        component = trigger.getComponent();
    } else {
        component = null;
    }
}
项目:jdk8u-jdk    文件:WToolkit.java   
/**
 * create the peer for a DragSourceContext
 */

@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
项目:jdk8u-jdk    文件:XToolkit.java   
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
项目:jdk8u-jdk    文件:SourceFileListFrame.java   
public void dragGestureRecognized(DragGestureEvent dge) {
    String [] filesAsStringArray = list.getItems();
    File [] files = new File[filesAsStringArray.length];
    for (int fileNumber=0; fileNumber<filesAsStringArray.length ; fileNumber++ ) {
        files[fileNumber]=new File(filesAsStringArray[fileNumber]);
    }
    dge.startDrag(null, new FileListTransferable(Arrays.asList(files)));
}
项目:jdk8u-jdk    文件:SourceFileListFrame.java   
public void dragGestureRecognized(DragGestureEvent dge) {
    String [] filesAsStringArray = list.getItems();
    File [] files = new File[filesAsStringArray.length];
    for (int fileNumber=0; fileNumber<filesAsStringArray.length ; fileNumber++ ) {
        files[fileNumber]=new File(filesAsStringArray[fileNumber]);
    }
    dge.startDrag(null, new FileListTransferable(Arrays.asList(files)));
}