Class JFileChooserOperator

All Implemented Interfaces:
Outputable, Timeoutable

public class JFileChooserOperator extends JComponentOperator implements Timeoutable, Outputable
Class provides methods to cover main JFileChooser component functionality.
Author:
Alexandre Iline (alexandre.iline@sun.com)
  • Constructor Details

    • JFileChooserOperator

      public JFileChooserOperator(JFileChooser comp)
      Constructor.
      Parameters:
      comp - a component
    • JFileChooserOperator

      public JFileChooserOperator(Operator env)
      Constructor. Waits component first. Constructor can be used in complicated cases when output or timeouts should differ from default.
      Parameters:
      env - an operator to get environment from.
    • JFileChooserOperator

      public JFileChooserOperator()
      Constructor. Waits component first.
  • Method Details

    • findJFileChooserDialog

      public static JDialog findJFileChooserDialog()
      Searches currently opened JDilog with JFileChooser inside.
      Returns:
      a component instance
    • waitJFileChooserDialog

      public static JDialog waitJFileChooserDialog()
      Waits currently opened JDilog with JFileChooser inside.
      Returns:
      a component instance
    • findJFileChooser

      public static JFileChooser findJFileChooser(Container cont)
      Searches JFileChooser in container.
      Parameters:
      cont - a container
      Returns:
      a component instance
    • waitJFileChooser

      public static JFileChooser waitJFileChooser(Container cont)
      Searches JFileChooser in container.
      Parameters:
      cont - a container
      Returns:
      a component instance
    • findJFileChooser

      public static JFileChooser findJFileChooser()
      Searches currently opened JFileChooser.
      Returns:
      a component instance
    • waitJFileChooser

      public static JFileChooser waitJFileChooser()
      Waits currently opened JFileChooser.
      Returns:
      a component instance
    • setTimeouts

      public void setTimeouts(Timeouts timeouts)
      Description copied from interface: Timeoutable
      Defines current timeouts.
      Specified by:
      setTimeouts in interface Timeoutable
      Overrides:
      setTimeouts in class JComponentOperator
      Parameters:
      timeouts - A collection of timeout assignments.
      See Also:
    • getTimeouts

      public Timeouts getTimeouts()
      Description copied from interface: Timeoutable
      Return current timeouts.
      Specified by:
      getTimeouts in interface Timeoutable
      Overrides:
      getTimeouts in class JComponentOperator
      Returns:
      the collection of current timeout assignments.
      See Also:
    • setOutput

      public void setOutput(TestOut out)
      Description copied from interface: Outputable
      Defines print output streams or writers.
      Specified by:
      setOutput in interface Outputable
      Overrides:
      setOutput in class JComponentOperator
      Parameters:
      out - Identify the streams or writers used for print output.
      See Also:
    • getOutput

      public TestOut getOutput()
      Description copied from interface: Outputable
      Returns print output streams or writers.
      Specified by:
      getOutput in interface Outputable
      Overrides:
      getOutput in class JComponentOperator
      Returns:
      an object that contains references to objects for printing to output and err streams.
      See Also:
    • getPathCombo

      public JComboBox getPathCombo()
      Returns combo box containing path (upper).
      Returns:
      JComboBox being used to show directories.
    • getFileTypesCombo

      public JComboBox getFileTypesCombo()
      Returns combo box containing file types (lower).
      Returns:
      JComboBox being used to show file types.
    • getApproveButton

      public JButton getApproveButton()
      Returns approve button.
      Returns:
      an approve button.
    • getCancelButton

      public JButton getCancelButton()
      Returns cancel button.
      Returns:
      a cancel button.
    • getHomeButton

      public JButton getHomeButton()
      Returns "Home" button.
      Returns:
      a "home" button.
    • getUpLevelButton

      public JButton getUpLevelButton()
      Returns "Up One Level" button.
      Returns:
      a "Up One Level" button.
    • getListToggleButton

      public JToggleButton getListToggleButton()
      Returns a toggle button being used to switch to list view.
      Returns:
      a "list mode" button.
    • getDetailsToggleButton

      public JToggleButton getDetailsToggleButton()
      Returns a toggle button being used to switch to detals view.
      Returns:
      a "list mode" button.
    • getPathField

      public JTextField getPathField()
      Returns field which can be used to type path.
      Returns:
      a text field being used for path typing.
    • getFileList

      public JList getFileList()
      Returns file list.
      Returns:
      a list being used to display directory content.
    • approve

      public void approve()
      Pushes approve button.
    • cancel

      public void cancel()
      Pushes cancel button.
    • chooseFile

      public void chooseFile(String fileName)
      Types file name into text field and pushes approve button.
      Parameters:
      fileName - a file to choose.
    • goUpLevel

      public File goUpLevel()
      Pushes "Up One Level" button.
      Returns:
      new current directory
    • goHome

      public File goHome()
      Pushes "Home" button.
      Returns:
      new current directory
    • clickOnFile

      public void clickOnFile(int index, int clickCount)
      Clicks on file in the list.
      Parameters:
      index - Ordinal file index.
      clickCount - click count
    • clickOnFile

      public void clickOnFile(String file, Operator.StringComparator comparator, int clickCount)
      Clicks on file in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      comparator - a comparator defining string comparision criteria
      clickCount - click count
    • clickOnFile

      public void clickOnFile(String file, boolean ce, boolean cc, int clickCount)
      Deprecated.
      Use clickOnFile(String, int) or clickOnFile(String, StringComparator, int)
      Clicks on file in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
      clickCount - click count
      See Also:
    • clickOnFile

      public void clickOnFile(String file, int clickCount)
      Clicks on file in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      clickCount - click count
      See Also:
    • clickOnFile

      public void clickOnFile(String file, Operator.StringComparator comparator)
      Clicks on file in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      comparator - a comparator defining string comparision criteria
      See Also:
    • clickOnFile

      public void clickOnFile(String file, boolean ce, boolean cc)
      Deprecated.
      Use clickOnFile(String) or clickOnFile(String, StringComparator)
      Clicks 1 time on file in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
      See Also:
    • clickOnFile

      public void clickOnFile(String file)
      Clicks 1 time on file in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      See Also:
    • enterSubDir

      public File enterSubDir(String dir, Operator.StringComparator comparator)
      Enters into subdirectory.
      Parameters:
      dir - A directory to enter into.
      comparator - a comparator defining string comparision criteria
      Returns:
      new current directory
    • enterSubDir

      public File enterSubDir(String dir, boolean ce, boolean cc)
      Deprecated.
      Use enterSubDir(String) or enterSubDir(String, StringComparator)
      Enters into subdir curently displayed in the list.
      Parameters:
      dir - Directory name (tmp1). Do not use full path (/tmp/tmp1) here.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
      Returns:
      new current directory
      See Also:
    • enterSubDir

      public File enterSubDir(String dir)
      Enters into subdir curently displayed in the list.
      Parameters:
      dir - Directory name (tmp1). Do not use full path (/tmp/tmp1) here.
      Returns:
      new current directory
      See Also:
    • selectFile

      public void selectFile(String file, Operator.StringComparator comparator)
      Selects a file curently in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      comparator - a comparator defining string comparision criteria
      See Also:
    • selectFile

      public void selectFile(String file, boolean ce, boolean cc)
      Deprecated.
      Use selectFile(String) or selectFile(String, StringComparator)
      Selects a file curently in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
      See Also:
    • selectFile

      public void selectFile(String file)
      Selects a file curently in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      See Also:
    • selectPathDirectory

      public void selectPathDirectory(String dir, Operator.StringComparator comparator)
      Selects directory from the combo box above.
      Parameters:
      dir - Directory name (tmp1). Do not use full path (/tmp/tmp1) here.
      comparator - a comparator defining string comparision criteria
    • selectPathDirectory

      public void selectPathDirectory(String dir, boolean ce, boolean cc)
      Deprecated.
      Use selectPathDirectory(String) or selectPathDirectory(String, StringComparator)
      Selects directory from the combo box above.
      Parameters:
      dir - Directory name (tmp1). Do not use full path (/tmp/tmp1) here.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
    • selectPathDirectory

      public void selectPathDirectory(String dir)
      Selects directory from the combo box above.
      Parameters:
      dir - Directory name (tmp1). Do not use full path (/tmp/tmp1) here.
    • selectFileType

      public void selectFileType(String filter, Operator.StringComparator comparator)
      Selects file type from the combo box below.
      Parameters:
      filter - a pattern for choosing a file type.
      comparator - a comparator defining string comparision criteria
    • selectFileType

      public void selectFileType(String filter, boolean ce, boolean cc)
      Deprecated.
      Use selectFileType(String) or selectFileType(String, StringComparator)
      Selects file type from the combo box below.
      Parameters:
      filter - a pattern for choosing a file type.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
    • selectFileType

      public void selectFileType(String filter)
      Selects file type from the combo box below.
      Parameters:
      filter - a pattern for choosing a file type.
    • checkFileDisplayed

      public boolean checkFileDisplayed(String file, Operator.StringComparator comparator)
      Checks if file is currently displayed in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      comparator - a comparator defining string comparision criteria
      Returns:
      true if file is displayed.
    • checkFileDisplayed

      public boolean checkFileDisplayed(String file, boolean ce, boolean cc)
      Deprecated.
      Use checkFileDisplayed(String) or checkFileDisplayed(String, StringComparator)
      Checks if file is currently displayed in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      ce - Compare exactly. If true, text can be a substring of caption.
      cc - Compare case sensitively. If true, both text and caption are
      Returns:
      true if file is displayed.
    • checkFileDisplayed

      public boolean checkFileDisplayed(String file)
      Checks if file is currently displayed in the list.
      Parameters:
      file - File name (foo.c). Do not use full path (/tmp/foo.c) here.
      Returns:
      true if file is displayed.
    • getFileCount

      public int getFileCount()
      Return count of files currently displayed.
      Returns:
      a number of items in the file list.
    • getFiles

      public File[] getFiles()
      Return files currently displayed.
      Returns:
      an array of items from the file list.
    • waitFileCount

      public void waitFileCount(int count)
      Waits for the file list to have required number of items.
      Parameters:
      count - Number of files to wait.
    • waitFileDisplayed

      public void waitFileDisplayed(String fileName)
      Waits for a file to be displayed in the file list.
      Parameters:
      fileName - a file to wait.
    • accept

      public boolean accept(File file)
      Maps JFileChooser.accept(File) through queue
    • addActionListener

      public void addActionListener(ActionListener actionListener)
      Maps JFileChooser.addActionListener(ActionListener) through queue
    • addChoosableFileFilter

      public void addChoosableFileFilter(FileFilter fileFilter)
      Maps JFileChooser.addChoosableFileFilter(FileFilter) through queue
    • approveSelection

      public void approveSelection()
      Maps JFileChooser.approveSelection() through queue
    • cancelSelection

      public void cancelSelection()
      Maps JFileChooser.cancelSelection() through queue
    • changeToParentDirectory

      public void changeToParentDirectory()
      Maps JFileChooser.changeToParentDirectory() through queue
    • ensureFileIsVisible

      public void ensureFileIsVisible(File file)
      Maps JFileChooser.ensureFileIsVisible(File) through queue
    • getAcceptAllFileFilter

      public FileFilter getAcceptAllFileFilter()
      Maps JFileChooser.getAcceptAllFileFilter() through queue
    • getAccessory

      public JComponent getAccessory()
      Maps JFileChooser.getAccessory() through queue
    • getApproveButtonMnemonic

      public int getApproveButtonMnemonic()
      Maps JFileChooser.getApproveButtonMnemonic() through queue
    • getApproveButtonText

      public String getApproveButtonText()
      Maps JFileChooser.getApproveButtonText() through queue
    • getApproveButtonToolTipText

      public String getApproveButtonToolTipText()
      Maps JFileChooser.getApproveButtonToolTipText() through queue
    • getChoosableFileFilters

      public FileFilter[] getChoosableFileFilters()
      Maps JFileChooser.getChoosableFileFilters() through queue
    • getCurrentDirectory

      public File getCurrentDirectory()
      Maps JFileChooser.getCurrentDirectory() through queue
    • getDescription

      public String getDescription(File file)
      Maps JFileChooser.getDescription(File) through queue
    • getDialogTitle

      public String getDialogTitle()
      Maps JFileChooser.getDialogTitle() through queue
    • getDialogType

      public int getDialogType()
      Maps JFileChooser.getDialogType() through queue
    • getFileFilter

      public FileFilter getFileFilter()
      Maps JFileChooser.getFileFilter() through queue
    • getFileSelectionMode

      public int getFileSelectionMode()
      Maps JFileChooser.getFileSelectionMode() through queue
    • getFileSystemView

      public FileSystemView getFileSystemView()
      Maps JFileChooser.getFileSystemView() through queue
    • getFileView

      public FileView getFileView()
      Maps JFileChooser.getFileView() through queue
    • getIcon

      public Icon getIcon(File file)
      Maps JFileChooser.getIcon(File) through queue
    • getName

      public String getName(File file)
      Maps JFileChooser.getName(File) through queue
    • getSelectedFile

      public File getSelectedFile()
      Maps JFileChooser.getSelectedFile() through queue
    • getSelectedFiles

      public File[] getSelectedFiles()
      Maps JFileChooser.getSelectedFiles() through queue
    • getTypeDescription

      public String getTypeDescription(File file)
      Maps JFileChooser.getTypeDescription(File) through queue
    • getUI

      public FileChooserUI getUI()
      Maps JFileChooser.getUI() through queue
    • isDirectorySelectionEnabled

      public boolean isDirectorySelectionEnabled()
      Maps JFileChooser.isDirectorySelectionEnabled() through queue
    • isFileHidingEnabled

      public boolean isFileHidingEnabled()
      Maps JFileChooser.isFileHidingEnabled() through queue
    • isFileSelectionEnabled

      public boolean isFileSelectionEnabled()
      Maps JFileChooser.isFileSelectionEnabled() through queue
    • isMultiSelectionEnabled

      public boolean isMultiSelectionEnabled()
      Maps JFileChooser.isMultiSelectionEnabled() through queue
    • isTraversable

      public boolean isTraversable(File file)
      Maps JFileChooser.isTraversable(File) through queue
    • removeActionListener

      public void removeActionListener(ActionListener actionListener)
      Maps JFileChooser.removeActionListener(ActionListener) through queue
    • removeChoosableFileFilter

      public boolean removeChoosableFileFilter(FileFilter fileFilter)
      Maps JFileChooser.removeChoosableFileFilter(FileFilter) through queue
    • rescanCurrentDirectory

      public void rescanCurrentDirectory()
      Maps JFileChooser.rescanCurrentDirectory() through queue
    • resetChoosableFileFilters

      public void resetChoosableFileFilters()
      Maps JFileChooser.resetChoosableFileFilters() through queue
    • setAccessory

      public void setAccessory(JComponent jComponent)
      Maps JFileChooser.setAccessory(JComponent) through queue
    • setApproveButtonMnemonic

      public void setApproveButtonMnemonic(char c)
      Maps JFileChooser.setApproveButtonMnemonic(char) through queue
    • setApproveButtonMnemonic

      public void setApproveButtonMnemonic(int i)
      Maps JFileChooser.setApproveButtonMnemonic(int) through queue
    • setApproveButtonText

      public void setApproveButtonText(String string)
      Maps JFileChooser.setApproveButtonText(String) through queue
    • setApproveButtonToolTipText

      public void setApproveButtonToolTipText(String string)
      Maps JFileChooser.setApproveButtonToolTipText(String) through queue
    • setCurrentDirectory

      public void setCurrentDirectory(File file)
      Maps JFileChooser.setCurrentDirectory(File) through queue
    • setDialogTitle

      public void setDialogTitle(String string)
      Maps JFileChooser.setDialogTitle(String) through queue
    • setDialogType

      public void setDialogType(int i)
      Maps JFileChooser.setDialogType(int) through queue
    • setFileFilter

      public void setFileFilter(FileFilter fileFilter)
      Maps JFileChooser.setFileFilter(FileFilter) through queue
    • setFileHidingEnabled

      public void setFileHidingEnabled(boolean b)
      Maps JFileChooser.setFileHidingEnabled(boolean) through queue
    • setFileSelectionMode

      public void setFileSelectionMode(int i)
      Maps JFileChooser.setFileSelectionMode(int) through queue
    • setFileSystemView

      public void setFileSystemView(FileSystemView fileSystemView)
      Maps JFileChooser.setFileSystemView(FileSystemView) through queue
    • setFileView

      public void setFileView(FileView fileView)
      Maps JFileChooser.setFileView(FileView) through queue
    • setMultiSelectionEnabled

      public void setMultiSelectionEnabled(boolean b)
      Maps JFileChooser.setMultiSelectionEnabled(boolean) through queue
    • setSelectedFile

      public void setSelectedFile(File file)
      Maps JFileChooser.setSelectedFile(File) through queue
    • setSelectedFiles

      public void setSelectedFiles(File[] file)
      Maps JFileChooser.setSelectedFiles(File[]) through queue
    • showDialog

      public int showDialog(Component component, String string)
      Maps JFileChooser.showDialog(Component, String) through queue
    • showOpenDialog

      public int showOpenDialog(Component component)
      Maps JFileChooser.showOpenDialog(Component) through queue
    • showSaveDialog

      public int showSaveDialog(Component component)
      Maps JFileChooser.showSaveDialog(Component) through queue