FeatureNode root = (FeatureNode) treeTable.getTreeTableModel().getRoot();
if (propertyName.equals(ConstraintModelProperties.RELATION_ADDED)) {
//--���������VPConstraint�ϵĹ�ϵ��
CFRelation relation = (CFRelation) evt.getNewValue();
Constraint constraint = relation.getConstraint();
if (constraint instanceof VPConstraint) {
VPConstraint vpc = (VPConstraint) constraint;
Feature feature = relation.getFeature();
FeatureNode featureNode = getTreeNode(root, feature);
boolean isSource = relation.isSource();
if (isSource) { //--������source��ϵ: ���е�sink��Ϊsource���ӽڵ�
Iterator<Feature> it = vpc.getSinkFeatureSet().iterator();
while (it.hasNext()) {
Feature sink = it.next();
FeatureNode child = getTreeNode(root, sink);
///---���û��һ�������ϵ�Ľڵ㣬������һ�������Ľڵ�
FeatureNode specNode = featureNode.getSpecilizationNode();
if (specNode == null) {
specNode = new FeatureNode(context, FeatureNode.NODE_TYPE_SPECILIZATION);
//featureNode.add(specNode);
treeTableModel.insertNodeInto(specNode, featureNode, featureNode.getChildCount());
}
//specNode.add(child);
treeTableModel.removeNodeFromParent(child);
treeTableModel.insertNodeInto(child, specNode, specNode.getChildCount());
}
} else { //--������sink��ϵ: ������sink��Ϊsource��specNode���ӽڵ�
Iterator<Feature> it = vpc.getSourceFeatureSet().iterator();
if (it.hasNext()) {
Feature source = it.next();
FeatureNode parent = getTreeNode(root, source);
FeatureNode specNode = parent.getSpecilizationNode();
if (specNode == null) {
specNode = new FeatureNode(context, FeatureNode.NODE_TYPE_SPECILIZATION);
//parent.add(specNode);
treeTableModel.insertNodeInto(specNode, parent, parent.getChildCount());
}
//specNode.add(featureNode);
treeTableModel.removeNodeFromParent(featureNode);
treeTableModel.insertNodeInto(featureNode, specNode, specNode.getChildCount());
}
}
}
} else if (propertyName.equals(ConstraintModelProperties.RELATION_REMOVED)) {
//--���������VPConstraint�ϵĹ�ϵ��
CFRelation relation = (CFRelation) evt.getOldValue();
Constraint constraint = relation.getConstraint();
if (constraint instanceof VPConstraint) {
VPConstraint vpc = (VPConstraint) constraint;
Feature feature = relation.getFeature();
FeatureNode featureNode = getTreeNode(root, feature);
boolean isSource = relation.isSource();
if (isSource) { //--ɾ����source��ϵ: ���е�sink��Ϊ���ڵ㣬��������������Ƿ�ɾ��������ϵ�ڵ�
Iterator<Feature> it = vpc.getSinkFeatureSet().iterator();
FeatureNode specNode = null;
while (it.hasNext()) {
Feature sink = it.next();