Examples of EditorIcon


Examples of ptolemy.vergil.icon.EditorIcon

        columns.setExpression("10");
        rows = new Parameter(this, "rows");
        rows.setExpression("10");

        // Create the LED Array icon.
        _ledArray_icon = new EditorIcon(this, "_icon");
        _init();
    }
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

        // declare the type.
        TypeAttribute portType = new TypeAttribute(output, "type");
        portType.setExpression("{location={double}, time=double, depth=int}");

        // Create an icon for this sensor node.
        EditorIcon node_icon = new EditorIcon(this, "_icon");

        // The icon has two parts: a circle and an antenna.
        // Create a circle that indicates the signal radius.
        _circle = new EllipseAttribute(node_icon, "_circle");
        _circle.centered.setToken("true");
        _circle.width.setToken("range*2");
        _circle.height.setToken("range*2");
        _circle.fillColor.setToken("{0.0, 0.0, 1.0, 0.05}");
        _circle.lineColor.setToken("{0.0, 0.0, 1.0, 0.05}");

        _circle2 = new EllipseAttribute(node_icon, "_circle2");
        _circle2.centered.setToken("true");
        _circle2.width.setToken("20");
        _circle2.height.setToken("20");
        _circle2.fillColor.setToken("{1.0, 1.0, 1.0, 1.0}");
        _circle2.lineColor.setToken("{0.0, 0.5, 0.5, 1.0}");

        node_icon.setPersistent(false);

        // Hide the name of this sensor node.
        SingletonParameter hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

        hide.setToken(BooleanToken.TRUE);
        hide = new SingletonParameter(test, "_hide");
        hide.setToken(BooleanToken.TRUE);

        // Create an icon for this sensor node.
        EditorIcon node_icon = new EditorIcon(this, "_icon");

        // The icon has two parts: a circle and an antenna.
        // Create a circle that indicates the signal radius.
        _circle = new EllipseAttribute(node_icon, "_circle");
        _circle.centered.setToken("true");
        _circle.width.setToken("sureRange*2");
        _circle.height.setToken("sureRange*2");
        _circle.fillColor.setToken("{0.0, 0.0, 1.0, 0.05}");
        _circle.lineColor.setToken("{0.0, 0.0, 1.0, 0.05}");

        _circle2 = new EllipseAttribute(node_icon, "_circle2");
        _circle2.centered.setToken("true");
        _circle2.width.setToken("20");
        _circle2.height.setToken("20");
        _circle2.fillColor.setToken("{1.0, 1.0, 1.0, 1.0}");
        _circle2.lineColor.setToken("{0.0, 0.5, 0.5, 1.0}");

        node_icon.setPersistent(false);

        // Hide the name of this sensor node.
        hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

    public MicaLeds(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        // Create the node icon.
        EditorIcon node_icon = new EditorIcon(this, "_icon");

        // The icon of this actor has 3 LEDs: red, yellow, and green.
        // For each LED, create the corresponding parameter and
        // graphical icon.  Then initialize the LED to the off setting.
        red = new Parameter(this, "red");
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

        _yPoints[2] = 5;
        _xPoints[3] = 20;
        _yPoints[3] = 0;

        //Create the icon.
        _icon = new EditorIcon(this, "_icon");
        _terrain = new FilledShapeAttribute(_icon, "terrain") {
            protected Shape _newShape() {
                return new Polygon(_xPoints, _yPoints, _numberOfPoints);
            }
        };
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

        hide.setToken(BooleanToken.TRUE);
        hide = new SingletonParameter(input, "_hide");
        hide.setToken(BooleanToken.TRUE);

        // Create an icon for this sensor node.
        EditorIcon node_icon = new EditorIcon(this, "_icon");

        // The icon has two parts: a circle and an antenna.
        // Create a circle that indicates the signal radius.
        _circle = new EllipseAttribute(node_icon, "_circle");
        _circle.centered.setToken("true");
        _circle.width.setToken("outputRange*2");
        _circle.height.setToken("outputRange*2");
        _circle.fillColor.setToken("{0.0, 0.0, 1.0, 0.08}");
        _circle.lineColor.setToken("{0.0, 0.5, 0.5, 1.0}");

        // Create the green antenna shape.
        ResizablePolygonAttribute antenna = new ResizablePolygonAttribute(
                node_icon, "antenna2");
        antenna.vertices.setToken("{0, -5, -5, -15, 5, -15, 0, -5, 0, 15}");
        antenna.width.setToken("10");
        antenna.height.setToken("30");

        // Set the color to green.
        antenna.fillColor.setToken("{0.0, 1.0, 0.0, 1.0}");

        node_icon.setPersistent(false);

        // Hide the name of this sensor node.
        hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

        TypeAttribute portType = new TypeAttribute(output, "type");
        portType
                .setExpression("{location=arrayType(double, 2), time=double, depth=int}");

        // Create an icon for this sensor node.
        EditorIcon node_icon = new EditorIcon(this, "_icon");

        // The icon has two parts: a circle and an antenna.
        // Create a circle that indicates the signal radius.
        _circle = new EllipseAttribute(node_icon, "_circle");
        _circle.centered.setToken("true");
        _circle.width.setToken("range*2");
        _circle.height.setToken("range*2");
        _circle.fillColor.setToken("{0.0, 0.0, 1.0, 0.05}");
        _circle.lineColor.setToken("{0.0, 0.0, 1.0, 0.05}");

        _circle2 = new EllipseAttribute(node_icon, "_circle2");
        _circle2.centered.setToken("true");
        _circle2.width.setToken("20");
        _circle2.height.setToken("20");
        _circle2.fillColor.setToken("{1.0, 1.0, 1.0, 1.0}");
        _circle2.lineColor.setToken("{0.0, 0.5, 0.5, 1.0}");

        node_icon.setPersistent(false);

        // Hide the name of this sensor node.
        SingletonParameter hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

                    // Further, we have to make a record of the figure, indexed
                    // by the object, in case some other change request is
                    // executed before this gets around to setting the
                    // container.  Otherwise, that second change request
                    // will result in the creation of a second figure.
                    final EditorIcon icon = new XMLIcon(object.workspace(),
                            "_icon");
                    icon.setContainerToBe(object);
                    icon.setPersistent(false);
                    result = icon.createFigure();

                    // NOTE: Make sure this is done before the change request
                    // below is executed, which may be as early as when it is
                    // requested.
                    _iconsPendingContainer.put(object, icon);

                    // NOTE: Make sure the source of this change request is
                    // the graph model. Otherwise, this change request will
                    // trigger a redraw of the entire graph, which will result
                    // in another call to this very same method, which will
                    // 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);
                    result = icon.createFigure();
                }
            } catch (KernelException ex) {
                throw new InternalErrorException(null, ex,
                        "Could not create icon " + "in " + object + " even "
                                + "though one did not previously exist.");
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

         @return A Figure.
         */
        public Figure render(Object n) {
            Locatable location = (Locatable) n;
            final NamedObj object = location.getContainer();
            EditorIcon icon;

            try {
                // In theory, there shouldn't be more than one
                // icon, but if there are, use the last one.
                List icons = object.attributeList(EditorIcon.class);

                // Check to see whether there is an icon that has been created,
                // but not inserted.
                if (icons.size() == 0) {
                    XMLIcon alreadyCreated = (XMLIcon) _iconsPendingContainer
                            .get(object);

                    if (alreadyCreated != null) {
                        icons.add(alreadyCreated);
                    }
                }

                if (icons.size() > 0) {
                    icon = (EditorIcon) icons.get(icons.size() - 1);
                } else {
                    // NOTE: This code is the same as in
                    // IconController.IconRenderer.
                    // NOTE: This used to directly create an XMLIcon within
                    // the container "object". However, this is not cosher,
                    // since we may not be able to get write access on the
                    // workspace. We instead use a hack supported by XMLIcon
                    // to create an XMLIcon with no container (this does not
                    // require write access to the workspace), and specify
                    // to it what the container will eventually be. Then
                    // we queue a change request to make that the container.
                    // Further, we have to make a record of the figure, indexed
                    // by the object, in case some other change request is
                    // executed before this gets around to setting the
                    // container.  Otherwise, that second change request
                    // will result in the creation of a second figure.
                    icon = new XMLIcon(object.workspace(), "_icon");
                    icon.setContainerToBe(object);
                    icon.setPersistent(false);

                    // NOTE: Make sure this is done before the change request
                    // below is executed, which may be as early as when it is
                    // requested.
                    _iconsPendingContainer.put(object, icon);

                    // NOTE: Make sure the source of this change request is
                    // the graph model. Otherwise, this change request will
                    // trigger a redraw of the entire graph, which will result
                    // in another call to this very same method, which will
                    // result in creation of yet another figure before this
                    // method even returns!
                    final EditorIcon finalIcon = icon;
                    ChangeRequest request = new ChangeRequest(_model,
                            "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 (finalIcon.getContainer() != null) {
                                return;
                            }

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

                            finalIcon.setContainer(object);
                        }
                    };

                    request.setPersistent(false);
                    object.requestChange(request);
View Full Code Here

Examples of ptolemy.vergil.icon.EditorIcon

                if ((iconList.size() > 0)
                        || (object.getAttribute("_iconDescription") != null)
                        || (object.getAttribute("_smallIconDescription") != null)) {
                    // NOTE: this code is similar to that in IconController.
                    EditorIcon icon = null;

                    try {
                        if (iconList.size() == 0) {
                            icon = new XMLIcon(object, "_icon");
                            icon.setPersistent(false);
                        } else {
                            icon = (EditorIcon) iconList
                                    .get(iconList.size() - 1);
                        }
                    } catch (KernelException ex) {
                        throw new InternalErrorException(
                                "could not create icon in "
                                        + object
                                        + " even though one did not previously exist.");
                    }

                    // Wow.. this is a confusing line of code.. :)
                    try {
                        component.setIcon(icon.createIcon());
                    } catch (Throwable throwable) {
                        // Ignore this, but print a message
                        System.err.println("Warning: Failed to create or "
                                + "set icon " + icon + " for component "
                                + component);
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.