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() { |
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 |
|
|
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; |