org.rosuda.ibase
Class Common

java.lang.Object
  extended by org.rosuda.ibase.Common

public class Common
extends java.lang.Object

Common constants and gereral static methods for the entire application and ibase toolkit

Version:
$Id: Common.java 2589 2006-08-29 18:29:16Z urbaneks $

Field Summary
static java.lang.String appName
          application identifier (the first thing to do in main is to modify this)
static java.awt.Color aquaBgColor
          common background color when aqua-style background is used
static int AT_Framework
          AppType contstant: launched by interactive framework interface
static int AT_KOH
          AppType contstant: Klimt called by Omegahat SJava interface
static java.awt.Color backgroundColor
          common background color.
static Notifier breakDispatcher
          BREAK dispatcher for this application. check for null before use, since it is initialized only if BREAK event is supported *and* dispatched
static java.awt.Cursor cur_aim
          Cursor: aim or cross-hair (used for targeting exact point(s))
static java.awt.Cursor cur_arrow
          Cursor: arrow (all Common.cur_xxx variables are set by Platform class upon init)
static java.awt.Cursor cur_hand
          Cursor: hand (either pointing or dragging - not specified yet - for general use)
static java.awt.Cursor cur_move
          Cursor: move (usually 4 arrows but may as well be other symbol, e.g. dragging hand)
static java.awt.Cursor cur_query
          Cursor: query (usually arrow with a question mark)
static java.awt.Cursor cur_tick
          Cursor: tick hint/cue (usually arrow with a separator resize symbol)
static java.awt.Cursor cur_zoom
          Cursor: zoom (usually magnifying glass; should NOT contain + or -)
static java.awt.Font defaultFont
           
static double displayGamma
          display gamma setting (used by color conversion functions such as getHCLcolor(double, double, double)
static java.awt.Frame mainFrame
          main frame
static int NM_ActionEvent
           
static int NM_AxisChange
          Notify-Message constant: Axis changed
static int NM_AxisDataChange
          Notify-Message constant: value/data part of an Axis changed
static int NM_AxisGeometryChange
          Notify-Message constant: geometry part of an Axis changed
static int NM_BREAK
          Notify-Message constant: BREAK event - this one is usually not processed in Java but sent to the calling system.
static int NM_CatSeqChange
          Notify-Message constant: category sequence changed (fired by SCatSeqence) note that SCatSequence passes change events to SVar only if it is told to.
static int NM_ExtEvent
           
static int NM_MarkerChange
          Notify-Message constant: SMarker state changed
static int NM_MASK
          mask to apply in order to get the top-level event
static int NM_NodeChange
          Notify-Message constant: current node changed
static int NM_PrefsChanged
          Notify-Message constant: preferences have changed
static int NM_SecMarkerChange
          Notify-Message constant: SMarker state changed (secondary marks)
static int NM_VarChange
          Notify-Message constant: SVar changed
static int NM_VarContentChange
          Notify-Message constant: SVar changed: content of a variable changed
static int NM_VarSeqChange
          Notify-Message constant: SVar changed: sequence of categories changed
static int NM_VarSetChange
          Notify-Message constant: SVarSet changed (e.g. # of vars...)
static int NM_VarTypeChange
          Notify-Message constant: SVar changed: type (cat/num) changed
static boolean noIntVar
          if true no internal variables are created
static java.awt.Color objectsColor
          common objects color
static java.awt.Color popupColor
          common query popup background color
static java.lang.String Release
          ibase release
static java.awt.Dimension screenRes
          screen resolution as obtained from the toolkit.
static java.awt.Color selectColor
          common selection color (so far only BaseCanvas-based plots use this)
static boolean startRserv
          determines whether R-serve should be started if it's not running yet
static boolean supportsBREAK
          this flag is set to true by an external application if the underlying system supports the BREAK event
static boolean useSwing
           
static java.lang.String Version
          ibase version
 
Constructor Summary
Common()
           
 
Method Summary
static void addWarning(java.lang.String war)
          add an application warning/error
static void beginWorking(java.lang.String txt)
           
static void endWorking()
           
static void flushWarnings()
          clear all warnings
static double gammaAdjust(double u)
          adjusts RGB value according to the specified display gamma setting (see displayGamma)
static java.awt.event.WindowListener getDefaultWindowListener()
           
static java.awt.Color getHCLcolor(double hue)
           
static java.awt.Color getHCLcolor(double hue, double chroma)
           
static java.awt.Color getHCLcolor(double hue, double chroma, double luminance)
          transforms color defined in HCL space into RGB color
static java.awt.Dimension getScreenRes()
          returns screen resolution. the value is cached after first successful retrival
static int getSelectMode(java.awt.event.MouseEvent ev)
          get selection mode according to the modifiers.
static java.lang.String getTriGraph(java.lang.String s)
          returns a short form of the string given in s. it is more complex but tries to get a half-way sensible combination of letters from the word.
static java.lang.String getWarnings()
          get warnings/errors reported so far
static void initValuesFromConfigFile(PluginManager pm)
           
static boolean isExtQuery(java.awt.event.MouseEvent ev)
           
static boolean isMac()
          returns true if ran on an Apple Macintosh computer
static boolean isMoveTrigger(java.awt.event.MouseEvent ev)
          returns true if the supplied event corresponds to object-move trigger
static boolean isPopupTrigger(java.awt.event.MouseEvent ev)
          given mouse event this method determines whether pop-up sequence was triggered
static boolean isQueryTrigger(java.awt.event.MouseEvent ev)
          returns true if the supplied event corresponds to popup query trigger.
static boolean isSelectTrigger(java.awt.event.MouseEvent ev)
          "select" trigger is left mouse button(1) - none of Alt, Meta or other mouse keys may be pressed.
static boolean isZoomTrigger(java.awt.event.MouseEvent ev)
          given mouse event this method determines whether zoom sequence was triggered (middle mouse button or META on a Mac)
static void printEvent(java.awt.event.MouseEvent ev)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Version

public static java.lang.String Version
ibase version


Release

public static java.lang.String Release
ibase release


appName

public static java.lang.String appName
application identifier (the first thing to do in main is to modify this)


useSwing

public static boolean useSwing

startRserv

public static boolean startRserv
determines whether R-serve should be started if it's not running yet


AT_KOH

public static final int AT_KOH
AppType contstant: Klimt called by Omegahat SJava interface

See Also:
Constant Field Values

AT_Framework

public static final int AT_Framework
AppType contstant: launched by interactive framework interface

See Also:
Constant Field Values

screenRes

public static java.awt.Dimension screenRes
screen resolution as obtained from the toolkit.


backgroundColor

public static java.awt.Color backgroundColor
common background color. TFrame uses this as default


popupColor

public static java.awt.Color popupColor
common query popup background color


aquaBgColor

public static java.awt.Color aquaBgColor
common background color when aqua-style background is used


selectColor

public static java.awt.Color selectColor
common selection color (so far only BaseCanvas-based plots use this)


objectsColor

public static java.awt.Color objectsColor
common objects color


noIntVar

public static boolean noIntVar
if true no internal variables are created


defaultFont

public static java.awt.Font defaultFont

NM_MarkerChange

public static final int NM_MarkerChange
Notify-Message constant: SMarker state changed

See Also:
Constant Field Values

NM_SecMarkerChange

public static final int NM_SecMarkerChange
Notify-Message constant: SMarker state changed (secondary marks)

See Also:
Constant Field Values

NM_AxisChange

public static final int NM_AxisChange
Notify-Message constant: Axis changed

See Also:
Constant Field Values

NM_AxisGeometryChange

public static final int NM_AxisGeometryChange
Notify-Message constant: geometry part of an Axis changed

See Also:
Constant Field Values

NM_AxisDataChange

public static final int NM_AxisDataChange
Notify-Message constant: value/data part of an Axis changed

See Also:
Constant Field Values

NM_VarChange

public static final int NM_VarChange
Notify-Message constant: SVar changed

See Also:
Constant Field Values

NM_VarContentChange

public static final int NM_VarContentChange
Notify-Message constant: SVar changed: content of a variable changed

See Also:
Constant Field Values

NM_VarTypeChange

public static final int NM_VarTypeChange
Notify-Message constant: SVar changed: type (cat/num) changed

See Also:
Constant Field Values

NM_VarSeqChange

public static final int NM_VarSeqChange
Notify-Message constant: SVar changed: sequence of categories changed

See Also:
Constant Field Values

NM_VarSetChange

public static final int NM_VarSetChange
Notify-Message constant: SVarSet changed (e.g. # of vars...)

See Also:
Constant Field Values

NM_NodeChange

public static final int NM_NodeChange
Notify-Message constant: current node changed

See Also:
Constant Field Values

NM_CatSeqChange

public static final int NM_CatSeqChange
Notify-Message constant: category sequence changed (fired by SCatSeqence) note that SCatSequence passes change events to SVar only if it is told to. This allows other classes to maintain private category sequences independent of the variable's main sequence. This event is sent to the private dependents.

See Also:
Constant Field Values

NM_PrefsChanged

public static final int NM_PrefsChanged
Notify-Message constant: preferences have changed

See Also:
Constant Field Values

NM_BREAK

public static final int NM_BREAK
Notify-Message constant: BREAK event - this one is usually not processed in Java but sent to the calling system. Usually this event is used to stop an external event loop, such as an iPlots event loop.

See Also:
Constant Field Values

NM_ExtEvent

public static final int NM_ExtEvent
See Also:
Constant Field Values

NM_ActionEvent

public static final int NM_ActionEvent
See Also:
Constant Field Values

NM_MASK

public static final int NM_MASK
mask to apply in order to get the top-level event

See Also:
Constant Field Values

supportsBREAK

public static boolean supportsBREAK
this flag is set to true by an external application if the underlying system supports the BREAK event


breakDispatcher

public static Notifier breakDispatcher
BREAK dispatcher for this application. check for null before use, since it is initialized only if BREAK event is supported *and* dispatched


cur_arrow

public static java.awt.Cursor cur_arrow
Cursor: arrow (all Common.cur_xxx variables are set by Platform class upon init)


cur_query

public static java.awt.Cursor cur_query
Cursor: query (usually arrow with a question mark)


cur_tick

public static java.awt.Cursor cur_tick
Cursor: tick hint/cue (usually arrow with a separator resize symbol)


cur_hand

public static java.awt.Cursor cur_hand
Cursor: hand (either pointing or dragging - not specified yet - for general use)


cur_zoom

public static java.awt.Cursor cur_zoom
Cursor: zoom (usually magnifying glass; should NOT contain + or -)


cur_move

public static java.awt.Cursor cur_move
Cursor: move (usually 4 arrows but may as well be other symbol, e.g. dragging hand)


cur_aim

public static java.awt.Cursor cur_aim
Cursor: aim or cross-hair (used for targeting exact point(s))


mainFrame

public static java.awt.Frame mainFrame
main frame


displayGamma

public static double displayGamma
display gamma setting (used by color conversion functions such as getHCLcolor(double, double, double)

Constructor Detail

Common

public Common()
Method Detail

getDefaultWindowListener

public static java.awt.event.WindowListener getDefaultWindowListener()

initValuesFromConfigFile

public static void initValuesFromConfigFile(PluginManager pm)

isMac

public static boolean isMac()
returns true if ran on an Apple Macintosh computer


isPopupTrigger

public static boolean isPopupTrigger(java.awt.event.MouseEvent ev)
given mouse event this method determines whether pop-up sequence was triggered


isZoomTrigger

public static boolean isZoomTrigger(java.awt.event.MouseEvent ev)
given mouse event this method determines whether zoom sequence was triggered (middle mouse button or META on a Mac)


isQueryTrigger

public static boolean isQueryTrigger(java.awt.event.MouseEvent ev)
returns true if the supplied event corresponds to popup query trigger.


isMoveTrigger

public static boolean isMoveTrigger(java.awt.event.MouseEvent ev)
returns true if the supplied event corresponds to object-move trigger


isExtQuery

public static boolean isExtQuery(java.awt.event.MouseEvent ev)

isSelectTrigger

public static boolean isSelectTrigger(java.awt.event.MouseEvent ev)
"select" trigger is left mouse button(1) - none of Alt, Meta or other mouse keys may be pressed. the only optional ones are Shift (XOR) and Shift+Ctrl (OR) (see getSelectMode(java.awt.event.MouseEvent))

Returns:
true if supplied event triggers selection trigger

getSelectMode

public static int getSelectMode(java.awt.event.MouseEvent ev)
get selection mode according to the modifiers. Make sure isSelectTrigger(java.awt.event.MouseEvent) returns true otherwise the result of this function is invalid.

Returns:
0=replace, 1=XOR, 2=union

printEvent

public static void printEvent(java.awt.event.MouseEvent ev)

addWarning

public static void addWarning(java.lang.String war)
add an application warning/error


getWarnings

public static java.lang.String getWarnings()
get warnings/errors reported so far

Returns:
null if there are no warnings or string containing all warnings

flushWarnings

public static void flushWarnings()
clear all warnings


getTriGraph

public static java.lang.String getTriGraph(java.lang.String s)
returns a short form of the string given in s. it is more complex but tries to get a half-way sensible combination of letters from the word. first approach is to use capitals and numbers only. If that doesnt work then first letter+first consonant+last letter is used.

Parameters:
s - string to be abbreviated
Returns:
abbreviated string (mostly trigraph, but exceptions may include 4 letters)

getScreenRes

public static java.awt.Dimension getScreenRes()
returns screen resolution. the value is cached after first successful retrival

Returns:
screen resolution

beginWorking

public static void beginWorking(java.lang.String txt)

endWorking

public static void endWorking()

gammaAdjust

public static double gammaAdjust(double u)
adjusts RGB value according to the specified display gamma setting (see displayGamma)


getHCLcolor

public static java.awt.Color getHCLcolor(double hue,
                                         double chroma,
                                         double luminance)
transforms color defined in HCL space into RGB color

Parameters:
hue - - hue (in degrees, between 0.0 and 360.0). basic colors are at angles 0, 120, 240
chroma - - colorfullness of the color - unlike the saturation, chroma is an absolute value (default=35)
luminance - - brightness of the color relative to while (white=100; default=85)
Returns:
color object in RGB representation suitable for use in graphics

getHCLcolor

public static java.awt.Color getHCLcolor(double hue)

getHCLcolor

public static java.awt.Color getHCLcolor(double hue,
                                         double chroma)