Examples of ChangeRequest


Examples of ptolemy.kernel.util.ChangeRequest

    /** Insert a new clock.
     */
    public void insertClock() {
        // Create an anonymous inner class
        ChangeRequest change = new ChangeRequest(this, "test2") {
            protected void _execute() throws Exception {
                _clock.output.unlinkAll();
                _rec.input.unlinkAll();

                Clock clock2 = new Clock(_top, "clock2");
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

                    // result in creation of yet another figure before this
                    // method even returns!
                    GraphController controller = IconController.this
                            .getController();
                    GraphModel graphModel = controller.getGraphModel();
                    ChangeRequest request = new ChangeRequest(graphModel,
                            "Set the container of a new XMLIcon.") {
                        // NOTE: The KernelException should not be thrown,
                        // but if it is, it will be handled properly.
                        protected void _execute() throws KernelException {
                            _iconsPendingContainer.remove(object);

                            // If the icon already has a container, do nothing.
                            if (icon.getContainer() != null) {
                                return;
                            }

                            // If the container already has an icon, do nothing.
                            if (object.getAttribute("_icon") != null) {
                                return;
                            }

                            icon.setContainer(object);
                        }
                    };

                    request.setPersistent(false);
                    object.requestChange(request);
                } else if (iconList.size() >= 1) {
                    // Use only the last icon in the list.
                    EditorIcon icon = (EditorIcon) iconList
                            .get(iconList.size() - 1);
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

     @exception IllegalActionException If the change is not acceptable
     *   to the container.
     */
    public void setExpression(String expression) throws IllegalActionException {
        if (expression.equals("")) {
            ChangeRequest request = new ChangeRequest(this,
                    "Delete empty doc tag.") {
                protected void _execute() throws Exception {
                    setContainer(null);
                }
            };
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

    public void managerStateChanged(Manager manager) {
        Manager.State newState = manager.getState();

        if (newState != _previousState) {
            // Clear any error reporting highlights that may be present.
            ChangeRequest request = new ChangeRequest(this,
                    "Error Highlight Clearer") {
                protected void _execute() throws Exception {
                    for (Attribute highlight : _errorHighlights) {
                        highlight.setContainer(null);
                    }
                }
            };

            // Mark the Error Highlight Clearer request as
            // non-persistant so that we don't mark the model as being
            // modified.  ptolemy/actor/lib/jni/test/Scale/Scale.xml
            // required this change.
            request.setPersistent(false);
            manager.requestChange(request);

            getFrame().report(manager.getState().getDescription());
            _previousState = newState;
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

     *  indicate that it is the source of an error.
     *  @param culprit The culprit.
     */
    private void _highlightError(final Nameable culprit) {
        if (culprit instanceof NamedObj) {
            ChangeRequest request = new ChangeRequest(this, "Error Highlighter") {
                protected void _execute() throws Exception {
                    _addErrorHighlightIfNeeded(culprit);
                    NamedObj container = culprit.getContainer();
                    while (container != null) {
                        _addErrorHighlightIfNeeded(container);
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

    /** Insert a feedback loop.
     */
    public void insertFeedback() {
        // Create an anonymous inner class
        ChangeRequest change = new ChangeRequest(this, "test2") {
            protected void _execute() throws Exception {
                _const.output.unlinkAll();
                _rec.input.unlinkAll();

                AddSubtract add = new AddSubtract(_top, "add");
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

    }

    /** Create a change request that always throws an exception. */
    public ChangeRequest mutateBadChangeRequest() {
        // Create an anonymous inner class
        changeRequest = new ChangeRequest(this,
                "Change request that always throws an Exception") {
            protected void _execute() throws Exception {
                if (1 == 1) {
                    throw new Exception("Always Thrown Exception");
                }
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

    }

    /** Create a change request that sets const to 2.0. */
    public ChangeRequest mutateConst2ChangeRequest() {
        // Create an anonymous inner class
        changeRequest = new ChangeRequest(this, "Changing Const to 2.0") {
            protected void _execute() throws Exception {
                _const.value.setToken(new DoubleToken(2.0));
            }
        };
        return changeRequest;
View Full Code Here

Examples of ptolemy.kernel.util.ChangeRequest

        ;

        String moml = getDeleteNodeMoML(node);

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

Examples of ptolemy.kernel.util.ChangeRequest

    private void _setPortSignalTypes(final SignalTypeMap typeMap) {
        Director director = (Director) getContainer();
        final CompositeActor container = (CompositeActor) director
                .getContainer();

        ChangeRequest request = new ChangeRequest(this, "Record signal types") {
            protected void _execute() throws KernelException {
                Iterator entities = container.deepEntityList().iterator();

                while (entities.hasNext()) {
                    Entity entity = (Entity) entities.next();

                    for (Iterator ports = entity.portList().iterator(); ports
                            .hasNext();) {
                        IOPort port = (IOPort) ports.next();
                        String typeString = typeMap.getType(port).toString();
                        _setOrCreate(port, "resolvedSignalType", typeString);
                    }
                }
            }
        };

        // Indicate that the change is non-persistent, so that
        // the UI doesn't prompt to save.
        request.setPersistent(false);
        container.requestChange(request);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.