diva.sketch.toolbox
Class SketchTransducer

java.lang.Object
  extended by diva.sketch.toolbox.SketchTransducer
All Implemented Interfaces:
Transducer, ClipboardOwner, Transferable

public class SketchTransducer
extends Object
implements Transducer

Write a sketch model into an XML string.

Version:
$Revision: 1.4 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Field Summary
static DataFlavor SKETCH_FLAVOR
          The data flavor corresponding to sketch strokes serialized in XML.
 
Constructor Summary
SketchTransducer()
          This constructor should only be called once, to create the prototype object.
SketchTransducer(SketchModel model)
          This constructor is called by the newInstance() method, which builds a new transducer for the given sketch model.
 
Method Summary
 Object getTransferData(DataFlavor flavor)
          Perform recognition on the sketch model and return the transfer data as a string, or as plain text (based on StringSelection's implementation of getTransferData();
 DataFlavor[] getTransferDataFlavors()
          Return StringSelection's data flavors.
 boolean isDataFlavorSupported(DataFlavor in)
          Call StringSelection's predicate.
 void lostOwnership(Clipboard clipboard, Transferable contents)
          Do nothing.
 Transducer newInstance(SketchModel in)
          Apply the transducer to the given set of strokes by performing sketch recognition on the given strokes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SKETCH_FLAVOR

public static final DataFlavor SKETCH_FLAVOR
The data flavor corresponding to sketch strokes serialized in XML.

Constructor Detail

SketchTransducer

public SketchTransducer()
This constructor should only be called once, to create the prototype object.


SketchTransducer

public SketchTransducer(SketchModel model)
This constructor is called by the newInstance() method, which builds a new transducer for the given sketch model.

Method Detail

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Return StringSelection's data flavors.

Specified by:
getTransferDataFlavors in interface Transferable

getTransferData

public Object getTransferData(DataFlavor flavor)
                       throws UnsupportedFlavorException,
                              IOException
Perform recognition on the sketch model and return the transfer data as a string, or as plain text (based on StringSelection's implementation of getTransferData();

Specified by:
getTransferData in interface Transferable
Throws:
UnsupportedFlavorException
IOException

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor in)
Call StringSelection's predicate.

Specified by:
isDataFlavorSupported in interface Transferable

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Do nothing.

Specified by:
lostOwnership in interface ClipboardOwner

newInstance

public Transducer newInstance(SketchModel in)
Apply the transducer to the given set of strokes by performing sketch recognition on the given strokes.

Specified by:
newInstance in interface Transducer


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.