1 | public static class DateFormatTypeCombo extends JComboBox↵ | | 1 | public static class DateFormatTypeCombo extends JComboBox↵
|
2 | {↵ | | |
|
3 | ↵ | | 2 | {↵
|
4 | private static final long serialVersionUID = 1L;↵ | | 3 | private static final long serialVersionUID = 1L;↵
|
|
5 | public DateFormatTypeCombo()↵ | | 4 | public DateFormatTypeCombo()↵
|
6 | {↵ | | |
|
7 | ↵ | | 5 | {↵
|
8 | // i18n[dataTypeDate.full=Full ({0})]↵ | | 6 | // i18n[dataTypeTime.full=Full ({0})]↵
|
9 | addItem(s_stringMgr.getString("dataTypeDate.full", DateFormat.getDateInstance(DateFormat.FULL).format(new java.util.Date())));↵ | | 7 | addItem(s_stringMgr.getString("dataTypeTime.full", DateFormat.getTimeInstance(DateFormat.FULL).format(new java.util.Date())));↵
|
10 | // i18n[dataTypeDate.long=Long ({0})]↵ | | 8 | // i18n[dataTypeTime.long=Long ({0})]↵
|
11 | addItem(s_stringMgr.getString("dataTypeDate.long", DateFormat.getDateInstance(DateFormat.LONG).format(new java.util.Date())));↵ | | 9 | addItem(s_stringMgr.getString("dataTypeTime.long", DateFormat.getTimeInstance(DateFormat.LONG).format(new java.util.Date())));↵
|
12 | // i18n[dataTypeDate.medium=Medium ({0})]↵ | | 10 | // i18n[dataTypeTime.medium=Medium ({0})]↵
|
13 | addItem(s_stringMgr.getString("dataTypeDate.medium", DateFormat.getDateInstance(DateFormat.MEDIUM).format(new java.util.Date())));↵ | | 11 | addItem(s_stringMgr.getString("dataTypeTime.medium", DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new java.util.Date())));↵
|
14 | // i18n[dataTypeDate.short=Short ({0})]↵ | | 12 | // i18n[dataTypeTime.short=Short ({0})]↵
|
15 | addItem(s_stringMgr.getString("dataTypeDate.short", DateFormat.getDateInstance(DateFormat.SHORT).format(new java.util.Date())));↵ | | 13 | addItem(s_stringMgr.getString("dataTypeTime.short", DateFormat.getTimeInstance(DateFormat.SHORT).format(new java.util.Date())));↵
|
16 | }↵ | | |
|
|
17 | ↵ | | 14 | }↵
|
|
18 | public void setSelectedIndex(int option) {↵ | | 15 | public void setSelectedIndex(int option) {↵
|
19 | if (option == DateFormat.SHORT)↵ | | 16 | if (option == DateFormat.SHORT)↵
|
20 | super.setSelectedIndex(3);↵ | | 17 | super.setSelectedIndex(3);↵
|
21 | else if (option == DateFormat.MEDIUM)↵ | | 18 | else if (option == DateFormat.MEDIUM)↵
|
22 | super.setSelectedIndex(2);↵ | | 19 | super.setSelectedIndex(2);↵
|
23 | else if (option == DateFormat.LONG)↵ | | 20 | else if (option == DateFormat.LONG)↵
|
24 | super.setSelectedIndex(1);↵ | | 21 | super.setSelectedIndex(1);↵
|
25 | else super.setSelectedIndex(0);↵ | | 22 | else super.setSelectedIndex(0);↵
|
26 | }↵ | | |
|
|
27 | ↵ | | 23 | }↵
|
|
28 | public int getValue() {↵ | | 24 | public int getValue() {↵
|
29 | if (getSelectedIndex() == 3)↵ | | 25 | if (getSelectedIndex() == 3)↵
|
30 | return DateFormat.SHORT;↵ | | 26 | return DateFormat.SHORT;↵
|
31 | else if (getSelectedIndex() == 2)↵ | | 27 | else if (getSelectedIndex() == 2)↵
|
32 | return DateFormat.MEDIUM;↵ | | 28 | return DateFormat.MEDIUM;↵
|
33 | else if (getSelectedIndex() == 1)↵ | | 29 | else if (getSelectedIndex() == 1)↵
|
34 | return DateFormat.LONG;↵ | | 30 | return DateFormat.LONG;↵
|
35 | else return DateFormat.FULL | | 31 | else return DateFormat.FULL
|