Package ptolemy.moml

Examples of ptolemy.moml.MoMLChangeRequest


            String moml = "<property name=\"" + newName + "\" value=\""
                    + newDefValue + "\" class=\""
                    + _query.getStringValue("class") + "\"/>";
            _target.addChangeListener(this);

            MoMLChangeRequest request = new MoMLChangeRequest(this, _target,
                    moml);
            request.setUndoable(true);
            _target.requestChange(request);
        }

        return dialog;
    }
View Full Code Here


                                moml.append(_highlightColor.exportMoML());
                                moml.append("</entity>");
                            }
                        }
                        moml.append("</group>");
                        container.requestChange(new MoMLChangeRequest(this,
                                container, moml.toString()));
                    } else {
                        // Clear all highlights.
                        StringBuffer moml = new StringBuffer("<group>");
                        for (Object entity : ((CompositeEntity) container)
                                .entityList()) {
                            if (((ComponentEntity) entity)
                                    .getAttribute("_highlightColor") != null) {
                                moml.append("<entity name=\"");
                                moml.append(((ComponentEntity) entity)
                                        .getName());
                                moml.append("\">");
                                moml
                                        .append("<deleteProperty name=\"_highlightColor\"/>");
                                moml.append("</entity>");
                            }
                        }
                        moml.append("</group>");
                        container.requestChange(new MoMLChangeRequest(this,
                                container, moml.toString()));
                    }
                }
            } catch (IllegalActionException e1) {
                MessageHandler.error("Failed to set highlight colors", e1);
View Full Code Here

                + lineName
                + "\" class=\"ptolemy.vergil.kernel.attributes.LineAttribute\">"
                + senderLocation.exportMoML() + "<property name=\"x\" value=\""
                + x + "\"/>" + "<property name=\"y\" value=\"" + y + "\"/>"
                + "</property>";
        ChangeRequest request = new MoMLChangeRequest(this, getContainer(),
                moml) {
            protected void _execute() throws Exception {
                try {
                    super._execute();
                    LineAttribute line = (LineAttribute) getContainer()
View Full Code Here

     *
     * @param lineName Name of line previously created.
     */
    protected void _removeLine(String lineName) {
        String moml = "<deleteProperty name=\"" + lineName + "\"/>";
        ChangeRequest request = new MoMLChangeRequest(this, getContainer(),
                moml) {
            protected void _execute() throws Exception {
                try {
                    super._execute();
                } catch (Exception e) {
View Full Code Here

            NamedObj actor = getTarget();
            StringBuffer moml = new StringBuffer("<group>");
            HashSet<NamedObj> visited = new HashSet<NamedObj>();
            _addHighlights(actor, moml, visited, _forward, _clear);
            moml.append("</group>");
            actor.requestChange(new MoMLChangeRequest(this, actor
                    .getContainer(), moml.toString()));
        }
View Full Code Here

                    randomLocation));
        }

        changeMoML.append("</group>");

        MoMLChangeRequest request = new MoMLChangeRequest(this, container,
                changeMoML.toString());
        container.requestChange(request);

        // Increment the workspace version number, since the wireless
        // graph connectivity probably changed as a result of the node
View Full Code Here

            String moml = "<deleteEntity name=\"" + deleteObj.getName()
                    + "\"/>\n";

            // Note: The source is NOT the graph model.
            MoMLChangeRequest request = new MoMLChangeRequest(this, container,
                    moml);
            request.setUndoable(true);
            container.requestChange(request);
        }
View Full Code Here

            inputReader.close();
            addChangeListener(this);

            try {
                requestChange(new MoMLChangeRequest(this, this, buffer
                        .toString()));
            } catch (Exception ex) {
                throw new IllegalActionException(this, ex, "Failed to parse "
                        + buffer.toString());
            }
View Full Code Here

        undoMoml.append("</group>\n");

        final String finalUndoMoML = undoMoml.toString();

        // Request the change.
        MoMLChangeRequest request = new MoMLChangeRequest(this, toplevel, moml
                .toString()) {
            protected void _execute() throws Exception {
                super._execute();

                // Next create and register the undo entry;
View Full Code Here

            // handle the event dispatch specially:  An event is only
            // dispatched if both the head and the tail are attached.
            // This rather obnoxious hack is here because edge creation
            // is tricky and we can't rerender the edge while we are dragging
            // it.
            MoMLChangeRequest request = new MoMLChangeRequest(
                    ActorGraphModel.this, container, moml.toString()) {
                protected void _execute() throws Exception {
                    // If nonEmptyMoML is false, then the MoML code is empty.
                    // Do not execute it, as this will put spurious empty
                    // junk on the undo stack.
                    if (nonEmptyMoML) {
                        super._execute();
                    }

                    link.setHead(newLinkHead);

                    if (relationNameToAdd != null) {
                        ComponentRelation relation = container
                                .getRelation(relationNameToAdd);

                        if (relation == null) {
                            throw new InternalErrorException(
                                    "Tried to find relation with name "
                                            + relationNameToAdd
                                            + " in context " + container);
                        }

                        link.setRelation(relation);
                    } else {
                        link.setRelation(null);
                    }
                }
            };

            // Handle what happens if the mutation fails.
            request.addChangeListener(new LinkChangeListener(link, container,
                    failmoml));

            request.setUndoable(true);
            container.requestChange(request);
        }
View Full Code Here

TOP

Related Classes of ptolemy.moml.MoMLChangeRequest

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.