public ImageIcon getConstraintIcon(Object cons , ConstraintModel constraintModel , CustomizationVersion cv) {
if (!(cons instanceof VPConstraint)) {
return null;
}
VPConstraint vp = (VPConstraint)cons;
CompositeConstraintPortType lType = null;
if (vp.getType().equals(VPConstraintType.SingleVP)) {
lType = CompositeConstraintPortType.Single;
} else if (vp.getType().equals(VPConstraintType.MultiVP)) {
lType = CompositeConstraintPortType.Multi;
} else if (vp.getType().equals(VPConstraintType.AllVP)) {
lType = CompositeConstraintPortType.All;
}
CompositeConstraintPortType rType = lType;
if (cv==null) {
return ImageManager.getInstance().getCompositeConstraintHeader(lType , rType , CompositeConstraintType.Equivalence , null , null , ImageManager.ConstraintStat.csNone);
} else {
List<Customization> sCustomization = new ArrayList<Customization>();
for (Iterator<Feature> itFeature=vp.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
Feature feature = itFeature.next();
CFRelation cf = constraintModel.getCFRelation(feature , vp , true);
if (cf==null) {
cf = constraintModel.getCFRelation(feature , vp , false);
}
sCustomization.add(super.convertCustomization(cv.getFinalCustomizationById(feature.getID()) , cf));
}
Customization lValue = Customization.Undecided;
if (lType.getName().equals(CompositeConstraintPortType.Single.getName())) {
if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
lValue = Customization.Undecided;
} else if (super.getCustomizationCount(sCustomization , Customization.Selected)==1) {
lValue = Customization.Selected;
} else {
lValue = Customization.Unselected;
}
} else if (lType.getName().equals(CompositeConstraintPortType.All.getName())) {
if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
lValue = Customization.Undecided;
} else if (super.getCustomizationCount(sCustomization , Customization.Unselected)==0) {
lValue = Customization.Selected;
} else {
lValue = Customization.Unselected;
}
} else /*if (gc.getType().getName().equals(GroupConstraintType.SingleGroup))*/ {
if (super.getCustomizationCount(sCustomization , Customization.Selected)>0) {
lValue = Customization.Selected;
} else if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
lValue = Customization.Undecided;
} else {
lValue = Customization.Unselected;
}
}
sCustomization = new ArrayList<Customization>();
for (Iterator<Feature> itFeature=vp.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
Feature feature = itFeature.next();
CFRelation cf = constraintModel.getCFRelation(feature , vp , true);
if (cf==null) {
cf = constraintModel.getCFRelation(feature , vp , false);
}