@InternalApi public class JFileChooserDriver extends JComponentDriver
JFileChooser
s.
Note: This class is intended for internal use only. Please use the classes in the package
org.assertj.swing.fixture
in your tests.
robot
Constructor and Description |
---|
JFileChooserDriver(Robot robot)
Creates a new
JFileChooserDriver . |
Modifier and Type | Method and Description |
---|---|
JButton |
approveButton(JFileChooser fileChooser)
Finds the "Approve" button in the given
JFileChooser . |
JButton |
cancelButton(JFileChooser fileChooser)
Finds the "Cancel" button in the given
JFileChooser . |
void |
clickApproveButton(JFileChooser fileChooser)
Finds and clicks the "Approve" button in the given
JFileChooser . |
void |
clickCancelButton(JFileChooser fileChooser)
Finds and clicks the "Cancel" button in the given
JFileChooser . |
JTextField |
fileNameTextBox(JFileChooser fileChooser)
Returns the text field where the user can enter the name of the file to select.
|
void |
selectFile(JFileChooser fileChooser,
File file)
Selects the given file in the
JFileChooser . |
void |
selectFiles(JFileChooser fileChooser,
File[] files)
Selects the given file in the
JFileChooser . |
void |
setCurrentDirectory(JFileChooser fileChooser,
File dir)
Sets the current directory in the
JFileChooser to the given one. |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
doResizeHeight, doResizeWidth, isResizable, move, resize
backgroundOf, checkClickAllowed, checkInEdtEnabledAndShowing, checkInEdtShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, drop, focus, focusAndWaitForFocusGain, fontOf, foregroundOf, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, pressKeyWhileRunning, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
public JFileChooserDriver(@Nonnull Robot robot)
JFileChooserDriver
.robot
- the robot to use to simulate user input.@RunsInEDT public void selectFile(@Nonnull JFileChooser fileChooser, @Nonnull File file)
JFileChooser
.fileChooser
- the target JFileChooser
.file
- the file to select.NullPointerException
- if the given file is null
.IllegalStateException
- if the JFileChooser
is disabled.IllegalStateException
- if the JFileChooser
is not showing on the screen.IllegalArgumentException
- if the JFileChooser
can select directories only and the file to select is
not a directory.IllegalArgumentException
- if the JFileChooser
cannot select directories and the file to select is a
directory.public void selectFiles(@Nonnull JFileChooser fileChooser, @Nonnull File[] files)
JFileChooser
.fileChooser
- the target JFileChooser
.files
- the files to select.NullPointerException
- if the given array of files is null
.IllegalArgumentException
- if the given array of files is empty.IllegalStateException
- if this fixture's JFileChooser
is disabled.IllegalStateException
- if this fixture's JFileChooser
is not showing on the screen.IllegalStateException
- if this fixture's JFileChooser
does not support multiple selection and there
is more than one file to select.IllegalArgumentException
- if this fixture's JFileChooser
can select directories only and any of the
files to select is not a directory.IllegalArgumentException
- if this fixture's JFileChooser
cannot select directories and any of the
files to select is a directory.@RunsInEDT public void setCurrentDirectory(@Nonnull JFileChooser fileChooser, @Nonnull File dir)
JFileChooser
to the given one.fileChooser
- the target JFileChooser
.dir
- the directory to set as current.IllegalStateException
- if the JFileChooser
is disabled.IllegalStateException
- if the JFileChooser
is not showing on the screen.@RunsInEDT public JTextField fileNameTextBox(@Nonnull JFileChooser fileChooser)
fileChooser
- the target JFileChooser
.ComponentLookupException
- if a matching text field could not be found.@RunsInEDT public void clickCancelButton(@Nonnull JFileChooser fileChooser)
JFileChooser
.fileChooser
- the target JFileChooser
.ComponentLookupException
- if the "Cancel" button cannot be found.IllegalStateException
- if the "Cancel" button is disabled.IllegalStateException
- if the "Cancel" button is not showing on the screen.@RunsInEDT @Nonnull public JButton cancelButton(@Nonnull JFileChooser fileChooser)
JFileChooser
.fileChooser
- the target JFileChooser
.ComponentLookupException
- if the "Cancel" button cannot be found.@RunsInEDT public void clickApproveButton(@Nonnull JFileChooser fileChooser)
JFileChooser
.fileChooser
- the target JFileChooser
.ComponentLookupException
- if the "Approve" button cannot be found.IllegalStateException
- if the "Approve" button is disabled.IllegalStateException
- if the "Approve" button is not showing on the screen.@RunsInEDT @Nonnull public JButton approveButton(@Nonnull JFileChooser fileChooser)
JFileChooser
.fileChooser
- the target JFileChooser
.ComponentLookupException
- if the "Approve" button cannot be found.Copyright © 2014–2019 AssertJ. All rights reserved.