dasher.net
Class NetInput

java.lang.Object
  extended by dasher.CDasherComponent
      extended by dasher.CDasherModule
          extended by dasher.CDasherInput
              extended by dasher.net.NetInput

public class NetInput
extends CDasherInput

Dummy implementation of CDasherInput which provides input by virtue of accepting co-ordinates from some external source and reporting them when next GetCoordinates is called.

This is used by NetDasher to relay mouse co-ordinates extracted from an XML document by another class.


Field Summary
private  boolean coordsAvailable
          Flag indicating whether new co-ordinates have been supplied since the last call to GetCoordinates.
private  long[] nextCoords
          Cache of the most recently specified co-ordinates which will be returned next time GetCoordinates is called.
 
Fields inherited from class dasher.CDasherComponent
m_EventHandler, m_SettingsStore
 
Constructor Summary
NetInput(CEventHandler events, CSettingsStore sets)
          Creates a new input device; calls our super-constructor with an ID of 12 and a type of 1.
 
Method Summary
 int GetCoordinateCount()
          Gets the number of co-ordinates this device returns.
 int GetCoordinates(int iN, long[] Coordinates)
          Returns the last co-ordinates supplied by setNextCoords if coordsAvailable is true, or (0,0) otherwise.
 void setNextCoords(long x, long y)
          Sets the next co-ordinates to be reported by GetCoordinates
 
Methods inherited from class dasher.CDasherInput
Activate, Deactivate, SetMaxCoordinates
 
Methods inherited from class dasher.CDasherModule
GetID, GetName, GetType, Ref, Unref
 
Methods inherited from class dasher.CDasherComponent
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, HandleEvent, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter, UnregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextCoords

private long[] nextCoords
Cache of the most recently specified co-ordinates which will be returned next time GetCoordinates is called.


coordsAvailable

private boolean coordsAvailable
Flag indicating whether new co-ordinates have been supplied since the last call to GetCoordinates.

Constructor Detail

NetInput

public NetInput(CEventHandler events,
                CSettingsStore sets)
Creates a new input device; calls our super-constructor with an ID of 12 and a type of 1.

Parameters:
events - EventHandler with which to mention ourselves
sets - Settings repository to use
Method Detail

GetCoordinateCount

public int GetCoordinateCount()
Description copied from class: CDasherInput
Gets the number of co-ordinates this device returns.

At present, only 1- and 2-axis devices are accepted, but this may be easily upgraded in the future.

Specified by:
GetCoordinateCount in class CDasherInput
Returns:
Number of co-ordinates supplied by this device.

GetCoordinates

public int GetCoordinates(int iN,
                          long[] Coordinates)
Returns the last co-ordinates supplied by setNextCoords if coordsAvailable is true, or (0,0) otherwise.

Also sets coordsAvailable to false.

Specified by:
GetCoordinates in class CDasherInput
Parameters:
iN - Number of co-ordinates expected.
Coordinates - Fill with the current co-ordinates
Returns:
0, since these are always screen co-ordinates.

setNextCoords

public void setNextCoords(long x,
                          long y)
Sets the next co-ordinates to be reported by GetCoordinates

Parameters:
x - X co-ordinate to return
y - Y co-ordinate to return