public final class PsConfig
extends java.lang.Object
PvViewer
when PvViewer instance is created in the top applet. If applet does not create an
instance of PvViewer then applet must initialize this class directly using its
init
method.
Information about version, authors etc. is parsed during generation of jar file
to be included as manifest information (currently, the information is just added
as a file _jarVersion.txt
to the archive).
Modifier and Type | Field and Description |
---|---|
static int |
ARCHIVE_DEV
ID if the development JavaView jar archive.
|
static int |
ARCHIVE_DEV6
ID if the development JavaView jar archive.
|
static int |
ARCHIVE_JV
ID if the base JavaView jar archive.
|
static int |
ARCHIVE_JVX
ID if the expansion JavaView jar archive.
|
static java.lang.String[] |
ARCHIVE_NAME
Strings used as identifiers of jar archives available to a JavaView installation.
|
static int |
ARCHIVE_VGP
ID if the vgp application JavaView jar archive.
|
static java.lang.String[] |
AUTHOR
Array of author names.
|
static java.lang.String[] |
CONTRIBUTOR
Deprecated.
use method getContributors() to access list of contributors.
|
static java.lang.String |
EMAIL
Email address for contact.
|
static int |
FONT_FIXED
Identifier of fixed (i.e. non-proportional) text font used in panels.
|
static int |
FONT_HEADER2
Identifier of header font used in panels.
|
static int |
FONT_HEADER4
Identifier of sub header font used in panels.
|
static int |
FONT_MENU
Identifier of menu font used in panels.
|
static int |
FONT_TEXT
Identifier of text font used in panels.
|
static java.lang.String |
FONTS_HTML
Page with an applet showing available system fonts.
|
static java.lang.String |
HELP_HTML
Help page of JavaView in Html format.
|
static java.lang.String |
HOMEPAGE
Homepage of JavaView.
|
static java.lang.String |
JAVAVIEW_LOGO
Relative path and name of JavaView textual logo image.
|
static boolean |
JV_LITE |
static int |
m_osId
Identifier of current operating system.
|
static int |
NUM_OF_ARCHIVES
Number of jar archives available to a JavaView installation.
|
static int |
NUM_OF_RESOURCES
Number of language resource.
|
static int |
OS_IRIX
Identifier of Silicon Graphics Irix operating system.
|
static int |
OS_LINUX
Identifier of Linux operating system.
|
static int |
OS_OTHER
Identifier of unknown other operating system.
|
static int |
OS_SOLARIS
Identifier of Sun Solaris operating system.
|
static int |
OS_WIN
Identifier of Microsoft Windows operating systems.
|
static java.lang.String[] |
RESOURCE_NAME
Strings identifying a language resource.
|
static int |
VERSION_DTD_JVD
Identifier to receive the version number of the JVD dtd which this
JavaView program implements.
|
static int |
VERSION_DTD_JVF
Identifier to receive the version number of the JVF dtd which this
JavaView program implements.
|
static int |
VERSION_DTD_JVR
Identifier to receive the version number of the JVR dtd which this
JavaView program implements.
|
static int |
VERSION_DTD_JVV
Identifier to receive the version number of the JVV dtd which this
JavaView program implements.
|
static int |
VERSION_DTD_JVX
Identifier to receive the version number of the JVX dtd which this
JavaView program implements.
|
Constructor and Description |
---|
PsConfig() |
Modifier and Type | Method and Description |
---|---|
static java.applet.Applet |
getApplet()
Get applet if run as applet.
|
static java.lang.String |
getAuthors()
Get author names separated by comma as single string
|
static java.lang.String |
getCodeBase()
Get codebase of current applet or application.
|
static java.lang.String[] |
getContributors()
Get list of contributors as array of strings.
|
static java.lang.String |
getCopyright()
Get copyright notice as string.
|
static java.lang.String |
getEmail()
Get email contact address of JavaView as string.
|
static char |
getFileSeparator()
Always return "/", and do not use system file separator.
|
static java.awt.Font |
getFont(int type)
Get font for specific textual application type, like FONT_TEXT, FONT_HEADER2 etc.
|
static java.awt.Frame |
getFrame()
Get frame to be used as parent frame for dialogs.
|
static java.lang.String |
getHomepage()
Get homepage of JavaView as string.
|
static java.lang.String |
getImageIcon()
Get relative path and name of JavaView icon image as string.
|
static java.lang.String |
getImageLaunch()
Get relative path and name of JavaView launch image as string.
|
static java.lang.String |
getImageToolbar()
Get relative path and name of JavaView toolbar image as string.
|
static java.lang.String |
getJavaViewLogo()
Get relative path and name of JavaView logo image as string.
|
static java.lang.String |
getLanguage()
Get the current language used in localizations.
|
static java.util.Locale |
getLocale()
Get the current language locale, for example, for number formatting.
|
static java.lang.String |
getMessage(boolean bNew,
int groupId,
java.lang.String keyval)
Temporary method to get localized translation of message.
|
static java.lang.String |
getMessage(int key)
Get localized translation of message.
|
static java.lang.String |
getMessage(java.lang.String key)
Get localized translation of message.
|
static int |
getOSId()
Get index of current operating system.
|
static java.lang.String |
getOSName()
Get name of operating system as string.
|
static java.lang.String |
getParameter(java.lang.String name)
Return a parameter from the system properties list.
|
static java.lang.String |
getProgram()
Get name of program as string.
|
static java.lang.String |
getProgramAndVersion()
Get name of program and version number as single string.
|
static java.lang.String |
getProject()
Get name of project as string.
|
static java.util.Hashtable |
getProperties()
Get JavaView and system properties.
|
static java.lang.String |
getTopic()
Get topic of current version as string.
|
static java.lang.String |
getUserBase()
Get user directory of current application from where JavaView was launched.
|
static java.lang.String |
getVersion()
Get version number as string.
|
static int[] |
getVersion(int id)
Get the version number of a JavaView resource.
|
static PsViewerIf |
getViewer()
Get viewer.
|
static boolean |
hasArchive(int archiveID)
Test whether this applet or application has access to
a certain JavaView archive.
|
static void |
init(java.applet.Applet applet,
java.awt.Frame frame)
Initialize this configuration class.
|
static void |
init(java.applet.Applet applet,
PsViewerIf viewer,
java.awt.Frame frame)
Initialize this configuration class.
|
static boolean |
isApplication()
Returns
true if run as application, else false . |
static boolean |
isDev()
Temporary method, avoid usage.
|
static void |
parseArgs(java.lang.String[] args,
java.util.Properties props)
Store given command-line arguments as system properties by adding to each
parameter to the system properties list.
|
static void |
reset()
Clear all registered instances of applet, frame and viewer.
|
static void |
runGC()
Finalize and run system gc until not further gain up to a
total of 40 gc loops.
|
static void |
runGC(int intensity,
int loops)
Finalize and run system gc until not further gain up to a
total of 40 gc loops.
|
static void |
setApplication(boolean flag)
Determines status of this program if running as applet or application.
|
static void |
setCodeBase(java.lang.String aCodeBase)
Set codebase of current applet or application.
|
static boolean |
setFont(int os,
int type,
java.lang.String name,
int style,
int size)
Set font for specific textual application type, like FONT_TEXT, FONT_HEADER2 etc.
|
static void |
setLanguage(java.lang.String language)
Set the current language used in localizations.
|
static void |
setUserBase(java.lang.String userBase) |
public static final java.lang.String[] AUTHOR
getAuthors()
public static java.lang.String[] CONTRIBUTOR
public static java.lang.String HOMEPAGE
public static java.lang.String EMAIL
public static java.lang.String HELP_HTML
public static java.lang.String FONTS_HTML
public static java.lang.String JAVAVIEW_LOGO
public static final int VERSION_DTD_JVX
JVX files conforming to the version 1.00.001 or later of the jvx.dtd (and with minor changes since version 0.98.000) will validate against future versions of the jvx.dtd. This is called "forward compatibility" of the JVX dtd.
The forward compatibility of JVX files includes that JVX files generated with this JavaView program will be correctly displayed by in future versions of JavaView.
public static final int VERSION_DTD_JVD
public static final int VERSION_DTD_JVR
public static final int VERSION_DTD_JVF
public static final int VERSION_DTD_JVV
public static final int OS_WIN
public static final int OS_IRIX
public static final int OS_SOLARIS
public static final int OS_LINUX
public static final int OS_OTHER
public static int m_osId
public static final int FONT_TEXT
public static final int FONT_FIXED
public static final int FONT_MENU
public static final int FONT_HEADER2
public static final int FONT_HEADER4
public static final int ARCHIVE_JV
public static final int ARCHIVE_JVX
public static final int ARCHIVE_VGP
public static final int ARCHIVE_DEV
public static final int ARCHIVE_DEV6
public static final java.lang.String[] ARCHIVE_NAME
public static final int NUM_OF_ARCHIVES
public static final boolean JV_LITE
public static final int NUM_OF_RESOURCES
public static final java.lang.String[] RESOURCE_NAME
public static boolean isApplication()
true
if run as application, else false
.
E.g. applet.stub is not initialized when applet does not run in browser.
This information is used e.g. in PsDebug when displaying status messages.
JavaView runs as application if and only if the argument frame != null
in PsConfig.init(Applet,Frame)
.
Therefore it is essential to call PsConfig.init
.
Usually, this initialization is automatically done in the constructor of PvViewer,
but it can be done by hand, if no PvViewer is created.
public static void setApplication(boolean flag)
isApplication()
public static java.applet.Applet getApplet()
public static java.awt.Frame getFrame()
PsConfig.init(Applet,Frame)
this
frame is return. Otherwise an invisible new frame is generated upon the first invocation.public static PsViewerIf getViewer()
PsViewerIf
,
PvViewerIf
,
PvViewer.PvViewer(Applet, Frame)
public static void runGC()
public static void runGC(int intensity, int loops)
public static void reset()
Calling init() after a reset() will lead to a full new initialization of this class. If no reset() is invoked, subsequent init() calls will be ignored after the first init() call.
init(Applet, Frame)
public static void init(java.applet.Applet applet, PsViewerIf viewer, java.awt.Frame frame)
public static void init(java.applet.Applet applet, java.awt.Frame frame)
If argument frame == null
and applet != null
then program
runs as applet, and applet is used to access codebase etc.
Otherwise, the program runs as application.
Initialization must be done as soon as possible in an applet or application since system properties are parsed and evaluated. Usually, method is called automatically in the constructor of PvViewer.
reset()
public static int[] getVersion(int id)
getVersion()
public static java.util.Locale getLocale()
setLanguage(String)
public static java.lang.String getLanguage()
public static void setLanguage(java.lang.String language)
getMessage(String)
will return
a message in the selected language.
This method does not change any existing labels or menu items which must be done by hand at other place.
language
- Two letter id of language in {"de", "en", ...}public static boolean hasArchive(int archiveID)
public static java.lang.String getMessage(int key)
Usage of this method reduces the Java archives since the message string is no longer multiply stored.
key
- message identifier whose localized text is requestedgetMessage(String)
public static java.lang.String getMessage(boolean bNew, int groupId, java.lang.String keyval)
bNew
- if true then return keyval, else return getMessage(keyval)groupId
- five digit integer representing a message groupkeyval
- either value or key of a messagegetMessage(String)
public static java.lang.String getMessage(java.lang.String key)
If using the default language or if the current resource bundle failed
to deliver the requested message, then use message from the default language.
The messages of the default language are store in PsResource
.
key
- message identifier whose localized text is requestedgetMessage(int)
public static java.lang.String getAuthors()
public static java.lang.String[] getContributors()
public static java.lang.String getEmail()
public static java.lang.String getHomepage()
public static java.lang.String getTopic()
public static java.lang.String getCopyright()
public static java.lang.String getVersion()
getVersion(int)
public static java.lang.String getJavaViewLogo()
public static java.lang.String getImageIcon()
public static java.lang.String getImageLaunch()
public static java.lang.String getImageToolbar()
public static java.lang.String getProgram()
public static java.lang.String getProgramAndVersion()
public static java.lang.String getProject()
public static java.lang.String getOSName()
null
if not identified.getOSId()
public static int getOSId()
OS_WIN
is used as default. Use method getOSName()
to check
whether system could be identified.OS_WIN
if not identified.getOSName()
public static java.util.Hashtable getProperties()
public static void parseArgs(java.lang.String[] args, java.util.Properties props)
property=valueNote, parameters containing blanks should be enclosed in quotes.
There are two exceptions:
1. JavaView model files.
JavaView model files may either be specified using the above property=value scheme
or simply as a single or list of files.
For example, filenames specified in a model parameter are
model=myFile.jvxor
model=myFile1.jvx;myFile2.objand, alternatively, filenames may appear as blank separated list of filenames such as
myFile.jvxor
myFile1.jvx myFile2.objIn the later case the property "model" is automatically generated and multiply geometry files are concatenated with ";"-separators in a single "model" property.
2. JavaView display files:
A single display file may be passed to JavaView similar like model files either
as a property
displayFile=myFile.jvdor simply as a filename (which is detected by its filename extension JVD)
myFile.jvd
public static java.lang.String getParameter(java.lang.String name)
name
- Name of parameter whose value is requested, not case-sensitive.public static java.lang.String getUserBase()
getCodeBase()
public static void setUserBase(java.lang.String userBase)
getCodeBase()
public static java.lang.String getCodeBase()
This method just returns the codebase as string. The codebase was most likely
automatically determined in init(Applet,Frame)
, or it was assigned using
setCodeBase(String)
.
If JavaView runs as application then the codeBase ends with current file separator.
init(Applet,Frame)
,
getFileSeparator()
public static void setCodeBase(java.lang.String aCodeBase)
If JavaView runs as application then the codeBase ends with current file separator.
If JavaView is running locally within a web page then some browser use the the "file:" protocol to access local files. In this case, some browsers, notably IE, modify the codebase and replace blanks with %20. This leads to a FileNotFoundException when later reading a local file. I solved this problem by replacing any %20 in a codebase argument of this method if the codebase starts with "file:".
aCodeBase
- new codebasegetFileSeparator()
public static char getFileSeparator()
public static java.awt.Font getFont(int type)
public static boolean setFont(int os, int type, java.lang.String name, int style, int size)
Use JavaView applet SystemFonts
to show a list all available fonts.
os
- identifier of operating system among OS_WIN etc. If os==-1 use current osId.type
- identifier among FONT_TEXT, FONT_HEADER2 etc.name
- name of font such as SansSerif, Monospaced etc. If name==null ignore name.style
- use among Font.PLAIN, Font.BOLD etc. If style==-1 ignore style.size
- any size which is supported by Java and operating system.public static final boolean isDev()
"