本文整理匯總了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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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));
}
}