Search in sources :

Example 31 with TextField

use of com.vaadin.ui.TextField in project linkki by linkki-framework.

the class AddressFields2 method createTextField.

// end::addressFields-methodBinding[]
private static TextField createTextField(String caption) {
    TextField tf = new TextField(caption);
    tf.setNullRepresentation("");
    return tf;
}
Also used : TextField(com.vaadin.ui.TextField)

Example 32 with TextField

use of com.vaadin.ui.TextField in project linkki by linkki-framework.

the class ComponentFactory method newReadOnlyTextField.

public static TextField newReadOnlyTextField(String value, int columns) {
    TextField field = newReadOnlyTextField(value);
    field.setColumns(columns);
    return field;
}
Also used : TextField(com.vaadin.ui.TextField)

Example 33 with TextField

use of com.vaadin.ui.TextField in project linkki by linkki-framework.

the class ComponentFactory method newReadOnlyTextField.

public static TextField newReadOnlyTextField(String value) {
    TextField field = newTextfield();
    field.setValue(value);
    field.setReadOnly(true);
    return field;
}
Also used : TextField(com.vaadin.ui.TextField)

Example 34 with TextField

use of com.vaadin.ui.TextField in project linkki by linkki-framework.

the class BindingContextTest method testBind_BoundComponentsAreMadeImmediate.

@Test
public void testBind_BoundComponentsAreMadeImmediate() {
    setUpPmo();
    TextField field = new TextField();
    BindingDefinition fieldDefintion = mock(BindingDefinition.class);
    when(fieldDefintion.required()).thenReturn(RequiredType.REQUIRED);
    when(fieldDefintion.enabled()).thenReturn(EnabledType.ENABLED);
    when(fieldDefintion.visible()).thenReturn(VisibleType.VISIBLE);
    ElementDescriptor fieldDescriptor = new ElementDescriptor(fieldDefintion, "value", Void.class, new ArrayList<>());
    // Precondition
    assertThat(field.isImmediate(), is(false));
    context.bind(pmo, fieldDescriptor, new LabelComponentWrapper(field));
    assertThat(field.isImmediate(), is(true));
}
Also used : BindingDefinition(org.linkki.core.ui.section.annotations.BindingDefinition) TextField(com.vaadin.ui.TextField) UITextField(org.linkki.core.ui.section.annotations.UITextField) ElementDescriptor(org.linkki.core.ui.section.descriptor.ElementDescriptor) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper) Test(org.junit.Test)

Example 35 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class ProfilePanel method initContactSection.

protected void initContactSection() {
    Label header = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_CONTACT));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    infoPanelLayout.addComponent(header);
    GridLayout contactLayout = createInfoSectionLayout(2, 4);
    // Email
    if (!editable && isDefined(user.getEmail())) {
        addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), user.getEmail());
    } else if (editable) {
        emailField = new TextField();
        addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), emailField, user.getEmail());
    }
    // Phone
    if (!editable && isDefined(phone)) {
        addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phone);
    } else if (editable) {
        phoneField = new TextField();
        addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phoneField, phone);
    }
    // Twitter
    if (!editable && isDefined(twitterName)) {
        Link twitterLink = new Link(twitterName, new ExternalResource("http://www.twitter.com/" + twitterName));
        addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterLink);
    } else if (editable) {
        twitterField = new TextField();
        addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterField, twitterName);
    }
    // Skype
    if (!editable && isDefined(skypeId)) {
        // The skype entry shows the name + skype icon, laid out in a small grid
        GridLayout skypeLayout = new GridLayout(2, 1);
        skypeLayout.setSpacing(true);
        skypeLayout.setSizeUndefined();
        Label skypeIdLabel = new Label(skypeId);
        skypeIdLabel.setSizeUndefined();
        skypeLayout.addComponent(skypeIdLabel);
        addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeLayout);
    } else if (editable) {
        skypeField = new TextField();
        addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeField, skypeId);
    }
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField) ExternalResource(com.vaadin.terminal.ExternalResource) Link(com.vaadin.ui.Link)

Aggregations

TextField (com.vaadin.ui.TextField)79 Test (org.junit.Test)22 Button (com.vaadin.ui.Button)15 Label (com.vaadin.ui.Label)15 HorizontalLayout (com.vaadin.ui.HorizontalLayout)12 VerticalLayout (com.vaadin.ui.VerticalLayout)10 ClickListener (com.vaadin.ui.Button.ClickListener)7 ComboBox (com.vaadin.ui.ComboBox)7 GridLayout (com.vaadin.ui.GridLayout)7 SplitTextField (au.com.vaadinutils.crud.splitFields.SplitTextField)6 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)6 ClickEvent (com.vaadin.ui.Button.ClickEvent)6 PasswordField (com.vaadin.ui.PasswordField)6 CheckBox (com.vaadin.ui.CheckBox)4 Form (com.vaadin.ui.Form)4 TextArea (com.vaadin.ui.TextArea)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 Property (com.vaadin.data.Property)3 Validator (com.vaadin.data.Validator)3