Package ptolemy.gui

Examples of ptolemy.gui.ComponentDialog


            Query query = new Query();
            query.addChoice("delete", "Argument to delete", argumentNames,
                    null, false);

            ComponentDialog dialog = new ComponentDialog(_owner,
                    "Delete a argument for " + _target.getFullName(), query,
                    null);

            // If the OK button was pressed, then queue a mutation
            // to delete the argument.
            if (dialog.buttonPressed().equals("OK")) {
                String argumentName = query.getStringValue("delete");

                if (argumentName != null) {
                    Argument argument = _target.getArgument(argumentName);
View Full Code Here


        _query.addLine(name + " Name", name + " Name", name);
        _query.addLine(name + " CType", name + " C or C++ Type", cType);
        _query.addSelectButtons(name + " Kind", name + " Kind", _optionsArray,
                optionsDefault);

        ComponentDialog dialog = new ComponentDialog(_owner,
                "Add a new argument to " + _target.getFullName(), _query, null);

        // If the OK button was pressed, then queue a mutation
        // to create the parameter.
        // A blank property name is interpreted as a cancel.
        String newName = _query.getStringValue(name + " Name");
        String newCType = _query.getStringValue(name + " CType");
        String newKind = _query.getStringValue(name + " Kind");

        if (dialog.buttonPressed().equals("OK") && !newName.equals("")
                && !newCType.equals("") && !newKind.equals("")) {
            //set name
            Argument argument = _target.getArgument(newName);

            if (argument == null) {
View Full Code Here

    ////                         public methods                    ////

    /** Create an editor for configuring the specified object.
     */
    public void createEditor(NamedObj object, Frame parent) {
        ComponentDialog dialog = new ComponentDialog(parent,
                "Configure JNI Actor", createEditorPane(), _moreButtons);

        String button = dialog.buttonPressed();

        if (button.equals("Cancel")) {
            return;
        }

View Full Code Here

            Query query = new Query();
            query.addChoice("delete", "Parameter to delete", attributeNames,
                    null, false);

            ComponentDialog dialog = new ComponentDialog(_owner,
                    "Delete a parameter for " + _target.getFullName(), query,
                    null);

            // If the OK button was pressed, then queue a mutation
            // to delete the parameter.
            String deleteName = query.getStringValue("delete");

            if (dialog.buttonPressed().equals("OK") && !deleteName.equals("")) {
                String moml = "<deleteProperty name=\"" + deleteName + "\"/>";
                _target.addChangeListener(this);

                MoMLChangeRequest request = new MoMLChangeRequest(this,
                        _target, moml);
                request.setUndoable(true);
                _target.requestChange(request);
            }
        } else if (buttonPressed().equals("Restore Defaults")) {
            ((Configurer) contents).restoreToDefaults();

            // Open a new dialog (a modal dialog).
            new EditParametersDialog(_owner, _target);
        } else if (buttonPressed().equals("Preferences")) {
            // Create a dialog for setting parameter styles.
            try {
                StyleConfigurer panel = new StyleConfigurer(target);
                ComponentDialog dialog = new ComponentDialog(_owner,
                        "Edit preferences for " + target.getName(), panel);

                if (!(dialog.buttonPressed().equals("OK"))) {
                    // Restore original parameter values.
                    panel.restore();
                }

                new EditParametersDialog(_owner, _target);
View Full Code Here

                if (_query == null) {
                    return;
                }

                String newName = _query.getStringValue("name");
                ComponentDialog dialog = _openAddDialog(exception.getMessage()
                        + "\n\nPlease enter a new default value:", newName,
                        _query.getStringValue("default"), _query
                                .getStringValue("class"));
                _target.removeChangeListener(EditParametersDialog.this);

                if (!dialog.buttonPressed().equals("OK")) {
                    // Remove the parameter, since it seems to be erroneous
                    // and the user hit cancel or close.
                    String moml = "<deleteProperty name=\"" + newName + "\"/>";
                    MoMLChangeRequest request = new MoMLChangeRequest(this,
                            _target, moml);
View Full Code Here

        _query.addLine("name", "Name", name);
        _query.addLine("default", "Default value", defValue);
        _query.addLine("class", "Class", className);

        ComponentDialog dialog = new ComponentDialog(_owner,
                "Add a new parameter to " + _target.getFullName(), _query, null);

        // If the OK button was pressed, then queue a mutation
        // to create the parameter.
        // A blank property name is interpreted as a cancel.
        String newName = _query.getStringValue("name");

        // Need to escape quotes in default value.
        String newDefValue = StringUtilities.escapeForXML(_query
                .getStringValue("default"));

        if (dialog.buttonPressed().equals("OK") && !newName.equals("")) {
            String moml = "<property name=\"" + newName + "\" value=\""
                    + newDefValue + "\" class=\""
                    + _query.getStringValue("class") + "\"/>";
            _target.addChangeListener(this);
View Full Code Here

        if (toplevel instanceof Frame) {
            frame = (Frame) toplevel;
        }

        ComponentDialog dialog = new ComponentDialog(frame, "Set plot format",
                this, buttons);

        if (dialog.buttonPressed().equals("Apply")) {
            apply();
        } else {
            restore();
        }
    }
View Full Code Here

                            "Unable to get boolean " + "token.");
                }
            }

            if (directoryFile == null) {
                ComponentDialog dialog = new ComponentDialog(
                        TransformationEditor.this, "Select Model Directory",
                        new Configurer(_attribute));
                if (dialog.buttonPressed().equalsIgnoreCase("OK")) {
                    try {
                        directoryFile = _attribute.directory.asFile();
                        fileFilter = _attribute.fileFilter.getExpression();
                        subdirs = ((BooleanToken) _attribute.subdirs.getToken())
                                .booleanValue();
View Full Code Here

                    // Dialog to ask for a delay time.
                    Query query = new Query();
                    query.addLine("delay", "Time (in ms) to hold highlight",
                            Long.toString(_lastDelayTime));

                    ComponentDialog dialog = new ComponentDialog(
                            FSMGraphFrame.this, "Delay for Animation", query);

                    if (dialog.buttonPressed().equals("OK")) {
                        try {
                            _lastDelayTime = Long.parseLong(query
                                    .getStringValue("delay"));
                            _controller.setAnimationDelay(_lastDelayTime);
View Full Code Here

                        modelFile = parameter.asFile();
                    }
                }

                if (modelFile == null) {
                    ComponentDialog dialog = new ComponentDialog(
                            TransformationEditor.this, "Select Model File",
                            new Configurer(_attribute));
                    if (dialog.buttonPressed().equalsIgnoreCase("OK")) {
                        modelFile = ((FileParameter) _attribute.parameter)
                                .asFile();
                    }
                }
View Full Code Here

TOP

Related Classes of ptolemy.gui.ComponentDialog

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.