Package ptolemy.actor.gui

Examples of ptolemy.actor.gui.ModelDirectory


    protected Configuration _createEmptyConfiguration() throws Exception {
        Configuration configuration = _createDefaultConfiguration();
        URL welcomeURL = null;
        URL introURL = null;

        ModelDirectory directory = configuration.getDirectory();

        Parameter applicationBlankPtolemyEffigyAtStartup = (Parameter) configuration
                .getAttribute("_applicationBlankPtolemyEffigyAtStartup",
                        Parameter.class);
        if ((applicationBlankPtolemyEffigyAtStartup != null)
                && applicationBlankPtolemyEffigyAtStartup.getExpression()
                        .equals("true")) {
            PtolemyEffigy.Factory factory = new PtolemyEffigy.Factory(
                    directory, directory.uniqueName("ptolemyEffigy"));

            Effigy effigy = factory.createEffigy(directory, null, null);
            configuration.createPrimaryTableau(effigy);
        }
View Full Code Here


                // Set the URI and identifier of the effigy.
                effigy.uri.setURI(uri);
                effigy.identifier.setExpression(uri.toString());

                // Put the effigy into the directory
                ModelDirectory directory = getDirectory();
                effigy.setName(directory.uniqueName(entity.getName()));
                effigy.setContainer(directory);

                // Create a default tableau.
                return createPrimaryTableau(effigy);
            } else {
                // If we get here, then we are looking inside a model
                // that is defined within the same file as the parent,
                // probably.  Create a new PtolemyEffigy
                // and open a tableau for it.
                // Put the effigy inside the effigy of the parent,
                // rather than directly into the directory.
                NamedObj parent = entity.getContainer();
                PtolemyEffigy parentEffigy = null;

                // Find the first container above in the hierarchy that
                // has an effigy.
                while ((parent != null) && (parentEffigy == null)) {
                    parentEffigy = getEffigy(parent);
                    parent = parent.getContainer();
                }

                boolean isContainerSet = false;

                if (parentEffigy != null) {
                    // OK, we can put it into this other effigy.
                    effigy.setName(parentEffigy.uniqueName(entity.getName()));
                    effigy.setContainer(parentEffigy);

                    // Set the identifier of the effigy to be that
                    // of the parent with the model name appended.
                    // Note that we add a # the first time, and
                    // then add . after that.  So
                    // file:/c:/foo.xml#bar.bif is ok, but
                    // file:/c:/foo.xml#bar#bif is not
                    // If the title does not contain a legitimate
                    // way to reference the submodel, then the user
                    // is likely to look at the title and use the wrong
                    // value if they xml edit files by hand. (cxh-4/02)
                    String entityName = parentEffigy.identifier.getExpression();
                    String separator = "#";

                    if (entityName.indexOf("#") >= 0) {
                        separator = ".";
                    }

                    effigy.identifier.setExpression(entityName + separator
                            + entity.getName());

                    // Set the uri of the effigy to that of
                    // the parent.
                    effigy.uri.setURI(parentEffigy.uri.getURI());

                    // Indicate success.
                    isContainerSet = true;
                }

                // If the above code did not find an effigy to put
                // the new effigy within, then put it into the
                // directory directly.
                if (!isContainerSet) {
                    CompositeEntity directory = getDirectory();
                    effigy.setName(directory.uniqueName(entity.getName()));
                    effigy.setContainer(directory);
                    effigy.identifier.setExpression(entity.getFullName());
                }

                return createPrimaryTableau(effigy);
View Full Code Here

                            // The finally clause below can result in the
                            // application exiting if there are no other
                            // effigies open.  We check for that condition,
                            // and report the error here.  Otherwise, we
                            // pass the error to the caller.
                            ModelDirectory dir = (ModelDirectory) effigy
                                    .topEffigy().getContainer();
                            List effigies = dir.entityList(Effigy.class);

                            // We might get to here if we are running a
                            // vergil with a model specified as a command
                            // line argument and the model has an invalid
                            // parameter.
View Full Code Here

TOP

Related Classes of ptolemy.actor.gui.ModelDirectory

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.