Revision 2180
org.gvsig.jexcel/trunk/org.gvsig.jexcel/org.gvsig.jexcel.provider/src/main/java/org/gvsig/jexcel/JExcelLibrary.java | ||
---|---|---|
99 | 99 |
exs.add(e); |
100 | 100 |
} |
101 | 101 |
|
102 |
DynStruct parametersDefinition = ToolsLocator.getPersistenceManager().getDefinition(JExcelStoreParameters.PARAMETERS_DEFINITION_NAME); |
|
103 |
parametersDefinition.getDynField(JExcelStoreParameters.ENCODING).setAvailableValues(getAvailableEncodingValues()); |
|
104 |
parametersDefinition.getDynField(JExcelStoreParameters.LOCALE).setAvailableValues(getAvailableLocaleValues()); |
|
105 |
|
|
106 | 102 |
DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager(); |
107 | 103 |
manager.registerDynFieldFactory(new JDynFormFieldExcelSheetFactory()); |
108 | 104 |
manager.registerDynFieldFactory(new JDynFormFieldExcelPointFieldsFactory()); |
... | ... | |
112 | 108 |
} |
113 | 109 |
} |
114 | 110 |
|
115 |
private DynObjectValueItem[] getAvailableEncodingValues() { |
|
116 |
SortedMap<String, Charset> charsets = Charset.availableCharsets(); |
|
117 |
DynObjectValueItem[] availableValues = new DynObjectValueItem[charsets.size()+1]; |
|
118 |
int i = 0; |
|
119 |
availableValues[i++] = new DynObjectValueItem("DEFAULT", "Default (use system language)"); |
|
120 |
for (Map.Entry<String, Charset> entry : charsets.entrySet()) { |
|
121 |
String key = entry.getKey(); |
|
122 |
Charset value = entry.getValue(); |
|
123 |
availableValues[i++] = new DynObjectValueItem(value, key); |
|
124 |
} |
|
125 |
|
|
126 |
return availableValues; |
|
127 |
} |
|
128 |
|
|
129 |
private DynObjectValueItem[] getAvailableLocaleValues() { |
|
130 |
Locale[] locales = Locale.getAvailableLocales(); |
|
131 |
Arrays.sort(locales, (Locale o1, Locale o2) -> { |
|
132 |
if (o1 == null) { |
|
133 |
return -1; |
|
134 |
} |
|
135 |
if (o2 == null) { |
|
136 |
return 1; |
|
137 |
} |
|
138 |
return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName()); |
|
139 |
}); |
|
140 |
DynObjectValueItem[] availableValues = new DynObjectValueItem[locales.length+1]; |
|
141 |
availableValues[0] = new DynObjectValueItem("DEFAULT", "Default (use system locale)"); |
|
142 |
for (int i = 0; i < locales.length; i++) { |
|
143 |
availableValues[i+1] = new DynObjectValueItem(locales[i].toLanguageTag(), locales[i].getDisplayName()); |
|
144 |
} |
|
145 |
return availableValues; |
|
146 |
|
|
147 |
} |
|
148 | 111 |
} |
org.gvsig.jexcel/trunk/org.gvsig.jexcel/org.gvsig.jexcel.provider/src/main/resources/org/gvsig/jexcel/dal/provider/JExcelParameters.xml | ||
---|---|---|
13 | 13 |
</field> |
14 | 14 |
<field name="locale" label="Locale" type="string" subtype="locale" mandatory="true" defaultValue="DEFAULT"> |
15 | 15 |
<description>Locale used to parse double and float values (BCP47 language tag representing the locale)</description> |
16 |
<availableValues> |
|
17 |
<value label="Default (use system locale)">DEFAULT</value> |
|
18 |
<value label="Canada (english)">en-CA</value> |
|
19 |
<value label="Canada (french)">fr-CA</value> |
|
20 |
<value label="Chinese">zh</value> |
|
21 |
<value label="English">en</value> |
|
22 |
<value label="French">fr</value> |
|
23 |
<value label="German">de</value> |
|
24 |
<value label="Italian">it</value> |
|
25 |
<value label="Japanese">ja</value> |
|
26 |
<value label="Korea">ko</value> |
|
27 |
<value label="Spain">es</value> |
|
28 |
<value label="Uk">en-GB</value> |
|
29 |
<value label="Us">en-US</value> |
|
30 |
</availableValues> |
|
16 |
<!-- For "locale" subtype DefaultDynField.setSubtype handle available values --> |
|
31 | 17 |
</field> |
32 | 18 |
|
33 | 19 |
<field name="Encoding" type="string" subtype="charset" mandatory="false" defaultValue="DEFAULT"> |
34 |
<description>Encoding used in this file</description> |
|
35 |
<availableValues> |
|
36 |
<value label="Default (use system language)">DEFAULT</value> |
|
37 |
<value label="US-ASCII">US-ASCII</value> |
|
38 |
<value label="ISO-8859-1">ISO-8859-1</value> |
|
39 |
<value label="ISO-8859-15">ISO-8859-15</value> |
|
40 |
<value label="windows-1250">windows-1250</value> |
|
41 |
<value label="windows-1252">windows-1252</value> |
|
42 |
<value label="UTF-8">UTF-8</value> |
|
43 |
<value label="UTF-16">UTF-16</value> |
|
44 |
<value label="UTF-16BE">UTF-16BE</value> |
|
45 |
<value label="UTF-16LE">UTF-16LE</value> |
|
46 |
</availableValues> |
|
20 |
<description>Encoding used in this file</description> |
|
21 |
<!-- For "charset" subtype DefaultDynField.setSubtype handle available values --> |
|
47 | 22 |
</field> |
48 | 23 |
|
49 | 24 |
<field name="sheet" label="Sheet to load" type="integer" subtype="jexcel.sheet.selector" mandatory="false" defaultValue="0"> |
Also available in: Unified diff