Package org.enhydra.shark.xpdl

Examples of org.enhydra.shark.xpdl.XMLElement


            return;
        }

        int action = info.getAction();

        XMLElement chel = info.getChangedElement();
        if (chel != null && chel.getParent() instanceof Package) {
            if (action == XMLElementChangeInfo.UPDATED && chel instanceof XMLAttribute && chel.toName().equals("Id") || chel.toName().equals("Name")) {
                if (chel.toName().equals("Id")) {
                    changePackageId((Package) chel.getParent(),
                            (String) info.getOldValue(),
                            (String) info.getNewValue());
                }
                updateTitle();
            }
View Full Code Here


                    newPackage(typeId);
                }
            } else {
                startUndouableChange();
                List temp = new ArrayList();
                XMLElement newEl = null;
                if (xpdlClass == Activities.class || xpdlClass == Activity.class) {
                    ActivitySet as = selectionMng.getWorkingActivitySet();
                    WorkflowProcess wp = selectionMng.getWorkingProcess();
                    if (as != null && !as.isReadOnly()) {
                        newEl = JaWEManager.getInstance().getXPDLObjectFactory().createXPDLObject(as.getActivities(), typeId, true);
View Full Code Here

        ucInfo = createInfo(mainPkg, XPDLElementChangeInfo.UNDOABLE_ACTION_ENDED);

        if (elementsToSelect != null && elementsToSelect.size() > 0) {
            if (!selectionMng.checkSelection(elementsToSelect)) {
                XMLElement firstToSelect = (XMLElement) elementsToSelect.get(0);
                elementsToSelect.clear();
                elementsToSelect.add(firstToSelect);
            }
        } else {
            elementsToSelect = new ArrayList();
View Full Code Here

        }
        return false;
    }

    public void handleEvent(XPDLElementChangeInfo info) {
        XMLElement changedElement = info.getChangedElement();

        JaWEManager.getInstance().getLoggingManager().debug("INFO: handleEvenet(): " + info);

        int action = info.getAction();

        if (action == XPDLElementChangeInfo.SELECTED) {
            // should never happen
        } else {
            if (changedElement instanceof WorkflowProcesses) {
                if (action == XMLElementChangeInfo.REMOVED) {
                    if (info.getChangedSubElements() != null) {
                        Iterator it = info.getChangedSubElements().iterator();
                        while (it.hasNext()) {
                            WorkflowProcess wp = (WorkflowProcess) it.next();
                            if (wp == selectionMng.getWorkingProcess()) {
                                // select package
                                selectionMng.setSelection(wp.getParent().getParent(), true);
                                break;
                            }
                        }
                    }
                }
            } else if (changedElement instanceof ActivitySet) {
                if (action == XMLElementChangeInfo.REMOVED) {
                    if (info.getChangedSubElements() != null) {
                        Iterator it = info.getChangedSubElements().iterator();
                        while (it.hasNext()) {
                            ActivitySet as = (ActivitySet) it.next();
                            if (as == selectionMng.getWorkingActivitySet()) {
                                // select process
                                selectionMng.setSelection(as.getParent().getParent(), true);
                                break;
                            }
                        }
                    }
                }
            }
        }

        if (action == XMLElementChangeInfo.INSERTED && (changedElement instanceof WorkflowProcesses || changedElement instanceof ActivitySets)) {
            if (info.getChangedSubElements() != null) {
                selectionMng.setSelection(info.getChangedSubElements(), true);
            }
        }

        updateTitle();
        adjustActions();

        if (action == XMLElementChangeInfo.REMOVED || action == XMLElementChangeInfo.INSERTED) {
            JaWEManager.getInstance().getLoggingManager().info("JaWEController -> performing appropriate actions on inserting/removing");
            if (changedElement instanceof Activities && action == XMLElementChangeInfo.REMOVED) {
                // for removing connected Transitions
                updateSpecialInProgress = true;
                JaWEManager.getInstance().getXPDLUtils().removeTransitionsForActivities(info.getChangedSubElements());
                selectionMng.removeFromSelection(info.getChangedSubElements());
                updateSpecialInProgress = false;
            } else if (changedElement instanceof Transitions) {
                Activities acts = (Activities) ((XMLCollectionElement) changedElement.getParent()).get("Activities");

                updateSpecialInProgress = true;
                JaWEManager.getInstance().getXPDLUtils().correctSplitsAndJoins(acts.toElements());
                updateSpecialInProgress = false;
                if (action == XMLElementChangeInfo.REMOVED) {
                    selectionMng.removeFromSelection(info.getChangedSubElements());
                }
            }
            JaWEManager.getInstance().getLoggingManager().info("JaWEController -> finished performing appropriate actions on inserting/removing");
        } else if (action == XMLElementChangeInfo.UPDATED) {
            XMLElement parent = changedElement.getParent();
            if ((changedElement.toName().equals("Id") && (parent instanceof WorkflowProcess || parent instanceof ActivitySet || parent instanceof Application || parent instanceof Participant || parent instanceof DataField || parent instanceof FormalParameter || parent instanceof Activity || parent instanceof Transition || parent instanceof TypeDeclaration)) || ((changedElement.toName().equals("From") || changedElement.toName().equals("To")) && parent instanceof Transition) || ((parent instanceof Split || parent instanceof Join) && changedElement instanceof XMLAttribute)) {

                if (parent instanceof Activity || parent instanceof Transition || parent instanceof Split || parent instanceof Join) {
                    XMLCollectionElement wpOrAs = XMLUtil.getActivitySet(parent);
                    if (wpOrAs == null) {
                        wpOrAs = XMLUtil.getWorkflowProcess(parent);
                    }
                    if (parent instanceof Activity) {
                        updateSpecialInProgress = true;
                        JaWEManager.getInstance().getXPDLUtils().updateTransitionsOnActivityIdChange((Transitions) wpOrAs.get("Transitions"),
                                (String) info.getOldValue(),
                                (String) info.getNewValue());
                        updateSpecialInProgress = false;
                    } else if (parent instanceof Transition) {
                        if (changedElement.toName().equals("Id")) {
                            updateSpecialInProgress = true;
                            JaWEManager.getInstance().getXPDLUtils().updateActivityOnTransitionIdChange((Activities) wpOrAs.get("Activities"),
                                    ((Transition) parent).getFrom(),
                                    (String) info.getOldValue(),
                                    (String) info.getNewValue());
                            updateSpecialInProgress = false;
                        } else if (changedElement.toName().equals("From")) {
                            updateSpecialInProgress = true;
                            JaWEManager.getInstance().getXPDLUtils().updateActivitiesOnTransitionFromChange((Activities) wpOrAs.get("Activities"),
                                    ((Transition) parent).getId(),
                                    (String) info.getOldValue(),
                                    (String) info.getNewValue());
                            updateSpecialInProgress = false;
                        } else {
                            updateSpecialInProgress = true;
                            JaWEManager.getInstance().getXPDLUtils().updateActivitiesOnTransitionToChange((Activities) wpOrAs.get("Activities"),
                                    ((Transition) parent).getId(),
                                    (String) info.getOldValue(),
                                    (String) info.getNewValue());
                            updateSpecialInProgress = false;
                        }
                    } else if (parent instanceof Split || parent instanceof Join) {
                        updateSpecialInProgress = true;
                        Activity act = XMLUtil.getActivity(parent);
                        JaWEManager.getInstance().getXPDLUtils().correctSplitAndJoin(act);
                        updateSpecialInProgress = false;
                    }
                } else if (parent instanceof TypeDeclaration) {
                    updateSpecialInProgress = true;
                    JaWEManager.getInstance().getXPDLUtils().updateTypeDeclarationReferences(JaWEManager.getInstance().getXPDLUtils().getTypeDeclarationReferences(XMLUtil.getPackage(parent),
                            (String) info.getOldValue()),
                            (String) info.getNewValue());
                    updateSpecialInProgress = false;
                } else if (parent instanceof WorkflowProcess) {
                    updateSpecialInProgress = true;
                    JaWEManager.getInstance().getXPDLUtils().updateWorkflowProcessReferences(JaWEManager.getInstance().getXPDLUtils().getWorkflowProcessReferences(XMLUtil.getPackage(parent),
                            (String) info.getOldValue()),
                            (String) info.getNewValue());
                    updateSpecialInProgress = false;
                } else if (parent instanceof ActivitySet) {
                    updateSpecialInProgress = true;
                    JaWEManager.getInstance().getXPDLUtils().updateActivitySetReferences(JaWEManager.getInstance().getXPDLUtils().getActivitySetReferences(XMLUtil.getWorkflowProcess(parent),
                            (String) info.getOldValue()),
                            (String) info.getNewValue());
                    updateSpecialInProgress = false;
                } else if (parent instanceof Application) {
                    updateSpecialInProgress = true;
                    JaWEManager.getInstance().getXPDLUtils().updateApplicationReferences(JaWEManager.getInstance().getXPDLUtils().getApplicationReferences((XMLComplexElement) parent.getParent().getParent(),
                            (String) info.getOldValue()),
                            (String) info.getNewValue());
                    updateSpecialInProgress = false;
                } else if (parent instanceof Participant) {
                    updateSpecialInProgress = true;
                    JaWEManager.getInstance().getXPDLUtils().updateParticipantReferences(JaWEManager.getInstance().getXPDLUtils().getParticipantReferences((XMLComplexElement) parent.getParent().getParent(),
                            (String) info.getOldValue()),
                            (String) info.getNewValue());
                    updateSpecialInProgress = false;
                } else if (parent instanceof DataField || (parent instanceof FormalParameter && parent.getParent().getParent() instanceof WorkflowProcess)) {
                    updateSpecialInProgress = true;
                    XMLComplexElement pkgOrWp = (XMLComplexElement) parent.getParent().getParent();
                    List refs = null;
                    if (parent instanceof DataField) {
                        refs = JaWEManager.getInstance().getXPDLUtils().getDataFieldReferences(pkgOrWp, (String) info.getOldValue());
                    } else {
                        refs = JaWEManager.getInstance().getXPDLUtils().getFormalParameterReferences((WorkflowProcess) pkgOrWp,
View Full Code Here

    }

    public XPDLElementChangeInfo getCurrentSelectionEvent() {
        // add will be selected event at the end
        List currentSelection = selectionMng.getSelectedElements();
        XMLElement selectionOwner = getMainPackage();
        if (currentSelection != null && currentSelection.size() > 0) {
            selectionOwner = (XMLElement) currentSelection.get(0);
            if (currentSelection.size() == 1) {
                currentSelection.clear();
            } else {
                selectionOwner = selectionOwner.getParent();
            }
        }
        XPDLElementChangeInfo selectionEvent = createInfo(selectionOwner,
                currentSelection,
                XPDLElementChangeInfo.SELECTED);
View Full Code Here

        String doNotAskOnDeletionOfReferencedElements = getControllerSettings().doNotAskOnDeletionOfReferencedElementTypes();
        Set notToAsk = refElsNotToAskOnDeletion(doNotAskOnDeletionOfReferencedElements);
        List refs = new ArrayList();
        if (getControllerSettings().shouldAskOnDeletionOfReferencedElements()) {
            for (int i = 0; i < sel.size(); i++) {
                XMLElement el = (XMLElement) sel.get(i);
                if (el instanceof Activity) {
                    if (!notToAsk.contains(el.toName())) {
                        refs.addAll(JaWEManager.getInstance().getXPDLUtils().getReferences((Activity) el));
                    }
                } else if (el instanceof Transition) {
                    if (!notToAsk.contains(el.toName())) {
                        refs.addAll(JaWEManager.getInstance().getXPDLUtils().getReferences((Transition) el));
                    }
                } else if (el instanceof XMLComplexElement) {
                    if (!notToAsk.contains(el.toName())) {
                        refs.addAll(JaWEManager.getInstance().getXPDLUtils().getReferences(pkgOrWP, (XMLComplexElement) el));
                    }
                }
            }
        }
View Full Code Here

     */
    public String getFilteredProperty(XMLComplexElement element, String property) {
        if (element == null) {
            return null;
        }
        XMLElement elt = element.get(property);
        return elt == null ? null : getValueFilter().getValue(elt);
    }
View Full Code Here

    }

    public void actionPerformed(ActionEvent e) {
        JaWEController jc = JaWEManager.getInstance().getJaWEController();
        List sel = jc.getSelectionManager().getSelectedElements();
        XMLElement firstSelected = jc.getSelectionManager().getSelectedElement();

        //CUSTOM
        if ((!(firstSelected instanceof WorkflowProcess)) || (((JMenuItem) e.getSource()).getAccelerator().getKeyCode() == KeyEvent.VK_DELETE && e.getModifiers() != 0)) {
            if (jc.confirmDelete(sel, firstSelected)) {
                jc.getEdit().delete();
View Full Code Here

                true);
        return p;
    }

    public XMLPanel getPanel(DeclaredType el) {
        XMLElement tdsel = el;
        while (!(tdsel instanceof TypeDeclarations)) {
            tdsel = tdsel.getParent();
            if (tdsel == null) {
                tdsel = XMLUtil.getPackage(el).getTypeDeclarations();
                break;
            }
        }

        TypeDeclarations tds = (TypeDeclarations) tdsel;
        List choices = tds.toElements();
        XMLElement choosen = tds.getTypeDeclaration(el.getId());
        if (el.getParent().getParent() instanceof TypeDeclaration) {
            choices.remove(el.getParent().getParent());
        }
        SpecialChoiceElement cc = new SpecialChoiceElement(el,
                "Id",
View Full Code Here

                        true,
                        false,
                        true,
                        JaWEManager.getInstance().getJaWEController().canModifyElement(el));
            }
            XMLElement holder = el.getParent().getParent().getParent();
            if (XMLUtil.getWorkflowProcess(holder) != null && (holder instanceof Activity || holder instanceof Transition || holder instanceof Tool || holder instanceof WorkflowProcess)) {
                return generateMultiLineTextPanel(el, "Value", false, true, XMLMultiLineTextPanel.SIZE_LARGE, false, JaWEManager.getInstance().getJaWEController().canModifyElement(el));
            } else if (holder instanceof Application && ((Application) holder).getApplicationTypes().getChoosen() instanceof FormalParameters) {
                return generateMultiLineTextPanel(el, "Value", false, true, XMLMultiLineTextPanel.SIZE_LARGE, false, JaWEManager.getInstance().getJaWEController().canModifyElement(el));
            } else {
                return generateMultiLineTextPanel(el, "Value", false, true, XMLMultiLineTextPanel.SIZE_LARGE, false, JaWEManager.getInstance().getJaWEController().canModifyElement(el));
            }
        }
        if (el.getParent() instanceof BlockActivity) {
            WorkflowProcess wp = XMLUtil.getWorkflowProcess(el);
            List choices = wp.getActivitySets().toElements();
            XMLElement choosen = wp.getActivitySet(el.toValue());
            SpecialChoiceElement cc = new SpecialChoiceElement(el,
                    "",
                    choices,
                    choosen,
                    true,
View Full Code Here

TOP

Related Classes of org.enhydra.shark.xpdl.XMLElement

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.