Re: specifying file name at command prompt

Hi Michelle,

You are trying to change the behavior of the SpreadSheet's "-file"
command line flag?  Then comment out the old behavior!  But if I
were you, I would make up your own flag instead, and leave "-file"
alone, because anyone familiar with the SpreadSheet will be
confused that "-file" isn't doing what it usually does (which is
to load the file immediately).

Add your own static variable called "myfile" or something, and add
   if (argv[ix].equals("-myflag")) {
     if (ix < len - 1) myfile = argv[++ix];
   }
for whatever flag you decide to use, then reference the myfile
variable when your READ button is clicked.

The SpreadSheet's command line logic is not complicated. If you
are still confused, study SpreadSheet.main more closely.

-Curtis

At 12:31 PM 8/11/2003, you wrote:
>Hi,
>
>I'm trying to specify the name of the .csv file I want in the SS cells by 
>typing it in at the command line. When I click on my "READ" button which reads 
>in the filename, the correct file is loaded in but for some reason, the file 
>is als loaded into the top left cell with the default mappings displayed. So 
>when the SS first opens up, I have a mapping at cell 0,0 before I have even 
>clicked on READ which calls addDataSource() and works fine from that point 
>forward. 
>I made the variable dfile in main() into a static class variable and 
>initialized it to null and then made this change in main():
>
>    //String dfile = null;
>    dfile = null;
>
>I got a null pointer exception:
>
>        at visad.DisplayImpl.doAction(DisplayImpl.java:1602)
>        at visad.java2d.DisplayImplJ2D.doAction(DisplayImplJ2D.java:306)
>        at visad.ActionImpl.run(ActionImpl.java:303)
>        at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95)
>
>and it's complaining about the same line as before that I sent in a previous 
>email. Without initializing dfile to null in the declaration, there is no null 
>pointer excpetion but cell 0,0 still has the mapping loaded in initially 
>before I ever press READ. Does anyone know where in main() I should comment 
>out the code to load in a data file? I can't see where this might be since 
>there is ... "if (dfile != null) {" which checks if dfile is null (which it is 
>not apparently) before ever reading anything in.
>
>Thanks,
>Michelle
>
>Michelle Kam           (408) 742-2881
>Lockheed Martin Space Systems Co. SSM/ATC/MSIS
>B/153 O/L922 
>1111 Lockheed Martin Way, Sunnyvale, CA 94089


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: