当前位置: 首页>>代码示例>>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;未经允许,请勿转载。