Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /antelope/src/ise/antelope/common/builder/

antelope
Discussion topic

Back to topic list

CVS update: /antelope/src/ise/antelope/common/builder/

Author danson
Full name Dale Anson
Date 2004-03-02 20:47:10 PST
Message User: danson
Date: 04/03/02 20:47:10

Added:
 /antelope/src/ise/an​telope/common/builde​r/
  TreePathFlavor.java, TreeTransferable.java

Log:
 new files to support dnd
 

File Changes:

Directory: /antelope/src/ise/an​telope/common/builde​r/
====================​====================​=============

File [added]: TreePathFlavor.java
Url: http://antelope.tigr​is.org/source/browse​/antelope/src/ise/an​telope/common/builde​r/TreePathFlavor.jav​a?rev=1.1&conten​t-type=text/vnd.view​cvs-markup
Added lines: 12
---------------
package ise.antelope.common.builder;

import java.awt.datatransfer.*;

public class TreePathFlavor extends DataFlavor {
   
   
   public TreePathFlavor() {
      super(javax.swing.tr​ee.TreePath.class, "TreePath");
   }
   
}

File [added]: TreeTransferable.java
Url: http://antelope.tigr​is.org/source/browse​/antelope/src/ise/an​telope/common/builde​r/TreeTransferable.j​ava?rev=1.1&cont​ent-type=text/vnd.vi​ewcvs-markup
Added lines: 73
---------------
package ise.antelope.common.builder;

import java.awt.datatransfer.*;
import javax.swing.tree.TreePath;

/**
 * Package TreePaths for movement.
 */
public class TreeTransferable implements Transferable {

   private static DataFlavor[] flavors = null;
   private TreePath data = null;

   /**
    * @param data the type of Ant element being transferred, e.g., target, task,
    * type, etc.
    */
   public TreeTransferable( TreePath data ) {
      this.data = data;
      init();
   }

   /**
    * Set up the supported flavors: DataFlavor.stringFlavor for a raw string containing
    * an Ant element name (e.g. task, target, etc), or an ElementFlavor containing
    * an ElementPanel.
    */
   private void init() {
      try {
         flavors = new DataFlavor[ 1 ];
         flavors[ 0 ] = new TreePathFlavor();
      }
      catch ( Exception e ) {
         e.printStackTrace();
      }
   }

   /**
    * @param df the flavor type desired for the data. Acceptable value is
    * DataFlavor.stringFlavor.
    * @return if df is DataFlavor.stringFlavor, returns a raw string containing
    * an Ant element name.
    */
   public Object getTransferData( DataFlavor df ) {
      if ( df == null )
         return null;
      if ( data != null && df instanceof TreePathFlavor )
         return data;
      return null;
   }

   /**
    * @return an array containing a single ElementFlavor.
    */
   public DataFlavor[] getTransferDataFlavors() {
      return flavors;
   }

   /**
    * @param df the flavor to check
    * @return true if df is an ElementFlavor
    */
   public boolean isDataFlavorSupported( DataFlavor df ) {
      if ( df == null )
         return false;
      for ( int i = 0; i < flavors.length; i++ ) {
         if ( df.equals( flavors[ i ] ) ) {
            return true;
         }
      }
      return false;
   }
}




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@ante​lope.tigris.org
For additional commands, e-mail: cvs-help at antelope dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /antelope/src/ise/antelope/common/builder/ danson Dale Anson 2004-03-02 20:47:10 PST
Messages per page: