Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.NamedObj


                return null;
            }

            effigy.setTableauFactory(this);

            NamedObj model = ((PtolemyEffigy) effigy).getModel();

            if (model instanceof CompositeEntity) {
                // Check to see whether this factory contains a
                // default library.
                LibraryAttribute library = (LibraryAttribute) getAttribute(
View Full Code Here


            if (token != null) {
                return token;
            }
        }

        NamedObj child = GTTools.getChild(_object, label, true, true, true,
                true);
        if (child instanceof ActorScopeExtender) {
            child = GTTools.getChild(_object, label, false, true, true, true);
        }
        try {
View Full Code Here

            }

            Collection<?> children = GTTools.getChildren(_object, true, true,
                    true, true);
            for (Object childObject : children) {
                NamedObj child = (NamedObj) childObject;
                if (child instanceof ActorScopeExtender) {
                    continue;
                }
                _labelSet.add(child.getName());
            }
            _version = version;
        }
        return _labelSet;
    }
View Full Code Here

    public void event(DebugEvent event) {
        if (event instanceof FiringEvent) {
            Actor actor = ((FiringEvent) event).getActor();

            if (actor instanceof NamedObj) {
                NamedObj objToHighlight = (NamedObj) actor;

                // If the object is not contained by the associated
                // composite, then find an object above it in the hierarchy
                // that is.
                AbstractBasicGraphModel graphModel = (AbstractBasicGraphModel) getGraphModel();
                NamedObj toplevel = graphModel.getPtolemyModel();

                while ((objToHighlight != null)
                        && (objToHighlight.getContainer() != toplevel)) {
                    objToHighlight = objToHighlight.getContainer();
                }
View Full Code Here

    public ActorGraphTableau(PtolemyEffigy container, String name,
            LibraryAttribute defaultLibrary) throws IllegalActionException,
            NameDuplicationException {
        super(container, name);

        NamedObj model = container.getModel();

        if (model == null) {
            return;
        }
View Full Code Here

        if (debug) {
            System.out.println("Inlining method calls in method " + method);
        }

        // Resolve thisRef for this class.
        NamedObj referredObject = ModelTransformer.getObjectForClass(theClass);

        CompleteUnitGraph unitGraph = new CompleteUnitGraph(body);

        // this will help us figure out where locals are defined.
        SimpleLocalDefs localDefs = new SimpleLocalDefs(unitGraph);
View Full Code Here

            ASTPtAssignmentNode assignmentNode = (ASTPtAssignmentNode) node;
            targetName = assignmentNode.getIdentifier();
            node = assignmentNode.getExpressionTree();
        }

        final NamedObj model = ((ExpressionShellEffigy) getContainer())
                .getModel();
        ParserScope scope = new ModelScope() {
            public ptolemy.data.Token get(String name)
                    throws IllegalActionException {
                Variable result = getScopedVariable(null, model, name);

                if (result != null) {
                    return result.getToken();
                } else {
                    return null;
                }
            }

            public ptolemy.data.type.Type getType(String name)
                    throws IllegalActionException {
                Variable result = getScopedVariable(null, model, name);

                if (result != null) {
                    return result.getType();
                } else {
                    return null;
                }
            }

            public InequalityTerm getTypeTerm(String name)
                    throws IllegalActionException {
                Variable result = getScopedVariable(null, model, name);

                if (result != null) {
                    return result.getTypeTerm();
                } else {
                    return null;
                }
            }

            public Set identifierSet() {
                return getAllScopedVariableNames(null, model);
            }
        };

        Token result = _evaluator.evaluateParseTree(node, scope);

        // If a target was specified, instantiate a new token.
        if (targetName != null) {
            Attribute attribute = model.getAttribute(targetName);

            if ((attribute != null) && !(attribute instanceof Parameter)) {
                attribute.setContainer(null);
                attribute = null;
            }
View Full Code Here

    /** Set the attribute name.
     *  @param attributeName The attribute name.
     */
    protected void _setAttributeName(final String attributeName) {
        NamedObj container = getContainer();

        if (container != null) {
            Attribute newAttribute = ModelScope.getScopedVariable(null,
                    container, attributeName);
            if (newAttribute == null) {
                // Either the specified attribute name is invalid,
                // or this is getting invoked in the constructor, and the
                // attribute being referenced has not yet been constructed.
                // To support the latter situation, we try again (just one
                // more time) in a ChangeRequest.
                if (!_deferred) {
                    ChangeRequest request = new ChangeRequest(this,
                            "AttributeValueAttribute") {
                        protected void _execute() {
                            _setAttributeName(attributeName);
                            _deferred = false;
                        }
                    };
                    _deferred = true;
                    container.requestChange(request);
                }
                _attribute = null;
            } else if (_attribute != newAttribute) {
                if (_attribute != null) {
                    _attribute.removeValueListener(this);
View Full Code Here

                            .toplevel();
                    try {
                        _parser.reset();
                        // Export the model into moml string and then import it
                        // again. Needed b some models with unnoticeable state.
                        NamedObj newModel = _parser.parse(model.exportMoML());
                        Tableau tableau = configuration.openModel(newModel,
                                effigy);
                        if (_tableaus[i] != null) {
                            _tableaus[i].close();
                        }
                        _tableaus[i] = tableau;

                        JFrame frame = tableau.getFrame();
                        // Compute location of the new frame.
                        RecordToken location =
                            (RecordToken) screenLocation.getToken();
                        int x = ((IntToken) location.get("x")).intValue();
                        int y = ((IntToken) location.get("y")).intValue();
                        Point newLocation = frame.getLocation();
                        if (x >= 0) {
                            newLocation.x = x;
                        }
                        if (y >= 0) {
                            newLocation.y = y;
                        }
                        // Move the frame to the edge if it exceeds the screen.
                        Dimension size = frame.getSize();
                        Toolkit toolkit = Toolkit.getDefaultToolkit();
                        Dimension screenSize = toolkit.getScreenSize();
                        newLocation.x = Math.min(newLocation.x,
                                screenSize.width - size.width);
                        newLocation.y = Math.min(newLocation.y,
                                screenSize.height - size.height);
                        frame.setLocation(newLocation);
                        frame.addWindowListener(this);

                        String titleString = null;
                        if (titleValue.equals("")) {
                            URI uri = URIAttribute.getModelURI(newModel);
                            if (uri != null) {
                                URI modelURI = new URI(uri.getScheme(), uri
                                        .getUserInfo(), uri.getHost(), uri
                                        .getPort(), uri.getPath()
                                        + newModel.getName() + ".xml", null,
                                        null);
                                titleString = modelURI.toString() + " ("
                                        + getName() + ")";
                            }
                        } else {
View Full Code Here

    /** Return a new string that contains the expression of the
     *  referred to attribute.
     *  @return A new shape.
     */
    protected String _getText() {
        NamedObj container = getContainer();

        try {
            if (container != null) {
                if (_attribute instanceof Variable) {
                    String value = ((Variable) _attribute).getToken()
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.NamedObj

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.