performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / model / TaxonTransfer.java
index df6e443ad6fa5d6019e9dc2dc60efbf7307cb374..36e8b3ca356d085edc4bcb4142284727057b313b 100644 (file)
-package eu.etaxonomy.taxeditor.model;\r
-\r
-import org.eclipse.swt.dnd.ByteArrayTransfer;\r
-import org.eclipse.swt.dnd.TransferData;\r
-\r
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-\r
-/**\r
- * For drag and drop - a drag widget with this transfer type can only be dropped onto\r
- *  a drop widget with the same type.\r
- *    \r
- * @author p.ciardelli\r
- *\r
- */\r
-public class TaxonTransfer extends ByteArrayTransfer {\r
-\r
-       private static final String TAXONTYPENAME = "taxon_type";\r
-       private static final int TAXONTYPEID = registerType (TAXONTYPENAME);            \r
-       private static final TaxonTransfer INSTANCE = new TaxonTransfer();\r
-       \r
-       /*\r
-        * The object associated with this transfer event\r
-        */\r
-       private TaxonBase<?> taxonBase;\r
-               \r
-       /*\r
-        * Returns the singleton\r
-        */\r
-       public static TaxonTransfer getInstance() {\r
-               return INSTANCE;\r
-       }\r
-       /*\r
-        * Set transfer data for local use\r
-        */\r
-       public void setTaxon(TaxonBase<?> taxon) {\r
-               this.taxonBase = taxon;\r
-       }\r
-       /*\r
-        * Returns the local transfer data\r
-        */\r
-       public TaxonBase<?> getTaxon() {\r
-               return taxonBase;\r
-       }\r
-       \r
-       /* \r
-        * The type ID is used to identify this transfer\r
-        */\r
-       @Override\r
-       protected int[] getTypeIds() {\r
-               return new int[] { TAXONTYPEID };\r
-       }\r
-\r
-       @Override\r
-       protected String[] getTypeNames() {\r
-               return new String[] { TAXONTYPENAME } ;\r
-       }\r
-\r
-       @Override\r
-       protected void javaToNative(Object object, TransferData transferData) {\r
-               // No encoding needed since this is a hardcoded string read and written\r
-               // in the same process.\r
-               // See nativeToJava below\r
-               byte[] check = TAXONTYPENAME.getBytes();\r
-               super.javaToNative(check, transferData);\r
-       }\r
-\r
-       @Override\r
-       protected Object nativeToJava(TransferData transferData) {\r
-               Object result = super.nativeToJava(transferData);\r
-               if (isInvalidNativeType(result)) {\r
-                       throw new RuntimeException(); //$NON-NLS-1$\r
-               }\r
-               return taxonBase;\r
-       }\r
-       \r
-       private boolean isInvalidNativeType(Object result) {\r
-               // No encoding needed since this is a hardcoded string read and written\r
-               // in the same process.\r
-               // See javaToNative above\r
-               return !(result instanceof byte[])\r
-                               || !TAXONTYPENAME.equals(new String((byte[]) result));\r
-       }\r
-}\r
+package eu.etaxonomy.taxeditor.model;
+
+import org.eclipse.swt.dnd.ByteArrayTransfer;
+import org.eclipse.swt.dnd.TransferData;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+
+/**
+ * For drag and drop - a drag widget with this transfer type can only be dropped onto
+ *  a drop widget with the same type.
+ *
+ * @author p.ciardelli
+ * @version $Id: $
+ */
+public class TaxonTransfer extends ByteArrayTransfer {
+
+       private static final String TAXONTYPENAME = "taxon_type";
+       private static final int TAXONTYPEID = registerType (TAXONTYPENAME);            
+       private static final TaxonTransfer INSTANCE = new TaxonTransfer();
+       
+       /*
+        * The object associated with this transfer event
+        */
+       private TaxonBase<?> taxonBase;
+               
+       /*
+        * Returns the singleton
+        */
+       /**
+        * <p>getInstance</p>
+        *
+        * @return a {@link eu.etaxonomy.taxeditor.model.TaxonTransfer} object.
+        */
+       public static TaxonTransfer getInstance() {
+               return INSTANCE;
+       }
+       /*
+        * Set transfer data for local use
+        */
+       /**
+        * <p>setTaxon</p>
+        *
+        * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
+        */
+       public void setTaxon(TaxonBase<?> taxon) {
+               this.taxonBase = taxon;
+       }
+       /*
+        * Returns the local transfer data
+        */
+       /**
+        * <p>getTaxon</p>
+        *
+        * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
+        */
+       public TaxonBase<?> getTaxon() {
+               return taxonBase;
+       }
+       
+       /* 
+        * The type ID is used to identify this transfer
+        */
+       /** {@inheritDoc} */
+       @Override
+       protected int[] getTypeIds() {
+               return new int[] { TAXONTYPEID };
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       protected String[] getTypeNames() {
+               return new String[] { TAXONTYPENAME } ;
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       protected void javaToNative(Object object, TransferData transferData) {
+               // No encoding needed since this is a hardcoded string read and written
+               // in the same process.
+               // See nativeToJava below
+               byte[] check = TAXONTYPENAME.getBytes();
+               super.javaToNative(check, transferData);
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       protected Object nativeToJava(TransferData transferData) {
+               Object result = super.nativeToJava(transferData);
+               if (isInvalidNativeType(result)) {
+                       throw new RuntimeException(); //$NON-NLS-1$
+               }
+               return taxonBase;
+       }
+       
+       private boolean isInvalidNativeType(Object result) {
+               // No encoding needed since this is a hardcoded string read and written
+               // in the same process.
+               // See javaToNative above
+               return !(result instanceof byte[])
+                               || !TAXONTYPENAME.equals(new String((byte[]) result));
+       }
+}