All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.ide.common.control.TransferableObject Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.ide.common.control;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;

/**
 * IDE????ʱ???ݵĶ???
 */
public class TransferableObject implements Transferable {
	/**
	 * ???ƵĶ???
	 */
	private Object object;
	/**
	 * DataFlavor????
	 */
	public static final DataFlavor objectFlavor = new DataFlavor(
			TransferableObject.class, "object");

	/**
	 * DataFlavor????
	 */
	static DataFlavor[] flavors = { objectFlavor };

	/**
	 * ???캯??
	 * 
	 * @param object
	 *            ???ƵĶ???
	 */
	public TransferableObject(Object object) {
		this.object = object;
	}

	/**
	 * ȡ???ݵ?DataFlavor????
	 */
	public DataFlavor[] getTransferDataFlavors() {
		return flavors;
	}

	/**
	 * DataFlavor?Ƿ?֧??
	 */
	public boolean isDataFlavorSupported(DataFlavor flavor) {
		return flavor.equals(objectFlavor);
	}

	/**
	 * ??DataFlavorȡ???ݵĶ???
	 */
	public synchronized Object getTransferData(DataFlavor flavor)
			throws UnsupportedFlavorException {
		if (flavor.equals(objectFlavor)) {
			return object;
		} else {
			return null;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy