Java 8 TransferHandler - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TransferHandler class.

This code example shows how to use the following methods:getVisualRepresentation
    public int getSourceActions(JComponent arg0) {
        return delegate.getSourceActions(arg0);
    } 
 
    public Icon getVisualRepresentation(Transferable arg0) {
        return delegate.getVisualRepresentation(arg0);
    } 
 
    private static List<File> uriToFileList(Object data) {
        List<File> list = new ArrayList<File>();
        StringTokenizer st = new StringTokenizer(data.toString(), "\r\n");
        while (st.hasMoreTokens())
        { 
            String s = st.nextToken();
            if (s.startsWith("#")) {
                continue; 
            } 
            try { 
                list.add(new File(new URI(s)));
            } catch (Exception e) {
4
CodeRank
This code example shows how to use the following methods:exportAsDrag
        if (node == null) {
            return; 
        } 
        if (node.isLeaf()) {
            TransferHandler handler = c.getTransferHandler();
            handler.exportAsDrag(c, e, TransferHandler.COPY);
        } 
    } 
 
    /** 
     * Finds the correct tree path. 
     * 
     * @param tree  the tree to search. 
     * @param nodes the nodes to find in the tree. 
     * @return the treepath. 
     */ 
    public TreePath find(Tree tree, Object[] nodes) {
        TreeNode root = (TreeNode)tree.getModel().getRoot();
        return find2(tree, new TreePath(root), nodes, 0, false);
    } 
3
CodeRank
This code example shows how to use the following methods:
     * @throws Exception exception 
     */ 
    public void setUp() throws Exception {
        graphNode = TestHelper.createGraphNodeForSubsystem();
        properties = new HashMap<String, String>();
        handler = new TransferHandler("property_name");
        subsystemNodeContainer = new SubsystemNodeContainer(graphNode, properties, handler);
    } 
 
    /** 
     * <p> 
     * Tests constructor SubsystemNodeContainer(graphNode, properties, handler) if graphNode is null. 
     * IllegalArgumentException is expected. 
     * </p> 
     * 
     * @throws Exception exception 
     */ 
    public void testCtorIfGraphNodeNull() throws Exception {
        try { 
            new SubsystemNodeContainer(null, properties, handler);
4
CodeRank
This code example shows how to use the following methods:exportAsDrag
    @Override 
    public void mousePressed(MouseEvent e) {
        
            NWidget c = (NWidget) e.getSource();
            TransferHandler handler = c.getTransferHandler();
            handler.exportAsDrag(c, e, TransferHandler.COPY); 
            
    } 
} 
3
CodeRank
This code example shows how to use the following methods:
 
        classNode = new ClassNode(classGraphNode, properties);
 
        enumerationNode = new EnumerationNode(enumerationGraphNode, properties);
 
        packageNode = new PackageNode(packageGraphNode, properties, new TransferHandler(null));
    } 
 
    /** 
     * <p> 
     * Test the method <code>checkNotNull(Object argument, String name)</code> with <code>null</code> Argument. 
     * <code>IllegalArgumentException</code> should be thrown. 
     * </p> 
     */ 
    public void testCheckNotNullWithNullArgument() { 
        try { 
            Util.checkNotNull(null, "test"); 
            fail("IllegalArgumentException should be thrown");
        } catch (IllegalArgumentException iae) {
            // Success 
3
CodeRank
This code example shows how to use the following methods:
    protected void setUp() throws Exception {
        super.setUp(); 
 
        graphNode = FailureTestHelper.createPackageGraphNode(new Point(50, 50), new Dimension(20, 20));
        graphNode.setContainer(new GraphNode());
        handler = new TransferHandler(null);
 
        properties = FailureTestHelper.createProperties();
 
        packageNode = new PackageNode(graphNode, properties, handler);
    } 
 
    /** 
     * Tests the constructor PackageNode(GraphNode, Map&lt;String, String&gt;) with null graphNode, expected 
     * IllegalArgumentException. 
     *  
     * @throws Exception 
     *             to junit 
     */ 
    public void testCtor_NullGraphNode() throws Exception {
4
CodeRank
This code example shows how to use the following methods:
     * </p> 
     * 
     * @throws Exception when error occurs 
     */ 
    public void testSetTransferHandlerAccuracy() throws Exception {
        this.view.setTransferHandler(new TransferHandler("Test"));
    } 
 
    /** 
     * <p> 
     * This is the failure test for constructor: notifyDiagramChanged().<br> 
     * Failure condition: The handler is null. <br> 
     * Expected: IllegalArgumentException. <br> 
     * </p> 
     * 
     * @throws Exception when error occurs 
     */ 
    public void testSetTransferHandlerWithNull() throws Exception {
        try { 
            this.view.setTransferHandler(null);
4
CodeRank
This code example shows how to use the following methods:exportAsDrag
This code example shows how to use the following methods:
     */ 
    public void setUp() throws Exception {
        location = new Point();
        GraphNode graphNode = TestHelper.createGraphNodeForSubsystem();
        source = new SubsystemNodeContainer(graphNode, new HashMap<String, String>(),
                new TransferHandler("property_name"));
    } 
 
    /** 
     * <p> 
     * Tests constructor EdgeAddEvent(source, location, isStart) if source is null. 
     * IllegalArgumentException is expected. 
     * </p> 
     */ 
    public void testCtorIfSourceNull() { 
        try { 
            new EdgeAddEvent(null, location, true);
            fail("IllegalArgumentException is excpected because source cannot be null.");
        } catch (IllegalArgumentException e) {
            //success 
4
CodeRank
This code example shows how to use the following methods:
     */ 
    public void setUp() throws Exception {
        location = new Point();
        GraphNode graphNode = TestHelper.createGraphNodeForSubsystem();
        source = new SubsystemNodeContainer(graphNode, new HashMap<String, String>(),
                new TransferHandler("property_name"));
    } 
 
    /** 
     * <p> 
     * Tests constructor NodeAddEvent(source, location) if source is null. 
     * IllegalArgumentException is expected. 
     * </p> 
     */ 
    public void testCtorIfSourceNull() { 
        try { 
            new NodeAddEvent(null, location);
            fail("IllegalArgumentException is excpected because source cannot be null.");
        } catch (IllegalArgumentException e) {
            //success 
4
CodeRank
See Code Examples for Java 8 TransferHandler Methods: