Finally, DWR is used to call the listFiles() method of the FileSystemFunctions class,
passing it the path of the clicked directory. Upon returning, we delete our ???Loading...??? row and
prepare to build the real contents of the grid.
The return from this method is an array of FileVO objects, so now it??™s time to iterate over
that array. For each file (or directory, remember it could be either), we add a new row to the
grid, and also set the name of the item on the row for later retrieval using the setUserData()
method.
CHAPTER 6 n REMOTELY MANAGING YOUR FILES: DWR FILE MANAGER 301
Would you care to guess what will happen if the file name returned has a comma in it? I??™ll save you the time:
nothing good! The columns will be pushed down, and things will simply not be lined up or work properly.
Commas are bad, m??™kay? Seriously though, consider this one possible enhancement for you to do later:
there are alternative ways to load the grid, and some exploration of the documentation should get you close
to an answer in no time.
filenameChanged() Method
The user can rename files and directories any time by double-clicking the name column of the
item he or she wishes to edit or clicking F2 when the cell is highlighted.
Pages:
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542