JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util
Class JCEnvironment

java.lang.Object
  |
  +--com.klg.jclass.util.JCEnvironment

public class JCEnvironment
extends Object

Static routines to provide environment information.


Field Summary
static String FILE_CHOOSER_MULTI_SELECTS
          Swing bug where file chooser does not allow multiple selection of files to work correctly.
static String FOCUS_RECT_IN_JTABLE
          Refers to a selection bug in JTable in which the selection model's anchor and lead do not get updated correctly if rows are added or deleted from the table's model.
static String HTML_IN_COMPONENTS
          Netscape bug that prevents HTML in Swing components from appearing.
protected static int javaVersion
           
protected static String javaVersionString
           
static String MOTIF_PREFERED_WIDTH_AJUSTMENT
          Motif bug where calculating the prefered size of the spinbox renderer is initialy calculated smaller then it needs to be once it is displayed.
static String MOTIF_TREE_LEAF_ICON
          Swing bug where Motif Tree Leaf Look and Feel Icon always draws from x = 0, no matter what x value you pass it.
static String PRINTING_USE_2ND_CALL
          Calls to the Printable interface's print() method can happen multiple times per page.
static String SET_RESIZABLE_TO_FALSE_ON_DIALOGS
          Motif bug where calling setResizable(false) causes a dialog to grow without bound.
protected static String vendorString
           
static int WORKING_NO
           
static int WORKING_UNKNOWN
           
static int WORKING_YES
           
 
Constructor Summary
JCEnvironment()
           
 
Method Summary
static Applet getApplet(Component comp)
          Follows the component's parents until a parent applet is found.
static AppletContext getAppletContext(Applet applet)
          Gets the component's applet context.
static int getJavaVersion()
          Returns the version of the JDK for easy numeric comparison.
static String getVendorString()
          Retrieves and caches the vendor String.
static String getVersionString()
          Retrieves and caches the version String.
static boolean inBrowser(Component comp)
          Returns true if the component is in an applet in a browser (in other words, its AppletContext is not null).
static boolean isDesignTime()
          Globally useful isDesignTime check.
static boolean isMetal()
          Is the current Look and Feel Metal?
static boolean isMotif()
          Is the current Look and Feel Motif?
static boolean isNetBeansDesignTime()
          Environment is design-time in NetBeans.
static boolean isPJAToolkit()
          Returns true if the PJA toolkit is currently being used.
static boolean isVisualCafe()
          Environment is Symantec Visual Cafe.
static boolean isWindows()
          Is the current Look and Feel Windows?
static int isWorking(String feature)
          Returns YES or NO if the answer to the question is known; otherwise it returns UNKNOWN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORKING_UNKNOWN

public static final int WORKING_UNKNOWN
See Also:
Constant Field Values

WORKING_YES

public static final int WORKING_YES
See Also:
Constant Field Values

WORKING_NO

public static final int WORKING_NO
See Also:
Constant Field Values

FILE_CHOOSER_MULTI_SELECTS

public static final String FILE_CHOOSER_MULTI_SELECTS
Swing bug where file chooser does not allow multiple selection of files to work correctly.

See Also:
Constant Field Values

MOTIF_TREE_LEAF_ICON

public static final String MOTIF_TREE_LEAF_ICON
Swing bug where Motif Tree Leaf Look and Feel Icon always draws from x = 0, no matter what x value you pass it.

See Also:
Constant Field Values

SET_RESIZABLE_TO_FALSE_ON_DIALOGS

public static final String SET_RESIZABLE_TO_FALSE_ON_DIALOGS
Motif bug where calling setResizable(false) causes a dialog to grow without bound.

See Also:
Constant Field Values

MOTIF_PREFERED_WIDTH_AJUSTMENT

public static final String MOTIF_PREFERED_WIDTH_AJUSTMENT
Motif bug where calculating the prefered size of the spinbox renderer is initialy calculated smaller then it needs to be once it is displayed. This will return an ajustment value that can be added to the width.

See Also:
Constant Field Values

HTML_IN_COMPONENTS

public static final String HTML_IN_COMPONENTS
Netscape bug that prevents HTML in Swing components from appearing.

See Also:
Constant Field Values

PRINTING_USE_2ND_CALL

public static final String PRINTING_USE_2ND_CALL
Calls to the Printable interface's print() method can happen multiple times per page. In some cases (jdk 1.4 & Windows for one), it is the second call that has the real graphics class needed for correct formatting based on printer font metrics.

See Also:
Constant Field Values

FOCUS_RECT_IN_JTABLE

public static final String FOCUS_RECT_IN_JTABLE
Refers to a selection bug in JTable in which the selection model's anchor and lead do not get updated correctly if rows are added or deleted from the table's model. This manifests itself in JCTreeTable because we add/delete rows every time we expand or collapse a node.

See Also:
Constant Field Values

javaVersionString

protected static String javaVersionString

vendorString

protected static String vendorString

javaVersion

protected static int javaVersion
Constructor Detail

JCEnvironment

public JCEnvironment()
Method Detail

isWorking

public static int isWorking(String feature)
Returns YES or NO if the answer to the question is known; otherwise it returns UNKNOWN.

This will be extended in the future as platform specific bugs appear, since many problems are specific to many versions or many different platforms. All knowledge of the problem will be encasulated (hidden) in this class to make it easier to track and implement multiple manifestations of the problem and to make the workarounds more legible and maintainable.

A String based lookup method is used so that the API remains constant, even as this class handles more and more divergent cases.

Parameters:
feature -
Returns:
YES or NO if the answer to the question is known; otherwise it returns UNKNOWN

getJavaVersion

public static int getJavaVersion()
Returns the version of the JDK for easy numeric comparison. Return value looks like the following: 120 for 1.2.0.

An additional reason for this is that historically the vendor provided version is sometimes inconsistent. If the version String is not found, or if there is a parsing error, then the return value is -1.

Returns:
version of the JCK

getVersionString

public static String getVersionString()
Retrieves and caches the version String.

Returns:
version String

isMotif

public static boolean isMotif()
Is the current Look and Feel Motif?

Returns:
true, if the current L&F is Motif.

isWindows

public static boolean isWindows()
Is the current Look and Feel Windows?

Returns:
true, if the current L&F is Windows.

isMetal

public static boolean isMetal()
Is the current Look and Feel Metal?

Returns:
true, if the current L&F is Metal.

isDesignTime

public static boolean isDesignTime()
Globally useful isDesignTime check. This will take into account environments that don't set java.beans.isDesignTime.

Returns:

isNetBeansDesignTime

public static boolean isNetBeansDesignTime()
Environment is design-time in NetBeans.

Returns:

isVisualCafe

public static boolean isVisualCafe()
Environment is Symantec Visual Cafe.

Returns:

getVendorString

public static String getVendorString()
Retrieves and caches the vendor String.

Returns:

getApplet

public static Applet getApplet(Component comp)
Follows the component's parents until a parent applet is found. Returns null if no applet is found.

Parameters:
comp -
Returns:
null if no applet is found

getAppletContext

public static AppletContext getAppletContext(Applet applet)
Gets the component's applet context. The applet context lets an applet control the applet's environment, which is usually the browser or the applet viewer.

Parameters:
applet -
Returns:
null if the component is not in an applet or the applet is not in a browser
See Also:
Applet.getAppletContext()

inBrowser

public static boolean inBrowser(Component comp)
Returns true if the component is in an applet in a browser (in other words, its AppletContext is not null).

Parameters:
comp -
Returns:
true if the component is in an applet in a browser

isPJAToolkit

public static boolean isPJAToolkit()
Returns true if the PJA toolkit is currently being used.

Returns:
true if the PJA toolkit is currently being used.

Copyright © 2004 Quest Software Inc..
All rights reserved.