当前位置: 首页>>代码示例>>Java>>正文


Java DataFlavor.equals方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:TransferableOperator.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:HtmlTransferable.java

示例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);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:11,代码来源:TransferableNode.java

示例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);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:8,代码来源:BracketEntry.java

示例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));
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:EqualsHashCodeSymmetryTest.java

示例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));
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:EqualsHashCodeSymmetryTest.java

示例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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:HtmlTransferable.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:DataHandler.java

示例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;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:12,代码来源:TransferableImage.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ImageTransferTest.java

示例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;
}
 
开发者ID:JorenSix,项目名称:Panako,代码行数:33,代码来源:FileDrop.java

示例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);

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:DataHandler.java

示例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;
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:10,代码来源:RtfTransferable.java

示例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");
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:ExternalizeTest.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:NullDataFlavorTest.java


注:本文中的java.awt.datatransfer.DataFlavor.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。