/** * Retrieves the last name entered by the user. * * @return the last name. */ public String getLastName() { return lastName.getText(); }
/** * Retrieves the first name entered by the user. * * @return the first name. */ public String getFirstName() { return firstName.getText(); }
@Override public void execute(final ActionEvent event) { forward(urlField.getText()); } });
/** * Executes the action which duplicates the text. * * @param event details about the event that occured. */ @Override public void execute(final ActionEvent event) { // Get the text entered by the user. String text = textFld.getText(); // Now duplicate it. textFld.setText(text + text); } }
@Override public void execute(final ActionEvent event) { String name = nameField.getText(); outputHeading.setVisible(!(name == null || "".equals(name))); } });
/** * {@inheritDoc} */ @Override public void handleRequest(final Request request) { // A dodgy example of using the unsaved changes flag on the // cancel button. String t1 = textField.getText(); String t2 = textArea.getText(); boolean hasChanges = (t1 != null && t1.length() > 0) || (t2 != null && t2.length() > 0); this.cancelBtn.setUnsavedChanges(hasChanges); }
@Override public void executeOnValid(final ActionEvent event) { helloWorldText.setVisible(true); helloWorldText.setText("HELLO_NAME", nameField.getText()); }
/** * Adds a new contact to the list of contacts. The contact's name is obtained from {@link newNameField}. */ private void addNewContact() { String name = newNameField.getText(); if (name != null && !"".equals(name)) { List list = new ArrayList(repeater.getBeanList()); list.add(new ContactDetails(name, null, new String[0])); repeater.setBeanList(list); } newNameField.setText(""); }
@Override protected boolean isValid() { WTextField textField = (WTextField) getInputField(); String selection = textField.getText(); if (selection != null && selection.length() > 0) { WComponent selectedComponent = UIRegistry.getInstance() .getUI(selection); return selectedComponent != null; } return true; } });
/** * Adds a new contact to the list of contacts. The contact's name is obtained from {@link newNameField}. */ private void addNewContact() { List list = new ArrayList(repeater.getBeanList()); list.add(new ContactDetails(newNameField.getText(), null, new String[0])); newNameField.setText(""); repeater.setBeanList(list); }
@Override public void updateData(final Object data) { MyDataBean myBean = (MyDataBean) data; myBean.setName(nameText.getText()); myBean.setMyBeans(repeater.getBeanList()); } }
/** * {@inheritDoc} */ @Override public void updateData(final Object data) { ContactDetails details = (ContactDetails) data; details.setPhoneNumber(phoneNumField.getText()); details.setRoles((List<String>) roleSelect.getSelected()); }
@Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); //you would normally do something sensible here String inputText = whatTextField.getText(); if (inputText != null) { setText(inputText); whatTextField.setText(""); } else { setText("What?"); } } };
@Test public void testComponentModelSerialization() { WTextField name = new WTextField(); UIContext uic = createUIContext(); setActiveContext(uic); name.setText(TEST_STRING); Assert.assertEquals("Initial text incorrect", TEST_STRING, name.getText()); WebModel model = uic.getModel(name); model = (WebModel) pipe(model); uic.setModel(name, model); Assert.assertEquals("Text incorrect after serialization", TEST_STRING, name.getText()); }
@Override public void executeOnValid(final ActionEvent event) { String regex = pattern.getText(); textField.setPattern(regex); textField.getLabel().setHint(regex); phoneNumberField.setPattern(regex); phoneNumberField.getLabel().setHint(regex); multiTextField.setPattern(regex); multiTextField.getLabel().setHint(regex); } });
@Test public void testInterceptorOkStep() throws XpathException, SAXException, IOException { MyApp app = new MyApp(); app.setLocked(true); MockResponse response = doAjaxRequest(app, 1, 1); assertXpathEvaluatesTo(app.target.getText(), "//ui:textfield", response.getWriterOutput()); }