// Data Modification @Override public void newAttribute( String key, Object value, boolean isReadOnly, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } model.keys.add(key); model.values.add(value); model.readOnly.add(new Boolean(isReadOnly)); node.setAttribute(key, value); OutlinerDocument doc = view.tree.getDocument(); doc.setModified(true); // undo Undoable undoable = new UndoableDocumentAttributeChange(view.tree, null, null, false, key, value, isReadOnly); undoable.setName("New Document Attribute"); doc.getUndoQueue().add(undoable); model.fireTableDataChanged(); }
// Set Value @Override public void setValueAt(Object value, int row, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } String key = (String) model.keys.get(row); boolean readOnly = node.isReadOnly(key); Object oldValue = node.getAttribute(key); model.values.set(row, value); node.setAttribute(key, value); OutlinerDocument doc = view.tree.getDocument(); doc.setModified(true); // undo Undoable undoable = new UndoableDocumentAttributeChange( view.tree, key, oldValue, readOnly, key, value, readOnly); undoable.setName("Edit Document Attribute"); doc.getUndoQueue().add(undoable); model.fireTableDataChanged(); }