/[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 33 by alfonx, Sat Mar 28 17:06:27 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                                    // We dont' want to overwrite the Translation object on
107                                    // restore(). We just want to change its values.
108    
109                                    backup[count++] = orig.toOneLine();
110                            }
111                    }
112          }          }
113    
114          private void init() {          private void init() {
# Line 136  public class TranslationAskJDialog exten Line 149  public class TranslationAskJDialog exten
149                  for (JComponent component : translationEditJPanelsOrJustComponents) {                  for (JComponent component : translationEditJPanelsOrJustComponents) {
150                          if (component instanceof TranslationEditJPanel) {                          if (component instanceof TranslationEditJPanel) {
151                                  TranslationEditJPanel tep = (TranslationEditJPanel) component;                                  TranslationEditJPanel tep = (TranslationEditJPanel) component;
152                                  tep.getTranslation().fromOneLine(backup[count]);                                  tep.getTranslation().fromOneLine(backup[count++]);
153                          }                          }
                         count++;  
154                  }                  }
155          }          }
156    
# Line 233  public class TranslationAskJDialog exten Line 245  public class TranslationAskJDialog exten
245          }          }
246    
247          /**          /**
248           * 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, wether
249             * the dialog has been canceled.
250             *
251           * @return           * @return
252           */           */
253          public boolean isHasBeenCanceled() {          public boolean isHasBeenCanceled() {

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26