Package org.jbpm.ui.common.model

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


    private void createSwimlane() {
        UpdateSwimlaneNameDialog newSwimlaneDialog = new UpdateSwimlaneNameDialog(currentDefinition, true);
        if (newSwimlaneDialog.open() == IDialogConstants.OK_ID) {
            String swimlaneName = newSwimlaneDialog.getName();
            Swimlane newSwimlane = JpdlVersionRegistry.getElementTypeDefinition(currentDefinition.getJpdlVersion(), "swimlane").createElement();
            newSwimlane.setParent(currentDefinition);
            newSwimlane.setName(swimlaneName);
            newSwimlane.setDelegationClassName(Swimlane.DELEGATION_CLASS_NAME);
            currentDefinition.addSwimlane(newSwimlane);
            setSwimlane(swimlaneName);
        }
    }
View Full Code Here


        }
    }

    private void setSwimlane(String swimlaneName) {
        if (swimlaneName != null) {
            Swimlane swimlane = currentDefinition.getSwimlaneByName(swimlaneName);
            currentNode.setSwimlane(swimlane);
        } else {
            currentNode.setSwimlane(null);
        }
    }
View Full Code Here

                                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()) {
                            tr.getBendpoints().add(new Bendpoint(bp.getX(), bp.getY()));
                        }
                        source.addLeavingTransition(tr);

                        for (org.jbpm.ui.common.model.Action action : transition.getActions()) {
                            AddActionHandlerAction copyAction = new AddActionHandlerAction(tr, action);
                            elements.add(copyAction);
                        }
                    }
                }
            }

            List<ExtraCopyAction> userConfirmedActions = new ArrayList<ExtraCopyAction>();
            for (ExtraCopyAction copyAction : elements) {
                if (copyAction.isUserConfirmationRequired()) {
                    copyAction.setEnabled(false);
                    userConfirmedActions.add(copyAction);
                }
            }
            if (userConfirmedActions.size() > 0) {
                // display dialog with collisions
                CopyGraphRewriteDialog dialog = new CopyGraphRewriteDialog(userConfirmedActions);
                dialog.open();
            }

            // run copy actions
            for (ExtraCopyAction copyAction : elements) {
                if (copyAction.isEnabled()) {
                    copyAction.execute();
                    executedActionsList.add(copyAction);
                }
            }

            // set swimlanes
            for (Node node : targetNodeList.values()) {
                if (node instanceof SwimlanedNode) {
                    SwimlanedNode sourceNode = (SwimlanedNode) copyBuffer.getSourceDefinition().getNodeByNameNotNull(node.getName());
                    Swimlane swimlane = targetDefinition.getSwimlaneByName(sourceNode.getSwimlaneName());
                    ((SwimlanedNode) node).setSwimlane(swimlane);
                }
            }
        } catch (Exception e) {
            DesignerLogger.logError("'Paste' operation failed", e);
View Full Code Here

    }
   
    @Override
    public void activate() {
        if (!isActive()) {
            Swimlane swimlane = getSwimlane();
            if (swimlane != null) {
                swimlane.addPropertyChangeListener(this);
            }
            super.activate();
        }
    }
View Full Code Here

    }

    @Override
    public void deactivate() {
        if (isActive()) {
            Swimlane swimlane = getSwimlane();
            if (swimlane != null) {
                swimlane.removePropertyChangeListener(this);
            }
            super.deactivate();
        }
    }
View Full Code Here

    @Override
    public void propertyChange(PropertyChangeEvent evt) {
        super.propertyChange(evt);
        String propertyName = evt.getPropertyName();
        if (PROPERTY_SWIMLANE.equals(propertyName)) {
            Swimlane oldSwimlane = (Swimlane) evt.getOldValue();
            Swimlane newSwimlane = (Swimlane) evt.getNewValue();
            if (oldSwimlane != null) {
                oldSwimlane.removePropertyChangeListener(this);
            }
            if (newSwimlane != null) {
                newSwimlane.addPropertyChangeListener(this);
            }
            getFigure().setSwimlaneName(newSwimlane);
        }
        if (PROPERTY_NAME.equals(propertyName) && evt.getSource() instanceof Swimlane) {
            getFigure().setSwimlaneName(getModel().getSwimlane());
View Full Code Here

        NodeList startStates = document.getElementsByTagName(START_STATE_NODE);
        if (startStates.getLength() == 1) {
            Node node = startStates.item(0);
            StartState startState = create(node, definition);
            String swimlaneName = getAttribute(node, SWIMLANE_NODE);
            Swimlane swimlane = definition.getSwimlaneByName(swimlaneName);
            startState.setSwimlane(swimlane);
        }

        NodeList states = document.getElementsByTagName(STATE_NODE);
        for (int i = 0; i < states.getLength(); i++) {
            Node node = states.item(i);
            NodeList nodeList = node.getChildNodes();
            int transitionsCount = 0;
            boolean hasTimeOutTransition = false;
            for (int j = 0; j < nodeList.getLength(); j++) {
                Node childNode = nodeList.item(j);
                if (TRANSITION_NODE.equals(childNode.getNodeName())) {
                  String transitionName = getAttribute(childNode, NAME_ATTR);
                  if (PluginConstants.TIMER_TRANSITION_NAME.equals(transitionName)) {
                    hasTimeOutTransition = true;
                  }
                  transitionsCount++;
                }
            }
            GraphElement state;
            if (transitionsCount == 1 && hasTimeOutTransition) {
              state = create(node, definition, "waitState");
            } else {
              state = create(node, definition);
            }
            for (int j = 0; j < nodeList.getLength(); j++) {
                Node childNode = nodeList.item(j);
                if (ASSIGNMENT_NODE.equals(childNode.getNodeName()) && state instanceof TimerState) {
                    String swimlaneName = getAttribute(childNode, SWIMLANE_NODE);
                    Swimlane swimlane = definition.getSwimlaneByName(swimlaneName);
                    ((TimerState) state).setSwimlane(swimlane);
                    String assignmentType = getAttribute(childNode, ASSIGNMENT_NODE);
                    ((TimerState) state).setReassignmentEnabled(assignmentType != null && "reassign".equals(assignmentType));
                }
                if (TIMER_NODE.equals(childNode.getNodeName())) {
View Full Code Here

TOP

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

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.