Package ptolemy.data.expr

Examples of ptolemy.data.expr.FileParameter


        super(container, name);

        _initializePtalonActor();

        setClassName("ptolemy.actor.ptalon.PtalonActor");
        ptalonCodeLocation = new FileParameter(this, "ptalonCodeLocation");
    }
View Full Code Here


        parameter = new StringParameter(this, "display");
        parameter.setDisplayName("Display (./)");
        parameter.setPersistent(false);
        parameter.setVisibility(NONE);

        directory = new FileParameter(this, "directory");
        directory.setDisplayName("Directory");
        directory.setExpression(".");
        directory.addValueListener(this);
        Parameter allowFiles = new Parameter(directory, "allowFiles");
        allowFiles.setTypeEquals(BaseType.BOOLEAN);
View Full Code Here

     @see FileParameter
     */
    protected void _help() {
        try {
            Configuration configuration = getConfiguration();
            FileParameter helpAttribute = (FileParameter) configuration
                    .getAttribute("_helpDocViewer", FileParameter.class);
            URL doc;

            if (helpAttribute != null) {
                doc = helpAttribute.asURL();
            } else {
                doc = getClass().getClassLoader().getResource(helpFile);
            }

            configuration.openModel(null, doc, doc.toExternalForm());
View Full Code Here

        styleSheetParameters = new PortParameter(this, "styleSheetParameters");
        styleSheetParameters.setTypeAtMost(new RecordType(new String[0],
                new Type[0]));
        styleSheetParameters.setExpression("emptyRecord()");
        styleSheetFile = new FileParameter(this, "styleSheetFile");

    }
View Full Code Here

     @return the URL of the HTML file that was searched.
     *  @exception Exception If there is a problem opening a model.
     */
    public static URL _expandLibrary(String regexp,
            Configuration configuration) throws Exception {
        FileParameter aboutAttribute = (FileParameter) configuration
            .getAttribute("_about", FileParameter.class);

        URL baseURL = null;
        URL modelURL = null;

        // HyVisual, VisualSense: Search for models in the _about
        // attribute of the configuration.
        // If we don't have an _about, or _about returns
        // no models, then look in the complete demos location

        if (aboutAttribute != null) {
            baseURL = aboutAttribute.asURL();
            String aboutURLString = baseURL.toExternalForm();
            String base = aboutURLString.substring(0,
                    aboutURLString.lastIndexOf("/"));
            baseURL = MoMLApplication.specToURL(base + "/intro.htm");
            System.out.println("HTMLAbout._expandLibrary(): looking in about URL: " + baseURL);
View Full Code Here

     */
    public void createEditor(NamedObj object, Frame parent) {

        ComponentDialog dialog = null;

        FileParameter helpFileParameter = (FileParameter) object
                .getAttribute("help");

        String[] buttons = _moreButtons;
        if (helpFileParameter == null) {
            // Do not include the help button.
            buttons = _moreButtonsNoHelp;
        }

        dialog = new ComponentDialog(parent, "Edit Parameters or File",
                createEditorPane(), buttons);

        String button = dialog.buttonPressed();

        if (button.equals("Cancel")) {
            return;
        }

        if (button.equals(_moreButtons[0])) {
            new EditParametersDialog(parent, object);
            return;
        }

        Configuration configuration = (Configuration) Configuration.findEffigy(
                object.getContainer()).toplevel();

        if (button.equals(_moreButtons[1])) {
            FileParameter fileOrURLParameter = (FileParameter) object
                    .getAttribute("fileOrURL");
            if (fileOrURLParameter == null) {
                throw new InternalErrorException(object, null,
                        "No \"fileOrURL\" attribute.");
            } else {
                try {
                    if (fileOrURLParameter.asURL() == null) {
                        ModelDirectory directory = configuration.getDirectory();

                        StringParameter initialDefaultContentsParameter = (StringParameter) object
                                .getAttribute("initialDefaultContents");
                        String defaultText = "";
                        if (initialDefaultContentsParameter != null) {
                            defaultText = initialDefaultContentsParameter
                                    .getExpression();
                        }
                        Effigy effigy = TextEffigy.newTextEffigy(directory,
                                defaultText);
                        configuration.createPrimaryTableau(effigy);

                        //                         EffigyFactory textEffigyFactory = new TextEffigy.Factory(directory, "effigyFactory");
                        //                         Tableau tableau = configuration.openModel(
                        //                                 null, null, "Unnamed",
                        //                                 textEffigyFactory);
                        //                         Effigy effigy = (Effigy) tableau.getContainer();
                        //                         effigy.masterEffigy().setModifiable(true);
                        //                         System.out.println("FileOrURLEditorFactory: modifiable"
                        //                                            + effigy.isModifiable() + " " + effigy);

                    } else {
                        URL fileURL = fileOrURLParameter.asFile().toURI()
                                .toURL();
                        configuration.openModel(null, fileURL, fileURL
                                .toExternalForm());
                    }
                } catch (Exception ex) {
View Full Code Here

        input.setTypeEquals(BaseType.OBJECT);

        _icon = new ImageIcon(this, "_icon");
        _icon.setPersistent(false);
        FileParameter source = new FileParameter(this, "source");
        source
                .setExpression("$CLASSPATH/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif");
        URL url = source.asURL();
        Toolkit tk = Toolkit.getDefaultToolkit();
        Image image = tk.getImage(url);
        _icon.setImage(image);
    }
View Full Code Here

        ModelDirectory directory = getDirectory();

        if (directory != null) {
            try {
                Configuration configuration = getConfiguration();
                FileParameter aboutAttribute = (FileParameter) configuration
                        .getAttribute("_about", FileParameter.class);
                URL doc;

                if (aboutAttribute != null) {
                    doc = aboutAttribute.asURL();
                } else {
                    doc = getClass().getClassLoader().getResource(aboutFile);
                }

                // The usual mechanism for opening a file is:
View Full Code Here

    protected Image _getDefaultIconImage() {
        if (_defaultIconImage == null) {
            URL url = null;
            try {
                Configuration configuration = getConfiguration();
                FileParameter iconAttribute = (FileParameter) configuration
                        .getAttribute("_applicationIcon", FileParameter.class);

                if (iconAttribute != null) {
                    url = iconAttribute.asURL();
                }
            } catch (Throwable ex) {
                // Ignore, we will set url to the default.
            }
            if (url == null) {
View Full Code Here

     @see FileParameter
     */
    protected void _help() {
        try {
            Configuration configuration = getConfiguration();
            FileParameter helpAttribute = (FileParameter) configuration
                    .getAttribute("_help", FileParameter.class);
            URL doc;

            if (helpAttribute != null) {
                doc = helpAttribute.asURL();
            } else {
                doc = getClass().getClassLoader().getResource(helpFile);
            }

            configuration.openModel(null, doc, doc.toExternalForm());
View Full Code Here

TOP

Related Classes of ptolemy.data.expr.FileParameter

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.