Search in sources :

Example 1 with BusinessItemShape

use of org.talend.designer.business.model.business.BusinessItemShape in project tdi-studio-se by Talend.

the class TalendSVGIDGenerator method generateID.

@Override
public String generateID(String prefix) {
    Integer maxId = (Integer) prefixMap.get(prefix);
    if (maxId == null) {
        maxId = new Integer(0);
        prefixMap.put(prefix, maxId);
    }
    maxId = new Integer(maxId.intValue() + 1);
    prefixMap.put(prefix, maxId);
    if (svgObject != null && maxId - 1 < svgObject.size() && prefix.equals(SVGSyntax.ID_PREFIX_CLIP_PATH)) {
        if (svgObject.get(maxId - 1) != null) {
            Object obj = svgObject.get(maxId - 1);
            if (obj instanceof BusinessItemShape) {
                BusinessItemShape item = (BusinessItemShape) obj;
                String id = "";
                for (Object assign : item.getAssignments()) {
                    if (assign instanceof BusinessAssignment) {
                        BusinessAssignment assignment = (BusinessAssignment) assign;
                        id = id + assignment.getTalendItem().getLabel() + ";";
                    }
                }
                if (id != "") {
                    id = id.substring(0, id.length() - 1);
                    return "businessItem." + businessModels.indexOf(obj);
                }
            }
        }
    }
    return prefix + maxId;
}
Also used : BusinessItemShape(org.talend.designer.business.model.business.BusinessItemShape) BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment)

Example 2 with BusinessItemShape

use of org.talend.designer.business.model.business.BusinessItemShape in project tdi-studio-se by Talend.

the class TalendSVGIDGenerator method init.

private List init(List businessModels) {
    List svgObject = new ArrayList();
    if (businessModels != null) {
        // add shap items
        for (Object obj : businessModels) {
            if (obj instanceof BusinessItemShape) {
                BusinessItemShape editPart = (BusinessItemShape) obj;
                svgObject.add(obj);
                if (editPart.getName() != null) {
                    svgObject.add(null);
                }
            }
        }
        return svgObject;
    }
    return null;
}
Also used : BusinessItemShape(org.talend.designer.business.model.business.BusinessItemShape) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

BusinessItemShape (org.talend.designer.business.model.business.BusinessItemShape)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BusinessAssignment (org.talend.designer.business.model.business.BusinessAssignment)1