本文整理汇总了Java中java.awt.datatransfer.DataFlavor.equals方法的典型用法代码示例。如果您正苦于以下问题:Java DataFlavor.equals方法的具体用法?Java DataFlavor.equals怎么用?Java DataFlavor.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.datatransfer.DataFlavor
的用法示例。
在下文中一共展示了DataFlavor.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(LOCAL_TRANSFERRED_OPERATORS_FLAVOR)) {
return this.clonedOperators;
}
if (flavor.equals(DataFlavor.stringFlavor)) {
StringBuilder b = new StringBuilder();
for (Operator op : clonedOperators) {
b.append(op.getXML(false));
}
return b.toString();
} else {
throw new UnsupportedFlavorException(flavor);
}
}
示例2: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (isDataFlavorSupported(flavor)) {
if (flavor.equals(DataFlavor.allHtmlFlavor)) {
return ALL_HTML_AS_STRING;
} else if (flavor.equals(DataFlavor.fragmentHtmlFlavor)) {
return FRAGMENT_HTML_AS_STRING;
} else if (flavor.equals(DataFlavor.selectionHtmlFlavor)) {
return SELECTION_HTML_AS_STRING;
}
}
throw new UnsupportedFlavorException(flavor);
}
示例3: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public T getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (flavor.equals(dataFlavor)) {
return sourceNode;
} else {
throw new UnsupportedFlavorException(flavor);
}
}
示例4: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException
{
if (flavor.equals(myFlavor))
return entry;
throw new UnsupportedFlavorException(flavor);
}
示例5: testEqualsHashCodeConsistency
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
private static void testEqualsHashCodeConsistency() {
for (DataFlavor flavor1 : dataFlavors) {
for (DataFlavor flavor2 : dataFlavors) {
if ((flavor1.equals(flavor2) && flavor1.hashCode() != flavor2.hashCode())) {
throw new RuntimeException(
String.format("Equals and hash code not consistent for %s and %s", flavor1, flavor2));
}
}
}
}
示例6: testEqualsSymmetry
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
private static void testEqualsSymmetry() {
for (DataFlavor flavor1 : dataFlavors) {
for (DataFlavor flavor2 : dataFlavors) {
if (flavor1.equals(flavor2) != flavor2.equals(flavor1)) {
throw new RuntimeException(
String.format("Equals is not symmetric for %s and %s", flavor1, flavor2));
}
}
}
}
示例7: isDataFlavorSupported
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
for (DataFlavor supportedDataFlavor : supportedDataFlavors) {
if (supportedDataFlavor.equals(flavor)) {
return true;
}
}
return false;
}
示例8: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
/**
* Return the Transfer Data of type DataFlavor from InputStream.
* @param df the DataFlavor
* @param ds the DataSource
* @return the constructed Object
*/
public Object getTransferData(DataFlavor df, DataSource ds) throws
UnsupportedFlavorException, IOException {
if (dch != null)
return dch.getTransferData(df, ds);
else if (df.equals(getTransferDataFlavors()[0])) // only have one now
return ds.getInputStream();
else
throw new UnsupportedFlavorException(df);
}
示例9: isDataFlavorSupported
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
DataFlavor[] flavors = getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
if (flavor.equals(flavors[ i])) {
return true;
}
}
return false;
}
示例10: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (flavor.equals(flavors[IMAGE])) {
return data;
} else {
throw new UnsupportedFlavorException(flavor);
}
}
示例11: isDragOk
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
/** Determine if the dragged data is a file list. */
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{ boolean ok = false;
// Get data flavors being dragged
java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
// See if any of the flavors are a file list
int i = 0;
while( !ok && i < flavors.length )
{
// BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
// Is the flavor a file list?
final DataFlavor curFlavor = flavors[i];
if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
curFlavor.isRepresentationClassReader()){
ok = true;
}
// END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
i++;
} // end while: through flavors
// If logging is enabled, show data flavors
if( out != null )
{ if( flavors.length == 0 )
log( out, "FileDrop: no data flavors." );
for( i = 0; i < flavors.length; i++ )
log( out, flavors[i].toString() );
} // end if: logging enabled
return ok;
}
示例12: getTransferData
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
/**
* Return the Transfer Data of type DataFlavor from InputStream.
* @param df the DataFlavor
* @param ds the DataSource
* @return the constructed Object
*/
public Object getTransferData(DataFlavor df, DataSource ds)
throws UnsupportedFlavorException, IOException {
if (dch != null)
return dch.getTransferData(df, ds);
else if (df.equals(getTransferDataFlavors()[0])) // only have one now
return obj;
else
throw new UnsupportedFlavorException(df);
}
示例13: isDataFlavorSupported
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
for (int i=0; i<FLAVORS.length; i++) {
if (flavor.equals(FLAVORS[i])) {
return true;
}
}
return false;
}
示例14: main
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
public static void main(String[] args) {
DataFlavor df = new DataFlavor("text/enriched; charset=ascii", "Enrich Flavor");
storeDataFlavor(df);
DataFlavor df1 = retrieveDataFlavor();
if (!df.equals(df1)) {
throw new RuntimeException("FAILED: restored DataFlavor is not equal to externalized one");
}
}
示例15: isDataFlavorSupported
import java.awt.datatransfer.DataFlavor; //导入方法依赖的package包/类
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
for (DataFlavor fl : flavors) {
if (flavor.equals(fl)) {
return true;
}
}
return false;
}