fable.gui
Class FableComponentTransfer

java.lang.Object
  extended by ByteArrayTransfer
      extended by fable.gui.FableComponentTransfer

public class FableComponentTransfer
extends ByteArrayTransfer

This class is about data-transfer between data-sender and data-receiver.
The data format is "String", ID of FableComponent.
In general, this class is used for Drag & Drop action.

ex>> 0 1 3 means zeroth -> first -> and then third.
Sender sends this string, (or sometimes strings) to receiver,
and receiver will parse received string(s) to
get the actual FableComponent.

Author:
Yongjin Kim
See Also:
FableComponent, FableManager

Constructor Summary
FableComponentTransfer()
           
 
Method Summary
static FableComponentTransfer getInstance(FableManager fbm)
          This will return a static variable "instance" with provided FableManager.
protected  int[] getTypeIds()
           
protected  java.lang.String[] getTypeNames()
           
protected  void javaToNative(java.lang.Object inputObject, TransferData transferData)
          javeToNative: make an out-stream of the combination of type and ID.
protected  java.lang.Object nativeToJava(TransferData transferData)
          nativeToJave: takes an input-stream, and then parse it.

---------------------------------------------------------------------
(1) If type is "normal", then it will just return object of that type.
(2) If type is "PseudoFeed', then it will return a new PseudoFeed with articles.

line 3: 1st article -> extracted from FableManager, by ID.
line 4: 2nd article -> extracted from FableManager, by ID.
....
line last: last article -> extracted from FableManager, by ID.

all these articles can be "packed" into PseudoFeed.
---------------------------------------------------------------------

 void setFableManager(FableManager fbm)
          Set the FableManager of the instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FableComponentTransfer

public FableComponentTransfer()
Method Detail

getInstance

public static FableComponentTransfer getInstance(FableManager fbm)
This will return a static variable "instance" with provided FableManager.

Parameters:
fbm -
Returns:
an instance of this class
Requires:
fbm != null

setFableManager

public void setFableManager(FableManager fbm)
Set the FableManager of the instance.

Parameters:
fbm -
Requires:
fbm != null

getTypeIds

protected int[] getTypeIds()

getTypeNames

protected java.lang.String[] getTypeNames()

javaToNative

protected void javaToNative(java.lang.Object inputObject,
                            TransferData transferData)
javeToNative: make an out-stream of the combination of type and ID.

---------------------------------------------------------------------
1. The first line of data is...
type: FEED_LABEL, FOLDER_LABEL, ARTICLE_LABEL, or PSEUDOFEED_LABEL

2. There are two cases for second line.
(1) If type is "normal"; that is, the selection is only one::
then the second line of data becomes ID.

(2) If type is "PseudoFeed"; that is, the selection is of several articles::
then the second line is the number of articles.

3. Extra lines... for PseudoFeed.
line 3: ID of the first article.
line 4: ID of the second article.
line 5: ....
....
line last: ID of the last article.
---------------------------------------------------------------------

Parameters:
inputObject - input object
transferData -
Effects:
make a raw-data format from input object

nativeToJava

protected java.lang.Object nativeToJava(TransferData transferData)
nativeToJave: takes an input-stream, and then parse it.

---------------------------------------------------------------------
(1) If type is "normal", then it will just return object of that type.
(2) If type is "PseudoFeed', then it will return a new PseudoFeed with articles.

line 3: 1st article -> extracted from FableManager, by ID.
line 4: 2nd article -> extracted from FableManager, by ID.
....
line last: last article -> extracted from FableManager, by ID.

all these articles can be "packed" into PseudoFeed.
---------------------------------------------------------------------

Parameters:
transferData - the data that will be decoded.
Returns:
transferred object
Effects:
decode raw-data to retreive object.