Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.Location


     @exception IllegalActionException If the location attribute does
     *   not exist or cannot be evaluated.
     */
    protected double[] _getLocation() throws IllegalActionException {
        //Entity container = (Entity)this.getContainer();
        Location locationAttribute = (Location) getAttribute("_location",
                Location.class);

        if (locationAttribute == null) {
            throw new IllegalActionException(this,
                    "Cannot find a _location attribute of class Location.");
        }

        return locationAttribute.getLocation();
    }
View Full Code Here


                if (portAttribute instanceof Locatable) {
                    portLocation = (Locatable) portAttribute;
                } else {
                    try {
                        portLocation = new Location(_port, "_location");
                        ((NamedObj) portLocation).propagateExistence();
                    } catch (KernelException ex) {
                        throw new InternalErrorException(ex);
                    }
                }
View Full Code Here

        double[] locationValue = new double[2];
        locationValue[0] = _getDouble(attributes, "x", 0.0);
        locationValue[1] = _getDouble(attributes, "y", 0.0);

        try {
            Location location = new Location(attribute, "_location");
            location.setLocation(locationValue);

            // Since this isn't delegated to the MoML parser,
            // we have to handle propagation here.
            location.propagateExistence();
        } catch (KernelException e) {
            throw new InternalErrorException(e);
        }
    }
View Full Code Here

                return locationList.get(0);
            } else {
                try {
                    // NOTE: We need the location right away, so we go ahead
                    // and create it and handle the propagation locally.
                    Location location = new Location(entity, "_location");
                    location.propagateExistence();
                    return location;
                } catch (Exception e) {
                    throw new InternalErrorException("Failed to create "
                            + "location, even though one does not exist:"
                            + e.getMessage());
View Full Code Here

                // and create it. However, we also issue a MoMLChangeRequest
                // so that the change propagates, and any models that defer
                // to this one (e.g. subclasses) also have locations.
                // This is necessary so that if the location later moves,
                // then the move can be duplicated in the deferrers.
                Location location = new Location(object, "_location");

                // Since this isn't delegated to the MoML parser,
                // we have to handle propagation here.
                location.propagateExistence();

                return location;
            } catch (Exception e) {
                throw new InternalErrorException(object, e, "Failed to create "
                        + "location, even though one does not exist.");
View Full Code Here

        _icon.setPersistent(false);

        // Create a location because, for some mysterious reason,
        // if there isn't one, then the icon is not shown in the
        // icon editor.
        new Location(this, "_location");

        // This must appear before lineColor or cloning could
        // fail if lineColor references it.
        _none = new Variable(this, "none");
        _none.setExpression("{1.0, 1.0, 1.0, 0.0}");
View Full Code Here

            // NOTE: this gives at iteration over locations.
            Iterator nodes = model.nodes(composite);

            while (nodes.hasNext()) {
                Location location = (Location) nodes.next();

                // Get the containing element
                NamedObj element = location.getContainer();

                // Give default values in case the previous locations value
                // has not yet been set
                String expression = location.getExpression();

                if (expression == null) {
                    expression = "0, 0";
                }

                // Create the MoML, wrapping the location attribute
                // in an element refering to the container
                String containingElementName = element.getElementName();
                moml.append("<" + containingElementName + " name=\""
                        + element.getName() + "\" >\n");

                // NOTE: use the moml info element name here in case the
                // location is a vertex
                moml.append("<" + location.getElementName() + " name=\""
                        + location.getName() + "\" value=\"" + expression
                        + "\" />\n");
                moml.append("</" + containingElementName + ">\n");
            }

            moml.append("</group>\n");
View Full Code Here

                "rectangle");
        rectangle.width.setExpression("155.0");
        rectangle.height.setExpression("20.0");
        rectangle.fillColor.setExpression("{1.0, 0.7, 0.7, 1.0}");

        Location _location = new Location(rectangle, "_location");
        _location.setExpression("-5.0, -15.0");

        TextAttribute text = new TextAttribute(_icon, "text");
        text.text.setExpression("DependencyHighlighter");
    }
View Full Code Here

                "rectangle");
        rectangle.width.setExpression("120.0");
        rectangle.height.setExpression("20.0");
        rectangle.fillColor.setExpression("{0.2,1.0,1.0,1.0}");

        Location _location = new Location(rectangle, "_location");
        _location.setExpression("-5.0, -15.0");

        TextAttribute text = new TextAttribute(_icon, "text");
        text.text.setExpression("LocalPreferences");

        // Hide the name.
View Full Code Here

                // and create it. However, we also issue a MoMLChangeRequest
                // so that the change propagates, and any models that defer
                // to this one (e.g. subclasses) also have locations.
                // This is necessary so that if the location later moves,
                // then the move can be duplicated in the deferrers.
                Location location = new Location(object, "_location");

                // Since this isn't delegated to the MoML parser,
                // we have to handle propagation here.
                location.propagateExistence();

                return location;
            } catch (Exception e) {
                throw new InternalErrorException("Failed to create "
                        + "location, even though one does not exist:"
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.Location

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.