fr.emn.reactiveinput.devices
Class DSwPick

java.lang.Object
  extended byfr.emn.reactiveinput.AbstractDevice
      extended byfr.emn.reactiveinput.devices.DSwPick
All Implemented Interfaces:
Device, Processor

public class DSwPick
extends AbstractDevice


Nested Class Summary
static class DSwPick.PickEnum
           
 
Field Summary
 Out id
           
 In pick
           
 In x
           
 In y
           
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
DSwPick()
           
 
Method Summary
 boolean getPickTableCells()
           
 DSwPick.PickEnum getWhenDrags()
           
 DSwPick.PickEnum getWhenMoves()
           
 DSwPick.PickEnum getWhenPress()
           
 DSwPick.PickEnum getWhenRelease()
           
 boolean hasExternalInput()
          Specifies whether this device has external (implicit) input or not.
 Processor open(OpenContext context)
          Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.
protected  void pickComponent()
           
 void setPickTableCells(boolean pick)
          JTables have no child component, but create and popup a component when a cell is being edited.
 void setWhenDrags(DSwPick.PickEnum whenDrags)
           
 void setWhenMoves(DSwPick.PickEnum whenMoves)
           
 void setWhenPress(DSwPick.PickEnum whenPress)
           
 void setWhenRelease(DSwPick.PickEnum whenRelease)
           
 void toLocal(java.awt.Point p)
          Use this method to convert a point into local coordinates.
 void update()
          Updates device's output values.
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, close, copy, doDisable, doEnable, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalOutput, init, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, isOpenable, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pick

public final In pick

x

public final In x

y

public final In y

id

public final Out id
Constructor Detail

DSwPick

public DSwPick()
Method Detail

open

public Processor open(OpenContext context)
Description copied from class: AbstractDevice
Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.

By default, open() does nothing and returns the device itself as the Processor (or null if it is not openable): AbstractDevice implements both Device and Processor interfaces, so that you can add processing code directly into the device.

If you want to add specialization features, subclass this method to return a specific processor implementation depending on your device configuration.

Example :

public Processor getProcessor() { if (super.open() == null) return null; // Select the right processor if (in2.isValid()) { return new twoParamProcessor(in1, in2, out); else return new oneParamProcessor(in1, out); }

In this method, you may also perform all necessary pre-running initialization. If initialization fails, return null even if isOpenable() returns true.

In all cases, return null if isOpenable() returns false.

Specified by:
open in interface Device
Overrides:
open in class AbstractDevice
See Also:
Processor, Device.open()

update

public void update()
Description copied from class: AbstractDevice
Updates device's output values.

Subclass init() and update() methods if you want the device to process the data itself. Otherwise, subclass getProcessor() method to use extern processors.

Specified by:
update in interface Processor
Overrides:
update in class AbstractDevice
See Also:
Processor.update()

pickComponent

protected void pickComponent()

toLocal

public void toLocal(java.awt.Point p)
Use this method to convert a point into local coordinates.


hasExternalInput

public boolean hasExternalInput()
Description copied from class: AbstractDevice
Specifies whether this device has external (implicit) input or not. Returns false by default.

Return false if the device is deterministic from the data & time points of view, i.e. if its output production only depend on the explicit input history (input slots) and device's initial configuration. This is the case of most of the processing devices.

Return true if output values not only depend on the values of input slots, or if output production takes undefined time. Examples of devices with external input are input peripherals and asynchronous devices.

This method is used by the reactive machine to determine if this device is triggered by its input slots, or if it must be triggered continuously (i.e. each tick). This method can also be used by the editor for the device's graphical representation.

Specified by:
hasExternalInput in interface Device
Overrides:
hasExternalInput in class AbstractDevice

getWhenMoves

public DSwPick.PickEnum getWhenMoves()
Returns:
Returns the whenMoves.

setWhenMoves

public void setWhenMoves(DSwPick.PickEnum whenMoves)
Parameters:
whenMoves - The whenMoves to set.

getWhenPress

public DSwPick.PickEnum getWhenPress()
Returns:
Returns the whenPress.

setWhenPress

public void setWhenPress(DSwPick.PickEnum whenPress)
Parameters:
whenPress - The whenPress to set.

getWhenDrags

public DSwPick.PickEnum getWhenDrags()
Returns:
Returns the whenDrags.

setWhenDrags

public void setWhenDrags(DSwPick.PickEnum whenDrags)
Parameters:
whenDrags - The whenDrags to set.

getWhenRelease

public DSwPick.PickEnum getWhenRelease()
Returns:
Returns the whenRelease.

setWhenRelease

public void setWhenRelease(DSwPick.PickEnum whenRelease)
Parameters:
whenRelease - The whenRelease to set.

getPickTableCells

public boolean getPickTableCells()

setPickTableCells

public void setPickTableCells(boolean pick)
JTables have no child component, but create and popup a component when a cell is being edited. Set this option to true if you want cell components to be created and picked automatically.