Class PropertiesTransfer

java.lang.Object
org.eclipse.swt.dnd.Transfer
org.eclipse.swt.dnd.ByteArrayTransfer
com.iizigo.dnd.PropertiesTransfer

public class PropertiesTransfer extends org.eclipse.swt.dnd.ByteArrayTransfer
The transfer class for properties in clip board or for drag-drop. The PropertiesTransfer class is used to transfer an array of GProp from one part to another in a drag and drop operation or a cut, copy, paste action.

This class can be used for a Viewer or an SWT component directly. A singleton is provided which may be serially reused (see getInstance). It is not intended to be sub classed.

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The transfer type for IIZI properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.eclipse.swt.dnd.TransferData
    Creates a TransferData from a list of selected properties, where TransferData is typically used in drag-drop operations.
    Gets the instance.
    protected int[]
    Returns the platform specific Ids of the data types that can be converted using this transfer agent.
    protected String[]
    Returns the platform specific names of the data types that can be converted using this transfer agent.
    void
    javaToNative(Object object, org.eclipse.swt.dnd.TransferData transferData)
    Converts the properties into a platform specific representation.
    nativeToJava(org.eclipse.swt.dnd.TransferData transferData)
    Converts a platform specific representation of a byte array to a GProp[].
    protected boolean
    validate(Object object)
    Test that the object is of the correct format for this Transfer class.

    Methods inherited from class org.eclipse.swt.dnd.ByteArrayTransfer

    getSupportedTypes, isSupportedType

    Methods inherited from class org.eclipse.swt.dnd.Transfer

    registerType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getInstance

      public static PropertiesTransfer getInstance()
      Gets the instance.
      Returns:
      The instance for properties transfer.
    • getTypeNames

      protected String[] getTypeNames()
      Returns the platform specific names of the data types that can be converted using this transfer agent.
      Specified by:
      getTypeNames in class org.eclipse.swt.dnd.Transfer
    • getTypeIds

      protected int[] getTypeIds()
      Returns the platform specific Ids of the data types that can be converted using this transfer agent.
      Specified by:
      getTypeIds in class org.eclipse.swt.dnd.Transfer
    • createDndTransferData

      public org.eclipse.swt.dnd.TransferData createDndTransferData(ArrayList<DesignerProp> list)
      Creates a TransferData from a list of selected properties, where TransferData is typically used in drag-drop operations.
      Parameters:
      list - The list of properties.
      Returns:
      The TransferData instance, or null if list is empty.
    • validate

      protected boolean validate(Object object)
      Test that the object is of the correct format for this Transfer class.
      Overrides:
      validate in class org.eclipse.swt.dnd.Transfer
      Parameters:
      object - a Java representation of the data to be converted.
      Returns:
      true if object is of the correct form for this transfer type.
    • javaToNative

      public void javaToNative(Object object, org.eclipse.swt.dnd.TransferData transferData)
      Converts the properties into a platform specific representation.
      Overrides:
      javaToNative in class org.eclipse.swt.dnd.ByteArrayTransfer
      Parameters:
      object - A Java byte[] containing the data to be converted.
      transferData - An empty TransferData object that will be filled in on return with the platform specific format of the data.
    • nativeToJava

      public Object nativeToJava(org.eclipse.swt.dnd.TransferData transferData)
      Converts a platform specific representation of a byte array to a GProp[].
      Overrides:
      nativeToJava in class org.eclipse.swt.dnd.ByteArrayTransfer
      Parameters:
      transferData - The platform specific representation of the data to be converted.
      Returns:
      A Java byte[] containing the converted data if the conversion was successful; otherwise null.