All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.vaccess.IFSFileDialog

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Dialog
                                   |
                                   +----com.ibm.as400.vaccess.IFSFileDialog

public class IFSFileDialog
extends Dialog
The IFSFileDialog class represents a file dialog for the IFS file classes. This dialog allows the user to traverse the file system and select a file. The text on the Cancel button and the OK button can be set by the calling application. A filter list can be provided by the caller. This dialog is designed to emulate the Windows file dialog. Usage:
      AS400 sys = new AS400("system1");
      IFSFileDialog fd = new IFSFileDialog(this, "File Open", sys);
      FileFilter[] filterList = {new FileFilter("All files (*.*)", "*.*"),
                                 new FileFilter("Executables (*.exe)", "*.exe"),
                                 new FileFilter("HTML files (*.html)", "*.html"),
                                 new FileFilter("HTML files (*.htm)", "*.htm"),
                                 new FileFilter("Images (*.gif)", "*.gif"),
                                 new FileFilter("Text files (*.txt)", "*.txt")};
      fd.setFileFilter(filterList, 2);
      if (fd.show() == IFSFileDialog.OK)
      {
         String s = fd.getFileName();        // get file name
         String p = fd.getPath();            // get path
         String a = fd.getAbsolutePath();    // get fully qualified file
      }
 


Variable Index

 o ACTIVE
Dialog still active.
 o CANCEL
Dialog was dismissed with the Cancel button.
 o OK
Dialog was dismissed with the Ok button.

Constructor Index

 o IFSFileDialog(Frame, String, AS400)
Constructs an IFSFileDialog object.

Method Index

 o add(Component, GridBagLayout, GridBagConstraints, int, int, int, int)
This methods adds a user interface component to the specified GridBagLayout manager using the specified constraints.
 o getAbsolutePath()
Returns the absolute path for the file that was selected.
 o getCancelButtonText()
Returns the text for the Cancel button.
 o getDirectory()
Returns the path for the file selected.
 o getFileFilter()
Returns the filter that was selected.
 o getFileName()
Returns the selected file name.
 o getOkButtonText()
Returns the text for the Ok button.
 o getSystem()
Returns the system for this dialog.
 o setCancelButtonText(String)
Sets the text for the Cancel button.
 o setDirectory(String)
Sets the path to be used.
 o setFileFilter(FileFilter[], int)
Sets the filter list.
 o setFileName(String)
Sets the file name field.
 o setOkButtonText(String)
Sets the button text for the Ok button.
 o setVisible()
Shows the dialog.
 o showDialog()
Shows the dialog and returns the current state.

Variables

 o ACTIVE
 public static final int ACTIVE
Dialog still active.

 o OK
 public static final int OK
Dialog was dismissed with the Ok button.

 o CANCEL
 public static final int CANCEL
Dialog was dismissed with the Cancel button.

Constructors

 o IFSFileDialog
 public IFSFileDialog(Frame parent,
                      String title,
                      AS400 system)
Constructs an IFSFileDialog object.

Parameters:
parent - The parent.
title - The title of the dialog.
system - The AS/400 system.

Methods

 o add
 protected void add(Component component,
                    GridBagLayout layout,
                    GridBagConstraints constraints,
                    int x,
                    int y,
                    int width,
                    int height)
This methods adds a user interface component to the specified GridBagLayout manager using the specified constraints.

Parameters:
component - the user interface component to add
layout - the GridBagLayout manager
constraints - the constraints for the component
x - the x coordinate of the leftmost cell of the component
y - the y coordinate of the topmost cell of the component
width - the horizontal measurement of the component in cells
height - the vertical measurement of the component in cells
Returns:
none
 o getAbsolutePath
 public String getAbsolutePath()
Returns the absolute path for the file that was selected.

Returns:
The fully qualified path, including the file name.
 o getCancelButtonText
 public String getCancelButtonText()
Returns the text for the Cancel button.

Returns:
The text for the Cancel button.
 o getFileName
 public String getFileName()
Returns the selected file name.

Returns:
The file name.
 o getFileFilter
 public FileFilter getFileFilter()
Returns the filter that was selected.

Returns:
The file filter that was selected.
 o getOkButtonText
 public String getOkButtonText()
Returns the text for the Ok button.

Returns:
The text for the Ok button.
 o getDirectory
 public String getDirectory()
Returns the path for the file selected. The file name is not part of the path.

Returns:
The path for the selected file.
 o getSystem
 public AS400 getSystem()
Returns the system for this dialog.

Returns:
The object that represents the system.
 o setCancelButtonText
 public void setCancelButtonText(String buttonText)
Sets the text for the Cancel button.

Parameters:
buttonText - The text to use for the Cancel button.
 o setFileName
 public void setFileName(String filename)
Sets the file name field.

Parameters:
filename - The name of the file.
 o setFileFilter
 public void setFileFilter(FileFilter filterList[],
                           int defaultFilter)
Sets the filter list.

Parameters:
filterList - The list of filters to be listed in the choice control.
defaultFilter - The index into the list that is to be used as the default.
 o setOkButtonText
 public void setOkButtonText(String buttonText)
Sets the button text for the Ok button.

Parameters:
buttonText - The text to use for the Ok button.
 o setDirectory
 public void setDirectory(String path)
Sets the path to be used.

Parameters:
path - The path to use.
 o setVisible
 public void setVisible()
Shows the dialog.

 o showDialog
 public int showDialog()
Shows the dialog and returns the current state.

Returns:
The current state of the dialog.

All Packages  Class Hierarchy  This Package  Previous  Next  Index