/[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 2 by mojays, Tue Feb 24 22:43:52 2009 UTC revision 34 by alfonx, Sat Mar 28 18:08:42 2009 UTC
# Line 88  public class TranslationAskJDialog exten Line 88  public class TranslationAskJDialog exten
88    
89          /**          /**
90           * 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
91           * to PROPERTY_APPLY_AND_CLOSE events.           * to PROPERTY_APPLY_AND_CLOSE events. This dialog is modal. The dialog has
92           * This dialog is modal. The dialog has to be set visible afterwards.           * to be set visible afterwards.
93           */           */
94          public TranslationAskJDialog(Window owner,          public TranslationAskJDialog(Window owner,
95                          final JComponent... translationEditJPanels) {                          final JComponent... translationEditJPanels) {
96                  super(owner);                  super(owner);
97                  this.translationEditJPanelsOrJustComponents = translationEditJPanels;                  this.translationEditJPanelsOrJustComponents = translationEditJPanels;
98                  init();                  init();
99    
100                    // Rememebr backups for all the jtextpanels
101                    int count = 0;
102                    for (JComponent component : translationEditJPanelsOrJustComponents) {
103                            if (component instanceof TranslationEditJPanel) {
104                                    TranslationEditJPanel tep = (TranslationEditJPanel) component;
105                                    Translation orig = tep.getTranslation();
106                                    
107                                    // We don't want to overwrite the Translation object on
108                                    // restore(). We just want to change its value.
109    
110                                    backup[count++] = orig.toOneLine();
111                            }
112                    }
113          }          }
114    
115          private void init() {          private void init() {
# Line 136  public class TranslationAskJDialog exten Line 150  public class TranslationAskJDialog exten
150                  for (JComponent component : translationEditJPanelsOrJustComponents) {                  for (JComponent component : translationEditJPanelsOrJustComponents) {
151                          if (component instanceof TranslationEditJPanel) {                          if (component instanceof TranslationEditJPanel) {
152                                  TranslationEditJPanel tep = (TranslationEditJPanel) component;                                  TranslationEditJPanel tep = (TranslationEditJPanel) component;
153                                  tep.getTranslation().fromOneLine(backup[count]);                                  tep.getTranslation().fromOneLine(backup[count++]);
154                          }                          }
                         count++;  
155                  }                  }
156          }          }
157    
# Line 233  public class TranslationAskJDialog exten Line 246  public class TranslationAskJDialog exten
246          }          }
247    
248          /**          /**
249           * After the modal dialog has been closed, this allows to find out, wether the dialog has been canceled.           * After the modal dialog has been closed, this allows to find out, whether
250           * @return           * the dialog has been canceled.
251             *
252             * @return <code>true</code> if the {@link JDialog} has been canceled.
253           */           */
254          public boolean isHasBeenCanceled() {          public boolean isHasBeenCanceled() {
255                  return hasBeenCanceled;                  return hasBeenCanceled;

Legend:
Removed from v.2  
changed lines
  Added in v.34

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26