net.sf.intltyper.lib
Class GUIHelper

java.lang.Object
  extended bynet.sf.intltyper.lib.GUIHelper

public class GUIHelper
extends java.lang.Object

Class that contains all the gui-specific code which is not specific to a special GUI environment. This is the class the GUI will communicate with most of the time.


Field Summary
private  java.lang.String autotype
           
private  int autotypeLook
           
private  GUIAdapter ga
           
private  IntlTyperFacade itf
           
private  KeySequenceList ksl
           
private  int mode
           
private  java.lang.String prefix
           
private  java.lang.String shortPrefix
           
private  java.lang.String todefine
           
private  boolean useUnicodeMap
           
 
Constructor Summary
protected GUIHelper(IntlTyperFacade itf, GUIAdapter ga)
          Creates a GUIHelper.
 
Method Summary
private  void changeTextX(int delete, java.lang.String insert)
          Internal method handling both loading config files and changing text.
 int getNecessaryContextLength()
          Determines how much context is required for textAdded(java.lang.String, int).
private  void handleCommand(java.lang.String cmd)
          Handler for IntlTyper commands
 void inputChanged(java.lang.String newInput)
          Called by the text component's input field when the input has changed.
 void inputConfirmed(java.lang.String newInput)
          Called by the text component's input box when the input has been confirmed (by the return key)
 void loadConfig(java.lang.String cfg)
          Loads a configuration.
private  void recalcAutoType()
          Recalculates the needed context length for AutoType.
 void saveConfig(java.lang.String to)
          Saves a configuration.
static java.lang.String[] split(java.lang.String tosplit, java.lang.String sep)
          Utility method to split a String at separators.
 void textAdded(java.lang.String context, int length)
          Called by the text component when text has been added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ga

private GUIAdapter ga

ksl

private KeySequenceList ksl

mode

private int mode

shortPrefix

private java.lang.String shortPrefix

prefix

private java.lang.String prefix

todefine

private java.lang.String todefine

autotype

private java.lang.String autotype

autotypeLook

private int autotypeLook

useUnicodeMap

private boolean useUnicodeMap

itf

private IntlTyperFacade itf
Constructor Detail

GUIHelper

protected GUIHelper(IntlTyperFacade itf,
                    GUIAdapter ga)
Creates a GUIHelper.

Parameters:
itf - the facade that created for this GuiHelper
ga - the GUIAdapter to communicate with
See Also:
IntlTyperFacade.buildGUIHelper(GUIAdapter)
Method Detail

textAdded

public void textAdded(java.lang.String context,
                      int length)
Called by the text component when text has been added.

Parameters:
context - The last few characters before the cursor
length - The length of the inserted text.
See Also:
getNecessaryContextLength()

getNecessaryContextLength

public int getNecessaryContextLength()
Determines how much context is required for textAdded(java.lang.String, int).

Returns:
the minimum context length

inputChanged

public void inputChanged(java.lang.String newInput)
Called by the text component's input field when the input has changed.

Parameters:
newInput - the new input value

inputConfirmed

public void inputConfirmed(java.lang.String newInput)
Called by the text component's input box when the input has been confirmed (by the return key)

Parameters:
newInput - the new input value

handleCommand

private void handleCommand(java.lang.String cmd)
Handler for IntlTyper commands


recalcAutoType

private void recalcAutoType()
Recalculates the needed context length for AutoType.


saveConfig

public void saveConfig(java.lang.String to)
Saves a configuration.

Parameters:
to - name of the KeySequence where the configuration should be saved

loadConfig

public void loadConfig(java.lang.String cfg)
Loads a configuration.

Parameters:
cfg - name of the KeySequencs containing the configuration to load

changeTextX

private void changeTextX(int delete,
                         java.lang.String insert)
Internal method handling both loading config files and changing text.


split

public static java.lang.String[] split(java.lang.String tosplit,
                                       java.lang.String sep)
Utility method to split a String at separators. This is JDK1.3 compliant and preserves empty strings.

Parameters:
tosplit - The string to split
sep - Separator to split at
Returns:
An array containing the parts