Examples of DataFlavor


Examples of ae.java.awt.datatransfer.DataFlavor

            hashMap.putAll(map);
            flavorToFormatMap = Collections.unmodifiableMap(hashMap);
        }

        public int compare(Object obj1, Object obj2) {
            DataFlavor flavor1 = null;
            DataFlavor flavor2 = null;
            if (order == SELECT_BEST) {
                flavor1 = (DataFlavor)obj1;
                flavor2 = (DataFlavor)obj2;
            } else {
                flavor1 = (DataFlavor)obj2;
                flavor2 = (DataFlavor)obj1;
            }

            if (flavor1.equals(flavor2)) {
                return 0;
            }

            int comp = 0;

            String primaryType1 = flavor1.getPrimaryType();
            String subType1 = flavor1.getSubType();
            String mimeType1 = primaryType1 + "/" + subType1;
            Class class1 = flavor1.getRepresentationClass();

            String primaryType2 = flavor2.getPrimaryType();
            String subType2 = flavor2.getSubType();
            String mimeType2 = primaryType2 + "/" + subType2;
            Class class2 = flavor2.getRepresentationClass();

            if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
                // First, compare MIME types
                comp = compareIndices(textTypes, mimeType1, mimeType2,
                                      UNKNOWN_OBJECT_LOSES);
                if (comp != 0) {
                    return comp;
View Full Code Here

Examples of com.sun.star.datatransfer.DataFlavor

    /**
    * Get a system data type for 'text/html' MIME type. <p>
    * Has <b> OK </b> status if not <code>null</code> value returned.
    */
    public void _getSystemDataTypeFromDataFlavor() {
        DataFlavor df = new DataFlavor
            ("text/html","HTML-Documents", new Type());
        Object res = oObj.getSystemDataTypeFromDataFlavor(df);
        tRes.tested("getSystemDataTypeFromDataFlavor()",res != null);
    }
View Full Code Here

Examples of com.sun.star.datatransfer.DataFlavor

     * from 'text/html' MIME type. <p>
     * Has <b>OK</b> status if DataFlavour returned has 'text/hrml' MIME
     * type.
     */
    public void _getDataFlavorFromSystemDataType() {
        DataFlavor in = new DataFlavor
            ("text/html","HTML-Documents", new Type());
        Object res = oObj.getSystemDataTypeFromDataFlavor(in);
        DataFlavor out = oObj.getDataFlavorFromSystemDataType(res);
        tRes.tested("getDataFlavorFromSystemDataType()",
            out.MimeType.equals("text/html"));
    }
View Full Code Here

Examples of com.sun.star.datatransfer.DataFlavor

    class MyTransferable implements XTransferable {
        DataFlavor[] supportedFlavors;

        public MyTransferable() {
            supportedFlavors = new DataFlavor[] {
                new DataFlavor("text/plain", "Plain text", new Type(String.class))
            };
        }
View Full Code Here

Examples of java.awt.datatransfer.DataFlavor

  public void drop(DropTargetDropEvent e) {
    e.acceptDrop(e.getDropAction());
    this.paintImmediately(mCueLine.getBounds());
    Transferable transfer = e.getTransferable();

    if(transfer.isDataFlavorSupported(new DataFlavor(TreePath.class, "FavoriteNodeExport"))) {
      try {
        FavoriteNode node = mTransferNode;
        FavoriteNode parent = (FavoriteNode)node.getParent();

        int row = getClosestRowForLocation(e.getLocation().x, e.getLocation().y);
View Full Code Here

Examples of java.awt.datatransfer.DataFlavor

   * Set up the transferEntries.
   * @param program The selected program.
   */
  public TransferProgram(Program program) {
    mProgram = program;
    mPF = new DataFlavor(Program.class,"Program");
  }
View Full Code Here

Examples of java.awt.datatransfer.DataFlavor

   * @param source The source list name.
   * @param type The type of the list entries.
   */
  public TransferEntries(int[] indices, String source, String type) {
    mIndices = indices;
    mIF = new DataFlavor(Integer.class,type);
    mSource = source;
    mSF = new DataFlavor(JList.class,"Source");
  }
View Full Code Here

Examples of java.awt.datatransfer.DataFlavor

     * @param index
     *          The index of the drag source.
     */
    public TransferAction(String name, int index) {
      mName = name;
      mNF = new DataFlavor(Action.class, "Action");
      mIndex = index;
      mIF = new DataFlavor(Integer.class, "Integer");
    }
View Full Code Here

Examples of java.awt.datatransfer.DataFlavor

  private static class TransferNode implements Transferable {
    private DataFlavor mDF;

    public TransferNode() {
      mDF = new DataFlavor(TreePath.class, "NodeExport");
    }
View Full Code Here

Examples of java.awt.datatransfer.DataFlavor

      DragSource dragSource = DragSource.getDefaultDragSource();
      dragSource.createDefaultDragGestureRecognizer(getRealWidget(), DnDConstants.ACTION_COPY_OR_MOVE, handler);
    } else if (event.startsWith("drop[") && event.endsWith("]")) {
      try {
        StringTokenizer tokenizer = new StringTokenizer(event.substring(5, event.length() - 1), ", ");
        DataFlavor flavors[] = new DataFlavor[tokenizer.countTokens()];

        int counter = 0;
        while (tokenizer.hasMoreTokens()) {
          flavors[counter++] = new DataFlavor(tokenizer.nextToken());
        }

        DropHandler handler = new DropHandler(this, listener, name, flavors);
        new DropTarget(getRealWidget(), handler);
      } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.