home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-30 | 1.2 KB | 60 lines |
- package borland.samples.intl.beans;
-
- public class LocaleChooserDisplayStyleEditor
- extends java.beans.PropertyEditorSupport {
-
- int style;
-
- public String[] getTags() {
- String tags[] = {
- "ISO",
- "TARGET_LOCALE",
- "CURRENT_LOCALE"
- };
- return tags;
- }
-
- public String getJavaInitializationString() {
- switch (style) {
- case LocaleChooser.ISO:
- return "LocaleChooser.ISO";
- case LocaleChooser.TARGET_LOCALE:
- return "LocaleChooser.TARGET_LOCALE";
- default:
- return "LocaleChooser.CURRENT_LOCALE";
- }
- }
-
- public void setAsText(String text) {
- if (text.equals("ISO")) {
- style = LocaleChooser.ISO;
- } else if (text.equals("TARGET_LOCALE")) {
- style = LocaleChooser.TARGET_LOCALE;
- } else {
- style = LocaleChooser.CURRENT_LOCALE;
- }
- }
-
- public String getAsText() {
- switch (style) {
- case LocaleChooser.ISO:
- return "ISO";
- case LocaleChooser.TARGET_LOCALE:
- return "TARGET_LOCALE";
- default:
- return "CURRENT_LOCALE";
- }
- }
-
- public void setValue(Object o) {
- style = ((Integer) o).intValue();
- firePropertyChange();
- }
-
- public Object getValue() {
- return new Integer(style);
- }
-
- }
-
-