Examples of Settable


Examples of ptolemy.kernel.util.Settable

     *  the name of the attribute.  Attach the attribute to the created entry.
     *
     *  @param query The query into which to add the entry.
     */
    public void addEntry(PtolemyQuery query) {
        Settable container = (Settable) getContainer();
        String name = container.getName();
        String defaultValue = "";
        defaultValue = container.getExpression();
        query.addDisplay(name, container.getDisplayName(), defaultValue);
        query.attachParameter(container, name);
    }
View Full Code Here

Examples of ptolemy.kernel.util.Settable

        }

        Iterator parameters = object.attributeList(Settable.class).iterator();

        while (parameters.hasNext()) {
            Settable param = (Settable) parameters.next();

            // Skip if the parameter is not visible.
            if (!Configurer.isVisible(_object, param)) {
                continue;
            }

            // Get the current style.
            boolean foundOne = false;
            Iterator styles = ((NamedObj) param).attributeList(
                    ParameterEditorStyle.class).iterator();
            ParameterEditorStyle foundStyle = null;

            while (styles.hasNext()) {
                foundOne = true;
                foundStyle = (ParameterEditorStyle) styles.next();
            }

            List styleList = new ArrayList();

            // The index of the default;
            int defaultIndex = 0;

            if (param.getVisibility() == Settable.NOT_EDITABLE) {
                // If the parameter is set to NOT_EDITABLE visibility,
                // then only a fixed style is possible.
                styleList.add("Fixed");
                defaultIndex = 0;
            } else {
                int count = 0;

                // Reduce the list of parameters
                for (int i = 0; (i < _parameterStyles.length)
                        && (_parameterStyles[i] != null); i++) {
                    if (foundOne
                            && (_parameterStyles[i].getClass() == foundStyle
                                    .getClass())) {
                        defaultIndex = count;

                        if (foundStyle.acceptable(param)) {
                            styleList.add(_parameterStyles[i].getName());
                            count++;
                        }
                    } else if (_parameterStyles[i].acceptable(param)) {
                        styleList.add(_parameterStyles[i].getName());
                        count++;
                    }
                }
            }

            String[] styleArray = (String[]) styleList
                    .toArray(new String[styleList.size()]);

            addChoice(param.getName(), param.getName(), styleArray,
                    styleArray[defaultIndex]);
        }

        // Add the expert mode box.
        _originalExpertMode = _object.getAttribute("_expertMode") != null;
View Full Code Here

Examples of ptolemy.kernel.util.Settable

                // gets anything added to it!
                Iterator entries = _originalValues.entrySet().iterator();

                while (entries.hasNext()) {
                    Map.Entry entry = (Map.Entry) entries.next();
                    Settable param = (Settable) _object
                            .getAttribute((String) entry.getKey());

                    try {
                        param.setExpression((String) entry.getValue());
                    } catch (IllegalActionException ex) {
                        throw new InternalErrorException(
                                "Cannot restore style value!");
                    }
                }
View Full Code Here

Examples of ptolemy.kernel.util.Settable

     @param query The query into which to add the entry.
     *  @exception IllegalActionException If the containing attribute
     *   has a value that cannot be edited using this style.
     */
    public void addEntry(PtolemyQuery query) throws IllegalActionException {
        Settable container = (Settable) getContainer();
        String name = container.getName();
        List paramList = attributeList(Settable.class);
        Settable[] choices = (Settable[]) paramList
                .toArray(new Settable[paramList.size()]);
        String[] values = new String[choices.length];

        for (int i = 0; i < choices.length; i++) {
            values[i] = choices[i].getExpression();
        }

        String defaultChoice = container.getExpression();
        query.addChoice(name, container.getDisplayName(), values,
                defaultChoice, _isEditable, PtolemyQuery
                        .preferredBackgroundColor(container), PtolemyQuery
                        .preferredForegroundColor(container));
        query.attachParameter(container, name);
    }
View Full Code Here

Examples of ptolemy.kernel.util.Settable

     *  the name of the attribute.  Attach the attribute to the created entry.
     *
     *  @param query The query into which to add the entry.
     */
    public void addEntry(PtolemyQuery query) {
        Settable container = (Settable) getContainer();
        String name = container.getName();
        String defaultValue = "";
        defaultValue = container.getExpression();
        query.addLine(name, container.getDisplayName(), defaultValue,
                PtolemyQuery.preferredBackgroundColor(container), PtolemyQuery
                        .preferredForegroundColor(container));
        query.attachParameter(container, name);
    }
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.