JavaView© v3.95.000

jv.object
Class PsConfig

java.lang.Object
  extended byjv.object.PsConfig

public final class PsConfig
extends java.lang.Object

Static configuration class of JavaView with global static variables. The class must be initialized with current applet and frame. Initialization is automatically done in 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).


Field Summary
static int ARCHIVE_DEV
          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
          Image file with JavaView logo.
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_JVX
          Identifier to receive the version number of the JVX dtd which this JavaView program implements.
 
Constructor Summary
PsConfig()
           
 
Method Summary
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 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 getProgram()
          Get name of program as 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()
          Deprecated. the viewer should be made available through other mechanisms.
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 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHOR

public static final java.lang.String[] AUTHOR
Array of author names.

See Also:
getAuthors()

CONTRIBUTOR

public static java.lang.String[] CONTRIBUTOR
Deprecated. use method getContributors() to access list of contributors.

Array of contributor names.


HOMEPAGE

public static final java.lang.String HOMEPAGE
Homepage of JavaView.

See Also:
Constant Field Values

EMAIL

public static final java.lang.String EMAIL
Email address for contact.

See Also:
Constant Field Values

HELP_HTML

public static final java.lang.String HELP_HTML
Help page of JavaView in Html format.

See Also:
Constant Field Values

FONTS_HTML

public static final java.lang.String FONTS_HTML
Page with an applet showing available system fonts.

See Also:
Constant Field Values

JAVAVIEW_LOGO

public static final java.lang.String JAVAVIEW_LOGO
Image file with JavaView logo.

See Also:
Constant Field Values

VERSION_DTD_JVX

public static final int VERSION_DTD_JVX
Identifier to receive the version number of the JVX dtd which this JavaView program implements.

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 compatibity" 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.

See Also:
Constant Field Values

VERSION_DTD_JVD

public static final int VERSION_DTD_JVD
Identifier to receive the version number of the JVD dtd which this JavaView program implements.

See Also:
Constant Field Values

VERSION_DTD_JVR

public static final int VERSION_DTD_JVR
Identifier to receive the version number of the JVR dtd which this JavaView program implements.

See Also:
Constant Field Values

VERSION_DTD_JVF

public static final int VERSION_DTD_JVF
Identifier to receive the version number of the JVF dtd which this JavaView program implements.

See Also:
Constant Field Values

OS_WIN

public static final int OS_WIN
Identifier of Microsoft Windows operating systems.

See Also:
Constant Field Values

OS_IRIX

public static final int OS_IRIX
Identifier of Silicon Graphics Irix operating system.

See Also:
Constant Field Values

OS_SOLARIS

public static final int OS_SOLARIS
Identifier of Sun Solaris operating system.

See Also:
Constant Field Values

OS_LINUX

public static final int OS_LINUX
Identifier of Linux operating system.

See Also:
Constant Field Values

OS_OTHER

public static final int OS_OTHER
Identifier of unknown other operating system.

See Also:
Constant Field Values

m_osId

public static int m_osId
Identifier of current operating system.


FONT_TEXT

public static final int FONT_TEXT
Identifier of text font used in panels.

See Also:
Constant Field Values

FONT_FIXED

public static final int FONT_FIXED
Identifier of fixed (i.e. non-proportional) text font used in panels.

See Also:
Constant Field Values

FONT_MENU

public static final int FONT_MENU
Identifier of menu font used in panels.

See Also:
Constant Field Values

FONT_HEADER2

public static final int FONT_HEADER2
Identifier of header font used in panels.

See Also:
Constant Field Values

FONT_HEADER4

public static final int FONT_HEADER4
Identifier of sub header font used in panels.

See Also:
Constant Field Values

ARCHIVE_JV

public static final int ARCHIVE_JV
ID if the base JavaView jar archive.

See Also:
Constant Field Values

ARCHIVE_JVX

public static final int ARCHIVE_JVX
ID if the expansion JavaView jar archive.

See Also:
Constant Field Values

ARCHIVE_VGP

public static final int ARCHIVE_VGP
ID if the vgp application JavaView jar archive.

See Also:
Constant Field Values

ARCHIVE_DEV

public static final int ARCHIVE_DEV
ID if the development JavaView jar archive.

See Also:
Constant Field Values

ARCHIVE_NAME

public static final java.lang.String[] ARCHIVE_NAME
Strings used as identifiers of jar archives available to a JavaView installation.


NUM_OF_ARCHIVES

public static final int NUM_OF_ARCHIVES
Number of jar archives available to a JavaView installation.

See Also:
Constant Field Values

JV_LITE

public static final boolean JV_LITE
See Also:
Constant Field Values

NUM_OF_RESOURCES

public static final int NUM_OF_RESOURCES
Number of language resource.

See Also:
Constant Field Values

RESOURCE_NAME

public static final java.lang.String[] RESOURCE_NAME
Strings identifying a language resource. Currently, just use the same identifiers as for archives.

Constructor Detail

PsConfig

public PsConfig()
Method Detail

isApplication

public static boolean isApplication()
Returns 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 contructor of PvViewer, but it can be done by hand, if no PvViewer is created.

See Also:
init(Applet, PsViewerIf, Frame), PvViewer.PvViewer(Applet, Frame)

setApplication

public static void setApplication(boolean flag)
Determines status of this program if running as applet or application.

See Also:
isApplication()

getApplet

public static java.applet.Applet getApplet()
Get applet if run as applet.


getFrame

public static java.awt.Frame getFrame()
Get frame to be used as parent frame for dialogs. If a frame has been specified as argument of PsConfig.init(Applet,Frame) this frame is return. Otherwise an invisible new frame is generated upon the first invocation.


getViewer

public static PsViewerIf getViewer()
Deprecated. the viewer should be made available through other mechanisms.

Get viewer. Viewer manages the 3d-displays, control window, and list of projects. It is the central class in JavaView, and usually created at the beginning of an applet or application. This instance variable gives access to PvViewer, e.g. to show/hide dialogs and panels.

See Also:
PsViewerIf, PvViewerIf, PvViewer.PvViewer(Applet, Frame)

runGC

public static void runGC()
Finalize and run system gc until not further gain up to a total of 40 gc loops.

Since:
JavaView v2.22.001

runGC

public static void runGC(int intensity,
                         int loops)
Finalize and run system gc until not further gain up to a total of 40 gc loops.

Since:
JavaView v2.22.001

reset

public static void reset()
Clear all registered instances of applet, frame and viewer. Method should be invoked when applets are being destroyed in order to speed up the garbage collection.

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.

Since:
JavaView v2.22.001
See Also:
init(Applet, Frame)

init

public static void init(java.applet.Applet applet,
                        PsViewerIf viewer,
                        java.awt.Frame frame)
Initialize this configuration class.

See Also:
PvViewer.PvViewer(Applet, Frame), init(Applet, Frame), reset()

init

public static void init(java.applet.Applet applet,
                        java.awt.Frame frame)
Initialize this configuration class.

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.

See Also:
reset()

getVersion

public static int[] getVersion(int id)
Get the version number of a JavaView resource.

Returns:
array with three integers with major, minor and built number.
See Also:
getVersion()

getLocale

public static java.util.Locale getLocale()
Get the current language locale, for example, for number formatting. Default locale is English. Locale is determined by the current language setting.

Returns:
current locale
See Also:
setLanguage(String)

getLanguage

public static java.lang.String getLanguage()
Get the current language used in localizations.

Returns:
two letter id of language in {"de", "en", ...}

setLanguage

public static void setLanguage(java.lang.String language)
Set the current language used in localizations. Any subsequent call of 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.

Parameters:
language - Two letter id of language in {"de", "en", ...}

hasArchive

public static boolean hasArchive(int archiveID)
Test whether this applet or application has access to a certain JavaView archive. This test tries to find a class by name within the given archive. The class-for-name test is performed only once during the first search for that archive.

Since:
JavaView 2.38

getMessage

public static java.lang.String getMessage(int key)
Get localized translation of message. Never set an interface label or menu entry directly with a string but always call this method to obtain the localized version of the current locale.

Usage of this method reduces the Java archives since the message string is no longer multiply stored.

Parameters:
key - message identifier whose localized text is requested
Returns:
message message in localized form for use as label etc
See Also:
getMessage(String)

getMessage

public static java.lang.String getMessage(boolean bNew,
                                          int groupId,
                                          java.lang.String keyval)
Temporary method to get localized translation of message. This method will soon be replaced by getMessage(int).

Parameters:
bNew - if true then return keyval, else return getMessage(keyval)
groupId - five digit integer representing a message group
keyval - either value or key of a message
Returns:
message message in localized form for use as label etc
See Also:
getMessage(String)

getMessage

public static java.lang.String getMessage(java.lang.String key)
Get localized translation of message. Never set an interface label or menu entry directly with a string but always call this method to obtain the localized version of the current locale.

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.

Parameters:
key - message identifier whose localized text is requested
Returns:
message message in localized form for use as label etc
See Also:
getMessage(int)

getAuthors

public static java.lang.String getAuthors()
Get author names separated by comma as single string


getContributors

public static java.lang.String[] getContributors()
Get list of contributors as array of strings.


getEmail

public static java.lang.String getEmail()
Get email contact address of JavaView as string.


getHomepage

public static java.lang.String getHomepage()
Get homepage of JavaView as string.


getTopic

public static java.lang.String getTopic()
Get topic of current version as string.


getCopyright

public static java.lang.String getCopyright()
Get copyright notice as string.


getVersion

public static java.lang.String getVersion()
Get version number as string.

See Also:
getVersion(int)

getJavaViewLogo

public static java.lang.String getJavaViewLogo()
Get relative path and name of JavaView logo image as string.


getImageIcon

public static java.lang.String getImageIcon()
Get relative path and name of JavaView icon image as string.


getImageLaunch

public static java.lang.String getImageLaunch()
Get relative path and name of JavaView launch image as string.


getProgram

public static java.lang.String getProgram()
Get name of program as string.


getProject

public static java.lang.String getProject()
Get name of project as string.


getOSName

public static java.lang.String getOSName()
Get name of operating system as string. Might not be available because of security restrictions.

Returns:
name of operating system, or null if not identified.
See Also:
getOSId()

getOSId

public static int getOSId()
Get index of current operating system. Index determines the behaviour of JavaView such as font names and sizes. If operating system could not be identified, for example, because of security restrictions, then OS_WIN is used as default. Use method getOSName() to check whether system could be identified.

Returns:
name of operating system, or OS_WIN if not identified.
See Also:
getOSName()

getProperties

public static java.util.Hashtable getProperties()
Get JavaView and system properties. Call 'System.getProperties()' led to a security exception. Replace by single direct calls 'System.getProperty(String)'


getUserBase

public static java.lang.String getUserBase()
Get user directory of current application from where JavaView was launched.

Since:
JavaView 3.09.003
See Also:
getCodeBase()

setUserBase

public static void setUserBase(java.lang.String userBase)
Since:
JavaView 3.09.003
See Also:
getCodeBase()

getCodeBase

public static java.lang.String getCodeBase()
Get codebase of current applet or application.

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.

See Also:
init(Applet,Frame), getFileSeparator()

setCodeBase

public static void setCodeBase(java.lang.String aCodeBase)
Set codebase of current applet or application. Usually the codebase is automatically determined by JavaView.

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:".

Parameters:
aCodeBase - new codebase
See Also:
getFileSeparator()

getFileSeparator

public static char getFileSeparator()
Always return "/", and do not use system file separator. Previously. the file separator of system properties was used, but since Java gives the separator of the client instead of the server this behaviour led to problems. Since on windows systems "/" seems to work we use it as default.


getFont

public static java.awt.Font getFont(int type)
Get font for specific textual application type, like FONT_TEXT, FONT_HEADER2 etc. Selected font size and name depends on current operating system.


setFont

public 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. Only those gui widgets are affected which are constructed AFTER this call, so this method should probably be called right after JavaView starts. Note, that in general only a rather small set of fonts and font characteristics are supported. Especially, fonts supported on one OS may not be supported on other systems.

Use JavaView applet SystemFonts to show a list all available fonts.

Parameters:
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.

isDev

public static final boolean isDev()
Temporary method, avoid usage.


JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.