Back to index

wims  3.65+svn20090927
Static Public Member Functions | Static Public Attributes | Static Protected Attributes | Static Package Functions | Static Package Attributes
rene.gui.Global Class Reference

The Global class. More...

Collaboration diagram for rene.gui.Global:
Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static void makeFonts ()
static Font createfont (String name, String def, int defsize, boolean bold)
static void makeColors ()
static Enumeration names ()
static String name (String tag, String def)
static String name (String tag)
static void initBundle (String file, boolean language)
static void initBundle (String file)
static synchronized Enumeration properties ()
static synchronized void loadProperties (InputStream in)
static synchronized boolean loadPropertiesFromResource (String filename)
static synchronized boolean loadProperties (String filename)
static synchronized void loadProperties (String dir, String filename)
static synchronized void loadPropertiesInHome (String filename)
static synchronized void clearProperties ()
static synchronized void saveProperties (String text)
static void saveProperties (String text, String filename)
static synchronized void setParameter (String key, boolean value)
static synchronized boolean getParameter (String key, boolean def)
static synchronized String getParameter (String key, String def)
static synchronized void setParameter (String key, String value)
static synchronized int getParameter (String key, int def)
static synchronized void setParameter (String key, int value)
static synchronized double getParameter (String key, double def)
static synchronized void setParameter (String key, double value)
static synchronized Color getParameter (String key, Color c)
static synchronized Color getParameter (String key, int red, int green, int blue)
static synchronized void setParameter (String key, Color c)
static synchronized void removeParameter (String key)
 Remove a specific Paramater.
static synchronized void removeAllParameters (String start)
 Remove all Parameters that start with the string.
static synchronized void resetDefaults (String defaults)
 Set default values for parameters resetDefaults("default.") is the same as: setParameter("xxx",getParameter("default.xxx","")); if "default.xxx" has a value.
static void resetDefaults ()
static synchronized boolean haveParameter (String key)
static void warning (String s)
static void setApplet (boolean flag)
static boolean isApplet ()
static double getJavaVersion ()
static double convert (String s)
static synchronized String getUserDir ()
static synchronized void exit (int i)
static void main (String args[])

Static Public Attributes

static Font NormalFont = null
static Color Background = null
static String AppletClipboard = null
static boolean IsApplet = false
static Object ExitBlock = new Object()

Static Protected Attributes

static ResourceBundle B

Static Package Functions

 [static initializer]
 [static initializer]

Static Package Attributes

static Font FixedFont = null
static Font BoldFont = null
static Color ControlBackground = null
static Properties P = new Properties()
static String ConfigName
static Frame F = null

Detailed Description

The Global class.

This class will load a resource bundle with local support. It will set various things from this resource file.

Definition at line 27 of file Global.java.


Member Function Documentation

rene.gui.Global.[static initializer] ( ) [inline, static, package]
rene.gui.Global.[static initializer] ( ) [inline, static, package]
static synchronized void rene.gui.Global.clearProperties ( ) [inline, static]

Definition at line 185 of file Global.java.

       {      P=new Properties();
       }
static double rene.gui.Global.convert ( String  s) [inline, static]

Definition at line 381 of file Global.java.

       {      try
              {      return Integer.parseInt(s);
              }
              catch (Exception e)
              {      return 0;
              }
       }

Here is the caller graph for this function:

static Font rene.gui.Global.createfont ( String  name,
String  def,
int  defsize,
boolean  bold 
) [inline, static]

Definition at line 45 of file Global.java.

       {      String fontname=getParameter(name+".name",def);
              String mode=getParameter(name+".mode","plain");
           if (bold || mode.equals("bold"))
           {   return new Font(fontname,
                     Font.BOLD,getParameter(name+".size",defsize));
           }
           else if (mode.equals("italic"))
           {   return new Font(fontname,
                     Font.ITALIC,getParameter(name+".size",defsize));
           }
           else
           {   return new Font(fontname,
                     Font.PLAIN,Global.getParameter(name+".size",defsize));
           }      
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized void rene.gui.Global.exit ( int  i) [inline, static]

Definition at line 397 of file Global.java.

       {      synchronized (ExitBlock)
              {      System.exit(i);
              }
       }

Here is the caller graph for this function:

static double rene.gui.Global.getJavaVersion ( ) [inline, static]

Definition at line 362 of file Global.java.

       {      String version=System.getProperty("java.version");
              if (version==null) return 0.0;
              double v=0.0;
              StringTokenizer t=new StringTokenizer(version,".");
              if (t.hasMoreTokens())
              {      v=convert(t.nextToken());
              }
              else return v;
              if (t.hasMoreTokens())
              {      v=v+convert(t.nextToken())/10;
              }
              else return v;
              if (t.hasMoreTokens())
              {      v=v+convert(t.nextToken())/100;
              }
              return v;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized boolean rene.gui.Global.getParameter ( String  key,
boolean  def 
) [inline, static]

Definition at line 205 of file Global.java.

       {      try
              {      String s=P.getProperty(key);
                     if (s.equals("true")) return true;
                     else if (s.equals("false")) return false;
                     return def;
              }
              catch (Exception e)
              {      return def;
              }
       }

Here is the call graph for this function:

static synchronized String rene.gui.Global.getParameter ( String  key,
String  def 
) [inline, static]

Definition at line 216 of file Global.java.

       {      String res=def;
              try
              {      res=P.getProperty(key);
              }
              catch (Exception e) {}
              if (res!=null)
              {      if (res.startsWith("$")) res=res.substring(1);
                     return res;
              }
              else return def;
       }

Here is the call graph for this function:

static synchronized int rene.gui.Global.getParameter ( String  key,
int  def 
) [inline, static]

Definition at line 234 of file Global.java.

       {      try
              {      return Integer.parseInt(getParameter(key,""));
              }
              catch (Exception e)
              {      try
                     {      double x=new Double(getParameter(key,"")).doubleValue();
                            return (int)x;
                     }
                     catch (Exception ex) {}
                     return def;
              }
       }

Here is the call graph for this function:

static synchronized double rene.gui.Global.getParameter ( String  key,
double  def 
) [inline, static]

Definition at line 250 of file Global.java.

       {      try
              {      return new Double(getParameter(key,"")).doubleValue();
              }
              catch (Exception e)
              {      return def;
              }
       }

Here is the call graph for this function:

static synchronized Color rene.gui.Global.getParameter ( String  key,
Color  c 
) [inline, static]

Definition at line 261 of file Global.java.

       {      String s=getParameter(key,"");
              if (s.equals("")) return c;
              StringParser p=new StringParser(s);
              p.replace(',',' ');
              int red,green,blue;
              red=p.parseint(); green=p.parseint(); blue=p.parseint();
              try
              {      return new Color(red,green,blue);
              }
              catch (RuntimeException e)
              {      return c;
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized Color rene.gui.Global.getParameter ( String  key,
int  red,
int  green,
int  blue 
) [inline, static]

Definition at line 275 of file Global.java.

       {      String s=getParameter(key,"");
              if (s.equals("")) return new Color(red,green,blue);
              StringParser p=new StringParser(s);
              p.replace(',',' ');
              red=p.parseint(); green=p.parseint(); blue=p.parseint();
              try
              {      return new Color(red,green,blue);
              }
              catch (RuntimeException e)
              {      return Color.black;
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized String rene.gui.Global.getUserDir ( ) [inline, static]

Definition at line 390 of file Global.java.

       {      String dir=System.getProperty("user.dir");
              return FileName.canonical(dir);
       }

Here is the call graph for this function:

static synchronized boolean rene.gui.Global.haveParameter ( String  key) [inline, static]
Returns:
if I have such a parameter.

Definition at line 332 of file Global.java.

       {      try
              {      String res=P.getProperty(key);
                     if (res==null) return false;
              }
              catch (Exception e) { return false; }
              return true;
       }

Here is the caller graph for this function:

static void rene.gui.Global.initBundle ( String  file,
boolean  language 
) [inline, static]

Definition at line 99 of file Global.java.

       {      try
              {      B=ResourceBundle.getBundle(file);
                     String lang=getParameter("language","");
                     if (language && !lang.equals("") && !lang.equals("default"))
                     {      String langsec="";
                            if (lang.length()>3 && lang.charAt(2)=='_')
                            {      langsec=lang.substring(3);
                                   lang=lang.substring(0,2);
                            }
                            Locale.setDefault(new Locale(lang,langsec));
                            initBundle(file,false);
                     }
              }
              catch (RuntimeException e)
              {      B=null;
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static void rene.gui.Global.initBundle ( String  file) [inline, static]

Definition at line 117 of file Global.java.

       {      initBundle(file,false);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static boolean rene.gui.Global.isApplet ( ) [inline, static]

Definition at line 358 of file Global.java.

{ return IsApplet; }
static synchronized void rene.gui.Global.loadProperties ( InputStream  in) [inline, static]

Definition at line 126 of file Global.java.

       {      try
              {      P=new Properties();
                     P.load(in);
                     in.close();
              }
              catch (Exception e)
              {      P=new Properties();
              }
       }

Here is the caller graph for this function:

static synchronized boolean rene.gui.Global.loadProperties ( String  filename) [inline, static]

Definition at line 151 of file Global.java.

       {      ConfigName=filename;
              try
              {      FileInputStream in=new FileInputStream(filename);
                     P=new Properties();
                     P.load(in);
                     in.close();
              }
              catch (Exception e)
              {      P=new Properties();
                     return false;
              }
              return true;
       }
static synchronized void rene.gui.Global.loadProperties ( String  dir,
String  filename 
) [inline, static]

Definition at line 165 of file Global.java.

       {      try
              {      Properties p=System.getProperties();
                     ConfigName=dir+
                            p.getProperty("file.separator")+filename;
                     loadProperties(ConfigName);
              }
              catch (Exception e)
              {      P=new Properties();
              }
       }

Here is the call graph for this function:

static synchronized boolean rene.gui.Global.loadPropertiesFromResource ( String  filename) [inline, static]

Definition at line 136 of file Global.java.

       {      try
              {      Object G=new Object();
                     InputStream in=G.getClass().getResourceAsStream(filename);
                     P=new Properties();
                     P.load(in);
                     in.close();
              }
              catch (Exception e)
              {      P=new Properties();
                     return false;
              }
              ConfigName=filename;
              return true;
       }
static synchronized void rene.gui.Global.loadPropertiesInHome ( String  filename) [inline, static]

Definition at line 176 of file Global.java.

       {      try
              {      Properties p=System.getProperties();
                     loadProperties(p.getProperty("user.home"),filename);
              }
              catch (Exception e)
              {      P=new Properties();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static void rene.gui.Global.main ( String  args[]) [inline, static]

Definition at line 403 of file Global.java.

       {      try
              {      System.out.println(new Color(4,5,600));
              }
              catch (RuntimeException e) {}
       }
static void rene.gui.Global.makeColors ( ) [inline, static]

Definition at line 69 of file Global.java.

       {      if (haveParameter("color.background"))
                     Background=getParameter("color.background",Color.gray.brighter());
              else Background=SystemColor.window;
              if (haveParameter("color.control"))
                     ControlBackground=getParameter("color.control",Color.gray.brighter());
              else ControlBackground=SystemColor.control;
       }

Here is the call graph for this function:

static void rene.gui.Global.makeFonts ( ) [inline, static]

Definition at line 32 of file Global.java.

       {      NormalFont=createfont(
                     "normalfont","SansSerif",12,false);
              FixedFont=createfont(
                     "fixedfont","Monospaced",12,false);
              BoldFont=createfont(
                     "fixedfont","Monospaced",12,true);
       }      

Here is the call graph for this function:

static String rene.gui.Global.name ( String  tag,
String  def 
) [inline, static]

Definition at line 85 of file Global.java.

       {      String s;
              if (B==null) return def;
              try
              {      s=B.getString(tag);
              }
              catch (Exception e)
              {      s=def;
              }
              return s;
       }

Here is the call graph for this function:

static String rene.gui.Global.name ( String  tag) [inline, static]

Definition at line 96 of file Global.java.

       {      return name(tag,tag.substring(tag.lastIndexOf(".")+1));
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static Enumeration rene.gui.Global.names ( ) [inline, static]

Definition at line 81 of file Global.java.

       {      if (B!=null) return B.getKeys(); 
              else return null;
       }

Here is the caller graph for this function:

static synchronized Enumeration rene.gui.Global.properties ( ) [inline, static]

Definition at line 125 of file Global.java.

{ return P.keys(); }

Here is the caller graph for this function:

static synchronized void rene.gui.Global.removeAllParameters ( String  start) [inline, static]

Remove all Parameters that start with the string.

Definition at line 300 of file Global.java.

       {      Enumeration e=P.keys();
              while (e.hasMoreElements())
              {      String key=(String)e.nextElement();
                     if (key.startsWith(start))
                     {      P.remove((Object)key);
                     }
              }      
       }

Here is the caller graph for this function:

static synchronized void rene.gui.Global.removeParameter ( String  key) [inline, static]

Remove a specific Paramater.

Definition at line 294 of file Global.java.

       {      P.remove((Object)key);
       }

Here is the caller graph for this function:

static synchronized void rene.gui.Global.resetDefaults ( String  defaults) [inline, static]

Set default values for parameters resetDefaults("default.") is the same as: setParameter("xxx",getParameter("default.xxx","")); if "default.xxx" has a value.

Parameters:
defaults

Definition at line 316 of file Global.java.

       {      Enumeration e=P.keys();
              while (e.hasMoreElements())
              {      String key=(String)e.nextElement();
                     if (key.startsWith(defaults))
                     {      setParameter(key.substring(defaults.length()),
                                   getParameter(key,""));
                     }
              }      
       }

Here is the call graph for this function:

static void rene.gui.Global.resetDefaults ( ) [inline, static]

Definition at line 326 of file Global.java.

       {      resetDefaults("default.");
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized void rene.gui.Global.saveProperties ( String  text) [inline, static]

Definition at line 188 of file Global.java.

       {      try
              {      FileOutputStream out=new FileOutputStream(ConfigName);
                     P.save(out,text);
                     out.close();
              }
              catch (Exception e) {}
       }

Here is the caller graph for this function:

static void rene.gui.Global.saveProperties ( String  text,
String  filename 
) [inline, static]

Definition at line 196 of file Global.java.

Here is the call graph for this function:

static void rene.gui.Global.setApplet ( boolean  flag) [inline, static]

Definition at line 357 of file Global.java.

{ IsApplet=flag; }
static synchronized void rene.gui.Global.setParameter ( String  key,
boolean  value 
) [inline, static]

Definition at line 200 of file Global.java.

       {      if (P==null) return;
              if (value) P.put(key,"true");
              else P.put(key,"false");
       }
static synchronized void rene.gui.Global.setParameter ( String  key,
String  value 
) [inline, static]

Definition at line 228 of file Global.java.

       {      if (P==null) return;
              if (value.length()>0 && Character.isSpaceChar(value.charAt(0)))
                     value="$"+value;
              P.put(key,value);
       }
static synchronized void rene.gui.Global.setParameter ( String  key,
int  value 
) [inline, static]

Definition at line 247 of file Global.java.

       {      setParameter(key,""+value);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized void rene.gui.Global.setParameter ( String  key,
double  value 
) [inline, static]

Definition at line 258 of file Global.java.

       {      setParameter(key,""+value);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static synchronized void rene.gui.Global.setParameter ( String  key,
Color  c 
) [inline, static]

Definition at line 288 of file Global.java.

       {      setParameter(key,""+c.getRed()+","+c.getGreen()+","+c.getBlue());
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static void rene.gui.Global.warning ( String  s) [inline, static]

Definition at line 344 of file Global.java.

       {      if (F==null)
              {      F=new Frame();
              }
              Warning W=new Warning(F,s,name("warning"),false);
              W.center();
              W.show();
       }

Here is the call graph for this function:


Member Data Documentation

String rene.gui.Global.AppletClipboard = null [static]

Definition at line 354 of file Global.java.

ResourceBundle rene.gui.Global.B [static, protected]

Definition at line 79 of file Global.java.

Color rene.gui.Global.Background = null [static]

Definition at line 63 of file Global.java.

Font rene.gui.Global.BoldFont = null [static, package]

Definition at line 30 of file Global.java.

String rene.gui.Global.ConfigName [static, package]

Definition at line 123 of file Global.java.

Color rene.gui.Global.ControlBackground = null [static, package]

Definition at line 63 of file Global.java.

Object rene.gui.Global.ExitBlock = new Object() [static]

Definition at line 395 of file Global.java.

Frame rene.gui.Global.F = null [static, package]

Definition at line 343 of file Global.java.

Font rene.gui.Global.FixedFont = null [static, package]

Definition at line 30 of file Global.java.

Definition at line 356 of file Global.java.

Font rene.gui.Global.NormalFont = null [static]

Definition at line 30 of file Global.java.

Properties rene.gui.Global.P = new Properties() [static, package]

Definition at line 122 of file Global.java.


The documentation for this class was generated from the following file: