Hi
after upgrade from 3.1p to 5.0p our localization of valueMaps is not working for the case of using selectItem with the ListGrid inside the picklist.
The simplified logic (also can be found in attached file):
Tested on showcases:
https://www.smartclient.com/builds/S...rtgwt-3.1p.zip
https://www.smartclient.com/builds/S...rtgwt-5.0p.zip
Please, check it and let me know what you recommend.
Thank you
Matus
after upgrade from 3.1p to 5.0p our localization of valueMaps is not working for the case of using selectItem with the ListGrid inside the picklist.
The simplified logic (also can be found in attached file):
Code:
public Canvas getViewPanel() { final DynamicForm form = new DynamicForm(); form.setWidth(500); form.setNumCols(4); DataSource testDS = new TestDS(); localize(testDS, Languages.DE); form.setDataSource(testDS); SelectItem testSelectItem = new SelectItem(TEST_FIELD); SelectItemWithPickList testSelectItemWithPickList = new SelectItemWithPickList(TEST_FIELD2, true, false); form.setItems(testSelectItem, testSelectItemWithPickList); return form; } private void localize(DataSource testDS, Languages lang) { for (DataSourceField dsField : testDS.getFields()) { if (TEST_FIELD.equals(dsField.getName()) || TEST_FIELD2.equals(dsField.getName())) { Map<String, String> localizedValueMap = dsField.getValueMap(); for (String id : localizedValueMap.keySet()) { if ("1".equals(id)) { localizedValueMap.put(id, lang == Languages.EN ? "one" : "ein"); } else if ("2".equals(id)) { localizedValueMap.put(id, lang == Languages.EN ? "two" : "zwei"); } } dsField.setValueMap(localizedValueMap); } } } public class TestDS extends DataSource { public TestDS() { setID("testDS"); DataSourceTextField testField = new DataSourceTextField(TEST_FIELD, "Test"); DataSourceTextField testField2 = new DataSourceTextField(TEST_FIELD2, "Test"); Map<String, String> valueMap = new HashMap<String, String>(); valueMap.put("1", null); valueMap.put("2", null); testField.setValueMap(valueMap); testField2.setValueMap(valueMap); setFields(testField, testField2); setClientOnly(true); } } public class SelectItemWithPickList extends SelectItem { public SelectItemWithPickList(String name, final boolean multiple, boolean allowEmptyValue) { super(name); setMultiple(multiple); setAllowEmptyValue(allowEmptyValue); setPickListFields(getPickListFields()); setPickListProperties(getPickListGrid()); } public ListGridField[] getPickListFields() { ListGridField field = new ListGridField(getName(), 230); field.setShowHover(true); return new ListGridField[] { field }; } protected ListGrid getPickListGrid() { ListGrid pickListGrid = new ListGrid(); pickListGrid.setShowFilterEditor(getShowFilterEditor()); pickListGrid.setBackgroundColor("#fff"); pickListGrid.setCanReorderFields(false); pickListGrid.setCanFreezeFields(false); pickListGrid.setCanPickFields(false); pickListGrid.setCanGroupBy(false); return pickListGrid; } protected boolean getShowFilterEditor() { return true; } }
https://www.smartclient.com/builds/S...rtgwt-3.1p.zip
https://www.smartclient.com/builds/S...rtgwt-5.0p.zip
Please, check it and let me know what you recommend.
Thank you
Matus
Comment