Example usage for com.vaadin.ui TextField TextField

List of usage examples for com.vaadin.ui TextField TextField

Introduction

In this page you can find the example usage for com.vaadin.ui TextField TextField.

Prototype

public TextField(ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextField with a value change listener.

Usage

From source file:de.escidoc.admintool.view.resource.OrgUnitSpecificView.java

License:Open Source License

private void addCityField() {
    cityField = new TextField(ViewConstants.CITY_LABEL);
    cityField.setWidth(ViewConstants.FIELD_WIDTH);
    configure(cityField);/*  ww w  .  ja  v a 2s.co  m*/
    fieldByName.put(ViewConstants.CITY_LABEL, cityField);
    formLayout.addComponent(cityField);
}

From source file:de.escidoc.admintool.view.resource.OrgUnitSpecificView.java

License:Open Source License

private static TextField createTextField(final String caption) {
    return new TextField(caption);
}

From source file:de.fatalix.bookery.view.admin.ServerSettingsLayout.java

License:Open Source License

private AbstractTextField[] generateFields() {
    fields = new ArrayList<>();
    for (SettingKey key : SettingKey.values()) {
        AbstractTextField field = new TextField(key.getName());
        field.setColumns(25);//from   w  ww  .  j  a  v  a  2 s  .  c  o m
        field.setId(key.getKey());
        field.addBlurListener(this);
        fields.add(field);
    }
    AbstractTextField[] result = new AbstractTextField[fields.size()];
    return fields.toArray(result);
}

From source file:de.fzi.fhemapi.view.vaadin.ui.ServerDetailsForm.java

License:Apache License

public ServerDetailsForm() {
    FormLayout layout = new FormLayout();
    setCompositionRoot(layout);/*  w ww.  j a  va2  s. c  o m*/

    Label title = new Label("<h1> Server Details</h1>");
    title.setContentMode(Label.CONTENT_XHTML);
    layout.addComponent(title);

    final TextField serverIP = new TextField("Server IP");

    serverIP.setWidth(COMMON_FIELD_WIDTH);
    layout.addComponent(serverIP);

    final TextField port = new TextField("Port");
    port.setWidth(COMMON_FIELD_WIDTH);
    layout.addComponent(port);

    Button applyButton = new Button("Apply");
    layout.addComponent(applyButton);

    applyButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                //               Window mainWindow = new Window();
                FHEMServer server = new FHEMServer((String) serverIP.getValue(),
                        Integer.parseInt((String) port.getValue()));
                getWindow().setContent(new HWindow(server));
                //               VaadinServletResponse response = 
                //                        (VaadinServletResponse) VaadinService.getCurrentResponse();
                //                     Cookie ipCookie = new Cookie("ip", (String)serverIP.getValue());
                //                     Cookie portCookie = new Cookie("port", (String) port.getValue());
                //                     ipCookie.setMaxAge(30 * 24 * 60 * 60);
                //                     ipCookie.setPath("/HWC");
                //                     portCookie.setMaxAge(30 * 24 * 60 * 60);
                //                     portCookie.setPath("/HWC");
                //                     response.addCookie(ipCookie);
                //                     response.addCookie(portCookie);
            } catch (ConnectException e) {
                getWindow().setContent(new Window("Could not connect to FHEM!\n Cause: " + e.getMessage()));
                getWindow().showNotification("Error!", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    //
    //       VaadinServletRequest request = 
    //                (VaadinServletRequest) VaadinService.getCurrentRequest();
    //       if(request != null){
    //             Cookie[] cookies = request.getCookies();
    //             for (Cookie cookie : cookies) {
    //                if (cookie.getName().equals("ip")) {
    //                   serverIP.setValue(cookie.getValue());
    //                }else if(cookie.getName().equals("port")){
    //                   port.setValue(cookie.getValue());
    //                }
    //             }
    //       }

}

From source file:de.gedoplan.webclients.vaadin.LoginUi.java

@Override
protected void init(VaadinRequest request) {
    TextField name = new TextField(Messages.login_name.value());
    name.focus();//from www .j  a  va 2 s  .  c  o  m
    PasswordField password = new PasswordField(Messages.login_password.value());
    Button login = new Button(Messages.login_submit.value(), e -> {
        try {
            JaasAccessControl.login(name.getValue(), password.getValue());
            Page.getCurrent().setLocation(Konstanten.VAADIN_UI_PATH);
        } catch (ServletException ex) {
            Notification.show(Messages.login_invalid.value(), Notification.Type.ERROR_MESSAGE);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    FormLayout fieldLayout = new FormLayout(name, password, login);
    fieldLayout.setMargin(true);
    fieldLayout.setSpacing(true);
    Panel loginPanel = new Panel(Messages.login_title.value(), fieldLayout);
    loginPanel.setSizeUndefined();
    VerticalLayout page = new VerticalLayout();
    page.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    page.addComponent(loginPanel);
    page.setSizeFull();
    setContent(page);
}

From source file:de.kaiserpfalzEdv.infopir.ui.register.AccusedField.java

License:Apache License

@Override
protected Component initContent() {
    layout = new VerticalLayout();

    memberNumber = new TextField(i18n.get("accused.member-number"));
    memberNumber.setHeight(100f, PERCENTAGE);
    memberNumber.setWidth(50f, PERCENTAGE);
    layout.addComponent(memberNumber);//from  ww  w  .j a  v a2 s  . c  om

    surName = new TextField(i18n.get("accused.sur-name"));
    surName.setSizeFull();
    layout.addComponent(surName);

    givenName = new TextField(i18n.get("accused.given-name"));
    surName.setSizeFull();
    layout.addComponent(givenName);

    setTabIndex();

    return layout;
}

From source file:de.kaiserpfalzEdv.infopir.ui.register.TrialField.java

License:Apache License

@Override
protected Component initContent() {
    layout = new VerticalLayout();

    court = layoutHelper.createJpaComboBox(em, Court.class, "commonName", "register-entry.court", 4, COL_01,
            ROW_04, COL_04, ROW_04);//from   ww w  .  ja  va2  s .  c  o m
    fileNumber = layoutHelper.createTextField("trial.file-number", 5, COL_05, ROW_04, COL_08, ROW_04);
    openingDate = layoutHelper.createDateField("trial.opening-date", 6, COL_01, ROW_05, COL_04, ROW_05);
    closingDate = layoutHelper.createDateField("trial.closing-date", 7, COL_05, ROW_05, COL_08, ROW_05);

    memberNumber = new TextField(i18n.get("trial."));
    memberNumber.setHeight(100f, PERCENTAGE);
    memberNumber.setWidth(50f, PERCENTAGE);
    layout.addComponent(memberNumber);

    surName = new TextField(i18n.get("accused.sur-name"));
    surName.setSizeFull();
    layout.addComponent(surName);

    givenName = new TextField(i18n.get("accused.given-name"));
    surName.setSizeFull();
    layout.addComponent(givenName);

    setTabIndex();

    return layout;
}

From source file:de.kaiserpfalzEdv.vaadin.LayoutHelper.java

License:Apache License

public TextField createTextField(final String caption, final int tabIndex, final int startColumn,
        final int startRow, final int endColumn, final int endRow) {
    TextField result = new TextField(i18n.get(caption));
    addToLayout(result, tabIndex, startColumn, startRow, endColumn, endRow);
    return result;
}

From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java

License:Apache License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();//from w  ww .j  a  v a 2s  .c  o  m
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField(translate("login.name.caption")));
    username.setDescription(translate("login.name.description"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField(translate("login.password.caption")));
    password.setWidth(15, Unit.EM);
    password.setDescription(translate("login.password.description"));
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    login = new Button(translate("login.login-button.caption"));
    buttons.addComponent(login);
    login.setDescription(translate("login.login-button.description"));
    login.setDisableOnClick(true);
    login.addClickListener(event -> {
        try {
            login();
        } finally {
            login.setEnabled(true);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    Button forgotPassword;
    buttons.addComponent(forgotPassword = new Button(translate("login.password-forgotten.caption")));
    forgotPassword.setDescription(translate("login.password-forgotten.description"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            NotificationPayload notification = new NotificationPayload("login.password-forgotten.text");
            bus.post(new NotificationEvent(this, notification));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java

License:Apache License

protected TextField createTextField(final String caption, int tabIndex) {
    TextField result = new TextField(presenter.translate(caption));

    result.setWidth(100f, PERCENTAGE);/*ww w.  ja va 2s.  c  o m*/
    result.setTabIndex(tabIndex);
    result.setNullRepresentation("");

    String description = presenter.translate(caption + ".description");
    if (!description.equals(caption + ".description"))
        result.setDescription(description);

    return result;
}