Set<Feature> features = new HashSet<Feature>();
features.add(fSrc);
boolean changed = false;
do {
for (Iterator<Feature> itFeature = fmSrc.getAllFeature().values().iterator(); itFeature.hasNext();) {
Feature feature = itFeature.next();
if (!features.contains(feature) && features.contains(fmSrc.getParentFeature(feature.getID()))) {
features.add(feature);
changed = true;
}
}
changed = false;
} while (changed);
features.remove(fSrc);
// Hashtable<String , Figure> srcFigureMap = new Hashtable<String , Figure>();
// for (FigureEnumeration fe=dvSrc.getDrawing().getFigures()
// ; fe.hasMoreElements() ; ) {
// Figure figure = fe.nextFigure();
// srcFigureMap.put((String)figure.getAttribute("id") , figure);
// }
//
// Hashtable<String , String> nameMap = new Hashtable<String , String>();
nameMap.put(fSrc.getID(), fDist.getID());
// Hashtable<String , Figure> figureMap = new Hashtable<String , Figure>();
for (FigureEnumeration fe = dvDist.getDrawing().getFigures(); fe.hasMoreElements();) {
Figure figure = fe.nextFigure();
if (fDist.getID().equals(figure.getAttribute("id"))) {
figureMap.put(fDist.getID(), figure);
break;
}
}
// Figure rSrc = srcFigureMap.get(fSrc.getID());
Figure rDist = figureMap.get(fDist.getID());
for (Iterator<Feature> itFeature = features.iterator(); itFeature.hasNext();) {
Feature feature = itFeature.next();
Feature newFeature = fmEditor.addFeature(feature.getName());
fEditor.setBindingTime(newFeature, feature.getBindingTime());
fEditor.setCategory(newFeature, feature.getCategory());
fEditor.setVariability(newFeature, feature.getVariability());
nameMap.put(feature.getID(), newFeature.getID());
FeatureFigure figDist = new FeatureFigure();
figDist.setText(feature.getName());
figDist.setAttribute("id", feature.getID());
figDist.setAttribute(FeatureProperties.VARIABILITY, feature.getVariability().getName());
dvDist.add(figDist);
// Figure fOld = srcFigureMap.get(feature.getID());
// figDist.moveBy(rDist.getDisplayBox().x - rSrc.getDisplayBox().x + fOld.getDisplayBox().x
// , rDist.getDisplayBox().y - rSrc.getDisplayBox().y + fOld.getDisplayBox().y);
figureMap.put(newFeature.getID(), figDist);
}
for (Iterator<FeatureRelation> itRelation = fmSrc.getAllFeatureRelation().values().iterator(); itRelation != null && itRelation.hasNext();) {
FeatureRelation relation = itRelation.next();
if (!nameMap.containsKey(relation.getStartFeature().getID()) || !nameMap.containsKey(relation.getEndFeature().getID())) {