/[schmitzm]/trunk/src/skrueger/swing/TranslationJTextField.java
ViewVC logotype

Diff of /trunk/src/skrueger/swing/TranslationJTextField.java

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

revision 711 by alfonx, Fri Feb 19 01:09:35 2010 UTC revision 976 by alfonx, Thu Aug 12 14:14:08 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.swing;  package skrueger.swing;
31    
# Line 47  import skrueger.i8n.Translation; Line 47  import skrueger.i8n.Translation;
47   * listener is automatically registered with the {@link Translation} to update   * listener is automatically registered with the {@link Translation} to update
48   * on {@link Translation} changes.   * on {@link Translation} changes.
49   *   *
50   * @author Stefan Alfons Krüger   * @author Stefan Alfons Tzeggai
51   *   *
52   */   */
53  public class TranslationJTextField extends JTextField {  public class TranslationJTextField extends JTextField {
# Line 122  public class TranslationJTextField exten Line 122  public class TranslationJTextField exten
122                          public void actionPerformed(ActionEvent e) {                          public void actionPerformed(ActionEvent e) {
123                                  // LOGGER.debug("ActionListener called ");                                  // LOGGER.debug("ActionListener called ");
124    
125  //                              if (e.getSource() == trans)                                  // if (e.getSource() == trans)
126  //                              // && langCode.equals(e.getActionCommand()))                                  // // && langCode.equals(e.getActionCommand()))
127  //                              {                                  // {
128  //                                      // LOGGER.debug(" and omittet!\n");                                  // // LOGGER.debug(" and omittet!\n");
129  //                                      return;                                  // return;
130  //                              }                                  // }
131  //                              LOGGER.debug(" and performed!\n");                                  // LOGGER.debug(" and performed!\n");
132                                  String newString = trans.get(langCode);                                  String newString = trans.get(langCode);
133                                  if (newString == null)                                  if (newString == null)
134                                          newString = "";                                          newString = "";
135                                  if ((newString != null && !newString.equals(getText()))) {                                  if ((newString != null && !newString.equals(getText()))) {
136  //                                      LOGGER.debug("Setting text to " + newString                                          // LOGGER.debug("Setting text to " + newString
137  //                                                      + " becuse oldString was " + getText());                                          // + " becuse oldString was " + getText());
138                                          setText(newString);  
139                                            try {
140                                                    setText(newString);
141                                            } catch (java.lang.IllegalStateException ee) {
142                                                    /*
143                                                     *
144                                                     * ERROR Geopublisher uncaughtException An uncaught
145                                                     * exception happened on Thread
146                                                     * Thread[AWT-EventQueue-0,6,main]
147                                                     * java.lang.IllegalStateException: Attempt to mutate in
148                                                     * notification at
149                                                     * javax.swing.text.AbstractDocument.writeLock
150                                                     * (AbstractDocument.java:1323) at
151                                                     * javax.swing.text.AbstractDocument
152                                                     * .replace(AbstractDocument.java:644) at
153                                                     * javax.swing.text
154                                                     * .JTextComponent.setText(JTextComponent.java:1693) at
155                                                     * skrueger
156                                                     * .swing.TranslationJTextField$2.actionPerformed
157                                                     * (TranslationJTextField.java:138) at
158                                                     * skrueger.i8n.Translation
159                                                     * .fireTranslationChangedEvents(Translation.java:358)
160                                                     * at skrueger.i8n.Translation.put(Translation.java:365)
161                                                     * atskrueger.swing.TranslationJTextField.checkValid(
162                                                     * TranslationJTextField.java:184) at
163                                                     * skrueger.swing.TranslationJTextField$1
164                                                     * .removeUpdate(TranslationJTextField.java:104) at
165                                                     * javax.swing.text.AbstractDocument.fireRemoveUpdate(
166                                                     * AbstractDocument.java:243) _
167                                                     */
168                                                    LOGGER.warn(ee);
169                                            }
170                                  }                                  }
171                          }                          }
172    
# Line 183  public class TranslationJTextField exten Line 214  public class TranslationJTextField exten
214                  if (!trimmedText.equals(trans.get(langCode)))                  if (!trimmedText.equals(trans.get(langCode)))
215                          trans.put(langCode, trimmedText);                          trans.put(langCode, trimmedText);
216          }          }
217  //          //
218  //      ActionListener listenToChangesOfTheTranslationAndUpdateTheGUI = new ActionListener() {          // ActionListener listenToChangesOfTheTranslationAndUpdateTheGUI = new
219  //          // ActionListener() {
220  //              @Override          //
221  //              public void actionPerformed(ActionEvent e) {          // @Override
222  //                      if (!hasFocus())          // public void actionPerformed(ActionEvent e) {
223  //                              translationChangedExternally();          // if (!hasFocus())
224  //              }          // translationChangedExternally();
225  //      };          // }
226  //          // };
227  //      /**          //
228  //       * Call it when the translation object has changed to update the JTextFields          // /**
229  //       */          // * Call it when the translation object has changed to update the
230  //      public void translationChangedExternally() {          // JTextFields
231  //              setText(trans.get(langCode));          // */
232  //      }          // public void translationChangedExternally() {
233            // setText(trans.get(langCode));
234            // }
235    
236  }  }

Legend:
Removed from v.711  
changed lines
  Added in v.976

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26