public void addDictionaryAttributeItem(String dictionary, String key, String value){ ProcessInstanceDictionaryAttribute attr = (ProcessInstanceDictionaryAttribute)findAttributeByKey(dictionary); if (attr == null) { addAttribute(attr = new ProcessInstanceDictionaryAttribute(dictionary)); } attr.put(key, value); }
public ProcessInstanceDictionaryAttribute(String key) { setKey(key); }
public void put(String key, String value) { getItems().add(new ProcessInstanceDictionaryItem(key, value)); } }
@Override public void evaluate(AbstractSelect component, WidgetElement element) throws Exception { AbstractSelectWidgetElement aswe = Lang2.assumeType(element, AbstractSelectWidgetElement.class); String dictAttribute = aswe.getDictionaryAttribute(); ProcessInstanceDictionaryAttribute dict = (ProcessInstanceDictionaryAttribute) processInstance.findAttributeByKey(dictAttribute); if (dict != null) { int i = 0; Boolean prevReadOnly = component.isReadOnly(); component.setReadOnly(false); for (Object o : dict.getItems()) { ProcessInstanceDictionaryItem itemProcess = (ProcessInstanceDictionaryItem) o; component.addItem(itemProcess.getKey()); String itemKey = itemProcess.getKey().toString(); String value = itemProcess.getValue(); component.setItemCaption(itemProcess.getKey(), value); if (element instanceof AbstractSelectWidgetElement) { AbstractSelectWidgetElement select = (AbstractSelectWidgetElement) element; if (select.getDefaultSelect() != null && i == select.getDefaultSelect()) { component.setValue(itemProcess.getKey()); } List<ItemElement> values = select.getValues(); values.add(new ItemElement(itemKey, value)); } ++i; } component.setReadOnly(prevReadOnly); } } };