DESY ACOP Beans Home

com.cosylab.gui.util
Class AbstractDisplayerParametersTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by com.cosylab.gui.components.util.CosyTransferHandler
          extended by com.cosylab.gui.util.AbstractDisplayerParametersTransferHandler
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
AbstractMDPTransferHandler, AcopVideoTransferHandler, DefaultDisplayerParametersTransferHandler, MultipleDisplayerParametersTransferHandler

public abstract class AbstractDisplayerParametersTransferHandler
extends CosyTransferHandler

AbstractDisplayerParametersTransferHandler is a TransferHandler for all DisplayerParameters-type-displayer.

Author:
tkusterle
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.cosylab.gui.components.util.CosyTransferHandler
CosyTransferHandler.MouseFilter
 
Nested classes/interfaces inherited from class javax.swing.TransferHandler
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport
 
Field Summary
protected  DisplayerParametersSelectorDialog dialog
           
protected  javax.swing.JComponent displayer
           
protected  java.awt.datatransfer.DataFlavor[] flavors
           
 
Fields inherited from class com.cosylab.gui.components.util.CosyTransferHandler
isDragging
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
 
Constructor Summary
AbstractDisplayerParametersTransferHandler(javax.swing.JComponent comp, boolean reciveEnabled, boolean exportEnabled)
           
AbstractDisplayerParametersTransferHandler(javax.swing.JComponent comp, boolean reciveEnabled, boolean exportEnabled, java.awt.datatransfer.DataFlavor[] f, boolean resetFlavors)
          Creates new DnD transfer handler with modified flavors.
 
Method Summary
 boolean canImport(javax.swing.JComponent comp, java.awt.datatransfer.DataFlavor[] transferFlavors)
           
protected  DisplayerParameters[] castParameters(java.lang.Object... parameters)
           
protected abstract  DisplayerParameters exportDisplayerParameters()
           
 javax.swing.JComponent getComponent()
          Returns the displayer.
protected  DisplayerParametersSelectorDialog getParameterSelectionDialog()
           
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
           
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
           
 boolean importData(javax.swing.JComponent comp, java.awt.datatransfer.Transferable t)
           
protected  boolean importDisplayerParameters(DisplayerParameters[] dp)
           
protected  boolean importString(java.lang.String string)
           
protected  int selectParameters(java.awt.Component c, DisplayerParameters[] dp)
           
protected  int selectParameters(java.awt.Component c, java.lang.String[] dp)
           
 boolean setParametersToDisplayer(java.lang.Object disp, DisplayerParameters parameters)
          Sets the supplied parameters to the displayer.
 
Methods inherited from class com.cosylab.gui.components.util.CosyTransferHandler
addMouseFilter, canDrag, createTransferable, exportDone, getMouseFilters, getSourceActions, hookTransferHandler, hookTransferHandler, isDataFlavorSupported, isExportEnabled, isMouseDragGesture, isReceiveEnabled, mouseDragged, mouseMoved, registerTransferHandler, removeMouseFilter, setExportEnabled, setReceiveEnabled, unhookTransferHandler
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dialog

protected DisplayerParametersSelectorDialog dialog

displayer

protected javax.swing.JComponent displayer

flavors

protected java.awt.datatransfer.DataFlavor[] flavors
Constructor Detail

AbstractDisplayerParametersTransferHandler

public AbstractDisplayerParametersTransferHandler(javax.swing.JComponent comp,
                                                  boolean reciveEnabled,
                                                  boolean exportEnabled)

AbstractDisplayerParametersTransferHandler

public AbstractDisplayerParametersTransferHandler(javax.swing.JComponent comp,
                                                  boolean reciveEnabled,
                                                  boolean exportEnabled,
                                                  java.awt.datatransfer.DataFlavor[] f,
                                                  boolean resetFlavors)
Creates new DnD transfer handler with modified flavors.

Parameters:
comp - the component for which this handler si created
reciveEnabled - flag for recifving DnD gestures
exportEnabled - flag for exporting DnD gestures
f - the array of flavors, whih are inseted to this handler at beginning of default flavors. If null or 0 length then ignored.
resetFlavors - if true, then provided flavors replaces default flavors, otherwise provided flavors are inserted ad beginning of default flavor list.
Method Detail

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Specified by:
getTransferData in class CosyTransferHandler
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

exportDisplayerParameters

protected abstract DisplayerParameters exportDisplayerParameters()

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable
Specified by:
getTransferDataFlavors in class CosyTransferHandler

importData

public boolean importData(javax.swing.JComponent comp,
                          java.awt.datatransfer.Transferable t)
Overrides:
importData in class javax.swing.TransferHandler

importString

protected boolean importString(java.lang.String string)
                        throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

castParameters

protected DisplayerParameters[] castParameters(java.lang.Object... parameters)

importDisplayerParameters

protected boolean importDisplayerParameters(DisplayerParameters[] dp)
                                     throws java.beans.PropertyVetoException
Parameters:
dp -
Throws:
java.beans.PropertyVetoException

getParameterSelectionDialog

protected DisplayerParametersSelectorDialog getParameterSelectionDialog()

selectParameters

protected int selectParameters(java.awt.Component c,
                               DisplayerParameters[] dp)

selectParameters

protected int selectParameters(java.awt.Component c,
                               java.lang.String[] dp)

setParametersToDisplayer

public boolean setParametersToDisplayer(java.lang.Object disp,
                                        DisplayerParameters parameters)
                                 throws java.beans.PropertyVetoException
Sets the supplied parameters to the displayer.

Parameters:
disp - destination displayer
parameters - parameters to be set
Returns:
true if successful
Throws:
java.beans.PropertyVetoException - when setting of parameters failed

getComponent

public javax.swing.JComponent getComponent()
Returns the displayer.

Returns:
Returns the displayer.

canImport

public boolean canImport(javax.swing.JComponent comp,
                         java.awt.datatransfer.DataFlavor[] transferFlavors)
Overrides:
canImport in class CosyTransferHandler


Copyright © 2010. All Rights Reserved.