use of org.fest.swing.fixture.JSpinnerFixture in project android by JetBrains.
the class BuildSignedApkDialogCreateKeystoreSubDialogFixture method validity.
@NotNull
public BuildSignedApkDialogCreateKeystoreSubDialogFixture validity(String years) {
JSpinner spinner = robot().finder().findByLabel("Validity (years):", JSpinner.class);
new JSpinnerFixture(robot(), spinner).enterTextAndCommit(years);
return this;
}
use of org.fest.swing.fixture.JSpinnerFixture in project ats-framework by Axway.
the class SwingSpinner method clickNext.
/**
* Click next/increment spinner button
* @param times number of times to click. Must be greater than 0
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void clickNext(int times) {
if (times <= 0) {
throw new UiElementException("The number of times to click must be greater than 0", this);
}
new SwingElementState(this).waitToBecomeExisting();
((JSpinnerFixture) SwingElementLocator.findFixture(this)).increment(times);
}
use of org.fest.swing.fixture.JSpinnerFixture in project ats-framework by Axway.
the class SwingSpinner method enterText.
/**
* Enter text in the spinner text field without committing the value.
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void enterText(String text) {
new SwingElementState(this).waitToBecomeExisting();
JSpinnerFixture spinnerFixture = (JSpinnerFixture) SwingElementLocator.findFixture(this);
int delayBetweenEvents = spinnerFixture.robot.settings().delayBetweenEvents();
try {
// enterText() method sets the text value using the Robot, so we will speed it up
spinnerFixture.robot.settings().delayBetweenEvents(10);
spinnerFixture.enterText(text);
} finally {
spinnerFixture.robot.settings().delayBetweenEvents(delayBetweenEvents);
}
}
use of org.fest.swing.fixture.JSpinnerFixture in project ats-framework by Axway.
the class SwingElementLocator method findFixture.
public static ComponentFixture<? extends Component> findFixture(UiElement uiElement) {
SwingDriverInternal driver = (SwingDriverInternal) uiElement.getUiDriver();
ContainerFixture<?> containerFixture = (ContainerFixture<?>) driver.getActiveContainerFixture();
Class<? extends Component> componentClass = componentsMap.get(uiElement.getClass());
try {
if (componentClass.equals(JButton.class)) {
return (ComponentFixture<? extends Component>) new JButtonFixture(containerFixture.robot, (JButton) findElement(uiElement));
} else if (componentClass.equals(JTextComponent.class)) {
return (ComponentFixture<? extends Component>) new JTextComponentFixture(containerFixture.robot, (JTextComponent) findElement(uiElement));
} else if (componentClass.equals(JMenuItem.class)) {
if (uiElement.getElementProperty("path") != null) {
return containerFixture.menuItemWithPath(uiElement.getElementProperty("path").split("[\\,\\/]+"));
} else {
return (ComponentFixture<? extends Component>) new JMenuItemFixture(containerFixture.robot, (JMenuItem) findElement(uiElement));
}
} else if (componentClass.equals(JPopupMenu.class)) {
return (ComponentFixture<? extends Component>) new JPopupMenuFixture(containerFixture.robot, (JPopupMenu) findElement(uiElement));
} else if (componentClass.equals(JTree.class)) {
return (ComponentFixture<? extends Component>) new JTreeFixture(containerFixture.robot, (JTree) findElement(uiElement));
} else if (componentClass.equals(JList.class)) {
return (ComponentFixture<? extends Component>) new JListFixture(containerFixture.robot, (JList) findElement(uiElement));
} else if (componentClass.equals(JCheckBox.class)) {
return (ComponentFixture<? extends Component>) new JCheckBoxFixture(containerFixture.robot, (JCheckBox) findElement(uiElement));
} else if (componentClass.equals(JToggleButton.class)) {
return (ComponentFixture<? extends Component>) new JToggleButtonFixture(containerFixture.robot, (JToggleButton) findElement(uiElement));
} else if (componentClass.equals(JComboBox.class)) {
return (ComponentFixture<? extends Component>) new JComboBoxFixture(containerFixture.robot, (JComboBox) findElement(uiElement));
} else if (componentClass.equals(JRadioButton.class)) {
return (ComponentFixture<? extends Component>) new JRadioButtonFixture(containerFixture.robot, (JRadioButton) findElement(uiElement));
} else if (componentClass.equals(JTable.class)) {
return (ComponentFixture<? extends Component>) new JTableFixture(containerFixture.robot, (JTable) findElement(uiElement));
} else if (componentClass.equals(JSpinner.class)) {
return (ComponentFixture<? extends Component>) new JSpinnerFixture(containerFixture.robot, (JSpinner) findElement(uiElement));
} else if (componentClass.equals(JTabbedPane.class)) {
return (ComponentFixture<? extends Component>) new JTabbedPaneFixture(containerFixture.robot, (JTabbedPane) findElement(uiElement));
} else if (componentClass.equals(JOptionPane.class)) {
return (ComponentFixture<? extends Component>) containerFixture.optionPane();
} else if (componentClass.equals(JLabel.class)) {
return (ComponentFixture<? extends Component>) new JLabelFixture(containerFixture.robot, (JLabel) findElement(uiElement));
} else if (componentClass.equals(Component.class)) {
return new ComponentFixture<Component>(containerFixture.robot, findElement(uiElement)) {
};
} else if (componentClass.equals(JFileChooser.class)) {
// TODO - might be searched by name too
return containerFixture.fileChooser(Timeout.timeout(UiEngineConfigurator.getInstance().getElementStateChangeDelay()));
} else {
throw new ElementNotFoundException(uiElement.toString() + " not found. No such Fixture");
}
} catch (ComponentLookupException cle) {
throw new ElementNotFoundException(uiElement.toString() + " not found.", cle);
} catch (WaitTimedOutError exc) {
// thrown for OptionPane search, wait for Window (BasicRobot.waitForWindow), AbstractJTableCellWriter, JTreeDriver.waitForChildrenToShowUp, each Pause wait
throw new ElementNotFoundException(uiElement.toString() + " not found.", exc);
}
}
use of org.fest.swing.fixture.JSpinnerFixture in project ats-framework by Axway.
the class SwingSpinner method clickPrevious.
/**
* Click previous/decrement spinner button
* @param times number of times to click. Must be greater than 0
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void clickPrevious(int times) {
if (times <= 0) {
throw new UiElementException("The number of times to click must be greater than 0", this);
}
new SwingElementState(this).waitToBecomeExisting();
((JSpinnerFixture) SwingElementLocator.findFixture(this)).decrement(times);
}
Aggregations