Package org.jbpm.ui.common.model

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


      List<Node> result = new ArrayList<Node>();
        for (Object object : sourceSelection.toList()) {
            if (!(object instanceof NodeGraphicalEditPart)) {
                continue;
            }
            Node node = ((NodeGraphicalEditPart) object).getModel();
            result.add(node);
        }
      return result;
    }
View Full Code Here


        Document document = XmlUtil.parseDocument(folder.getFile(GPD_FILE_NAME).getContents());
        Element processDiagramInfo = document.getDocumentElement();
        addProcessDiagramInfo(definition, processDiagramInfo);
        List<Element> children = getNamedChildren(processDiagramInfo, NODE_ELEMENT_NAME);
        for (Element element : children) {
            Node node = definition.getNodeByNameNotNull(element.getAttribute(NAME_ATTRIBUTE_NAME));
            Rectangle constraint = new Rectangle();
            constraint.x = Integer.valueOf(element.getAttribute(X_ATTRIBUTE_NAME)).intValue();
            constraint.y = Integer.valueOf(element.getAttribute(Y_ATTRIBUTE_NAME)).intValue();
            constraint.width = Integer.valueOf(element.getAttribute(WIDTH_ATTRIBUTE_NAME)).intValue();
            constraint.height = Integer.valueOf(element.getAttribute(HEIGHT_ATTRIBUTE_NAME)).intValue();
            String minimizedViewStr = element.getAttribute(MIN_VIEW_ATTRIBUTE_NAME);
            if (!isEmptyOrNull(minimizedViewStr) && node instanceof State) {
                boolean minimizedView = Boolean.parseBoolean(minimizedViewStr);
                ((State) node).setMinimizedView(minimizedView);
            }
            node.setConstraint(constraint);
            List<Transition> leavingTransitions = node.getLeavingTransitions();
            List<Element> transitionInfoList = getNamedChildren(element, TRANSITION_ELEMENT_NAME);
            for (int i = 0; i < leavingTransitions.size(); i++) {
                Element transitionElement = transitionInfoList.get(i);
                String transitionName = transitionElement.getAttribute(NAME_ATTRIBUTE_NAME);
                for (Transition transition : leavingTransitions) {
View Full Code Here

        Document document = XmlUtil.parseDocument(formsFile.getContents());
        NodeList formElementsList = document.getDocumentElement().getElementsByTagName(FORM_ELEMENT_NAME);
        for (int i = 0; i < formElementsList.getLength(); i++) {
            Element formElement = (Element) formElementsList.item(i);
            String stateName = formElement.getAttribute(STATE_ATTRIBUTE_NAME);
            Node node = definition.getNodeByNameNotNull(stateName);
            if (node instanceof FormNode) {
                FormNode formNode = (FormNode) node;
                String typeName = formElement.getAttribute(TYPE_ATTRIBUTE_NAME);
                if (!isEmptyOrNull(typeName)) {
                    formNode.setFormType(typeName);
View Full Code Here

public class NodeGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {

    @Override
    protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
        Node node = getNode();
        TransitionCreateCommand command = (TransitionCreateCommand) request.getStartCommand();
        if (!node.canAddArrivingTransition(command.getSource())) {
            return null;
        }
        command.setTarget(node);
        return command;
    }
View Full Code Here

        return command;
    }

    @Override
    protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
        Node node = getNode();
        if (!node.canAddLeavingTransition(null)) {
            return null;
        }
        TransitionCreateCommand command = new TransitionCreateCommand();
        command.setSource(node);
        request.setStartCommand(command);
View Full Code Here

        return command;
    }

    @Override
    protected Command getReconnectTargetCommand(ReconnectRequest request) {
        Node node = getNode();
        Transition transition = getTransition(request);
        if (!node.canReconnectArrivingTransition(transition, transition.getSource())
                || !transition.getSource().canReconnectLeavingTransition(transition, node)) {
            return null;
        }
        TransitionReconnectCommand cmd = new TransitionReconnectCommand();
        cmd.setTransition(transition);
View Full Code Here

        return cmd;
    }

    @Override
    protected Command getReconnectSourceCommand(ReconnectRequest request) {
        Node node = getNode();
        Transition transition = getTransition(request);
        if (!node.canReconnectLeavingTransition(transition, transition.getTarget())
                || !transition.getTarget().canReconnectArrivingTransition(transition, node)) {
            return null;
        }
        TransitionReconnectCommand cmd = new TransitionReconnectCommand();
        cmd.setTransition(transition);
View Full Code Here

        transitionSources.put(transition, transition.getSource());
        transition.getSource().removeLeavingTransition(transition);
    }

    private void reattachTransition(Transition transition) {
        Node source = transitionSources.get(transition);
        source.addLeavingTransition(transition);
    }
View Full Code Here

import org.jbpm.ui.common.model.Node;

public class RotateForkJoinDelegate extends BaseActionDelegate {

    public void run(IAction action) {
        Node node = (Node) selectedPart.getModel();
        Rectangle oldConstraint = node.getConstraint();
        Rectangle newConstraint = oldConstraint.getCopy();
        newConstraint.width = oldConstraint.height;
        newConstraint.height = oldConstraint.width;
        node.setConstraint(newConstraint);
    }
View Full Code Here

                    factory = new GEFElementCreationFactory("end-state", targetDefinition);
                } else if (targetDefinition.getNodeByName(node.getName()) == null) {
                    factory = new GEFElementCreationFactory(node.getTypeName(), targetDefinition);
                }
                if (factory != null) {
                    Node copy = (Node) factory.getNewObject();
                    copy.setName(node.getName());
                    copy.setConstraint(node.getConstraint());
                    if (node instanceof ITimed && ((ITimed) node).timerExist()) {
                        ((ITimed) copy).setDueDate(((ITimed) node).getDuration().getDuration());
                        String variableName = ((ITimed) node).getDuration().getVariableName();
                        if (variableName != null) {
                          Variable variable = copyBuffer.getSourceDefinition().getVariablesMap().get(variableName);
                            CopyVariableAction copyAction = new CopyVariableAction(variable);
                            elements.add(copyAction);
                        }
                    }
                    if (node instanceof State) {
                        ((State) copy).setMinimizedView(((State) node).isMinimizedView());
                    }
                    if (node instanceof Decision) {
                        copy.setDelegationConfiguration(node.getDelegationConfiguration());
                        copy.setDelegationClassName(node.getDelegationClassName());
                    }
                    if (node instanceof Subprocess) {
                        ((Subprocess) copy).setSubProcessName(((Subprocess) node).getSubProcessName());
                        List<VariableMapping> variables = ((Subprocess) node).getVariablesList();
                        ((Subprocess) copy).setVariablesList(variables);
                        for (VariableMapping varMapping : variables) {
                            Variable variable = copyBuffer.getSourceDefinition().getVariablesMap().get(varMapping.getProcessVariable());
                            if (variable != null) {
                                CopyVariableAction copyAction = new CopyVariableAction(variable);
                                elements.add(copyAction);
                            }
                        }
                        copy.setDelegationClassName(node.getDelegationClassName());
                    }
                    targetDefinition.addChild(copy);

                    targetNodeList.put(copy.getName(), copy);

                    if (node instanceof FormNode) {
                        FormNode formNode = (FormNode) node;
                        if (formNode.hasForm() || formNode.hasFormValidation()) {
                            CopyFormFilesAction copyAction = new CopyFormFilesAction(formNode, (FormNode) copy);
                            copyAction.setSourceFolder(copyBuffer.getSourceFolder());
                            copyAction.setTargetFolder(targetFolder);
                            elements.add(copyAction);
                        }
                        Map<String, Integer> variables = formNode.getFormVariables(copyBuffer.getSourceFolder());
                        for (String varName : variables.keySet()) {
                            Variable variable = copyBuffer.getSourceDefinition().getVariablesMap().get(varName);
                            if (variable != null) {
                                CopyVariableAction copyAction = new CopyVariableAction(variable);
                                elements.add(copyAction);
                            }
                        }
                    }
                    if (node instanceof SwimlanedNode) {
                        Swimlane swimlane = ((SwimlanedNode) node).getSwimlane();
                        if (swimlane != null) {
                            CopySwimlaneAction copyAction = new CopySwimlaneAction(swimlane);
                            elements.add(copyAction);
                        }
                    }
                    if (node instanceof Active) {
                        List<? extends org.jbpm.ui.common.model.Action> actions = ((Active) node).getActions();
                        for (org.jbpm.ui.common.model.Action action : actions) {
                            AddActionHandlerAction copyAction = new AddActionHandlerAction((Active) copy, action);
                            elements.add(copyAction);
                        }
                    }
                }
            }

            // add transitions
            GEFElementCreationFactory trFactory = new GEFElementCreationFactory("transition", targetDefinition);
            for (Node node : sourceNodeList) {
                List<Transition> transitions = node.getChildren(Transition.class);
                for (Transition transition : transitions) {
                    Node source = targetNodeList.get(transition.getSource().getName());
                    Node target = targetNodeList.get(transition.getTarget().getName());
                    if (source != null && target != null) {
                        Transition tr = (Transition) trFactory.getNewObject(source);
                        tr.setName(transition.getName());
                        tr.setTarget(target);
                        for (Bendpoint bp : transition.getBendpoints()) {
View Full Code Here

TOP

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

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.