|
Last
revision of this document: |
This
is document contains the code for Class JSBS_UniversalParameters.
For
easy 'cut and paste' ;-)
package
js_base.structures;
import
java.util.*;
/**
*
* @author kurt@javascout.biz
*
@date 2006-05-09
*
* @description
*
Parameter-structure holding values needed by the
CommandCenter
* and detail-frames.
* These
values are for
* + Connection to a database
(DB)
* + Connection to a Java-Application-Server
(JAS)
* + User-specific: Language of the
User-Interface, id of the workstation, etc.
* +
subdirectories for language dependant text, graphic-elements (mostly
icons), forms-elements, etc.
*
* @change-log
*
when who why
*
--------------------------------------------------------
*
*/
public
class JSBS_UniversalParameters
implements
JSBS_UniversalParameters_Constants
{
/*
*
Status code to signal results (see interface
JSBS_UniversalParameters_Constants)
* of methods to the
caller. */
public
int StatusCode
=
0;
/*
*
Name of the user; the one he or she is registered at the user-table
of the application */
public
String strUserName
=
"";
/*
*
Work-Date of the client.
* This date can be different
from the actual date on the Server
* as it might be
necessary to perform business-operations for the future or the past
*/
public
GregorianCalendar calWorkDate;
/*
*
Chosen language */
public
String strLanguageCode
= "";
/*
*
Preferred currency; this is the one chosen for display.
* (only
needed if the application should work with multi-currency)
*/
public
String strPreferredCurrency
= "";
/*
*
Values with the directory-names and with parts
to
build them */
/*
* Character
which separates directories; e.g. "\" in Windows; "/"
in Linux */
public
String strDirectorySeparator
= "";
/*
*
Directory where the files with the application reside */
public
String strApplicationDirectoryName
=
"";
/*
*
Directories where
* language dependant text-elements,
*
graphic elements (mostly icons),
* graphic parts of forms to
be printed and
* files with parameters for the connection to
a database or Java-Application-Server
* are stored.
*
These directories are subdirectories of the directory in
'strApplicationDirectoryName' . */
public
String strTextElementsDirectoryName
=
"";
public
String strGraphicElementsDirectoryName
=
"";
public
String strFormsElementsDirectoryName
=
"";
public
String strConnectionsDirectoryName
=
"";
/*
*
-------------------------------
* Constructor of the class
*/
public
JSBS_UniversalParameters(String
parmLanguageCode) {
/*
*
The method to get the name of the directory where the files with the
application are
* stored and to build the names of
subdirectories which are not language dependant
*/
buildDirectoryNames();
/*
*
The method to get the name of the language dependant directory.
*
The code is in an extra method as the language of the User-interface
might
* be changed while the application is already up and
running.
*/
buildLanguageDependantDirectoryNames(parmLanguageCode);
}
/*
*
*/
public
void buildDirectoryNames() {
/*
*
Get the separator between directories respectively directory and
file.
* This character is system-specific !
*/
strDirectorySeparator
=
System.getProperty("file.separator");
/*
*
Get the name of the directory where the files with the application
are stored
* and append it already with the directory
separator */
strApplicationDirectoryName
=
System.getProperty("user.dir")
+ strDirectorySeparator;
/*
*
Build the names of the sub-directories based on the of the
application directory.
* Append it already with the
directory separator for easier appending of filenames
*/
strGraphicElementsDirectoryName
=
strApplicationDirectoryName
+
CONST_GRAPHICS_SUBDIRECTORY_NAME
+
strDirectorySeparator;
strFormsElementsDirectoryName
=
strApplicationDirectoryName
+
CONST_FORMS_SUBDIRECTORY_NAME
+
strDirectorySeparator;
strConnectionsDirectoryName
=
strApplicationDirectoryName
+
CONST_CONNECTIONS_SUBDIRECTORY_NAME
+
strDirectorySeparator;
}
/*
*
*/
public
void buildLanguageDependantDirectoryNames(String
parmstrLanguageCode) {
/*
*
Save the passed language code */
strLanguageCode
=
parmstrLanguageCode.trim();
/*
*
Build the first part of the directory name.
*/
strTextElementsDirectoryName
=
strApplicationDirectoryName
+ CONST_TEXT_SUBDIRECTORY_NAME;
/*
*
Depending if a Language Code is available, build the name of the
directory
* where the files with the language dependant
text-elements are stored */
if
(strLanguageCode.length()
> 0) {
/*
If a language code was passed, the code will be part of the directory
name. */
strTextElementsDirectoryName
=
strTextElementsDirectoryName
+
"."
+
strLanguageCode;
}
/*
End with the directory separator for easy appending a file-name.
*/
strTextElementsDirectoryName
+=
strDirectorySeparator;
}
}