/** * Sets the current directory of this fixture's {@code JFileChooser} to the given one. * * @param dir the directory to set as current. * @throws IllegalStateException if this fixture's {@code JFileChooser} is disabled. * @throws IllegalStateException if this fixture's {@code JFileChooser} is not showing on the screen. * @return this fixture. */ @Nonnull public JFileChooserFixture setCurrentDirectory(@Nonnull File dir) { driver().setCurrentDirectory(target(), dir); return this; } }
/** * Selects the given file in this fixture's {@code JFileChooser}. * * @param file the file to select. * @return this fixture. * @throws NullPointerException if the given file is {@code null}. * @throws IllegalStateException if this fixture's {@code JFileChooser} is disabled. * @throws IllegalStateException if this fixture's {@code JFileChooser} is not showing on the screen. * @throws IllegalArgumentException if this fixture's {@code JFileChooser} can select directories only and the file to * select is not a directory. * @throws IllegalArgumentException if this fixture's {@code JFileChooser} cannot select directories and the file to * select is a directory. */ @Nonnull public JFileChooserFixture selectFile(@Nonnull File file) { driver().selectFile(target(), file); return this; }
/** * Simulates a user pressing the "Cancel" button in this fixture's {@code JFileChooser}. * * @throws org.assertj.swing.exception.ComponentLookupException if the "Cancel" button cannot be found. * @throws IllegalStateException if the "Cancel" button is disabled. * @throws IllegalStateException if the "Cancel" button is not showing on the screen. */ public void cancel() { driver().clickCancelButton(target()); }
/** * Simulates a user pressing the "Approve" button in this fixture's {@code JFileChooser}. * * @throws org.assertj.swing.exception.ComponentLookupException if the "Approve" button cannot be found. * @throws IllegalStateException if the "Approve" button is disabled. * @throws IllegalStateException if the "Approve" button is not showing on the screen. */ public void approve() { driver().clickApproveButton(target()); }
/** * Selects the given files in this fixture's {@code JFileChooser}. * * @param files the files to select. * @return this fixture. * @throws NullPointerException if the given array of files is {@code null}. * @throws IllegalArgumentException if the given array of files is empty. * @throws IllegalStateException if this fixture's {@code JFileChooser} is disabled. * @throws IllegalStateException if this fixture's {@code JFileChooser} is not showing on the screen. * @throws IllegalStateException if this fixture's {@code JFileChooser} does not support multiple selection and there * is more than one file to select. * @throws IllegalArgumentException if this fixture's {@code JFileChooser} can select directories only and any of the * files to select is not a directory. * @throws IllegalArgumentException if this fixture's {@code JFileChooser} cannot select directories and any of the * files to select is a directory. */ @Nonnull public JFileChooserFixture selectFiles(@Nonnull File... files) { driver().selectFiles(target(), files); return this; }
/** * Returns a fixture that manages the field where the user can enter the name of the file to select in this fixture's * {@code JFileChooser}. * * @return the created fixture. * @throws org.assertj.swing.exception.ComponentLookupException if a matching textToMatch field could not be found. */ @Nonnull public JTextComponentFixture fileNameTextBox() { return new JTextComponentFixture(robot(), driver().fileNameTextBox(target())); }
/** * Finds the "Approve" button in this fixture's {@code JFileChooser}. * * @return the found "Approve" button. * @throws org.assertj.swing.exception.ComponentLookupException if the "Approve" button cannot be found. */ @Nonnull public JButtonFixture approveButton() { return new JButtonFixture(robot(), driver().approveButton(target())); }
/** * Finds the "Cancel" button in this fixture's {@code JFileChooser}. * * @return the found "Cancel" button. * @throws org.assertj.swing.exception.ComponentLookupException if the "Cancel" button cannot be found. */ @Nonnull public JButtonFixture cancelButton() { return new JButtonFixture(robot(), driver().cancelButton(target())); }