dasher
Class CDasherInterfaceBase

java.lang.Object
  extended by dasher.CDasherInterfaceBase
Direct Known Subclasses:
JDasher, NetDasher

public abstract class CDasherInterfaceBase
extends java.lang.Object

DasherInterfaceBase is the core of Dasher, and the entry point for all high-level functions which control the system as a whole.

The majority of the actual work involved in running Dasher is done by the Interface's two main children, a DasherModel and a DasherView; the interface primarily acts as a co-ordinator.

The DasherModel represents the tree of DasherNodes which forms the core of Dasher. It knows how to update the model in response to user input, and how to build, destroy and rebuild the tree.

The DasherView on the other hand is responsible for taking the abstract information in the Model and rendering it, visually or otherwise, in some way.

the Interface simply sits in the middle and co-ordinates whole-system actions such as updating the model and drawing a new frame.

The interface has a number of methods which remain abstract; this means that in order to implement Dasher, this class must be extended and the missing methods implemented.

Typically one would also extend DasherInput to provide a co-ordinate input of some sort, and implement DasherScreen to provide visual (or other) display.


Field Summary
 CFileLogger g_Logger
           
protected  CAlphabet m_Alphabet
          Current alphabet
protected  CAlphIO m_AlphIO
          Current AlphIO
protected  boolean m_bConnectLock
          Lock engaged when we're in the process of connecting to a remote language model
protected  boolean m_bGlobalLock
          Lock engaged when Dasher should not respond to commands for unspecified reason
protected  boolean m_bShutdownLock
          Lock engaged when Dasher is being destroyed
protected  CColourIO m_ColourIO
          Current ColourIO
protected  CCustomColours m_Colours
          Current colour scheme
protected  CDasherModel m_DasherModel
          Current DasherModel
protected  CDasherScreen m_DasherScreen
          Current DasherScreen
protected  CDasherView m_DasherView
          Current DasherView
protected  CEventHandler m_EventHandler
          Our event handler
protected  CDasherInput m_Input
          Current Input device
protected  CInputFilter m_InputFilter
          Current input filter
protected  CModuleManager m_oModuleManager
          The module manager
protected  CSettingsStore m_SettingsStore
          Our settings repository
protected  CUserLog m_UserLog
          Our logging module
protected  java.util.LinkedList<java.lang.Character> strCurrentContext
          Context of recently entered characters
protected  java.lang.StringBuffer strTrainfileBuffer
          Entered text which has not yet been written out to disk
 
Constructor Summary
CDasherInterfaceBase()
          Sole constructor.
 
Method Summary
 void ChangeAlphabet()
          Changes the alphabet in use to that described by SP_ALPHABET_ID.
 void ChangeColours()
          Changes the colour scheme to that described by SP_COLOUR_ID.
 void ChangeScreen(CDasherScreen NewScreen)
          Changes the Screen to which we should send drawing instructions.
 void ChangeView()
          Creates an instance of DasherViewSquare, and, if they are present, informs it of our current Input Filter and Screen.
 void ConnectNode(int iChild, int iParent, int iAfter)
          Deferred to m_DasherModel.
 void CreateDasherModel()
          Creates a new DasherModel, deleting any previously existing one if necessary.
 void CreateFactories()
          Manually registers a number of input filters.
 void CreateInput()
          Creates an input device by calling GetModuleByName on the parameter SP_INPUT_DEVICE.
 void CreateInputFilter()
          Creates m_InputFilter by retrieving the module named in SP_INPUT_FILTER.
abstract  void CreateSettingsStore()
          Should create a SettingsStore object of some sort and store a reference to it in m_SettingsStore.
 void DeleteAlphabet(java.lang.String AlphID)
          Deferred to m_AlphIO
 void DestroyInterface()
          Instructs all componenets to unregister themselves with the event handler, and nulls our pointers to them, such that they will be available for garbage collection.
 void DisconnectNode(int iChild, int iParent)
          Deferred to m_DasherModel.
 CAlphIO doAlphIO(java.util.ArrayList<java.lang.String> vFiles)
          Reads a list of XML files and returns an instance of CAlphIO which knows about the alphabets found in these files.
 CColourIO doColourIO(java.util.ArrayList<java.lang.String> vFiles)
          Reads a list of XML files and returns an instance of CColourIO which knows about the colours found in these files.
 void Draw(boolean bRedrawNodes)
          Completely draws the screen based on the current state of the model, taking into account whether the model has changed since the last frame.
 void ExternalEventHandler(CEvent Event)
          Called for every dispatched event after all components have received it and *after* InterfaceEventHandler.
 CAlphabet GetAlphabet()
          Gets the current alphabet
 void GetAlphabets(java.util.ArrayList<java.lang.String> AlphabetList)
          Deferred to m_AlphIO
 int GetAutoOffset()
          Deferred to m_DasherView.
 boolean GetBoolParameter(Ebp_parameters iParameter)
          Deferred to CSettingsStore
 void GetColours(java.util.ArrayList<java.lang.String> ColourList)
          Deferred to m_ColourIO
 double GetCurCPM()
          Stub.
 double GetCurFPS()
          Stub.
 CEventHandler GetEventHandler()
          Retrieves the EventHandler created during this class' construction, and which calls this interface to handle events.
abstract  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 GetFontSizes(java.util.Collection<java.lang.Integer> FontSizes)
          Retrieves a list of available font sizes.
 CAlphIO.AlphInfo GetInfo(java.lang.String AlphID)
          Deferred to m_AlphIO
 long GetLongParameter(Elp_parameters iParameter)
          Deferred to CSettingsStore
 CDasherModule GetModule(long iID)
          Deferred to m_oModuleManager
 CDasherModule GetModuleByName(java.lang.String strName)
          Deferred to m_oModuleManager
 double GetNats()
          Deferred to CDasherModel
 java.io.InputStream getResourceStream(java.lang.String filename)
          This will be called by a number of file I/O methods when ordinary file I/O fails; it is intended for implementations to override it if they wish to return a stream pointing to JAR-packed files, remote network locations, etc.
 java.lang.String GetStringParameter(Esp_parameters iParameter)
          Deferred to CSettingsStore
 CUserLog GetUserLogPtr()
          Gets a reference to m_UserLog.
 void Halt()
          Pauses Dasher and calls DasherModel.Halt().
 void InterfaceEventHandler(CEvent Event)
          This is called by the EventHandler after all other components have received this event.
 void InvalidateContext(boolean bForceStart)
          Attempts to retrieve a fresh context by dispatching an EditContextEvent, which has a field to return a new context if anybody hearing the event chose to submit one.
 void KeyDown(long iTime, int iId)
          Signals a key press to our input filter.
 void KeyUp(long iTime, int iId)
          Signals a key press to our input filter.
 void NewFrame(long iTime)
          Encapsulates the entire process of drawing a new frame of the Dasher world.
 void PauseAt(int MouseX, int MouseY)
          Pauses Dasher at a given mouse location, and sets BP_REDRAW so that a full redraw will be performed next frame.
 void PreSetNotify(Esp_parameters iParameter, java.lang.String sNewValue)
          Notifies the interface before a string parameter is changed.
 void Realize()
          Realize does the bulk of the work of setting up a working Dasher.
abstract  void Redraw(boolean bChanged)
          Abstract method which will be called whenever a screen redraw is required.
 void RegisterFactory(CModuleFactory Factory)
          Deferred to m_oModuleManager
 void RegisterNode(int iID, java.lang.String strLabel, int iColour)
          Deferred to m_DasherModel.
 void ResetNats()
          Passed on to CDasherModel, if it is non-null.
 void ResetParameter(EParameters iParameter)
          Deferred to CSettingsStore
abstract  void ScanAlphabetFiles(java.util.Collection<java.lang.String> vFileList)
          Somehow determines which alphabet XML files to parse.
abstract  void ScanColourFiles(java.util.Collection<java.lang.String> vFileList)
          Somehow determines which colour XML files to parse.
 void SetBoolParameter(Ebp_parameters iParameter, boolean bValue)
          Deferred to CSettingsStore
 void SetInfo(CAlphIO.AlphInfo NewInfo)
          Deferred to m_AlphIO
 void SetLongParameter(Elp_parameters iParameter, long lValue)
          Deferred to CSettingsStore
 void SetStringParameter(Esp_parameters iParameter, java.lang.String sValue)
          Deferred to CSettingsStore
abstract  void SetupPaths()
          Should setup the system and user locations; called early in the startup sequence.
abstract  void SetupUI()
          Should perform any UI building which is required.
 void Start()
          Simply calls DasherModel.Start() and DasherView.ResetYAutoOffset() so see these functions' documentation for detail.
 void StartShutdown()
          Engages the shutdown lock (m_bShutdownLock).
 int TrainFile(java.lang.String Filename, int iTotalBytes, int iOffset)
          Trains our Model from the text found in a given file, which must be UTF-8 encoded.
 int TrainStream(java.io.InputStream FileIn, int iTotalBytes, int iOffset)
          Trains the language model from a given InputStream, which must be UTF-8 encoded.
 void Unpause(long Time)
          Unpause Dasher.
 void WriteTrainFile(java.lang.String strNewText)
          Stub.
protected  void WriteTrainFileFull()
          Writes the text entered by the user as a training file.
protected  void WriteTrainFilePartial()
          Writes the first 100 characters of user-entered text as a training file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g_Logger

public CFileLogger g_Logger

m_Alphabet

protected CAlphabet m_Alphabet
Current alphabet


m_Colours

protected CCustomColours m_Colours
Current colour scheme


m_DasherModel

protected CDasherModel m_DasherModel
Current DasherModel


m_DasherScreen

protected CDasherScreen m_DasherScreen
Current DasherScreen


m_DasherView

protected CDasherView m_DasherView
Current DasherView


m_Input

protected CDasherInput m_Input
Current Input device


m_AlphIO

protected CAlphIO m_AlphIO
Current AlphIO


m_ColourIO

protected CColourIO m_ColourIO
Current ColourIO


strTrainfileBuffer

protected java.lang.StringBuffer strTrainfileBuffer
Entered text which has not yet been written out to disk


strCurrentContext

protected java.util.LinkedList<java.lang.Character> strCurrentContext
Context of recently entered characters


m_EventHandler

protected CEventHandler m_EventHandler
Our event handler


m_SettingsStore

protected CSettingsStore m_SettingsStore
Our settings repository


m_UserLog

protected CUserLog m_UserLog
Our logging module


m_InputFilter

protected CInputFilter m_InputFilter
Current input filter


m_oModuleManager

protected CModuleManager m_oModuleManager
The module manager


m_bGlobalLock

protected boolean m_bGlobalLock
Lock engaged when Dasher should not respond to commands for unspecified reason


m_bShutdownLock

protected boolean m_bShutdownLock
Lock engaged when Dasher is being destroyed


m_bConnectLock

protected boolean m_bConnectLock
Lock engaged when we're in the process of connecting to a remote language model

Constructor Detail

CDasherInterfaceBase

public CDasherInterfaceBase()
Sole constructor. Creates an EventHandler, sets up an initial context, and creates a ModuleManager. This does only enough that we can retrieve the event handler for the purposes of creating further components; as neither the settings store nor any of Dasher's internal components yet exist, it is not yet capable of any meaningful task.

Realize() must be called after construction and before any other functions which depend upon anything other than the event handler and module manager.

Method Detail

ScanAlphabetFiles

public abstract void ScanAlphabetFiles(java.util.Collection<java.lang.String> vFileList)
Somehow determines which alphabet XML files to parse.

Parameters:
vFileList - List to fill with filenames to process.

ScanColourFiles

public abstract void ScanColourFiles(java.util.Collection<java.lang.String> vFileList)
Somehow determines which colour XML files to parse.

Parameters:
vFileList - List to fill with filenames to process.

SetupPaths

public abstract void SetupPaths()
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.


SetupUI

public abstract void SetupUI()
Should perform any UI building which is required.


CreateSettingsStore

public abstract void CreateSettingsStore()
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.


GetFileSize

public abstract 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.

Parameters:
strFileName - File to be read
Returns:
Size of this file, or 0 on error.

Realize

public void Realize()
Realize does the bulk of the work of setting up a working Dasher. The sequence of actions is as follows:

When realize terminates, Dasher will be in a broadly usable state. It will still lack a co-ordinate input device, which should be registered with RegisterFactory, and will need a Screen which should be created externally and registered with ChangeScreen, but will otherwise be good to go.


DestroyInterface

public void DestroyInterface()
Instructs all componenets to unregister themselves with the event handler, and nulls our pointers to them, such that they will be available for garbage collection.


PreSetNotify

public void PreSetNotify(Esp_parameters iParameter,
                         java.lang.String sNewValue)
Notifies the interface before a string parameter is changed.

This enables the interface to read the parameter's current value if necessary.

Presently the interface responds to:

SP_ALPHABET_ID: Stores a history of previous used alphabets in SP_ALPHABET_1, SP_ALPHABET_2 and so on.

Parameters:
iParameter - Parameter which is going to change.
sNewValue - Value to which it will change.

InterfaceEventHandler

public void InterfaceEventHandler(CEvent Event)
This is called by the EventHandler after all other components have received this event.

The interface responds to the following parameter changes:

BP_COLOUR_MODE: Calls Start() and redraws the display.

BP_OUTLINE_MODE: Redraws the display.

BP_CONNECT_LOCK: Sets the internal m_bConnectLock variable.

LP_ORIENTATION: Sets the LP_REAL_ORIENTATION parameter either to the value of LP_ORIENTATION, or if the latter is -2 (a special sentinel value) queries the current alphabet for its preferred orientation, and sets LP_REAL_ORIENTATION appropriately.

SP_ALPHABET_ID: Calls ChangeAlphabet() to rebuild the DasherModel appropriately, and then Start().

SP_COLOUR_ID: Calls ChangeColours() to insert the new colour scheme.

BP_PALETTE_CHANGE and SP_DEFAULT_COLOUR_ID: If Palette Change is true, changes COLOUR_ID to match DEFAULT_COLOUR_ID which contains the current alphabet's preferred colour scheme.

LP_LANGUAGE_MODEL_ID: Runs CreateDasherModel() to rebuild the model based on our newly chosen language model.

SP_LM_HOST: If we are currently using a remote language model, rebuilds the Model as above; otherwise, ignores.

LP_DASHER_FONTSIZE and LP_LINE_WIDTH: Redraws the display.

SP_INPUT_FILTER: Runs CreateInputFilter() to recreate the requested filter.

SP_INPUT_DEVICE: Runs CreateInput() to create the requested input device.

It also responds to EditEvents by modifying strCurrentContext according to the text the user is reported to have entered or deleted, and LockEvents by setting m_bGlobalLock to the value indicated.

Parameters:
Event - The event the interface is to process.

doAlphIO

public CAlphIO doAlphIO(java.util.ArrayList<java.lang.String> vFiles)
Reads a list of XML files and returns an instance of CAlphIO which knows about the alphabets found in these files.

This class does it by the simple expedient of creating a new CAlphIO and passing these files, but some extensions may redirect the request in the case that the XML files have already been parsed.

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)
Reads a list of XML files and returns an instance of CColourIO which knows about the colours found in these files.

This class does it by the simple expedient of creating a new CColourIO and passing these files, but some extensions may redirect the request in the case that the XML files have already been parsed.

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

CreateDasherModel

public void CreateDasherModel()
Creates a new DasherModel, deleting any previously existing one if necessary.

The DasherModel does most of the actual initialisation work, so see the constructor documentation for DasherModel for details.

This function will also set m_Alphabet to that created in the course of the DasherModel's initialisation, and will train the newly created model using the new Alphabet's specified training text.


Start

public void Start()
Simply calls DasherModel.Start() and DasherView.ResetYAutoOffset() so see these functions' documentation for detail.


PauseAt

public void PauseAt(int MouseX,
                    int MouseY)
Pauses Dasher at a given mouse location, and sets BP_REDRAW so that a full redraw will be performed next frame.

Also generates a StopEvent to notify other components.

Parameters:
MouseX - Mouse x co-ordinate at the time of stopping
MouseY - Mouse y co-ordinate at the time of stopping

Halt

public void Halt()
Pauses Dasher and calls DasherModel.Halt().

This function, unlike PauseAt, does not throw a StopEvent.


Unpause

public void Unpause(long Time)
Unpause Dasher. This will send a StartEvent to all components.

Parameters:
Time - System time as a UNIX timestamp at which Dasher was restarted.

CreateInput

public void CreateInput()
Creates an input device by calling GetModuleByName on the parameter SP_INPUT_DEVICE. In the event that this does not correspond to a module known by the Module Manager, m_Input will be set to null.

If there is an existing input device, it will be Unref'd and Deactivated first.

In the event that a non-null DasherInput class is created, its Ref and Activate methods will be called immediately.

See Also:
CDasherInput, CModuleManager

NewFrame

public void NewFrame(long iTime)
Encapsulates the entire process of drawing a new frame of the Dasher world.

We invoke our input filter's Timer method, which determines in what way the Model should be updated, if at all, allow the Model to check its consistency after being changed, and then finally ask our View to draw the newly updated world.

Method will return without any action if any of the three lock variables are true.

Parameters:
iTime - Current system time as a UNIX time stamp.

Draw

public void Draw(boolean bRedrawNodes)
Completely draws the screen based on the current state of the model, taking into account whether the model has changed since the last frame.

This breaks down to calling the Model's RenderToView method if we need to draw the nodes, and then calling the InputFilter's DecorateView method.

The View's Display() method is called only in the event that anything has changed.

At present, this is hacked such that it always does a full redraw if Dasher is unpaused, owing to the fact that the Java front-end must receive a frame every time it calls Draw. See the documentation for applet.JDasherScreen for details.

Parameters:
bRedrawNodes - True if the Model has changed since the last frame.
See Also:
JDasherScreen

Redraw

public abstract void Redraw(boolean bChanged)
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.

Parameters:
bChanged - True if the model has changed since the last frame

ChangeAlphabet

public void ChangeAlphabet()
Changes the alphabet in use to that described by SP_ALPHABET_ID.

Writes the training file to disk using WriteTrainFileFull, and then runs CreateDasherModel, deleting an exsiting Model if it exists.

In the event that SP_ALPHABET_ID is empty when this function is called, it is set to the default suggested by m_AlphIO.


ChangeColours

public void ChangeColours()
Changes the colour scheme to that described by SP_COLOUR_ID.

If m_ColourIO is null at the time, this method will return without performing any action.

Specifically, this method retrieves the colour scheme named by SP_COLOUR_ID from m_ColourIO, and creates a new CustomColours wrapping it, finally setting m_Colours to point to the new scheme. Finally, if successful, the screen is informed of the new scheme by calling its SetColourScheme method.


ChangeScreen

public void ChangeScreen(CDasherScreen NewScreen)
Changes the Screen to which we should send drawing instructions.

If a view already exists, it is notified of the new screen.

If no view exists, one is created by a call to ChangeView.

Parameters:
NewScreen - New screen

ChangeView

public void ChangeView()
Creates an instance of DasherViewSquare, and, if they are present, informs it of our current Input Filter and Screen.

This ought to respond to the LP_VIEW_ID parameter, but since at present there is only one, it is ignored for now.


GetAlphabets

public void GetAlphabets(java.util.ArrayList<java.lang.String> AlphabetList)
Deferred to m_AlphIO

See Also:
CAlphIO

GetInfo

public CAlphIO.AlphInfo GetInfo(java.lang.String AlphID)
Deferred to m_AlphIO

See Also:
CAlphIO

SetInfo

public void SetInfo(CAlphIO.AlphInfo NewInfo)
Deferred to m_AlphIO

See Also:
CAlphIO

DeleteAlphabet

public void DeleteAlphabet(java.lang.String AlphID)
Deferred to m_AlphIO

See Also:
CAlphIO

GetColours

public void GetColours(java.util.ArrayList<java.lang.String> ColourList)
Deferred to m_ColourIO

See Also:
CColourIO

TrainFile

public int TrainFile(java.lang.String Filename,
                     int iTotalBytes,
                     int iOffset)
Trains our Model from the text found in a given file, which must be UTF-8 encoded.

The actual training is done by TrainStream; this just creates a FileInputStream and passes it into TrainStream.

Parameters:
Filename - Path (absolute or relative) to file containing training text.
iTotalBytes - Number of bytes to read
iOffset - Offset at which to start reading
Returns:
Number of bytes read

TrainStream

public int TrainStream(java.io.InputStream FileIn,
                       int iTotalBytes,
                       int iOffset)
Trains the language model from a given InputStream, which must be UTF-8 encoded.

LockEvents will be inserted every 1KB of data read, informing components and the interface of the progress made in reading the file.

Parameters:
FileIn - InputStream from which to read.
iTotalBytes - Number of bytes to read.
iOffset - Offset at which to start reading.
Returns:
Number of bytes read

GetFontSizes

public void GetFontSizes(java.util.Collection<java.lang.Integer> FontSizes)
Retrieves a list of available font sizes. This class returns a generic reasonably sensible list (11, 14, 20, 22, 28, 40, 44, 56, 80) but should be overridden by the implementing class if a better answer can be retrieved.

Parameters:
FontSizes - Collection to be filled with available sizes

GetCurCPM

public double GetCurCPM()
Stub. Ought to return the current characters per minute, but this is not yet implemented.

Returns:
0

GetCurFPS

public double GetCurFPS()
Stub. Ought to return the current frames rate, but this is not yet implemented.

Returns:
0

GetAutoOffset

public int GetAutoOffset()
Deferred to m_DasherView. If this is null, -1 is returned.

Returns:
-1 if null, or else DasherView's answer.
See Also:
CDasherView

GetNats

public double GetNats()
Deferred to CDasherModel

See Also:
CDasherModel

ResetNats

public void ResetNats()
Passed on to CDasherModel, if it is non-null.

See Also:
CDasherModel

InvalidateContext

public void InvalidateContext(boolean bForceStart)
Attempts to retrieve a fresh context by dispatching an EditContextEvent, which has a field to return a new context if anybody hearing the event chose to submit one.

If bForceStart is true, or we received a non-empty context, the Model is fed the new Context using SetContext and is then paused.

Finally there is a mandatory screen redraw.

Parameters:
bForceStart - Should we rebuild the context even if none is submitted?

RegisterNode

public void RegisterNode(int iID,
                         java.lang.String strLabel,
                         int iColour)
Deferred to m_DasherModel.

See Also:
CDasherModel

ConnectNode

public void ConnectNode(int iChild,
                        int iParent,
                        int iAfter)
Deferred to m_DasherModel.

See Also:
CDasherModel

DisconnectNode

public void DisconnectNode(int iChild,
                           int iParent)
Deferred to m_DasherModel.

See Also:
CDasherModel

SetBoolParameter

public void SetBoolParameter(Ebp_parameters iParameter,
                             boolean bValue)
Deferred to CSettingsStore

See Also:
CSettingsStore

SetLongParameter

public void SetLongParameter(Elp_parameters iParameter,
                             long lValue)
Deferred to CSettingsStore

See Also:
CSettingsStore

SetStringParameter

public void SetStringParameter(Esp_parameters iParameter,
                               java.lang.String sValue)
Deferred to CSettingsStore

See Also:
CSettingsStore

GetBoolParameter

public boolean GetBoolParameter(Ebp_parameters iParameter)
Deferred to CSettingsStore

See Also:
CSettingsStore

GetLongParameter

public long GetLongParameter(Elp_parameters iParameter)
Deferred to CSettingsStore

See Also:
CSettingsStore

GetStringParameter

public java.lang.String GetStringParameter(Esp_parameters iParameter)
Deferred to CSettingsStore

See Also:
CSettingsStore

ResetParameter

public void ResetParameter(EParameters iParameter)
Deferred to CSettingsStore

See Also:
CSettingsStore

GetUserLogPtr

public CUserLog GetUserLogPtr()
Gets a reference to m_UserLog.

Returns:
m_UserLog

KeyDown

public void KeyDown(long iTime,
                    int iId)
Signals a key press to our input filter. This should be invoked by an implementation whenever a key is pressed.

Key presses signalled in this way are ignored if we have no input filter, or if BP_TRAINING is true.

Currently assigned key IDs:

The actual physical keys assigned to these functions are down to the implementation, and may be user-definable.

Parameters:
iTime - System time as a UNIX timestamp at which the key was pressed
iId - Identifier of the pressed key

KeyUp

public void KeyUp(long iTime,
                  int iId)
Signals a key press to our input filter. This should be invoked by an implementation whenever a key is released.

Key presses signalled in this way are ignored if we have no input filter, or if BP_TRAINING is true.

Currently assigned key IDs:

The actual physical keys assigned to these functions are down to the implementation, and may be user-definable.

Parameters:
iTime - System time as a UNIX timestamp at which the key was pressed
iId - Identifier of the pressed key

CreateInputFilter

public void CreateInputFilter()
Creates m_InputFilter by retrieving the module named in SP_INPUT_FILTER.

If this is successful and an input filter is created, it will be Ref'd and Activated immediately.

If unsuccessful, m_InputFilter will be set to null.

If there is an existing filter, it is Deactivated and Unref'd first.


RegisterFactory

public void RegisterFactory(CModuleFactory Factory)
Deferred to m_oModuleManager

See Also:
CModuleManager

GetModule

public CDasherModule GetModule(long iID)
Deferred to m_oModuleManager

See Also:
CModuleManager

GetModuleByName

public CDasherModule GetModuleByName(java.lang.String strName)
Deferred to m_oModuleManager

See Also:
CModuleManager

CreateFactories

public void CreateFactories()
Manually registers a number of input filters.

At present this registers only Normal Control and Click Mode, but as an when others are implemented will register these also.

The same input filter may be registered repeatedly under a variety of different names if desired (so long as the filter's constructor permits a user-defined name).

This is commonly used to produce a number of different button modes which use the same filter class.


StartShutdown

public void StartShutdown()
Engages the shutdown lock (m_bShutdownLock).


WriteTrainFileFull

protected void WriteTrainFileFull()
Writes the text entered by the user as a training file.

Won't work at present, as WriteTrainFile() is stubbed.


WriteTrainFilePartial

protected void WriteTrainFilePartial()
Writes the first 100 characters of user-entered text as a training file.

Won't work at the moment, as WriteTrainFile() is stubbed.


GetEventHandler

public CEventHandler GetEventHandler()
Retrieves the EventHandler created during this class' construction, and which calls this interface to handle events.

Returns:
EventHandler tied to this Interface.

ExternalEventHandler

public void ExternalEventHandler(CEvent Event)
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.

Parameters:
Event - Event being signalled

GetAlphabet

public CAlphabet GetAlphabet()
Gets the current alphabet

Returns:
Current alphabet

WriteTrainFile

public void WriteTrainFile(java.lang.String strNewText)
Stub. This ought to write out a training file, but is not implemented at present due since the applet implementation cannot write a training file to the local disk.

This method should be implemented if a local application version of JDasher is to be implemented, and should write a file containing the user's typed text encoded as UTF-8 suitable for reading by the TrainStream routine.

Parameters:
strNewText -

getResourceStream

public java.io.InputStream getResourceStream(java.lang.String filename)
This will be called by a number of file I/O methods when ordinary file I/O fails; it is intended for implementations to override it if they wish to return a stream pointing to JAR-packed files, remote network locations, etc.

By default it ignores its arguments and returns null.

Overriding is optional; ordinary file I/O will still be tried before calling this method.

Parameters:
filename - File to be opened
Returns:
InputStream if it could be opened, or null if not.