private String handle(JTextArea textField, CommandRequest command) { JTextComponentFixture tFixture = new JTextComponentFixture(FestRobotInstance.getRobot(), textField); switch (command.action) { case SET: tFixture.setText(command.value); break; case GET: return tFixture.text(); case CLICK: FestRobotInstance.getRobot().click(textField); break; case CLEAR: tFixture.setText(command.value); default: throw new IllegalArgumentException("Unsupported command for JTextArea: " + command.action.name()); } return null; }
/** * Works in same way as the 'set text' method * * @param value */ @Override @PublicAtsApi public void appendValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); ((JTextComponentFixture) SwingElementLocator.findFixture(this)).setText(value); }
/** * Set text area value * * @param value the value to set * @throws VerificationException if the element doesn't exist */ @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); ((JTextComponentFixture) SwingElementLocator.findFixture(this)).setText(value); }
/** * Set value in the 'File Name' text field * * @param value the text value to set */ @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); ((JFileChooserFixture) SwingElementLocator.findFixture(this)).fileNameTextBox().setText(value); }
/** * Setting text in the Text field * * @param text the text to set */ @PublicAtsApi public void setText( String text ) { new SwingElementState(this).waitToBecomeExisting(); try { ((JOptionPaneFixture) SwingElementLocator.findFixture(this)).textBox().setText(text); } catch (ComponentLookupException cle) { throw new ElementNotFoundException(cle.getMessage()); } }