Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.Attribute


     @exception IllegalActionException If the highlight cannot be added.
     *  @exception NameDuplicationException Should not be thrown.
     */
    private void _addErrorHighlightIfNeeded(Nameable culprit)
            throws IllegalActionException, NameDuplicationException {
        Attribute highlightColor = ((NamedObj) culprit)
                .getAttribute("_highlightColor");
        if (highlightColor == null) {
            highlightColor = new ColorAttribute((NamedObj) culprit,
                    "_highlightColor");
            ((ColorAttribute) highlightColor)
                    .setExpression("{1.0, 0.0, 0.0, 1.0}");
            highlightColor.setPersistent(false);
            ((ColorAttribute) highlightColor).setVisibility(Settable.EXPERT);
            _errorHighlights.add(highlightColor);
        }
    }
View Full Code Here


            } else {
                List<?> ingredientsAttributes = target
                        .attributeList(GTIngredientsAttribute.class);
                try {
                    if (ingredientsAttributes.isEmpty()) {
                        Attribute attribute = new GTIngredientsAttribute(
                                target, target.uniqueName("operations"));
                        attribute.setPersistent(false);
                    }

                    EditorFactory factory = new GTIngredientsEditor.Factory(
                            target, target
                                    .uniqueName("ingredientsEditorFactory"));
View Full Code Here

            }

            NamedObj container = getContainer();

            if (container != null) {
                Attribute candidateAttribute = container
                        .getAttribute(attributeName.getExpression());

                if (candidateAttribute instanceof Settable) {
                    _associatedAttribute = (Settable) candidateAttribute;
                    _associatedAttribute.addValueListener(this);
View Full Code Here

            while (extenders.hasNext()) {
                ScopeExtender extender = (ScopeExtender) extenders.next();
                Iterator extenderAttributes = extender.attributeList()
                        .iterator();
                while (extenderAttributes.hasNext()) {
                    Attribute extenderAttribute = (Attribute) extenderAttributes
                            .next();
                    if (extenderAttribute instanceof Variable) {
                        result.addAll(((Variable) extenderAttribute)
                                .typeConstraintList());
                    }
View Full Code Here

    public List getChildren() {
        List results = new LinkedList();
        Iterator attributes = attributeList().iterator();
        while (attributes.hasNext()) {
            Attribute attribute = (Attribute) attributes.next();
            results.add(new WeakReference(attribute));
        }
        return results;
    }
View Full Code Here

        // Look for a parameter in the new container with the same name,
        // and establish an association.
        if (entity instanceof TypedActor) {
            // Establish association with the parameter.
            Attribute parameter = entity.getAttribute(getName());

            if (parameter instanceof PortParameter) {
                _parameter = (PortParameter) parameter;

                if (_parameter._port == null) {
View Full Code Here

    /** Return true if the relation has a _hide attribute indicating
     *  that it is hidden.
     *  @return True if the relation is hidden.
     */
    private boolean _isHidden(Relation relation) {
        Attribute hide = relation.getAttribute("_hide");
        if (hide != null) {
            if (hide instanceof Parameter) {
                Token token;
                try {
                    token = ((Parameter) hide).getToken();
View Full Code Here

        try {
            setName(name);

            // Create a tableau factory so that an instance
            // of this class is opened using the EditIconTableau.
            Attribute tableauFactory = new EditIconTableau.Factory(this,
                    "_tableauFactory");
            tableauFactory.setPersistent(false);
        } catch (NameDuplicationException ex) {
            throw new InternalErrorException(ex);
        }
    }
View Full Code Here

            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        // Create a tableau factory so that an instance
        // of this class is opened using the EditIconTableau.
        Attribute tableauFactory = new EditIconTableau.Factory(this,
                "_tableauFactory");
        tableauFactory.setPersistent(false);
    }
View Full Code Here

        // compose their background figures to make this one.
        CompositeFigure figure = null;
        Iterator attributes = attributeList().iterator();

        while (attributes.hasNext()) {
            Attribute attribute = (Attribute) attributes.next();

            // There is a level of indirection where the "subIcon" is a
            // "visible attribute" containing an attribute named "_icon"
            // that actually has the icon.
            Iterator subIcons = attribute.attributeList(EditorIcon.class)
                    .iterator();

            while (subIcons.hasNext()) {
                EditorIcon subIcon = (EditorIcon) subIcons.next();

                if (figure == null) {
                    // NOTE: This used to use a constructor that
                    // takes a "background figure" argument, which would
                    // then treat this first figure specially.  This is not
                    // right since getShape() on the figure will then return
                    // only the shape of the composite, which results in the
                    // wrong selection region being highlighted.
                    figure = new CompositeFigure();
                }

                Figure subFigure = subIcon.createBackgroundFigure();

                // Translate the figure to the location of the subfigure,
                // if there is a location. Also, center it if necessary.
                try {
                    // NOTE: This is inelegant, but only the subclasses
                    // have the notion of centering.
                    // FIXME: Don't use FilledShapeAttribute... promote
                    // centered capability to a base class.
                    if (attribute instanceof FilledShapeAttribute
                            && subFigure instanceof BasicFigure) {
                        boolean centeredValue = ((BooleanToken) ((FilledShapeAttribute) attribute).centered
                                .getToken()).booleanValue();

                        if (centeredValue) {
                            ((BasicFigure) subFigure).setCentered(true);
                        }
                    }

                    Locatable location = (Locatable) attribute.getAttribute(
                            "_location", Locatable.class);

                    if (location != null) {
                        double[] locationValue = location.getLocation();
                        CanvasUtilities.translateTo(subFigure,
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.Attribute

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.