/[schmitzm]/branches/2.3.x/src/skrueger/i8n/Translation.java
ViewVC logotype

Diff of /branches/2.3.x/src/skrueger/i8n/Translation.java

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

trunk/src/skrueger/i8n/Translation.java revision 292 by alfonx, Wed Aug 5 12:34:15 2009 UTC branches/1.0-gt2-2.6/src/skrueger/i8n/Translation.java revision 409 by alfonx, Fri Sep 18 15:00:29 2009 UTC
# Line 42  import java.util.Random; Line 42  import java.util.Random;
42  import javax.swing.JComponent;  import javax.swing.JComponent;
43    
44  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
45    import org.opengis.util.InternationalString;
46    
47  /**  /**
48   * Represents a {@link HashMap} of translations. toString() returns the   * Represents a {@link HashMap} of translations. toString() returns the
# Line 192  public class Translation extends HashMap Line 193  public class Translation extends HashMap
193           */           */
194          public void fromOneLine(final String oneLineCoded) {          public void fromOneLine(final String oneLineCoded) {
195                  clear();                  clear();
196                    
197                  if ((oneLineCoded == null) || (oneLineCoded.equals(""))) {                  if ((oneLineCoded == null) || (oneLineCoded.equals(""))) {
198                          put(DEFAULT_KEY, "");                          put(DEFAULT_KEY, "");
199                          return;                          return;
# Line 315  public class Translation extends HashMap Line 317  public class Translation extends HashMap
317                  return actionListeners.remove(actionListener);                  return actionListeners.remove(actionListener);
318          }          }
319    
320          public void fireTranslationChangedEvents() {          public void fireTranslationChangedEvents(String lang) {
321                  ActionEvent ae = new ActionEvent(this, new Random().nextInt(),  "");                  ActionEvent ae = new ActionEvent(this, new Random().nextInt(), lang);
322                                    
323                  for (ActionListener al : actionListeners) {                  for (ActionListener al : actionListeners) {
324                          al.actionPerformed( ae);                          al.actionPerformed( ae);
# Line 324  public class Translation extends HashMap Line 326  public class Translation extends HashMap
326          }          }
327                    
328          @Override          @Override
329          public String put(String key, String value) {          public String put(String lang, String value) {
330                  String result = super.put(key, value);                  String result = super.put(lang, value);
331                  fireTranslationChangedEvents();                  fireTranslationChangedEvents(lang);
332                  return result;                  return result;
333          }          }
334    
335            public void fromOneLine(InternationalString iString) {
336                    if (iString != null)
337                            fromOneLine(iString.toString());
338                    else
339                            fromOneLine((String)null);
340            }
341                    
342                    
343  }  }

Legend:
Removed from v.292  
changed lines
  Added in v.409

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26