Menu

Help with FolderFileWrapper

Help
Anonymous
2004-02-12
2004-02-16
  • Anonymous

    Anonymous - 2004-02-12

    Hello:

       I want to Know how i can to create a FolderFileWrapper for create a new folder without use FileChooser. The idea is create new folders with programming code and i dont know how do it. Note that i like to specify the folders name.

      Thank you. :)

     
    • allen petersen

      allen petersen - 2004-02-16

      Hi.

      The simple answer there is to use MailFileSystemView.createFileObject(File dir, String filename), followed by FolderFileWrapper.createNewFile().  Or, heck, you could even use FolderFileWrapper.getFileByName(String filename) followed by FolderFileWrapper.createNewFile().

      If you're looking to create a Folder that can hold other folders, use FolderFileWrapper.getFileByName(String filename) followed by FolderFileWrapper.mkdir().

      You may also need to run FolderFileWrapper.refreshChildren() after you call createNewFile() or mkdir().  ...That should probably be done automatically, come to think of it.  Actually, FolderFileWrapper should really implement javax.mail.event.FolderListener, and then it could call refreshChildren() even when a new child was created/deleted by an external event.  But, well, it works ok for me right now, and I have lots more on my plate....  So manually calling refreshChildren() it is!  :)

      Anyway.  Those _should_ work.  I wrote the FolderFileWrapper code specifically to work with the JFileChooser, so I haven't actually run it through all possibilities.

       

Log in to post a comment.

MongoDB Logo MongoDB