Package ptolemy.actor.gui

Examples of ptolemy.actor.gui.Configuration


            attributeName = new StringAttribute(this, "attributeName");
        }

        public void createEditor(NamedObj object, Frame parent) {
            Configuration configuration = ((TableauFrame) parent)
                    .getConfiguration();
            Effigy effigy = ((TableauFrame) parent).getEffigy();
            DialogTableau dialogTableau = DialogTableau.createDialog(parent,
                    configuration, effigy, GTIngredientsEditor.class,
                    (Entity) object);
View Full Code Here


        // Derived classes can add menu items to it.
        _menuFactory = new PtolemyMenuFactory(controller);

        List configsList = Configuration.configurations();

        Configuration config = null;
        for (Iterator it = configsList.iterator(); it.hasNext();) {
            config = (Configuration) it.next();
            if (config != null)
                break;
        }

        //If a MenuFactory has been defined in the configuration, use this
        //one; otherwise, use the default Ptolemy one:
        if (config != null && _contextMenuFactoryCreator == null) {
            _contextMenuFactoryCreator = (ContextMenuFactoryCreator) config
                    .getAttribute("contextMenuFactory");
        }
        if (_contextMenuFactoryCreator != null) {
            try {
                _menuFactory = (PtolemyMenuFactory) _contextMenuFactoryCreator
View Full Code Here

                        return;
                    }
                }

                try {
                    Configuration configuration = _owner.getConfiguration();
                    configuration
                            .openModel(null, _help, _help.toExternalForm());
                } catch (Exception e1) {
                    HTMLViewer viewer = new HTMLViewer();
                    try {
                        viewer.setPage(_help);
View Full Code Here

        if (target != null) {
            Parameter docApplicationSpecializerParameter = null;
            try {
                //find the configuration
                List configsList = Configuration.configurations();
                Configuration config = null;
                for (Iterator it = configsList.iterator(); it.hasNext();) {
                    config = (Configuration) it.next();
                    if (config != null)
                        break;
                }
                if (config == null) {
                    throw new InternalErrorException(target, null,
                            "Failed to find configuration");
                }

                // Check to see if the configuration has a
                // _docApplicationSpecializer parameter and if it does,
                // let it handle the customization

                docApplicationSpecializerParameter = (Parameter) config
                        .getAttribute("_docApplicationSpecializer",
                                Parameter.class);
            } catch (IllegalActionException iae) {
                // Ignore.  just let the default action happen
                System.out.println("Error getting the documentation "
View Full Code Here

                FileParameter docAttribute = null;
                if (!(parent instanceof TableauFrame)) {
                    throw new InternalErrorException("Frame \"" + parent
                            + "\" is not a TableauFrame");
                }
                Configuration configuration = ((TableauFrame) parent)
                        .getConfiguration();
                NamedObj documentedObject = object;

                while (documentedObject != null) {
                    docAttribute = (FileParameter) documentedObject
                            .getAttribute("_documentation", FileParameter.class);

                    if (docAttribute != null) {
                        break;
                    }

                    documentedObject = documentedObject.getContainer();
                }

                if (docAttribute != null) {
                    URL doc = MoMLApplication.specToURL(docAttribute
                            .getExpression());
                    configuration.openModel(doc, doc, doc.toExternalForm());
                } else {
                    NamedObj container = object.getContainer();

                    if (container == null) {
                        container = object;
View Full Code Here

        protected MatchResultViewer _showViewer(CompositeEntity model,
                List<MatchResult> results, String sourceFileName)
                throws IllegalActionException, NameDuplicationException {

            MatchResultViewer._setTableauFactory(this, model);
            Configuration configuration =
                getFrameController().getConfiguration();
            if (configuration == null) {
                throw new InternalErrorException("Cannot get configuration.");
            }

            Tableau tableau = configuration.openModel(model);
            MatchResultViewer viewer = (MatchResultViewer) tableau.getFrame();
            viewer.setMatchResult(results);
            viewer.setSourceFileName(sourceFileName);
            viewer.setTransformationRule(
                    getFrameController().getTransformationRule());
View Full Code Here

        // getting lost on the mac.
        // _jgraph.addMouseListener(new FocusMouseListener());
        _rightComponent.setAlignmentX(1);
        _rightComponent.setAlignmentY(1);
        // Background color is parameterizable by preferences.
        Configuration configuration = getConfiguration();
        _rightComponent.setBackground(BACKGROUND_COLOR);
        if (configuration != null) {
            try {
                PtolemyPreferences preferences = PtolemyPreferences
                        .getPtolemyPreferencesWithinConfiguration(configuration);
View Full Code Here

     *   the library, if one needs to be created.
     *  @return The new library, or null if there is no
     *   configuration.
     */
    protected CompositeEntity _createDefaultLibrary(Workspace workspace) {
        Configuration configuration = getConfiguration();

        if (configuration != null) {
            CompositeEntity result = (CompositeEntity) configuration
                    .getEntity("actor library");

            if (result == null) {
                // Create an empty library by default.
                result = new CompositeEntity(workspace);
View Full Code Here

                throw ex;
            }
        }

        // This has the side effects of merging properties from ptII.properties
        Configuration configuration = super._createDefaultConfiguration();

        try {
            configuration = readConfiguration(_configurationURL);
        } catch (Exception ex) {
            throw new Exception("Failed to read configuration '"
                    + _configurationURL + "'", ex);
        }

        // Read the user preferences, if any.
        PtolemyPreferences.setDefaultPreferences(configuration);

        // If _hideUserLibraryAttribute is not present, or is false,
        // call openUserLibrary().  openUserLibrary() will open either the
        // user library or the library named by the _alternateLibraryBuilder.
        Parameter hideUserLibraryAttribute = (Parameter) configuration
                .getAttribute("_hideUserLibrary", Parameter.class);

        if ((hideUserLibraryAttribute == null)
                || hideUserLibraryAttribute.getExpression().equals("false")) {
View Full Code Here

     *  then we create an empty up an empty PtolemyEffigy.
     *  @return A configuration for when there no command-line arguments.
     *  @exception Exception If the configuration cannot be opened.
     */
    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);
        }

        try {
            // First, we see if we can find the welcome window by
            // looking at the default configuration.
            // FIXME: this seems wrong, we should be able to get
            // an attribute from the configuration that names the
            // welcome window.
            String configurationURLString = _configurationURL.toExternalForm();
            String base = configurationURLString.substring(0,
                    configurationURLString.lastIndexOf("/"));

            welcomeURL = specToURL(base + "/welcomeWindow.xml");
            introURL = specToURL(base + "/intro.htm");
            _parser.reset();
            _parser.setContext(configuration);
            _parser.parse(welcomeURL, welcomeURL);
        } catch (Throwable throwable) {
            // OK, that did not work, try a different method.
            if (_configurationSubdirectory == null) {
                _configurationSubdirectory = "full";
            }

            // FIXME: This code is Dog slow for some reason.
            welcomeURL = specToURL(_basePath + "/" + _configurationSubdirectory
                    + "/welcomeWindow.xml");
            introURL = specToURL(_basePath + "/" + _configurationSubdirectory
                    + "/intro.htm");
            _parser.reset();
            _parser.setContext(configuration);
            _parser.parse(welcomeURL, welcomeURL);
        }

        Effigy doc = (Effigy) configuration.getEntity("directory.doc");

        doc.identifier.setExpression(introURL.toExternalForm());

        return configuration;
    }
View Full Code Here

TOP

Related Classes of ptolemy.actor.gui.Configuration

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.