Directories in AS400Panes

AS400Panes are GUI components that present and allow manipulation of one or more server resources. A VIFSDirectory object is a resource that represents a directory in the integrated file system for use in AS400Panes. AS400Pane and VIFSDirectory objects can be used together to present many views of the integrated file system, and to allow the user to navigate, manipulate, and select directories and files.

To use a VIFSDirectory, set both the system and path properties. You set these properties using a constructor or through the setSystem() and setPath() methods. You then plug the VIFSDirectory object into the AS400Pane as the root, using the constructor or setRoot() method of the AS400Pane.

VIFSDirectory has some other useful properties for defining the set of directories and files that are presented in AS400Panes. Use setInclude() to specify whether directories, files, or both appear. Use setPattern() to set a filter on the items that are shown by specifying a pattern that the file name must match. You can use wildcard characters, such as "*" and "?", in the patterns. Similarly, use setFilter() to set a filter with an IFSFileFilter object.

When AS400Pane objects and VIFSDirectory objects are created, they are initialized to a default state. The subdirectories and the files that make up the contents of the root directory have not been loaded. To load the contents, the caller must explicitly call the load() method on either object to initiate communication to the server to gather the contents of the directory.

At run-time, a user can perform actions on any directory or file by right-clicking it to display the context menu. The directory context menu can include the following items:

The file context menu can include the following items:

Users can only read or write directories and files to which they are authorized. In addition, the caller can prevent the user from performing actions by using the setAllowActions() method on the pane.

The following example creates a VIFSDirectory and presents it in an AS400ExplorerPane:

                       // Create the VIFSDirectory object.
                       // Assume that "system" in an AS400
                       // object created and initialized
                       // elsewhere. 
     VIFSDirectory root = new VIFSDirectory (system, "/DirectoryA/DirectoryB");

                       // Create and load an AS400ExplorerPane object.
     AS400ExplorerPane explorerPane = new AS400ExplorerPane (root);
     explorerPane.load ();

                       // Add the explorer pane to a frame.
                       // Assume that "frame" is a JFrame
                       // created elsewhere.
     frame.getContentPane ().add (explorerPane);
Example

Present an integrated file system directory hierarchy using an AS400TreePane with a VIFSDirectory object.

Figure 1 shows the VIFSDirectory graphical user interface component:

Figure 1: VIFSDirectory GUI component

VIFSDirectory GUI component