Package org.enhydra.jawe

Examples of org.enhydra.jawe.XPDLElementChangeInfo


    public void update(Observable o, Object arg) {
        if (!(arg instanceof XPDLElementChangeInfo)) {
            return;
        }
        XPDLElementChangeInfo info = (XPDLElementChangeInfo) arg;
        int action = info.getAction();
        if (action != 10) {
            return;
        } else {
            long start = System.currentTimeMillis();
            JaWEManager.getInstance().getLoggingManager().info("CustomValidator -> update for event " + info + " started ...");
View Full Code Here


            return;
        }
        if (!(arg instanceof XPDLElementChangeInfo)) {
            return;
        }
        XPDLElementChangeInfo info = (XPDLElementChangeInfo) arg;
        XMLElement changedElement = info.getChangedElement();
        int action = info.getAction();
        if (info.getSource() == this || (changedElement == null && action != XPDLElementChangeInfo.SELECTED)) {
            return;
        }
        if (!(action == XMLElementChangeInfo.UPDATED ||
                action == XMLElementChangeInfo.INSERTED ||
                action == XMLElementChangeInfo.REMOVED ||
                action == XMLElementChangeInfo.REPOSITIONED ||
                action == XPDLElementChangeInfo.SELECTED ||
                action == XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION ||
                action == XPDLElementChangeInfo.UNDO ||
                action == XPDLElementChangeInfo.REDO ||
                action == XPDLElementChangeInfo.COPY ||
                action == XPDLElementChangeInfo.CUT)) {
            return;
        }

        long start = System.currentTimeMillis();
        JaWEManager.getInstance().getLoggingManager().info(
                "GraphController -> update for event " + info + " started ...");

        updateInProgress = true;
        try {
            if (action == XPDLElementChangeInfo.COPY || action == XPDLElementChangeInfo.CUT) {
                copyOrCutInfo = null;
                if (selectedGraph != null) {
                    GraphManager gm = selectedGraph.getGraphManager();

                    Map actRectangles = new HashMap();
                    Iterator it = info.getChangedSubElements().iterator();
                    while (it.hasNext()) {
                        XMLElement toCopyOrCut = (XMLElement) it.next();
                        if (!(toCopyOrCut instanceof Activity)) {
                            continue;
                        }
                        Activity a = (Activity) toCopyOrCut;
                        GraphActivityInterface ga = gm.getGraphActivity(a);
                        if (ga != null) {
                            CopiedActivityInfo ai = new CopiedActivityInfo(
                                    GraphUtilities.getParticipantId(a),
                                    GraphUtilities.getOffsetPoint(a));
                            Rectangle rect = gm.getBounds(ga, new HashMap());
                            actRectangles.put(ai, rect);
                        }
                    }

                    if (actRectangles.size() > 0) {
                        Rectangle[] rarr = new Rectangle[actRectangles.size()];
                        actRectangles.values().toArray(rarr);
                        Point referencePoint = gm.getUnionBounds(rarr).getLocation();
                        copyOrCutInfo = new CopyOrCutInfo(referencePoint, actRectangles);
                    }
                }
            } else if (action == XPDLElementChangeInfo.UNDO || action == XPDLElementChangeInfo.REDO || action == XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION) {
                if (action == XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION) {
                    GraphUtilities.adjustPackageOnUndoableChangeEvent(info.getChangedSubElements());
                } else {
                    GraphUtilities.adjustPackageOnUndoOrRedoEvent(info.getChangedSubElements());
                }
            } else {
                update(info);
            }
        } finally {
View Full Code Here

            }
        }
    }

    protected XPDLElementChangeInfo createInfo(XMLElement main, List elements, int action) {
        XPDLElementChangeInfo info = new XPDLElementChangeInfo();
        info.setChangedElement(main);
        if (elements.size() != 0) {
            info.setChangedElement((XMLElement) elements.iterator().next());
        }
        info.setChangedSubElements(elements);
        info.setAction(action);
        info.setSource(this);
        return info;
    }
View Full Code Here

        if (!(arg instanceof XMLElementChangeInfo) || ((XMLElementChangeInfo) arg).getChangedElement() == null) {
            JaWEManager.getInstance().getLoggingManager().error("JaWEController -> Invalid arg " + arg + " or element");
            Thread.dumpStack();
            return;
        }
        XPDLElementChangeInfo info;
        if (!(arg instanceof XPDLElementChangeInfo)) {
            info = new XPDLElementChangeInfo(this, (XMLElementChangeInfo) arg);
        } else {
            info = (XPDLElementChangeInfo) arg;
        }
        if (arg instanceof XPDLElementChangeInfo && info.getSource() == this) {
            JaWEManager.getInstance().getLoggingManager().error("JaWEController -> Aborting update because JaWEController is a source!");
            Thread.dumpStack();
            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

                XMLUtil.getPackage(el),
                !specNotif,
                settings.getEncoding(),
                JaWEManager.getInstance().getStartingLocale());
        List l = checkValidity(el, fullCheck);
        XPDLElementChangeInfo info = createInfo(el,
                l,
                XPDLElementChangeInfo.VALIDATION_ERRORS);
        info.setNewValue(new Boolean(specNotif));
        info.setOldValue(new Boolean(initialOrDesignTimeValidation));
        sendEvent(info);
        return (l == null || l.size() == 0);
    }
View Full Code Here

                    notToClose.add(pkg);
                }
            }
            allPackages.removeAll(notToClose);
            setChanged();
            XPDLElementChangeInfo info = createInfo(mainPackage,
                    allPackages,
                    XMLElementChangeInfo.REMOVED);
            info.setOldValue(filePath);
            notifyObservers(info);
            clearXPDLListenerObservables(closeTransient);
        }
        JaWEManager.getInstance().getLoggingManager().info("JaWEController -> package " + xpdlId + " closed");
        updateTitle();
View Full Code Here

        }
    }

    // ////////////////////////// END Of XPDL File Handling /////////////////////
    public XPDLElementChangeInfo createInfo(XMLElement el, int action) {
        XPDLElementChangeInfo info = new XPDLElementChangeInfo();
        info.setChangedElement(el);
        info.setAction(action);
        info.setSource(this);
        return info;
    }
View Full Code Here

        info.setSource(this);
        return info;
    }

    public XPDLElementChangeInfo createInfo(XMLElement main, List elements, int action) {
        XPDLElementChangeInfo info = new XPDLElementChangeInfo();
        info.setChangedElement(main);
        info.setChangedSubElements(elements);
        info.setAction(action);
        info.setSource(this);
        return info;
    }
View Full Code Here

    public void startUndouableChange() {
        Package mainPkg = getMainPackage();
        xpdlInfoList.clear();
        undoableChangeInProgress = true;
        undoSelectionEvent = getCurrentSelectionEvent();
        XPDLElementChangeInfo ucInfo = createInfo(mainPkg,
                XPDLElementChangeInfo.UNDOABLE_ACTION_STARTED);
        ucInfo.setChangedSubElements(xpdlInfoList);
        setChanged();
        notifyObservers(ucInfo);
    }
View Full Code Here

        Package mainPkg = getMainPackage();
        List infoList = new ArrayList(xpdlInfoList);

        Iterator it = infoList.iterator();
        while (it.hasNext()) {
            XPDLElementChangeInfo info = (XPDLElementChangeInfo) it.next();
            handleEvent(info);
        }

        XPDLElementChangeInfo ucInfo = createInfo(mainPkg,
                XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION);
        ucInfo.setChangedSubElements(xpdlInfoList);
        setChanged();
        notifyObservers(ucInfo);

        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();
            elementsToSelect.add(mainPkg);
        }

        ucInfo.setChangedSubElements(xpdlInfoList);

        updateInProgress = true;
        setChanged();
        notifyObservers(ucInfo);
        updateInProgress = false;
View Full Code Here

TOP

Related Classes of org.enhydra.jawe.XPDLElementChangeInfo

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.