@Test(dependsOnMethods = "mapByGetter") public void mapByPropertyName() { final FormBuilder<Person> formBuilder = FormBuilder.map(Person.class).useForProperty("description", new StringToTextAreaMapper()); final Form<Person> form = env.buildFormInEDT(formBuilder); env.addToWindow(form.asComponent()); env.setValueInEDT(form, env.createPerson()); final JPanelFixture wrapperPanel = env.getWrapperPanelFixture(); final JTextComponentFixture nameComponent = wrapperPanel.textBox("name"); assert nameComponent.target instanceof JTextField; final JTextComponentFixture descComponent = wrapperPanel.textBox("description"); assert descComponent.target instanceof JTextArea; }
@Test public void mapByGetter() { final FormBuilder<Person> formBuilder = FormBuilder.map(Person.class) .useForGetters( new GetterMapper<Person>() { public void mapGetters(final Person beanSample, final GetterConfig config) { config.use(beanSample.getDescription(), new StringToTextAreaMapper()); } }); final Form<Person> form = env.buildFormInEDT(formBuilder); env.addToWindow(form.asComponent()); env.setValueInEDT(form, env.createPerson()); final JPanelFixture wrapperPanel = env.getWrapperPanelFixture(); final JTextComponentFixture nameComponent = wrapperPanel.textBox("name"); assert nameComponent.target instanceof JTextField; final JTextComponentFixture descComponent = wrapperPanel.textBox("description"); assert descComponent.target instanceof JTextArea; }
public void findEntryBoxAndEnterValue(String name, double value) { JPanelFixture entryBoxArrayPanel = focusedWindow.panel("EntryBoxArrayPanel"); JPanelFixture enumEntryBox = entryBoxArrayPanel.panel(name + "_YoEntryBox"); JTextComponentFixture textBox = enumEntryBox.textBox(); // For some reason deleting, and then entering doesn't seem to work. It only deletes part of the // text!? // Instead here we have to call setText. // textBox.deleteText(); // textBox.enterText(Double.toString(value) + "\n"); textBox.setText(Double.toString(value)); textBox.enterText("\n"); ThreadTools.sleep(500); }
public void enterSearchText(String text) { JPanelFixture searchPanel = focusedWindow.panel("SearchPanel"); JTextComponentFixture searchTextField = searchPanel.textBox("SearchTextField"); searchTextField.enterText(text); }
public void deleteSearchText() { JPanelFixture searchPanel = focusedWindow.panel("SearchPanel"); JTextComponentFixture searchTextField = searchPanel.textBox("SearchTextField"); searchTextField.deleteText(); }