Package ptolemy.data.expr

Examples of ptolemy.data.expr.FileParameter


         @param object The object to configure.
         *  @param parent The parent window, or null if there is none.
         */
        public void createEditor(NamedObj object, Frame parent) {
            try {
                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;
                    }

                    JFileChooser fileDialog = new JFileChooser();
                    fileDialog.setDialogTitle("Select a documentation file.");

                    //File _directory = null;

                    String cwd = StringUtilities.getProperty("user.dir");

                    if (cwd != null) {
                        fileDialog.setCurrentDirectory(new File(cwd));
                    }

                    if (fileDialog.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
                        // FIXME: why is this ignored?
                        //_directory = fileDialog.getCurrentDirectory();

                        String fileName = fileDialog.getSelectedFile()
                                .getAbsolutePath();

                        docAttribute = new FileParameter(container,
                                "_documentation");
                        docAttribute.setExpression(fileName);
                    }
                }
            } catch (Throwable throwable) {
                throw new InternalErrorException(object, throwable,
                        "Cannot access Documentation");
View Full Code Here


                    getFrameController().getTransformationRule();
                Pattern pattern = rule.getPattern();
                DefaultModelAttribute attribute = (DefaultModelAttribute) pattern
                        .getAttribute("DefaultModel");
                if (attribute != null) {
                    FileParameter parameter = (FileParameter) attribute.parameter;
                    if (parameter.getExpression() != null) {
                        modelFile = parameter.asFile();
                    }
                }

                if (modelFile == null) {
                    ComponentDialog dialog = new ComponentDialog(
View Full Code Here

        }
    }

    protected void _initParameter() throws IllegalActionException,
            NameDuplicationException {
        FileParameter fileParameter = new FileParameter(this, "model");

        parameter = fileParameter;
    }
View Full Code Here

        blockSize.setTypeEquals(BaseType.INT);

        endOfFile = new TypedIOPort(this, "endOfFile", false, true);
        endOfFile.setTypeEquals(BaseType.BOOLEAN);

        fileOrURL = new FileParameter(this, "fileOrURL");

        numberOfLinesToSkip = new Parameter(this, "numberOfLinesToSkip");
        numberOfLinesToSkip.setExpression("0");
        numberOfLinesToSkip.setTypeEquals(BaseType.INT);
View Full Code Here

    public ClipPlayer(CompositeEntity container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);
        trigger = new TypedIOPort(this, "trigger", true, false);

        fileOrURL = new FileParameter(this, "fileOrURL");
        fileOrURL.setExpression("$PTII/ptolemy/actor/lib/javasound/voice.wav");

        overlay = new Parameter(this, "overlay");
        overlay.setTypeEquals(BaseType.BOOLEAN);
        overlay.setExpression("false");
View Full Code Here

        // Make command be a StringParameter (no surrounding double quotes).
        command.setStringMode(true);
        new Parameter(command.getPort(), "_showName", BooleanToken.TRUE);

        directory = new FileParameter(this, "directory");
        directory.setExpression("$CWD");

        environment = new Parameter(this, "environment");

        String[] labels = new String[] { "name", "value" };
View Full Code Here

     */
    public AudioReader(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        fileOrURL = new FileParameter(this, "fileOrURL");

        // We use voice.wav so that we can include the voice.wav file
        // in the jar file for use under Web Start.
        fileOrURL
                .setExpression("$CLASSPATH/ptolemy/actor/lib/javasound/voice.wav");
View Full Code Here

        allowDynamicMultiportReference = new Parameter(this,
                "allowDynamicMultiportReference");
        allowDynamicMultiportReference.setTypeEquals(BaseType.BOOLEAN);
        allowDynamicMultiportReference.setExpression("false");

        codeDirectory = new FileParameter(this, "codeDirectory");
        codeDirectory.setExpression("$HOME/codegen/");

        // FIXME: This should not be necessary, but if we don't
        // do it, then getBaseDirectory() thinks we are in the current dir.
        codeDirectory.setBaseDirectory(codeDirectory.asFile().toURI());
View Full Code Here

        output.setTypeEquals(BaseType.STRING);

        endOfFile = new TypedIOPort(this, "endOfFile", false, true);
        endOfFile.setTypeEquals(BaseType.BOOLEAN);

        fileOrURL = new FileParameter(this, "fileOrURL");

        numberOfLinesToSkip = new Parameter(this, "numberOfLinesToSkip");
        numberOfLinesToSkip.setExpression("0");
        numberOfLinesToSkip.setTypeEquals(BaseType.INT);
View Full Code Here

            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        output.setTypeEquals(BaseType.STRING);

        fileOrURL = new FileParameter(this, "fileOrURL");

        fileOrURLPort = new TypedIOPort(this, "fileOrURL", true, false);
        fileOrURLPort.setTypeEquals(BaseType.STRING);

        newline = new Parameter(this, "newline");
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.