protected final void updateInsertIndexInChildrenOfNode(DynamicNode parentNode) throws DbException { Enumeration childrenEnum = parentNode.children(); while (childrenEnum.hasMoreElements()) { DynamicNode node = (DynamicNode) childrenEnum.nextElement(); DbObject dbo = (DbObject) node.getRealObject(); DbObject dbParent = dbo.getComposite(); node.insertIndex = getSequence(dbParent, dbo); } }
// Called at the end of a cell edition, to process the edition result. public final void valueForPathChanged(TreePath path, Object newValue) { DynamicNode node = (DynamicNode) path.getLastPathComponent(); Object obj = node.getRealObject(); if (obj instanceof DbObject) { boolean editable = false; try { Db db = ((DbObject) obj).getDb(); if (db.isValid()) { db.beginReadTrans(); MetaField editableMetaField = getEditableMetaField((DbObject) obj); if (editableMetaField == null) editable = ApplicationContext.getSemanticalModel() .isNameEditable((DbObject) obj, Explorer.class); else editable = ApplicationContext.getSemanticalModel() .isEditable(editableMetaField, (DbObject) obj, Explorer.class); db.commitTrans(); } } catch (DbException ex) { org.modelsphere.jack.util.ExceptionHandler.processUncatchedException( ApplicationContext.getDefaultMainFrame(), ex); editable = false; } if (!editable) return; } else { return; } DbObject semObj = (DbObject) obj; try { MetaField editableMetaField = getEditableMetaField(semObj); String transName = (editableMetaField == null ? LocaleMgr.action.getString("rename") : MessageFormat.format(kUpdate0, new Object[] {editableMetaField.getGUIName()})); semObj.getDb().beginTrans(Db.WRITE_TRANS, transName); if (editableMetaField == null) { if (semObj.getTransStatus() == Db.OBJ_REMOVED) return; semObj.setName((String) newValue); } else semObj.set(editableMetaField, (String) newValue); semObj.getDb().commitTrans(); nodeChanged(node); // in case it is a secondary node (only the // primary node is updated by the refresh // listener). } catch (Exception ex) { org.modelsphere.jack.util.ExceptionHandler.processUncatchedException( ApplicationContext.getDefaultMainFrame(), ex); } }