Package org.jbpm.ui.common.model

Examples of org.jbpm.ui.common.model.GraphElement


        treeViewer.refresh();
    }

    public Object getParent(Object element) {
        ElementMatch elementMatch = (ElementMatch) element;
        GraphElement graphElement = elementMatch.getGraphElement();
        if (graphElement instanceof ProcessDefinition)
            return null;
        if (elementMatch.getParent() != null) {
            return elementMatch.getParent();
        }
        return new ElementMatch(graphElement.getParent());
    }
View Full Code Here


    }

    @Override
    public String getText(Object element) {
        ElementMatch elementMatch = (ElementMatch) element;
        GraphElement graphElement = elementMatch.getGraphElement();
        String text;
        if (ElementMatch.CONTEXT_FORM.equals(elementMatch.getContext())) {
            text = Messages.getString("Search.formNode.form");
        } else if (ElementMatch.CONTEXT_FORM_VALIDATION.equals(elementMatch.getContext())) {
            text = Messages.getString("Search.formNode.validation");
        } else if (graphElement instanceof NamedGraphElement) {
            text = ((NamedGraphElement) graphElement).getName();
        } else {
            text = graphElement.toString();
        }
       
        if (ElementMatch.CONTEXT_TIMED_VARIABLE.equals(elementMatch.getContext())) {
          text += " [" + Messages.getString("Timer.baseDate") + "]";
        }
View Full Code Here

      return create(node, parent, node.getNodeName());
    }

    @SuppressWarnings("unchecked")
    private <T extends GraphElement> T create(Node node, GraphElement parent, String typeName) {
        GraphElement element = JpdlVersionRegistry.getElementTypeDefinition(jpdlVersion, typeName).createElement();
        if (parent != null) {
            parent.addChild(element);
        }
        if (element instanceof NamedGraphElement) {
            ((NamedGraphElement) element).setName(getAttribute(node, NAME_ATTR));
        }
        NodeList nodeList = node.getChildNodes();
        for (int j = 0; j < nodeList.getLength(); j++) {
            Node childNode = nodeList.item(j);
            if (DESCRIPTION_NODE.equals(childNode.getNodeName())) {
                ((Describable) element).setDescription(getTextContent(childNode));
            }
            if (HANDLER_NODE.equals(childNode.getNodeName()) || ASSIGNMENT_NODE.equals(childNode.getNodeName())) {
                ((Delegable) element).setDelegationClassName(getAttribute(childNode, CLASS_ATTR));
                element.setDelegationConfiguration(getTextContent(childNode));
            }
            if (ACTION_NODE.equals(childNode.getNodeName())) {
                // only transition actions loaded here
                String eventType;
                if (element instanceof Transition) {
View Full Code Here

                    hasTimeOutTransition = true;
                  }
                  transitionsCount++;
                }
            }
            GraphElement state;
            if (transitionsCount == 1 && hasTimeOutTransition) {
              state = create(node, definition, "waitState");
            } else {
              state = create(node, definition);
            }
View Full Code Here

    }

    private void addElements(ProcessDefinition oldDef, ProcessDefinition newDef, Class<? extends GraphElement> sourceClass, String targetTypeName) throws Exception {
        List<? extends GraphElement> sourceElements = oldDef.getChildren(sourceClass);
        for (GraphElement oldElement : sourceElements) {
            GraphElement newElement = JpdlVersionRegistry.getElementTypeDefinition(newJpdlVersion, targetTypeName).createElement();
            setProperties(oldElement, newElement, true);
            newDef.addChild(newElement);
        }
    }
View Full Code Here

    }

    private void copyChildren(GraphElement target, List<GraphElement> childs) throws Exception {
        log.append("Copy children for element '").append(target.getTypeName()).append("'; ");
        for (GraphElement oldChild : childs) {
            GraphElement newChild = JpdlVersionRegistry.getElementTypeDefinition(newJpdlVersion, oldChild.getTypeName()).createElement();
            setProperties(oldChild, newChild, true);
            target.addChild(newChild);
        }
    }
View Full Code Here

        this.elementType = elementType;
        this.definition = definition;
    }

    public Object getNewObject() {
        GraphElement element = JpdlVersionRegistry.getElementTypeDefinition(definition.getJpdlVersion(), elementType).createElement();
        element.setParent(definition);
        element.postCreate();
        return element;
    }
View Full Code Here

        element.postCreate();
        return element;
    }

    public Object getNewObject(GraphElement parent) {
        GraphElement element = JpdlVersionRegistry.getElementTypeDefinition(definition.getJpdlVersion(), elementType).createElement();
        element.setParent(parent);
        element.postCreate();
        return element;
    }
View Full Code Here

                firstTime = false;
                EditPart rootEditPart = new OutlineRootTreeEditPart();
                rootEditPart.setModel(model);
                return rootEditPart;
            }
            GraphElement element = (GraphElement) model;
            if (element instanceof Variable) {
                return new VariableTreeEditPart((Variable) element);
            }
            if (element instanceof GroupElement) {
                return new GroupElementTreeEditPart((GroupElement) element);
            }
            return element.getTypeDefinition().createTreeEditPart(element);
        }
View Full Code Here

    }
   
    private Action findByPath(ProcessDefinition definition, String path) {
        try {
            String[] components = path.split(DELIM, -1);
            GraphElement element = definition;
            if (components.length > 2) {
                for (int i = 1; i < components.length-1; i++) {
                    String name = components[i];
                    for (NamedGraphElement e : element.getChildren(NamedGraphElement.class)) {
                        if (name.equals(e.getName())) {
                            element = e;
                            break;
                        }
                    }
                }
            }
            String actionName = components[components.length-1];
            int actionIndex = Integer.parseInt(actionName.substring(ACTION_INDEX.length()));
            return element.getActions().get(actionIndex);
        } catch (Exception e) {
            DesignerLogger.logErrorWithoutDialog("findByPath in " + definition, e);
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.ui.common.model.GraphElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.