jigcell.compare.impl
Class OwnedDataSource

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by jigcell.compare.impl.Transferer
          extended by jigcell.compare.impl.DataSource
              extended by jigcell.compare.impl.OwnedDataSource
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, IDataSource, IWriteableDataSource
Direct Known Subclasses:
ClipboardDataSource, PrinterDataSource

public abstract class OwnedDataSource
extends DataSource
implements IWriteableDataSource

A data source that provides a callback for wrapping native objects prior to data transfer. The callback class must implement TransfererProxy.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataSource
IDataSource.Option
 
Field Summary
protected static java.lang.String MESSAGE_PACKERROR
          Error message when data packing fails
protected static java.lang.String MESSAGE_PROXYERROR
          Error message when an unusable transfer proxy is provided
static java.lang.String OPTION_OWNER
          Owner of the source
static java.lang.String OPTION_TRANSFERCLASS
          Callback class
static java.lang.Class[] SIGNATURE_TRANSFER
          Constructor signature for callback class
 
Fields inherited from class jigcell.compare.impl.DataSource
OPTIONS_LOCK, SEPARATOR_PAIR, SEPARATOR_PART, SEPARATORS
 
Fields inherited from class jigcell.compare.impl.Transferer
CSV_FOOTER, CSV_LINEPOSTPEND, CSV_LINEPREPEND, CSV_LINESEPARATOR, HTML_FOOTER, HTML_HEADPOSTPEND, HTML_HEADPREPEND, HTML_HEADSEPARATOR, HTML_LINEPOSTPEND, HTML_LINEPREPEND, HTML_LINESEPARATOR
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Fields inherited from interface jigcell.compare.IWriteableDataSource
OPTION_WRITEDESCRIPTION, OPTION_WRITEICON
 
Fields inherited from interface jigcell.compare.IDataSource
OPTION_NAME
 
Constructor Summary
OwnedDataSource()
           
 
Method Summary
protected static java.awt.datatransfer.Transferable encode(java.lang.Object data, java.lang.Object owner, java.lang.Class clazz)
          Encodes the data object using the callback if necessary.
 java.lang.Object getOwnerOption()
          The owner object that will be supplied to the callback.
 boolean getPredictedCompatibility(java.lang.Class clazz)
          A prediction on whether this data source can hold a particular type.
 boolean getPredictedCompatibility(java.lang.Object instance)
          A prediction on whether this data source can hold a particular type.
 java.lang.Class getTransferClassOption()
          The callback class that will be invoked.
 void setOwnerOption(java.lang.Object owner)
          Sets the owner object that will be supplied to the callback.
 void setTransferClassOption(java.lang.Class clazz)
          Sets the callback class that will be invoked.
 
Methods inherited from class jigcell.compare.impl.DataSource
addOption, addPropertyChangeListener, addPropertyChangeListener, clone, configure, getName, getOption, getOptions, getOptionType, getPropertyChangeListeners, getPropertyChangeListeners, getReadDescriptionOption, getReadIconOption, getState, getWriteDescriptionOption, getWriteIconOption, initializeSource, persistSource, propertyChange, removePropertyChangeListener, removePropertyChangeListener, setName, setOption, setOptions, setOptionType, setReadDescriptionOption, setReadIconOption, setState, setWriteDescriptionOption, setWriteIconOption, toString, unpersistSource
 
Methods inherited from class jigcell.compare.impl.Transferer
addExtension, addFlavor, createCSVTable, createFormattedTable, createHTMLTable, getExceptionRecorder, getExpectedClasses, getExpectedClasses, getExpectedClasses, getFlavors, getFlavors, getPreferredExtensions, getPreferredExtensions, getTransferClass, getTransferData, getTransferDataFlavors, getTransferFlavor, isDataFlavorSupported, transfer
 
Methods inherited from class javax.swing.TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getSourceActions, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jigcell.compare.IWriteableDataSource
getWriteDescriptionOption, getWriteIconOption, setWriteDescriptionOption, setWriteIconOption, write
 
Methods inherited from interface jigcell.compare.IDataSource
addOption, clone, configure, getName, getOption, getState, setOption, setState
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

SIGNATURE_TRANSFER

public static final java.lang.Class[] SIGNATURE_TRANSFER
Constructor signature for callback class


OPTION_OWNER

public static final java.lang.String OPTION_OWNER
Owner of the source

See Also:
Constant Field Values

OPTION_TRANSFERCLASS

public static final java.lang.String OPTION_TRANSFERCLASS
Callback class

See Also:
Constant Field Values

MESSAGE_PACKERROR

protected static final java.lang.String MESSAGE_PACKERROR
Error message when data packing fails

See Also:
Constant Field Values

MESSAGE_PROXYERROR

protected static final java.lang.String MESSAGE_PROXYERROR
Error message when an unusable transfer proxy is provided

See Also:
Constant Field Values
Constructor Detail

OwnedDataSource

public OwnedDataSource()
Method Detail

encode

protected static java.awt.datatransfer.Transferable encode(java.lang.Object data,
                                                           java.lang.Object owner,
                                                           java.lang.Class clazz)
                                                    throws java.lang.Exception
Encodes the data object using the callback if necessary.

Parameters:
data - Data
owner - Owner
clazz - Transfer class
Throws:
java.lang.Exception

getOwnerOption

public java.lang.Object getOwnerOption()
The owner object that will be supplied to the callback.


getPredictedCompatibility

public boolean getPredictedCompatibility(java.lang.Class clazz)
A prediction on whether this data source can hold a particular type.

Specified by:
getPredictedCompatibility in interface IWriteableDataSource
Parameters:
clazz - Type

getPredictedCompatibility

public boolean getPredictedCompatibility(java.lang.Object instance)
A prediction on whether this data source can hold a particular type.

Specified by:
getPredictedCompatibility in interface IWriteableDataSource
Parameters:
instance - Type

getTransferClassOption

public java.lang.Class getTransferClassOption()
The callback class that will be invoked.


setOwnerOption

public void setOwnerOption(java.lang.Object owner)
Sets the owner object that will be supplied to the callback.

Parameters:
owner - Owner

setTransferClassOption

public void setTransferClassOption(java.lang.Class clazz)
Sets the callback class that will be invoked.

Parameters:
clazz - Transfer class