// -------------------------------------------------------------------------------- public void onDomainSelect(Map domainData) { try { recordMap = session.getRecord((String) domainData.get("name")); state = STATE_RECORD_SUCCESS; notify1(); } catch (Exception e) { handleError(e); } }
// -------------------------------------------------------------------------------- private void onEditField(final MEditFieldAction action) { MSystemUtil.sleep(100); final String fieldName = action.getFieldName(); editingFieldName = fieldName; final TreeItem item = (TreeItem) fieldNameTreeItemMap.get(fieldName); if (item == null) { debug("item not found"); // debug( fieldNameTreeItemMap ); return; } // Object document = dataManager.getLastEditedDocument(); final MDocumentEditor view = this; shell .getDisplay() .asyncExec( new Runnable() { public void run() { // ***** if (action.getOriginView() != view) { tree.select(item); } if (fieldName.equals("_id")) { valueText.setEditable(false); valueText.setEnabled(true); typeCombo.setEnabled(false); nameText.setText(fieldName); editingData = item.getData("value"); valueText.setText(editingData + ""); typeCombo.select( ((Integer) typeComboIndexMap.get(editingData.getClass())).intValue()); updateButton.setEnabled(false); } else { valueText.setEditable(true); valueText.setEnabled(true); typeCombo.setEnabled(true); nameText.setText(fieldName); editingData = item.getData("value"); valueText.setText(editingData + ""); if (editingData == null) { typeCombo.select(11); verifyData(); } else { typeCombo.select( ((Integer) typeComboIndexMap.get(editingData.getClass())).intValue()); verifyData(); } } } }); // ******** // valueText.setText( docum ) }
// -------------------------------------------------------------------------------- private void drawItem(String parentFieldName, TreeItem parentItem, Map data, boolean expand) { Iterator p = data.keySet().iterator(); while (p.hasNext()) { String key = (String) p.next(); if (!data.containsKey(key)) { continue; } Object value = data.get(key); TreeItem newItem = new TreeItem(parentItem, SWT.NONE); newItem.setText(1, getClassName(value)); String fieldName = parentFieldName + "." + key; if (fieldName.startsWith(".")) { fieldName = fieldName.substring(1); } newItem.setData("fieldName", fieldName); newItem.setData("value", value); fieldNameTreeItemMap.put(fieldName, newItem); if (value == null) { newItem.setText(key + " : null"); newItem.setImage(nullImage); } else if (value instanceof Map) { newItem.setText(key); newItem.setImage(mapImage); drawItem(fieldName, newItem, (Map) value, expand); } else if (value instanceof List) { newItem.setText(key); newItem.setImage(listImage); drawItem(fieldName, newItem, (List) value, expand); } else { setItemInfo(newItem, key, value); } if (expand) { parentItem.setExpanded(expand); newItem.setExpanded(expand); } } }