dasher.net
Class NetDasher

java.lang.Object
  extended by dasher.CDasherInterfaceBase
      extended by dasher.net.NetDasher

public class NetDasher
extends CDasherInterfaceBase

Implementation of DasherInterfaceBase designed for use as part of a server supplying a remote interface to Dasher, typically by a web front-end.

For specification details of the front end, see the information relating to JSDasher at www.smowton.net/chris (found under Dasher Project).

As this implementation of Dasher is designed to be instantiated once for each connection, it includes hooks for some repetitive work to be externalised; specifically, it expects both a CAlphIO and CColourIO to have been ready-constructed by its host.


Field Summary
protected  CAlphIO m_alphIO
          Reference to the AlphIO object handed in by the host
protected  CColourIO m_ColourIO
          Reference to the ColourIO object handed in by the host
protected  NetInput m_CoordInput
          Reference to the NetInput device which is feeding Dasher co-ordinates.
protected  DasherEditListener m_Host
          Reference to our host
protected  java.lang.String userDataLocation
          User data location; this is where Dasher should look for training texts.
 
Fields inherited from class dasher.CDasherInterfaceBase
g_Logger, m_Alphabet, m_AlphIO, m_bConnectLock, m_bGlobalLock, m_bShutdownLock, m_Colours, m_DasherModel, m_DasherScreen, m_DasherView, m_EventHandler, m_Input, m_InputFilter, m_oModuleManager, m_SettingsStore, m_UserLog, strCurrentContext, strTrainfileBuffer
 
Constructor Summary
NetDasher(DasherEditListener host, CAlphIO alphIO, CColourIO colIO)
          Creates a new NetDasher which passes events out to a given host, and which gets its alphabets and colour schemes from given sources.
 
Method Summary
 void CreateSettingsStore()
          Should create a SettingsStore object of some sort and store a reference to it in m_SettingsStore.
 CAlphIO doAlphIO(java.util.ArrayList<java.lang.String> vFiles)
          Supplies the AlphIO object which was supplied to our constructor as a source of alphabet information.
 CColourIO doColourIO(java.util.ArrayList<java.lang.String> vFiles)
          Supplies the ColourIO object which was supplied to our constructor as a source of colour scheme information.
 void ExternalEventHandler(CEvent event)
          Called for every dispatched event after all components have received it and *after* InterfaceEventHandler.
 int GetFileSize(java.lang.String strFileName)
          Should return the size of a given file, or 0 if the file does not exist or cannot be accessed.
 void Redraw(boolean bChanged)
          Abstract method which will be called whenever a screen redraw is required.
 void ScanAlphabetFiles(java.util.Collection<java.lang.String> vFileList)
          Stub; not required in this version of Dasher since our host is responsible for constructing a CAlphIO
 void ScanColourFiles(java.util.Collection<java.lang.String> vFileList)
          Stub; not required in this version of Dasher since our host is responsible for constructing a CColourIO
 void setCoordinates(int x, int y)
          Informs the helper NetInput class that when next asked, it should supply these co-ordinates.
 void SetupPaths()
          Should setup the system and user locations; called early in the startup sequence.
 void SetupUI()
          Should perform any UI building which is required.
 void setUserLoc(java.lang.String loc)
          Sets the location where Dasher should search for training texts.
 
Methods inherited from class dasher.CDasherInterfaceBase
ChangeAlphabet, ChangeColours, ChangeScreen, ChangeView, ConnectNode, CreateDasherModel, CreateFactories, CreateInput, CreateInputFilter, DeleteAlphabet, DestroyInterface, DisconnectNode, Draw, GetAlphabet, GetAlphabets, GetAutoOffset, GetBoolParameter, GetColours, GetCurCPM, GetCurFPS, GetEventHandler, GetFontSizes, GetInfo, GetLongParameter, GetModule, GetModuleByName, GetNats, getResourceStream, GetStringParameter, GetUserLogPtr, Halt, InterfaceEventHandler, InvalidateContext, KeyDown, KeyUp, NewFrame, PauseAt, PreSetNotify, Realize, RegisterFactory, RegisterNode, ResetNats, ResetParameter, SetBoolParameter, SetInfo, SetLongParameter, SetStringParameter, Start, StartShutdown, TrainFile, TrainStream, Unpause, WriteTrainFile, WriteTrainFileFull, WriteTrainFilePartial
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_CoordInput

protected NetInput m_CoordInput
Reference to the NetInput device which is feeding Dasher co-ordinates.


m_Host

protected DasherEditListener m_Host
Reference to our host


userDataLocation

protected java.lang.String userDataLocation
User data location; this is where Dasher should look for training texts.


m_alphIO

protected CAlphIO m_alphIO
Reference to the AlphIO object handed in by the host


m_ColourIO

protected CColourIO m_ColourIO
Reference to the ColourIO object handed in by the host

Constructor Detail

NetDasher

public NetDasher(DasherEditListener host,
                 CAlphIO alphIO,
                 CColourIO colIO)
Creates a new NetDasher which passes events out to a given host, and which gets its alphabets and colour schemes from given sources.

This constructor will call CreateSettingsStore and register an instance of NetInput as our input device; however Realize still has to be called before it is ready to be used.

See the superclass documentation for more detail on the Interface's role.

Parameters:
host - Host to whom we should pass EditEvents
alphIO - AlphIO object to read alphabets from
colIO - ColourIO object to read colour schemes from
Method Detail

setCoordinates

public void setCoordinates(int x,
                           int y)
Informs the helper NetInput class that when next asked, it should supply these co-ordinates.

Parameters:
x - Mouse x co-ordinate
y - Mouse y co-ordinate

CreateSettingsStore

public void CreateSettingsStore()
Description copied from class: CDasherInterfaceBase
Should create a SettingsStore object of some sort and store a reference to it in m_SettingsStore.

This is an abstract method because most implementations will want to extend the default SettingsStore to provide the possibility of persistent settings.

Specified by:
CreateSettingsStore in class CDasherInterfaceBase

doAlphIO

public CAlphIO doAlphIO(java.util.ArrayList<java.lang.String> vFiles)
Supplies the AlphIO object which was supplied to our constructor as a source of alphabet information.

Overrides:
doAlphIO in class CDasherInterfaceBase
Parameters:
vFiles - List of files to be parsed
Returns:
a CAlphIO which knows about the alphabets recorded in these files.

doColourIO

public CColourIO doColourIO(java.util.ArrayList<java.lang.String> vFiles)
Supplies the ColourIO object which was supplied to our constructor as a source of colour scheme information.

Overrides:
doColourIO in class CDasherInterfaceBase
Parameters:
vFiles - List of files to be parsed
Returns:
a CColourIO which knows about the colours recorded in these files.

ExternalEventHandler

public void ExternalEventHandler(CEvent event)
Description copied from class: CDasherInterfaceBase
Called for every dispatched event after all components have received it and *after* InterfaceEventHandler.

By default this ignores all events; the intent is for implementations to override it if they want to either a) Pass events out to UI components which the core doesn't know about, or b) Transcribe our internal events into some other event-dispatching scheme such as Win32's message dispatching scheme.

Overrides:
ExternalEventHandler in class CDasherInterfaceBase
Parameters:
event - Event being signalled

GetFileSize

public int GetFileSize(java.lang.String strFileName)
Description copied from class: CDasherInterfaceBase
Should return the size of a given file, or 0 if the file does not exist or cannot be accessed.

Specified by:
GetFileSize in class CDasherInterfaceBase
Parameters:
strFileName - File to be read
Returns:
Size of this file, or 0 on error.

Redraw

public void Redraw(boolean bChanged)
Description copied from class: CDasherInterfaceBase
Abstract method which will be called whenever a screen redraw is required. This is implemented for architectures which require drawing to happen in a top-down fashion. Implementations which allow drawing to be initiated from the bottom up may do so my recalling Draw.

Specified by:
Redraw in class CDasherInterfaceBase
Parameters:
bChanged - True if the model has changed since the last frame

ScanAlphabetFiles

public void ScanAlphabetFiles(java.util.Collection<java.lang.String> vFileList)
Stub; not required in this version of Dasher since our host is responsible for constructing a CAlphIO

Specified by:
ScanAlphabetFiles in class CDasherInterfaceBase
Parameters:
vFileList - List to fill with filenames to process.

ScanColourFiles

public void ScanColourFiles(java.util.Collection<java.lang.String> vFileList)
Stub; not required in this version of Dasher since our host is responsible for constructing a CColourIO

Specified by:
ScanColourFiles in class CDasherInterfaceBase
Parameters:
vFileList - List to fill with filenames to process.

SetupPaths

public void SetupPaths()
Description copied from class: CDasherInterfaceBase
Should setup the system and user locations; called early in the startup sequence.

These correspond to the string parameters SP_SYSTEM_LOC and SP_USER_LOC respectively.

Specified by:
SetupPaths in class CDasherInterfaceBase

setUserLoc

public void setUserLoc(java.lang.String loc)
Sets the location where Dasher should search for training texts.

Parameters:
loc - New data location

SetupUI

public void SetupUI()
Description copied from class: CDasherInterfaceBase
Should perform any UI building which is required.

Specified by:
SetupUI in class CDasherInterfaceBase