120 |
|
|
121 |
@Override |
@Override |
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); |
setText(newString); |
139 |
} |
} |
140 |
} |
} |
141 |
|
|
142 |
}; |
}; |
143 |
|
|
|
LOGGER.debug("registering translationChangeActionListener"); |
|
144 |
trans.addTranslationChangeListener(translationChangeActionListener); |
trans.addTranslationChangeListener(translationChangeActionListener); |
145 |
} |
} |
146 |
|
|
180 |
} |
} |
181 |
|
|
182 |
// LOGGER.debug("putting '"+trimmedText+"' into the translation"); |
// LOGGER.debug("putting '"+trimmedText+"' into the translation"); |
183 |
trans.put(langCode, trimmedText); |
if (!trimmedText.equals(trans.get(langCode))) |
184 |
|
trans.put(langCode, trimmedText); |
185 |
} |
} |
186 |
|
// |
187 |
|
// ActionListener listenToChangesOfTheTranslationAndUpdateTheGUI = new ActionListener() { |
188 |
|
// |
189 |
|
// @Override |
190 |
|
// public void actionPerformed(ActionEvent e) { |
191 |
|
// if (!hasFocus()) |
192 |
|
// translationChangedExternally(); |
193 |
|
// } |
194 |
|
// }; |
195 |
|
// |
196 |
|
// /** |
197 |
|
// * Call it when the translation object has changed to update the JTextFields |
198 |
|
// */ |
199 |
|
// public void translationChangedExternally() { |
200 |
|
// setText(trans.get(langCode)); |
201 |
|
// } |
202 |
|
|
203 |
} |
} |