de.kleopatra.view.presentation
Class DefaultBundleHandler

java.lang.Object
  extended byde.kleopatra.view.presentation.DefaultBundleHandler
All Implemented Interfaces:
BundleHandler

public class DefaultBundleHandler
extends java.lang.Object
implements BundleHandler

Default implementation of localization support.

Version:
$Revision: 1.1.1.1 $ - $Date: 2004/08/19 11:18:33 $
Author:
(C) 2004 Jeanette Winzenburg, Berlin

Nested Class Summary
static class DefaultBundleHandler.DescriptionComparator
           
 
Constructor Summary
DefaultBundleHandler()
           
 
Method Summary
 java.lang.String createMarker(java.lang.Object formID, boolean startBlock)
           
protected  java.lang.String getResourceBundleName(Presentation presentation)
          encapsulates strategy to find an appropriate resourceBundle name.
 void localize(Presentation presentation, java.lang.Class targetClass)
          Find a resourceBundle in the default locale and apply to all presentation attributes of the given presentation.
 void updateBundle(Presentation presentation, java.net.URL bundle)
          Merge the presentation attributes of the presentation into the properties found at the file location bundle.
 void updatePresentation(java.util.ResourceBundle bundle, Presentation presentation)
          Apply the resourceBundle to all presentation attributes of the presentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBundleHandler

public DefaultBundleHandler()
Method Detail

updateBundle

public void updateBundle(Presentation presentation,
                         java.net.URL bundle)
Description copied from interface: BundleHandler
Merge the presentation attributes of the presentation into the properties found at the file location bundle.

If there the file does not yet exist, it will be created. If the file already exists it should be encoded like Properties (that is ISO 8859-1 with escaped unicode chars). A block representing the attributes should be written (replacing a possible existing block for this presentation), unrelated content is preserved as is.

Specified by:
updateBundle in interface BundleHandler
Parameters:
presentation -
bundle -
See Also:

Here: synch is "all-or-nothing" on a presentation basis - if the bundle contains a block of entries for the given presentation the complete block will be overwritten.


updatePresentation

public void updatePresentation(java.util.ResourceBundle bundle,
                               Presentation presentation)
Description copied from interface: BundleHandler
Apply the resourceBundle to all presentation attributes of the presentation.

Specified by:
updatePresentation in interface BundleHandler
Parameters:
bundle -
presentation -
See Also:

Here: Synch is "all-or-nothing" on a presentationDescription basis - if the resourceBundle contains any key for a component, all existing attributes are cleared and the keys as contained in the bundle are set.


localize

public void localize(Presentation presentation,
                     java.lang.Class targetClass)
Description copied from interface: BundleHandler
Find a resourceBundle in the default locale and apply to all presentation attributes of the given presentation.

Specified by:
localize in interface BundleHandler
Parameters:
presentation -
targetClass -

getResourceBundleName

protected java.lang.String getResourceBundleName(Presentation presentation)
encapsulates strategy to find an appropriate resourceBundle name.

Here: first check the Presentation, if it does not carry a resourceBundle, check the UIManager for a shared bundle. The result may be null. Subclasses may override for a different strategy.


createMarker

public java.lang.String createMarker(java.lang.Object formID,
                                     boolean startBlock)


Copyright © 2003, 2004 SwingEmpire Jeanette Winzenburg. All Rights Reserved.