Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.ChangeRequest


                        // immediate parent if there is none.
                        NamedObj container = argument.getContainer();
                        String moml = "<deleteProperty name=\""
                                + argument.getName() + "\"/>\n";

                        ChangeRequest request = new MoMLChangeRequest(this,
                                container, moml);
                        container.addChangeListener(this);
                        container.requestChange(request);
                    }
                }
View Full Code Here


                    // Defer change requests so that if changes are
                    // requested during execution, they get queued.
                    previousDeferStatus = setDeferringChangeRequests(true);

                    while (requests.hasNext()) {
                        ChangeRequest change = (ChangeRequest) requests.next();
                        change.setListeners(_changeListeners);

                        if (_debugging) {
                            _debug("-- Executing change request "
                                    + "with description: "
                                    + change.getDescription());
                        }

                        // The change listeners should be those of this
                        // actor and any container that it has!
                        // FIXME: This is expensive... Better solution?
                        // We previously tried issuing a dummy change
                        // request to the container, but this caused big
                        // problems... (weird null-pointer expections
                        // deep in diva when making connections).
                        // Is it sufficient to just go to the top level?
                        List changeListeners = new LinkedList();
                        NamedObj container = getContainer();

                        while (container != null) {
                            List list = container.getChangeListeners();

                            if (list != null) {
                                changeListeners.addAll(list);
                            }

                            container = container.getContainer();
                        }

                        change.setListeners(changeListeners);

                        change.execute();
                    }
                } finally {
                    _workspace.doneWriting();
                    setDeferringChangeRequests(previousDeferStatus);
                }
View Full Code Here

        super._addEntity(entity);

        // Issue a change request to add the appropriate
        // ports and connections to the new entity.
        ChangeRequest request = new ChangeRequest(this, // originator
                "Adjust contained entities, ports and parameters") {
            // Override this to indicate that the change is localized.
            // This keeps the EntityTreeModel from closing open libraries
            // when notified of this change.
            public NamedObj getLocality() {
View Full Code Here

        // the time this executes.  Do not use MoML here because it
        // isn't necessary to generate any undo code.  _removePort()
        // takes care of the undo.
        final MirrorPort castPort = (MirrorPort) port;

        ChangeRequest request = new ChangeRequest(this,
                "Add a port on the inside") {
            // Override this to indicate that the change is localized.
            // This keeps the EntityTreeModel from closing open libraries
            // when notified of this change.
            public NamedObj getLocality() {
View Full Code Here

                return;
            }

            // Use a change request so we can be sure the port
            // being added is fully constructed.
            ChangeRequest request = new ChangeRequest(this,
                    "Add mirror port to the container.") {
                // Override this to indicate that the change is localized.
                // This keeps the EntityTreeModel from closing open libraries
                // when notified of this change.
                public NamedObj getLocality() {
View Full Code Here

        // making a change request, which invalidates this HDF's schedule.
        // So we need to get the schedule of this HDFDirector also in a
        // change request.
        if (!isScheduleValid() || (getContainer() != toplevel())) {
            CompositeActor container = (CompositeActor) getContainer();
            ChangeRequest request = new ChangeRequest(this, "reschedule") {
                protected void _execute() throws KernelException {
                    getScheduler().getSchedule();
                }
            };

            request.setPersistent(false);
            container.requestChange(request);
        }

        return super.postfire();
    }
View Full Code Here

            // Increment the workspace version such that the
            // function dependencies will be reconstructed.
            // FIXME: Replace this with conservative approximation.
            if (_mutationEnabled) {
                ChangeRequest request = new ChangeRequest(this,
                        "increment workspace version to force recalculation of function dependencies") {
                    protected void _execute() throws KernelException {
                        getContainer().workspace().incrVersion();
                    }
                };
                request.setPersistent(false);
                getContainer().requestChange(request);
            }
        }

        // If a transition was taken, then request a refiring at the current time
View Full Code Here

                        String chg = newEntity.exportMoML();
                        System.out.println("the moml description of the "
                                + "new object is: \n" + chg + "\n");

                        ChangeRequest request = new MoMLChangeRequest(this, // originator
                                this, // context
                                chg, // MoML code
                                null); // base
                        requestChange(request);

                        ChangeRequest request2 = new MoMLChangeRequest(this, // originator
                                _cachedLib, // context
                                chg, // MoML code
                                null); // base

                        _cachedLib.requestChange(request2);
View Full Code Here

     *  it.  This overrides the base class to queue a change request to do
     *  the printing, because otherwise, printing will cause a deadlock.
     */
    protected void _print() {
        if (_model != null) {
            ChangeRequest request = new ChangeRequest(this, "Print") {
                protected void _execute() throws Exception {
                    PtolemyFrame.super._print();
                }
            };

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

TOP

Related Classes of ptolemy.kernel.util.ChangeRequest

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.