//grandParent.remove(parent);
treeTableModel.removeNodeFromParent(parent);
}
} else if (propertyName.equals(FeatureModelProperties.RELATION_ADDED)) {
//--��������˾�����ϵ����endNode��ΪstartNode�����ӽڵ㣬�м���Ϲ�ϵ�ڵ�
FeatureRelation fr = (FeatureRelation) evt.getNewValue();
String relationName = fr.getName();
if (refineRelation.containsKey(relationName)) {
Feature start = fr.getStartFeature();
Feature end = fr.getEndFeature();
FeatureNode startNode = getTreeNode(root, start);
FeatureNode endNode = getTreeNode(root, end);
if (relationName.equals(FeatureRelation.DECOMPOSE)) {
FeatureNode compNode = startNode.getCompositionNode();
if (compNode == null) {
compNode = new FeatureNode(context, FeatureNode.NODE_TYPE_COMPOSITION);
//startNode.add(compNode);
treeTableModel.insertNodeInto(compNode, startNode, startNode.getChildCount());
}
//compNode.add(endNode);
treeTableModel.removeNodeFromParent(endNode);
treeTableModel.insertNodeInto(endNode, compNode, compNode.getChildCount());
} else if (relationName.equals(FeatureRelation.ATTRIBUTE)) {
FeatureNode compNode = startNode.getCharacterizationNode();
if (compNode == null) {
compNode = new FeatureNode(context, FeatureNode.NODE_TYPE_CHARACTERIZATION);
//startNode.add(compNode);
treeTableModel.insertNodeInto(compNode, startNode, startNode.getChildCount());
}
//compNode.add(endNode);
treeTableModel.removeNodeFromParent(endNode);
treeTableModel.insertNodeInto(endNode, compNode, compNode.getChildCount());
}
}
} else if (propertyName.equals(FeatureModelProperties.RELATION_REMOVED)) {
//--���ɾ���˾�����ϵ����endNode��Ϊroot, ���endNode�ĸ��ڵ�(��ϵ�ڵ㣩û�������ӽڵ��ˣ���ɾ��endNode�ĸ��ڵ�
FeatureRelation fr = (FeatureRelation) evt.getOldValue();
String relationName = fr.getName();
if (refineRelation.containsKey(relationName)) {
Feature start = fr.getStartFeature();
Feature end = fr.getEndFeature();
FeatureNode startNode = getTreeNode(root, start);
FeatureNode endNode = getTreeNode(root, end);
FeatureNode relationNode = (FeatureNode) endNode.getParent();
//root.add(endNode);