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

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

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

revision 38 by alfonx, Sun Apr 5 15:06:56 2009 UTC revision 116 by alfonx, Wed May 13 17:37:11 2009 UTC
# Line 82  public class TranslationAskJDialog exten Line 82  public class TranslationAskJDialog exten
82           * This class handles the cancel button itself. You may still want to listen           * This class handles the cancel button itself. You may still want to listen
83           * to PROPERTY_APPLY_AND_CLOSE events. This dialog is modal. The dialog has           * to PROPERTY_APPLY_AND_CLOSE events. This dialog is modal. The dialog has
84           * to be set visible afterwards.<br/>           * to be set visible afterwards.<br/>
85             *
86             * @param owner
87             *            A component of the GUI that this dialog is related to. If no
88             *            {@link Window} is passed, SwingUtil.getParentWindow(owner) is
89             *            called.
90           */           */
91          public TranslationAskJDialog(Window owner,          public TranslationAskJDialog(Component owner,
92                          final JComponent... translationEditJPanels) {                          final JComponent... translationEditJPanels) {
93                  super(owner);                  super(owner instanceof Window ? (Window) owner : SwingUtil
94                                    .getParentWindow(owner));
95                  setComponents(translationEditJPanels);                  setComponents(translationEditJPanels);
96          }          }
97    
# Line 101  public class TranslationAskJDialog exten Line 107  public class TranslationAskJDialog exten
107           * Using this constructor, you have to call setComponents afterwards.           * Using this constructor, you have to call setComponents afterwards.
108           */           */
109          public TranslationAskJDialog(Window owner) {          public TranslationAskJDialog(Window owner) {
110                  super(owner);                  this(owner, new JComponent[] {});
111          }          }
112    
113          /**          /**
# Line 199  public class TranslationAskJDialog exten Line 205  public class TranslationAskJDialog exten
205                                  public void actionPerformed(ActionEvent evt) {                                  public void actionPerformed(ActionEvent evt) {
206                                          TranslationAskJDialog.this.firePropertyChange(                                          TranslationAskJDialog.this.firePropertyChange(
207                                                          PROPERTY_APPLY_AND_CLOSE, null, null);                                                          PROPERTY_APPLY_AND_CLOSE, null, null);
208                                            
209                                          if (!checkValidInputs()) return;                                          if (!checkValidInputs())
210                                                                                            return;
211    
212                                          setVisible(false);                                          setVisible(false);
213                                          dispose();                                          dispose();
214                                  }                                  }
# Line 229  public class TranslationAskJDialog exten Line 236  public class TranslationAskJDialog exten
236          }          }
237    
238          /**          /**
239           * @return <code>true</code> if none of the translations contains illegal characters.           * @return <code>true</code> if none of the translations contains illegal
240             *         characters.
241           */           */
242          protected boolean checkValidInputs() {          protected boolean checkValidInputs() {
243                    
244                  for (JComponent component : translationEditJPanelsOrJustComponents) {                  for (JComponent component : translationEditJPanelsOrJustComponents) {
245                          if (component instanceof TranslationEditJPanel) {                          if (component instanceof TranslationEditJPanel) {
246                                  TranslationEditJPanel tep = (TranslationEditJPanel) component;                                  TranslationEditJPanel tep = (TranslationEditJPanel) component;
247                                    
248                                  for (String l : tep.getTranslation().values()){                                  for (String l : tep.getTranslation().values()) {
249                                          if ( l.contains("{") || l.contains("}")) {                                          if (l.contains("{") || l.contains("}")) {
250                                                  JOptionPane.showMessageDialog(this, RESOURCE.getString("ErrorMsg.InvalidCharacterInTranslation"));                                                  JOptionPane
251                                                                    .showMessageDialog(
252                                                                                    this,
253                                                                                    RESOURCE
254                                                                                                    .getString("ErrorMsg.InvalidCharacterInTranslation"));
255                                                  return false;                                                  return false;
256                                          }                                          }
257                                  }                                  }
258                                    
259                          }                          }
260                  }                  }
261                    
                   
262                  return true;                  return true;
263          }          }
264    

Legend:
Removed from v.38  
changed lines
  Added in v.116

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26