Java 类org.eclipse.emf.ecore.impl.EAttributeImpl 实例源码

项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
private void createDockersForBoundaryEvent(BoundaryEvent boundaryEvent) {
    List<Point> dockers = _dockers.get(boundaryEvent.getId());
    StringBuffer dockerBuff = new StringBuffer();
    for (int i = 0; i < dockers.size(); i++) {
        dockerBuff.append(dockers.get(i).getX());
        dockerBuff.append("^");
        dockerBuff.append(dockers.get(i).getY());
        dockerBuff.append("|");
    }
    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
            "http://www.jboss.org/drools",
            "dockerinfo",
            false,
            false);
    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                     dockerBuff.toString());
    boundaryEvent.getAnyAttribute().add(extensionEntry);
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyAssociationProperties(Association association,
                                          Map<String, String> properties) {
    if (properties.get("type") != null) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "type",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("type"));
        association.getAnyAttribute().add(extensionEntry);
    }
    if (properties.get("bordercolor") != null && properties.get("bordercolor").length() > 0) {
        if (!(_elementColors.containsKey(association.getId()))) {
            List<String> colorsList = new ArrayList<String>();
            colorsList.add("bordercolor:" + properties.get("bordercolor"));
            _elementColors.put(association.getId(),
                               colorsList);
        } else {
            _elementColors.get(association.getId()).add("bordercolor:" + properties.get("bordercolor"));
        }
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyDefinitionProperties(Definitions def,
                                         Map<String, String> properties) {
    def.setTypeLanguage(properties.get("typelanguage"));
    //def.setTargetNamespace(properties.get("targetnamespace"));
    def.setTargetNamespace("http://www.omg.org/bpmn20");
    def.setExpressionLanguage(properties.get("expressionlanguage"));
    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
            "xsi",
            "schemaLocation",
            false,
            false);
    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                     "http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd");
    def.getAnyAttribute().add(extensionEntry);
    //_currentResource.getContents().add(def);// hook the definitions object to the resource early.
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyGatewayProperties(Gateway gateway,
                                      Map<String, String> properties) {
    if (properties.get("name") != null && properties.get("name").length() > 0) {
        gateway.setName(StringEscapeUtils.escapeXml(properties.get("name")).replaceAll("\\r\\n|\\r|\\n",
                                                                                       " "));
        // add unescaped and untouched name value as extension element as well
        Utils.setMetaDataExtensionValue(gateway,
                                        "elementname",
                                        wrapInCDATABlock(properties.get("name").replaceAll("\\\\n",
                                                                                           "\n")));
    } else {
        gateway.setName("");
    }
    if (properties.get("defaultgate") != null && (gateway instanceof InclusiveGateway || gateway instanceof ExclusiveGateway)) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "dg",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("defaultgate"));
        gateway.getAnyAttribute().add(extensionEntry);
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
protected void applyGroupProperties(Group group,
                                    Map<String, String> properties) {
    if (properties.get("name") != null) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "categoryval",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("name"));
        group.getAnyAttribute().add(extensionEntry);
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void applyReceiveTaskProperties(ReceiveTask receiveTask,
                                       Map<String, String> properties) {
    if (properties.get("messageref") != null && properties.get("messageref").length() > 0) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "msgref",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("messageref"));
        receiveTask.getAnyAttribute().add(extensionEntry);
    }
    receiveTask.setImplementation("Other");
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void applySendTaskProperties(SendTask sendTask,
                                    Map<String, String> properties) {
    if (properties.get("messageref") != null && properties.get("messageref").length() > 0) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "msgref",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("messageref"));
        sendTask.getAnyAttribute().add(extensionEntry);
    }
    sendTask.setImplementation("Other");
}
项目:seg.jUCMNav    文件:KPIUrnModelElementTreeEditPart.java   
/**
 * When something is changed, refresh. We are also refreshing the parent so that elements can be reordered if renamed
 * 
 */
public void notifyChanged(Notification notification) {
    if (notification.getEventType() != Notification.REMOVING_ADAPTER && getRoot() != null) {

        if (getWidget().isDisposed()) return;
        try {
            refreshChildren();
        } catch (Exception ex) {
            // Bug 475: should be resolved but leaving code here as defense in depth.
            // seems to happen in very complex models after very quick changes. 
            // probably during the quick moment where the model is inconsistent.  
            System.out.println("quick ugly hack; trying to prevent weird happenings in UI "); //$NON-NLS-1$
            getChildren().clear();
            try {
                refreshChildren();
            } catch (Exception ex2) {
                System.out.println("Even our quick ugly hack didn't work."); //$NON-NLS-1$
            }
        }
        refreshVisuals();

        // get rid of elements that were deleted.
        if (getModel() instanceof EObject && ((EObject) getModel()).eContainer() == null)
            getParent().refresh();

        // refresh parent to reorder children if name changes.
        if (notification.getFeature() instanceof EAttributeImpl && ((EAttributeImpl) notification.getFeature()).getName().equals("name")) { //$NON-NLS-1$
            getParent().refresh();
        }

        // force a refresh.
        getText();
        getImage();
    }
}
项目:seg.jUCMNav    文件:StrategyUrnModelElementTreeEditPart.java   
/**
 * When something is changed, refresh. We are also refreshing the parent so that elements can be reordered if renamed
 * 
 */
public void notifyChanged(Notification notification) {
    if (notification.getEventType() != Notification.REMOVING_ADAPTER && getRoot() != null) {

        if (getWidget().isDisposed())
            return;

        try {

            refreshChildren();
        } catch (Exception ex) {
            // Bug 475: should be resolved but leaving code here as defense in depth.
            // seems to happen in very complex models after very quick changes.
            // probably during the quick moment where the model is inconsistent.
            System.out.println("quick ugly hack; trying to prevent weird happenings in UI "); //$NON-NLS-1$
            getChildren().clear();
            try {
                refreshChildren();
            } catch (Exception ex2) {
                System.out.println("Even our quick ugly hack didn't work."); //$NON-NLS-1$
            }
        }
        refreshVisuals();

        // get rid of elements that were deleted.
        if (getModel() instanceof EObject && ((EObject) getModel()).eContainer() == null)
            getParent().refresh();

        // refresh parent to reorder children if name changes.
        if (notification.getFeature() instanceof EAttributeImpl && ((EAttributeImpl) notification.getFeature()).getName().equals("name")) { //$NON-NLS-1$
            getParent().refresh();
        }

        // force a refresh of colors.
        getText();

    }
}
项目:seg.jUCMNav    文件:UrnModelElementTreeEditPart.java   
/**
 * When something is changed, refresh. We are also refreshing the parent so that elements can be reordered if renamed
 * 
 */
public void notifyChanged(Notification notification) {
    if (notification.getEventType() != Notification.REMOVING_ADAPTER) {
        refreshChildren();
        refreshVisuals();

        // refresh parent to reorder children if name changes.
        if (notification.getFeature() instanceof EAttributeImpl
                && ((EAttributeImpl) notification.getFeature()).getName().equals("name") && getParent() != null) { //$NON-NLS-1$
            getParent().refresh();
        }

    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void updateShapeColors(BPMNShape shape) {
    List<String> eleColorsForShape = _elementColors.get(shape.getBpmnElement().getId());
    if (eleColorsForShape != null) {
        String backgroundColor = "";
        String borderColor = "";
        String fontColor = "";
        for (String shapeColor : eleColorsForShape) {
            String[] shapeColorParts = shapeColor.split(":");
            if (shapeColorParts[0].equals("bgcolor")) {
                backgroundColor = shapeColorParts[1];
            }
            if (shapeColorParts[0].equals("bordercolor")) {
                borderColor = shapeColorParts[1];
            }
            if (shapeColorParts[0].equals("fontcolor")) {
                fontColor = shapeColorParts[1];
            }
        }
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttributeBgColor = (EAttributeImpl) metadata.demandFeature(
                "http://www.omg.org/spec/BPMN/non-normative/color",
                "background-color",
                false,
                false);
        SimpleFeatureMapEntry extensionEntryBgColor = new SimpleFeatureMapEntry(extensionAttributeBgColor,
                                                                                backgroundColor);
        shape.getBpmnElement().getAnyAttribute().add(extensionEntryBgColor);
        EAttributeImpl extensionAttributeBorderColor = (EAttributeImpl) metadata.demandFeature(
                "http://www.omg.org/spec/BPMN/non-normative/color",
                "border-color",
                false,
                false);
        SimpleFeatureMapEntry extensionEntryBorderColor = new SimpleFeatureMapEntry(extensionAttributeBorderColor,
                                                                                    borderColor);
        shape.getBpmnElement().getAnyAttribute().add(extensionEntryBorderColor);
        EAttributeImpl extensionAttributeColor = (EAttributeImpl) metadata.demandFeature(
                "http://www.omg.org/spec/BPMN/non-normative/color",
                "color",
                false,
                false);
        SimpleFeatureMapEntry extensionEntryColor = new SimpleFeatureMapEntry(extensionAttributeColor,
                                                                              fontColor);
        shape.getBpmnElement().getAnyAttribute().add(extensionEntryColor);
    } else {
        _logger.debug("Unable to find color information for shape: " + shape.getBpmnElement().getId());
    }
}
项目:kie-wb-common    文件:Bpmn2JsonUnmarshaller.java   
public void updateEdgeColors(BPMNEdge edge) {
    List<String> eleColorsForEdge = _elementColors.get(edge.getBpmnElement().getId());
    if (eleColorsForEdge != null) {
        String backgroundColor = "";
        String borderColor = "";
        String fontColor = "";
        for (String edgeColor : eleColorsForEdge) {
            String[] shapeColorParts = edgeColor.split(":");
            if (shapeColorParts[0].equals("bgcolor")) {
                backgroundColor = shapeColorParts[1];
            }
            if (shapeColorParts[0].equals("bordercolor")) {
                borderColor = shapeColorParts[1];
            }
            if (shapeColorParts[0].equals("fontcolor")) {
                fontColor = shapeColorParts[1];
            }
        }
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttributeBgColor = (EAttributeImpl) metadata.demandFeature(
                "http://www.omg.org/spec/BPMN/non-normative/color",
                "background-color",
                false,
                false);
        SimpleFeatureMapEntry extensionEntryBgColor = new SimpleFeatureMapEntry(extensionAttributeBgColor,
                                                                                backgroundColor);
        edge.getBpmnElement().getAnyAttribute().add(extensionEntryBgColor);
        EAttributeImpl extensionAttributeBorderColor = (EAttributeImpl) metadata.demandFeature(
                "http://www.omg.org/spec/BPMN/non-normative/color",
                "border-color",
                false,
                false);
        SimpleFeatureMapEntry extensionEntryBorderColor = new SimpleFeatureMapEntry(extensionAttributeBorderColor,
                                                                                    borderColor);
        edge.getBpmnElement().getAnyAttribute().add(extensionEntryBorderColor);
        EAttributeImpl extensionAttributeColor = (EAttributeImpl) metadata.demandFeature(
                "http://www.omg.org/spec/BPMN/non-normative/color",
                "color",
                false,
                false);
        SimpleFeatureMapEntry extensionEntryColor = new SimpleFeatureMapEntry(extensionAttributeColor,
                                                                              fontColor);
        edge.getBpmnElement().getAnyAttribute().add(extensionEntryColor);
    } else {
        _logger.debug("Unable to find color information for shape: " + edge.getBpmnElement().getId());
    }
}