42 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
43 |
|
|
44 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
45 |
|
import org.opengis.util.InternationalString; |
46 |
|
|
47 |
/** |
/** |
48 |
* Represents a {@link HashMap} of translations. toString() returns the |
* Represents a {@link HashMap} of translations. toString() returns the |
193 |
*/ |
*/ |
194 |
public void fromOneLine(final String oneLineCoded) { |
public void fromOneLine(final String oneLineCoded) { |
195 |
clear(); |
clear(); |
196 |
|
|
197 |
if ((oneLineCoded == null) || (oneLineCoded.equals(""))) { |
if ((oneLineCoded == null) || (oneLineCoded.equals(""))) { |
198 |
put(DEFAULT_KEY, ""); |
put(DEFAULT_KEY, ""); |
199 |
return; |
return; |
317 |
return actionListeners.remove(actionListener); |
return actionListeners.remove(actionListener); |
318 |
} |
} |
319 |
|
|
320 |
public void fireTranslationChangedEvents() { |
public void fireTranslationChangedEvents(String lang) { |
321 |
ActionEvent ae = new ActionEvent(this, new Random().nextInt(), ""); |
ActionEvent ae = new ActionEvent(this, new Random().nextInt(), lang); |
322 |
|
|
323 |
for (ActionListener al : actionListeners) { |
for (ActionListener al : actionListeners) { |
324 |
al.actionPerformed( ae); |
al.actionPerformed( ae); |
326 |
} |
} |
327 |
|
|
328 |
@Override |
@Override |
329 |
public String put(String key, String value) { |
public String put(String lang, String value) { |
330 |
String result = super.put(key, value); |
String result = super.put(lang, value); |
331 |
fireTranslationChangedEvents(); |
fireTranslationChangedEvents(lang); |
332 |
return result; |
return result; |
333 |
} |
} |
334 |
|
|
335 |
|
public void fromOneLine(InternationalString iString) { |
336 |
|
if (iString != null) |
337 |
|
fromOneLine(iString.toString()); |
338 |
|
else |
339 |
|
fromOneLine((String)null); |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
} |
} |