/[schmitzm]/trunk/src/skrueger/i8n/Translation.java
ViewVC logotype

Diff of /trunk/src/skrueger/i8n/Translation.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/2.0-RC1/src/skrueger/i8n/Translation.java revision 615 by alfonx, Mon Dec 14 17:31:41 2009 UTC trunk/src/skrueger/i8n/Translation.java revision 862 by alfonx, Sat May 22 01:24:46 2010 UTC
# Line 25  Line 25 
25   *   *
26   * Contributors:   * Contributors:
27   *     Martin O. J. Schmitz - initial API and implementation   *     Martin O. J. Schmitz - initial API and implementation
28   *     Stefan A. Krüger - additional utility classes   *     Stefan A. Tzeggai - additional utility classes
29   ******************************************************************************/   ******************************************************************************/
30  package skrueger.i8n;  package skrueger.i8n;
31    
# Line 33  import java.awt.event.ActionEvent; Line 33  import java.awt.event.ActionEvent;
33  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
34  import java.beans.PropertyChangeEvent;  import java.beans.PropertyChangeEvent;
35  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
36    import java.io.Serializable;
37  import java.util.ArrayList;  import java.util.ArrayList;
38  import java.util.HashMap;  import java.util.HashMap;
39  import java.util.Iterator;  import java.util.Iterator;
# Line 58  import skrueger.geotools.Copyable; Line 59  import skrueger.geotools.Copyable;
59   */   */
60    
61  public class Translation extends HashMap<String, String> implements  public class Translation extends HashMap<String, String> implements
62                  Copyable<Translation> {                  Copyable<Translation>, Serializable {
63            
64            private static final long serialVersionUID = -347702744122305245L;
65            
66          public static final String LOCALECHANGE_PROPERTY = "localechange";          public static final String LOCALECHANGE_PROPERTY = "localechange";
67          public static final String NO_TRANSLATION = "NO TRANSLATION";          public static final String NO_TRANSLATION = "NO TRANSLATION";
68          public static final String DEFAULT_KEY = "default";          public static final String DEFAULT_KEY = "default";
# Line 77  public class Translation extends HashMap Line 81  public class Translation extends HashMap
81                  Locale locale = Locale.getDefault();                  Locale locale = Locale.getDefault();
82                  setActiveLang(locale.getLanguage());                  setActiveLang(locale.getLanguage());
83          }          }
84            
85            
86    
87          private WeakHashSet<ActionListener> actionListeners = new WeakHashSet<ActionListener>(          private WeakHashSet<ActionListener> actionListeners = new WeakHashSet<ActionListener>(
88                          ActionListener.class);                          ActionListener.class);
# Line 199  public class Translation extends HashMap Line 205  public class Translation extends HashMap
205           * <li>If format can't be recognized, the {@link String} is interpreted as           * <li>If format can't be recognized, the {@link String} is interpreted as
206           * the translation in the <code>{@value #DEFAULT_KEY}</code> language           * the translation in the <code>{@value #DEFAULT_KEY}</code> language
207           *           *
208           * @author Stefan Alfons Krüger           * @author Stefan Alfons Tzeggai
209           */           */
210          public void fromOneLine(final String oneLineCoded) {          public void fromOneLine(final String oneLineCoded) {
211    
# Line 240  public class Translation extends HashMap Line 246  public class Translation extends HashMap
246          /**          /**
247           * Exports the Translations to a String of the Format: "de{Baum}en{tree}"           * Exports the Translations to a String of the Format: "de{Baum}en{tree}"
248           *           *
249           * @author Stefan Alfons Krüger           * @author Stefan Alfons Tzeggai
250           */           */
251          public String toOneLine() {          public String toOneLine() {
252                  return I8NUtil.toOneLine(this);                  return I8NUtil.toOneLine(this);
# Line 335  public class Translation extends HashMap Line 341  public class Translation extends HashMap
341           */           */
342          public void addTranslationChangeListener(ActionListener actionListener) {          public void addTranslationChangeListener(ActionListener actionListener) {
343                  if (actionListeners.add(actionListener)) {                  if (actionListeners.add(actionListener)) {
344                          LOGGER  //                      LOGGER
345                                          .debug("registering a new translationChangeActionListener in the WeakHashSet");  //                                      .debug("registering a new translationChangeActionListener in the WeakHashSet");
346                  }                  }
347          }          }
348    

Legend:
Removed from v.615  
changed lines
  Added in v.862

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26