fr.umlv.unitex
Class Config

java.lang.Object
  extended by fr.umlv.unitex.Config

public class Config
extends java.lang.Object

This class contains general configuration information. It contains constants used by many other classes.

Author:
Sébastien Paumier

Field Summary
static java.lang.String CORPUS_TOO_LARGE_MESSAGE
          Message shown chen a text file is too large to be loaded.
static java.lang.String EMPTY_FILE_MESSAGE
          Empty file error message.
static java.lang.String ERROR_WHILE_READING_FILE_MESSAGE
          File reading error message.
static java.lang.String FILE_TOO_LARGE_MESSAGE
           
static int LINUX_SYSTEM
           
static int MAC_OS_X_SYSTEM
           
static int MAXIMUM_UTTERANCE_NUMBER_TO_DISPLAY_WITH_JAVA
          Limit over which the concordance should be viewed with a web navigator
static java.lang.String optionFieldTmp
           
static int SUN_OS_SYSTEM
           
static int WINDOWS_SYSTEM
           
 
Constructor Summary
Config()
           
 
Method Summary
static void changeLanguage()
          Shows a dialog box that offers to the user to change the language he works on.
static void changeUserDir()
          Asks for the user to change his private directory.
static void chooseInitialLanguage()
          Shows a dialog box that offers to the user to choose the initial language he wants to work on
static void chooseNewUserDir()
          Asks for the user to select his private directory.
static void copyDirRec(java.io.File src, java.io.File dest)
          Copies a directory recursively.
static void copyFile(java.io.File src, java.io.File dest)
          Copy one file.
static void copyFileByName(java.io.File src, java.io.File dest)
          Copies files.
static void deleteFileByName(java.io.File src)
          Deletes files.
static void determineCurrentUser()
          Finds the user's name.
static void determineUnitexDir()
          Finds the path of the Unitex directory.
static void determineWhichSystemIsRunning()
          Finds which operating system is used.
static java.io.File getAlphabet()
           
static java.io.File getApplicationDir()
           
static javax.swing.JFileChooser getCorpusDialogBox()
           
static java.io.File getCurrentCorpusDir()
           
static java.io.File getCurrentDELA()
           
static java.io.File getCurrentElagDir()
           
static java.io.File getCurrentGraphDir()
           
static java.lang.String getCurrentLanguage()
           
static java.io.File getCurrentReplaceGraph()
           
static java.io.File getCurrentSentenceGraph()
           
static java.io.File getCurrentSnt()
           
static java.io.File getCurrentSntDir()
           
static int getCurrentSystem()
           
static java.lang.String getCurrentSystemName()
           
static java.awt.Font getCurrentTextFont()
           
static javax.swing.JFileChooser getDelaDialogBox()
           
static javax.swing.JFileChooser getDevDialogBox()
           
static javax.swing.JFileChooser getFileEditionDialogBox()
           
static javax.swing.JFileChooser getFst2UnambigDialogBox()
           
static javax.swing.JFileChooser getGraphDialogBox()
           
static javax.swing.JFileChooser getGrfAndFst2DialogBox()
           
static javax.swing.JFileChooser getInflectDialogBox()
           
static javax.swing.JFileChooser getReplaceDialogBox()
           
static javax.swing.JFileChooser getSentenceDialogBox()
           
static javax.swing.JFileChooser getTableDialogBox()
           
static javax.swing.JFileChooser getTranscodeDialogBox()
           
static java.io.File getUnitexCurrentLanguageDir()
           
static java.io.File getUnitexDir()
           
static java.io.File getUserCurrentLanguageDir()
           
static java.io.File getUserDir()
           
static java.lang.String getUserName()
           
static javax.swing.JFileChooser getVarDialogBox()
           
static void initConfig()
          Initializes the system.
static boolean isCharByCharLanguage()
           
static boolean isRightToLeftLanguage()
           
static void removeFile(java.io.File src)
          Deletes files.
static void setAlphabet(java.io.File s)
          Sets user's current alphabet file
static void setApplicationDir(java.io.File s)
          Sets the application directory
static void setCurrentCorpusDir(java.io.File s)
          Sets the user's current corpus directory
static void setCurrentDELA(java.io.File s)
          Sets current DELA
static void setCurrentElagDir(java.io.File s)
          Sets the user's current ELAG directory
static void setCurrentGraphDir(java.io.File s)
          Sets the user's current graph directory
static void setCurrentLanguage(java.lang.String s)
          Sets the current language.
static void setCurrentReplaceGraph(java.io.File s)
          Sets current replace graph
static void setCurrentSentenceGraph(java.io.File s)
          Sets current sentence delimitation graph
static void setCurrentSnt(java.io.File s)
          Sets the current corpus
static void setCurrentSntDir(java.io.File s)
          Sets the current corpus
static void setDefaultPreprocessingGraphs()
          Sets sentence delimitation and replace graphs
static void setUnitexCurrentLanguageDir(java.io.File s)
          Sets the system's current language directory
static void setUnitexDir(java.io.File s)
          Sets the system directory
static void setUserCurrentLanguageDir(java.io.File s)
          Sets the user's current language directory.
static void setUserDir(java.io.File s)
          Sets the user directory
static void updateOpenSaveDialogBoxes()
          Updates working directories of dialog boxes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WINDOWS_SYSTEM

public static final int WINDOWS_SYSTEM
See Also:
Constant Field Values

LINUX_SYSTEM

public static final int LINUX_SYSTEM
See Also:
Constant Field Values

MAC_OS_X_SYSTEM

public static final int MAC_OS_X_SYSTEM
See Also:
Constant Field Values

SUN_OS_SYSTEM

public static final int SUN_OS_SYSTEM
See Also:
Constant Field Values

MAXIMUM_UTTERANCE_NUMBER_TO_DISPLAY_WITH_JAVA

public static final int MAXIMUM_UTTERANCE_NUMBER_TO_DISPLAY_WITH_JAVA
Limit over which the concordance should be viewed with a web navigator

See Also:
Constant Field Values

CORPUS_TOO_LARGE_MESSAGE

public static final java.lang.String CORPUS_TOO_LARGE_MESSAGE
Message shown chen a text file is too large to be loaded.

See Also:
Constant Field Values

FILE_TOO_LARGE_MESSAGE

public static final java.lang.String FILE_TOO_LARGE_MESSAGE
See Also:
Constant Field Values

EMPTY_FILE_MESSAGE

public static final java.lang.String EMPTY_FILE_MESSAGE
Empty file error message.

See Also:
Constant Field Values

ERROR_WHILE_READING_FILE_MESSAGE

public static final java.lang.String ERROR_WHILE_READING_FILE_MESSAGE
File reading error message.

See Also:
Constant Field Values

optionFieldTmp

public static java.lang.String optionFieldTmp
Constructor Detail

Config

public Config()
Method Detail

initConfig

public static void initConfig()
Initializes the system. This method finds which system is running, which user is working. Then, it initalizes dialog boxes and ask the user to choose the initial language he wants to work on.


getGraphDialogBox

public static javax.swing.JFileChooser getGraphDialogBox()

getGrfAndFst2DialogBox

public static javax.swing.JFileChooser getGrfAndFst2DialogBox()

getSentenceDialogBox

public static javax.swing.JFileChooser getSentenceDialogBox()

getReplaceDialogBox

public static javax.swing.JFileChooser getReplaceDialogBox()

getDelaDialogBox

public static javax.swing.JFileChooser getDelaDialogBox()

getCorpusDialogBox

public static javax.swing.JFileChooser getCorpusDialogBox()

getInflectDialogBox

public static javax.swing.JFileChooser getInflectDialogBox()

getVarDialogBox

public static javax.swing.JFileChooser getVarDialogBox()

getDevDialogBox

public static javax.swing.JFileChooser getDevDialogBox()

getTableDialogBox

public static javax.swing.JFileChooser getTableDialogBox()

getTranscodeDialogBox

public static javax.swing.JFileChooser getTranscodeDialogBox()

getFileEditionDialogBox

public static javax.swing.JFileChooser getFileEditionDialogBox()

getFst2UnambigDialogBox

public static javax.swing.JFileChooser getFst2UnambigDialogBox()

updateOpenSaveDialogBoxes

public static void updateOpenSaveDialogBoxes()
Updates working directories of dialog boxes. This method is called when the user changes of working language.


determineUnitexDir

public static void determineUnitexDir()
Finds the path of the Unitex directory. Sets up the application directory.


determineCurrentUser

public static void determineCurrentUser()
Finds the user's name. If the user works with Unitex for the first time, he is asked for choosing his private working directory if he works under Windows. Under Linux or MacOS, his private directory is a directory named "unitex", created in his home directory.


determineWhichSystemIsRunning

public static void determineWhichSystemIsRunning()
Finds which operating system is used. If the system is not supported by Unitex, the program stops.


getCurrentSystem

public static int getCurrentSystem()
Returns:
the current system constant

getCurrentSystemName

public static java.lang.String getCurrentSystemName()
Returns:
the current system name

getApplicationDir

public static java.io.File getApplicationDir()
Returns:
the application directory

setApplicationDir

public static void setApplicationDir(java.io.File s)
Sets the application directory

Parameters:
s - directory's path

getUnitexDir

public static java.io.File getUnitexDir()
Returns:
the Unitex directory

setUnitexDir

public static void setUnitexDir(java.io.File s)
Sets the system directory

Parameters:
s - directory's path

getUserDir

public static java.io.File getUserDir()
Returns:
the user directory

setUserDir

public static void setUserDir(java.io.File s)
Sets the user directory

Parameters:
s - directory's path

getCurrentLanguage

public static java.lang.String getCurrentLanguage()
Returns:
the current language

setCurrentLanguage

public static void setCurrentLanguage(java.lang.String s)
Sets the current language. All directories that depend of this one are updated. Preferences all also updated

Parameters:
s - language's name

getUnitexCurrentLanguageDir

public static java.io.File getUnitexCurrentLanguageDir()
Returns:
system's current language directory

setUnitexCurrentLanguageDir

public static void setUnitexCurrentLanguageDir(java.io.File s)
Sets the system's current language directory

Parameters:
s - directory's path

getUserCurrentLanguageDir

public static java.io.File getUserCurrentLanguageDir()
Returns:
the users' current language directory

setUserCurrentLanguageDir

public static void setUserCurrentLanguageDir(java.io.File s)
Sets the user's current language directory. If some sub-directories are missing, they are copied from the system's current language directory with all their files, excepting the dictionaries (".bin" and ".inf" files).

Parameters:
s - directory's path

getCurrentCorpusDir

public static java.io.File getCurrentCorpusDir()
Returns:
user's current corpus directory

setCurrentCorpusDir

public static void setCurrentCorpusDir(java.io.File s)
Sets the user's current corpus directory

Parameters:
s - directory's path

getCurrentGraphDir

public static java.io.File getCurrentGraphDir()
Returns:
user's current graph directory

setCurrentGraphDir

public static void setCurrentGraphDir(java.io.File s)
Sets the user's current graph directory

Parameters:
s - directory's path

getCurrentElagDir

public static java.io.File getCurrentElagDir()
Returns:
user's current ELAG directory

setCurrentElagDir

public static void setCurrentElagDir(java.io.File s)
Sets the user's current ELAG directory

Parameters:
s - directory's path

getAlphabet

public static java.io.File getAlphabet()
Returns:
user's current alphabet file

setAlphabet

public static void setAlphabet(java.io.File s)
Sets user's current alphabet file

Parameters:
s - file's path

getUserName

public static java.lang.String getUserName()
Returns:
user's name

chooseNewUserDir

public static void chooseNewUserDir()
Asks for the user to select his private directory. IMPORTANT: this method must be called only when Unitex is running under Windows.


changeUserDir

public static void changeUserDir()
Asks for the user to change his private directory. IMPORTANT: this method must be called only when Unitex is running under Windows.


chooseInitialLanguage

public static void chooseInitialLanguage()
Shows a dialog box that offers to the user to choose the initial language he wants to work on


changeLanguage

public static void changeLanguage()
Shows a dialog box that offers to the user to change the language he works on. If they are some frames that depend on the language (corpus frame, token frame, etc), they are all closed before changing the working language.


getCurrentSnt

public static java.io.File getCurrentSnt()
Returns:
current corpus

setCurrentSnt

public static void setCurrentSnt(java.io.File s)
Sets the current corpus

Parameters:
s - name of the corpus file

getCurrentSntDir

public static java.io.File getCurrentSntDir()
Returns:
current corpus

setCurrentSntDir

public static void setCurrentSntDir(java.io.File s)
Sets the current corpus

Parameters:
s - name of the corpus file

getCurrentSentenceGraph

public static java.io.File getCurrentSentenceGraph()
Returns:
current sentence delimitation graph

setCurrentSentenceGraph

public static void setCurrentSentenceGraph(java.io.File s)
Sets current sentence delimitation graph

Parameters:
s - graph's name

getCurrentReplaceGraph

public static java.io.File getCurrentReplaceGraph()
Returns:
current replace graph

setCurrentReplaceGraph

public static void setCurrentReplaceGraph(java.io.File s)
Sets current replace graph

Parameters:
s - graph's name

setDefaultPreprocessingGraphs

public static void setDefaultPreprocessingGraphs()
Sets sentence delimitation and replace graphs


copyFileByName

public static void copyFileByName(java.io.File src,
                                  java.io.File dest)
Copies files. The source is specified by a file name that can contain * and ? jokers.

Parameters:
src - source
dest - destination

copyDirRec

public static void copyDirRec(java.io.File src,
                              java.io.File dest)
Copies a directory recursively.

Parameters:
src - source directory
dest - destination directory

deleteFileByName

public static void deleteFileByName(java.io.File src)
Deletes files. The source is specified by a file name that can contain * and ? jokers.

Parameters:
src - source

removeFile

public static void removeFile(java.io.File src)
Deletes files. The source is specified by a file name that can contains * and ? jokers. This method differs from deleteFileByName because it cannot delete directories.

Parameters:
src - source

copyFile

public static void copyFile(java.io.File src,
                            java.io.File dest)
Copy one file.

Parameters:
src - source file
dest - destination file

setCurrentDELA

public static void setCurrentDELA(java.io.File s)
Sets current DELA

Parameters:
s - dictionary name

getCurrentDELA

public static java.io.File getCurrentDELA()
Returns:
current DELA's name

getCurrentTextFont

public static java.awt.Font getCurrentTextFont()
Returns:
current font used to display texts

isCharByCharLanguage

public static boolean isCharByCharLanguage()

isRightToLeftLanguage

public static boolean isRightToLeftLanguage()