org.formaria.editor.project.pages
Class BindingTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by org.formaria.editor.project.pages.BindingTransferHandler
All Implemented Interfaces:
java.io.Serializable

public class BindingTransferHandler
extends javax.swing.TransferHandler

This class handles the transfer of bindings to PageDesigner components

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.TransferHandler
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport
 
Field Summary
static BindingPropertiesDialog bindingDialog
           
protected  java.awt.datatransfer.DataFlavor dataFlavor
           
static java.awt.datatransfer.DataFlavor ModelFlavor
           
protected  PageDesigner pageDesigner
           
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
 
Constructor Summary
BindingTransferHandler(PageDesigner pd)
          Creates new instance of BindingTransferHandler
 
Method Summary
 boolean canImport(javax.swing.JComponent comp, java.awt.datatransfer.DataFlavor[] transferFlavors)
          Indicates whether the binding can be set to the comp component.
static boolean driverFound(EditorProject currentProject, java.lang.String driverName)
          TODO: should the EditorUtility::getEditorClassLoader be used here instead of creating a new class loader explicitly???
 boolean importData(javax.swing.JComponent comp, java.awt.datatransfer.Transferable t)
          Imports the component binding
static DataModel registerDbTable(EditorProject currentProject, java.lang.Object tableObject)
           
static DataModel registerDbTable(EditorProject currentProject, java.lang.Object tableObject, java.lang.String driverFileName)
          Registeres the specified database table in the model, copies the driver jar to the project's classpath.
static void setBindingProperties(javax.swing.JComponent comp, java.lang.String propertyName, java.util.Hashtable properties, PageDesigner pageDesigner)
          Sets up the binding of the specified component.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ModelFlavor

public static final java.awt.datatransfer.DataFlavor ModelFlavor

bindingDialog

public static BindingPropertiesDialog bindingDialog

dataFlavor

protected java.awt.datatransfer.DataFlavor dataFlavor

pageDesigner

protected PageDesigner pageDesigner
Constructor Detail

BindingTransferHandler

public BindingTransferHandler(PageDesigner pd)
Creates new instance of BindingTransferHandler

Parameters:
pd - the PageDesigner object containing components on which the data will be transfered.
Method Detail

canImport

public boolean canImport(javax.swing.JComponent comp,
                         java.awt.datatransfer.DataFlavor[] transferFlavors)
Indicates whether the binding can be set to the comp component.

Overrides:
canImport in class javax.swing.TransferHandler
Parameters:
comp - the Component that is about to receive the binding
transferFlavors - the data formats available
Returns:
true if the component can receive the binding, false otherwise

importData

public boolean importData(javax.swing.JComponent comp,
                          java.awt.datatransfer.Transferable t)
Imports the component binding

Overrides:
importData in class javax.swing.TransferHandler
Parameters:
comp - the Component which is to receive the binding
t - Transferable object describing the binding
Returns:
true if the operation succeed, false otherwise

registerDbTable

public static DataModel registerDbTable(EditorProject currentProject,
                                        java.lang.Object tableObject)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

registerDbTable

public static DataModel registerDbTable(EditorProject currentProject,
                                        java.lang.Object tableObject,
                                        java.lang.String driverFileName)
                                 throws java.lang.Exception
Registeres the specified database table in the model, copies the driver jar to the project's classpath.

Parameters:
current - project the current project
tableObject - the object encapsulating the database table properties
Throws:
java.lang.Exception

driverFound

public static boolean driverFound(EditorProject currentProject,
                                  java.lang.String driverName)
TODO: should the EditorUtility::getEditorClassLoader be used here instead of creating a new class loader explicitly???


setBindingProperties

public static void setBindingProperties(javax.swing.JComponent comp,
                                        java.lang.String propertyName,
                                        java.util.Hashtable properties,
                                        PageDesigner pageDesigner)
Sets up the binding of the specified component.

Parameters:
comp - the component which is about to receive the binding.
propertyName - the name of the component property to be set in order to set up the binding
properties - binding properties
pageDesigner - PageDesigner object