當前位置: 首頁>>代碼示例>>Java>>正文


Java TransferHandler.MOVE屬性代碼示例

本文整理匯總了Java中javax.swing.TransferHandler.MOVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java TransferHandler.MOVE屬性的具體用法?Java TransferHandler.MOVE怎麽用?Java TransferHandler.MOVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.TransferHandler的用法示例。


在下文中一共展示了TransferHandler.MOVE屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: exportDone

/**
 * 
 */
public void exportDone(JComponent c, Transferable data, int action)
{
	initialImportCount = 1;
	
	if (c instanceof mxGraphComponent
			&& data instanceof mxGraphTransferable)
	{
		// Requires that the graph handler resets the location to null if the drag leaves the
		// component. This is the condition to identify a cross-component move.
		boolean isLocalDrop = location != null;

		if (action == TransferHandler.MOVE && !isLocalDrop)
		{
			removeCells((mxGraphComponent) c, originalCells);
			initialImportCount = 0;
		}
	}

	originalCells = null;
	location = null;
	offset = null;
}
 
開發者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數:25,代碼來源:mxGraphTransferHandler.java

示例2: exportDone

/**
 * 
 */
public void exportDone(JComponent c, Transferable data, int action) {
  initialImportCount = 1;

  if (c instanceof mxGraphComponent && data instanceof mxGraphTransferable) {
    // Requires that the graph handler resets the location to null if the drag leaves the
    // component. This is the condition to identify a cross-component move.
    boolean isLocalDrop = location != null;

    if (action == TransferHandler.MOVE && !isLocalDrop) {
      removeCells((mxGraphComponent) c, originalCells);
      initialImportCount = 0;
    }
  }

  originalCells = null;
  location = null;
  offset = null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:21,代碼來源:mxGraphTransferHandler.java

示例3: exportToClipboard

@Override
public void exportToClipboard(JComponent c, Clipboard clip, int action) throws IllegalStateException {
    List<Position> regions;
    if (c instanceof JTextComponent &&
            (Boolean.TRUE.equals(c.getClientProperty(RECTANGULAR_SELECTION_PROPERTY))) &&
            (regions = RectangularSelectionUtils.regionsCopy(c)) != null)
    {
        final JTextComponent tc = (JTextComponent) c;
        String[] data;
        StringBuilder stringSelectionBuffer;
        AbstractDocument doc = (AbstractDocument) tc.getDocument();
        doc.readLock();
        try {
            // Cannot delegate to overriden transfer handler - at least not the JTextComponent.DefaultTransferHandler
            // because it would:
            // for COPY action whole selection would be copied which is wrong
            // for MOVE selection it would in addition remove <dot,mark> portion of the document.
            // Therefore handle string selection here explicitly.
            CharSequence docText = DocumentUtilities.getText(doc);
            stringSelectionBuffer = new StringBuilder(100);
            int size = regions.size();
            data = new String[size >>> 1];
            for (int i = 0; i < size; i++) {
                Position startPos = regions.get(i++);
                Position endPos = regions.get(i);
                CharSequence lineSel = docText.subSequence(startPos.getOffset(), endPos.getOffset());
                int halfI = (i >>> 1);
                if (halfI != 0) {
                    stringSelectionBuffer.append('\n');
                }
                stringSelectionBuffer.append(lineSel);
                data[halfI] = lineSel.toString();
            }
        } finally {
            doc.readUnlock();
        }

        clip.setContents(
                new WrappedTransferable(
                    new StringSelection(stringSelectionBuffer.toString()),
                    new RectangularSelectionData(data)),
                null);

        if (action == TransferHandler.MOVE) {
            try {
                RectangularSelectionUtils.removeSelection(doc, regions);
            } catch (BadLocationException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
        return;

    } else { // No rectangular selection
        delegate.exportToClipboard(c, clip, action);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:56,代碼來源:RectangularSelectionTransferHandler.java

示例4: exportDone

@Override final protected void exportDone(JComponent objPsourceJComponent, Transferable objPdataTransferable, int intPaction) {
	if (intPaction == TransferHandler.MOVE && objPsourceJComponent instanceof JTextComponent
		&& ((JTextComponent) objPsourceJComponent).isEditable()) {
		((JTextComponent) objPsourceJComponent).replaceSelection(Strings.strS_EMPTY);
	}
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:6,代碼來源:ExtendedTransferHandler.java

示例5: importData

/**
 * Method description
 * 
 * @see
 * @param objPtransferSupport
 * @return
 */
@SuppressWarnings("unchecked") @Override final public boolean importData(TransferHandler.TransferSupport objPtransferSupport) {

	if (objPtransferSupport.isDataFlavorSupported(DataFlavor.stringFlavor)) {
		return this.objGtextTransferHandler != null && this.objGtextTransferHandler.importData(objPtransferSupport);
	}

	final boolean bolLsiteswaps =
									this.bolGsiteswaps
										|| this.objGcontrolJFrame.getPatternsManager().bytGpatternsManagerType == Constants.bytS_MANAGER_NO_PATTERN
										|| this.objGcontrolJFrame.getPatternsManager().bytGpatternsManagerType == Constants.bytS_MANAGER_JM_PATTERN
										|| this.objGcontrolJFrame.getPatternsManager().bytGpatternsManagerType == Constants.bytS_MANAGER_NEW_ABSTRACT_LANGUAGE;

	java.util.List<File> objLfilesList = null;
	try {
		objLfilesList = (java.util.List<File>) objPtransferSupport.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
	} catch (final Throwable objPthrowable) {
		return false;
	}
	for (int intLfileIndex = 0; intLfileIndex < objLfilesList.size(); ++intLfileIndex) {
		final File objLfile = objLfilesList.get(intLfileIndex);
		final String strLloadedFileName = objLfile.getAbsolutePath();
		this.objGcontrolJFrame.doHidePopUps();
		this.objGcontrolJFrame.setLoadingPatternsFile(true);

		final boolean bolLnewPatternManager =
												(intLfileIndex == 0)
													&& bolLsiteswaps
													&& (objPtransferSupport.getUserDropAction() == TransferHandler.MOVE
														|| this.objGcontrolJFrame.getPatternsManager().bytGpatternsManagerType == Constants.bytS_MANAGER_NO_PATTERN
														|| this.objGcontrolJFrame.getPatternsManager().bytGpatternsManagerType == Constants.bytS_MANAGER_JM_PATTERN || this.objGcontrolJFrame.getPatternsManager().bytGpatternsManagerType == Constants.bytS_MANAGER_NEW_ABSTRACT_LANGUAGE);
		if (bolLnewPatternManager) {

			// Create new pattern manager :
			new PatternsFileJCheckBoxMenuItem(	this.objGcontrolJFrame,
												Strings.getRightDotTrimmedString(objLfile.getName()),
												Strings.strS_EMPTY,
												strLloadedFileName,
												true,
												bolLsiteswaps,
												this.bolGstyles).itemStateChanged(new ItemEvent(this.objGcontrolJFrame.objGpatternsExtendedJMenu,
																								Constants.bytS_UNCLASS_NO_VALUE,
																								null,
																								Constants.bytS_UNCLASS_NO_VALUE));
		} else {

			// Append new styles / patterns to the current pattern manager :
			FileActions.doImportJugglePatternsManager(	this.objGcontrolJFrame,
														strLloadedFileName,
														Strings.getRightDotTrimmedString(objLfile.getName()),
														bolLsiteswaps,
														this.bolGstyles);
		}

		this.objGcontrolJFrame.setLoadingPatternsFile(false);
	}
	return true;
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:64,代碼來源:ExtendedTransferHandler.java

示例6: exportDone

@Override
protected void exportDone(JComponent c, Transferable t, int act) {
   if ((act == TransferHandler.MOVE) || (act == TransferHandler.NONE)) {
      table.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   }
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:6,代碼來源:Digitizer.java


注:本文中的javax.swing.TransferHandler.MOVE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。