@Override public Map<String, Object> getDataMap() { Map<String, Object> data = super.getDataMap(); data.put("cssClassName", this.cssClassName); data.put("type", this.type); data.put("id", this.id); data.put("dir", this.dir); List<Object> mapItems = new ArrayList<Object>(); for (FormItemRepresentation item : this.items) { mapItems.add(item.getDataMap()); } data.put("items", mapItems); return data; }
@Override public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.name = (String) data.get("name"); this.id = (String) data.get("id"); this.value = (String) data.get("value"); this.selected = (Boolean) data.get("selected"); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.cssClassName = (String) data.get("cssClassName"); this.type = (String) data.get("type"); this.id = (String) data.get("id"); this.dir = (String) data.get("dir"); this.items.clear(); List<Object> mapItems = (List<Object>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Object obj : mapItems) { Map<String, Object> itemMap = (Map<String, Object>) obj; FormItemRepresentation item = (FormItemRepresentation) decoder.decode(itemMap); this.items.add(item); } } }