BeeSoft®
Since 1992
 

Content

 Welcome
 Products
       Abeona
       Gaia
       Hephaistos
       JavaGantt
             Features
             News
             Documentation
                   Programming domain objects
                   About JavaGantt model
                   Undo / Redo support
                   Localization support
                   Building a treetable
                   Painting a chart
                   Working with the time scale
                   JavaGantt actions
             License
             Download
             Purchase
 Services
       Promote your software
 Contact Us
 Links
      
  JavaGanttI®
© 2012 BeeSoft ®
 

Localization (internationalization)

The JavaGantt components (treetable columns and actions) intense use resource bundle technique. These methods of JavaGantt are about resource bundles:

  1. String getResourceBundleName () - returns the name of the resource bundle.
  2. void setResourceBundleName (String) - sets the name of resource bundle. This name must according to java.util.ResourceBundle specification. Resource bundle is then used to construct treetable columns and gantt actions.

But resource bundle may be accessed also if you don't set its name explicitly. So how does it work?

The main class for these purposes is eu.beesoft.gaia.util.Language. In the Swing environment is a singleton (but it has a public constructor, so you can create as many instances as you need in server environment). The singleton is accessible via method


      Language.getInstance ();

which returns last created instance of Language. Using Language has big advantage when you change application's Locale. Setting this into Language provides for all LanguageListeners notification to easy reloading texts from resource bundles.

When you take a look at Language API documentation, you can see method getText() with first argument either a resource bundle name or some object. These methods are used from JavaGantt and its subcomponents.

  1. if resource bundle name is set (by method JavaGantt.setResourceBundleName()), this resource bundle is constructed and used. Note, that resource bundle name must have a form of class name.
  2. if no resource bundle name is set, then the name of current JavaGantt class (its subclass) is taken and used to find resource. If resource is not found, or key with given name is not found, Language class takes a superclass name and repeats searching.

So if you don't use method JavaGantt.setResourceBundleName(), you must create a properties file in the same package where your JavaGantt subclass is stored and with the same name as thas subclass has. In that case it will work without explicitly setting the resource bundle name and you can use the advantages of inheritance.