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() 

Source Link

Document

Constructs an empty TextField with no caption.

Usage

From source file:de.escidoc.admintool.view.admintask.repositoryinfo.ShowRepoInfoCommandImpl.java

License:Open Source License

private TextField createReadOnlyField(final Entry<String, String> entry) {
    final TextField textField = new TextField();
    textField.setCaption(entry.getKey());
    textField.setValue(entry.getValue());
    textField.setWidth(400, RepositoryInfoView.UNITS_PIXELS);
    textField.setReadOnly(true);//w w  w  .j av  a 2s.  c  om
    return textField;
}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void addTypeField() {
    typeField = new TextField();
    typeField.setWidth(ViewConstants.FIELD_WIDTH);
    panel.addComponent(LayoutHelper.create(ViewConstants.TYPE_LABEL, typeField, LABEL_WIDTH, true));
}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void addDescField() {
    descriptionField = new TextField();
    descriptionField.setWidth(ViewConstants.FIELD_WIDTH);
    descriptionField.setRows(3);//  w w w  .j  av a 2s .  c  o m
    descriptionField.setMaxLength(ViewConstants.MAX_DESC_LENGTH);
    panel.addComponent(
            LayoutHelper.create(ViewConstants.DESCRIPTION_LABEL, descriptionField, LABEL_WIDTH, 80, true));
    mapBinding("", descriptionField);
}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void addNameField() {
    nameField = new TextField();
    nameField.setWidth(ViewConstants.FIELD_WIDTH);
    nameField.setMaxLength(ViewConstants.MAX_TITLE_LENGTH);

    form.addComponent(LayoutHelper.create(ViewConstants.NAME_LABEL, nameField, LABEL_WIDTH, true));
}

From source file:de.escidoc.admintool.view.EscidocPagedTable.java

License:Open Source License

public HorizontalLayout createControls() {
    // final Label itemsPerPageLabel = new Label("Items per page:");
    final Label pageLabel = new Label("Page:&nbsp;", Label.CONTENT_XHTML);
    final TextField currentPageTextField = new TextField();
    currentPageTextField.setValue(String.valueOf(getCurrentPage()));
    currentPageTextField.addValidator(new IntegerValidator(null));
    final Label separatorLabel = new Label("&nbsp;/&nbsp;", Label.CONTENT_XHTML);
    final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML);
    currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    currentPageTextField.setImmediate(true);
    currentPageTextField.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
            if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) {
                @SuppressWarnings("boxing")
                final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue()));
                setCurrentPage(page);//from  w w w . j a va  2s. c om
            }
        }
    });
    pageLabel.setWidth(null);
    currentPageTextField.setWidth("20px");
    separatorLabel.setWidth(null);
    totalPagesLabel.setWidth(null);

    final HorizontalLayout controlBar = new HorizontalLayout();
    final HorizontalLayout pageSize = new HorizontalLayout();
    final HorizontalLayout pageManagement = new HorizontalLayout();
    final Button first = new Button("<<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(final ClickEvent event) {
            setCurrentPage(0);
        }
    });
    final Button previous = new Button("<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(final ClickEvent event) {
            previousPage();
        }
    });
    final Button next = new Button(">", new ClickListener() {
        private static final long serialVersionUID = -1927138212640638452L;

        public void buttonClick(final ClickEvent event) {
            nextPage();
        }
    });
    final Button last = new Button(">>", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(final ClickEvent event) {
            setCurrentPage(getTotalAmountOfPages());
        }
    });
    first.setStyleName(BaseTheme.BUTTON_LINK);
    previous.setStyleName(BaseTheme.BUTTON_LINK);
    next.setStyleName(BaseTheme.BUTTON_LINK);
    last.setStyleName(BaseTheme.BUTTON_LINK);

    pageLabel.addStyleName("pagedtable-pagecaption");
    currentPageTextField.addStyleName("pagedtable-pagefield");
    separatorLabel.addStyleName("pagedtable-separator");
    totalPagesLabel.addStyleName("pagedtable-total");
    first.addStyleName("pagedtable-first");
    previous.addStyleName("pagedtable-previous");
    next.addStyleName("pagedtable-next");
    last.addStyleName("pagedtable-last");

    pageLabel.addStyleName("pagedtable-label");
    currentPageTextField.addStyleName("pagedtable-label");
    separatorLabel.addStyleName("pagedtable-label");
    totalPagesLabel.addStyleName("pagedtable-label");
    first.addStyleName("pagedtable-button");
    previous.addStyleName("pagedtable-button");
    next.addStyleName("pagedtable-button");
    last.addStyleName("pagedtable-button");

    pageSize.setSpacing(true);
    pageManagement.addComponent(first);
    pageManagement.addComponent(previous);
    pageManagement.addComponent(pageLabel);
    pageManagement.addComponent(currentPageTextField);
    pageManagement.addComponent(separatorLabel);
    pageManagement.addComponent(totalPagesLabel);
    pageManagement.addComponent(next);
    pageManagement.addComponent(last);
    pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT);
    pageManagement.setWidth(null);
    pageManagement.setSpacing(true);
    controlBar.addComponent(pageSize);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER);
    controlBar.setWidth("100%");
    controlBar.setExpandRatio(pageSize, 1);
    addListener(new PageChangeListener() {
        @SuppressWarnings("boxing")
        public void pageChanged(final PagedTableChangeEvent event) {
            previous.setEnabled(true);
            next.setEnabled(true);
            currentPageTextField.setValue(String.valueOf(getCurrentPage()));
            totalPagesLabel.setValue(getTotalAmountOfPages());
        }
    });
    return controlBar;
}

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

License:Open Source License

private void configureTextArea() {
    final TextField key = new TextField();
    key.setWidth(100, Sizeable.UNITS_PIXELS);
    final TextField value = new TextField();
    value.setWidth(200, Sizeable.UNITS_PIXELS);
    freeForm.addComponent(key);//from  www.  j av a  2s.  c om
    freeForm.addComponent(value);
    final Button addMoreField = new Button("+");
    freeForm.addComponent(addMoreField);

    addMoreField.addListener(new AddMoreFieldListener());
    fl.addComponent(freeForm);
}

From source file:de.escidoc.admintool.view.user.UserAddView.java

License:Open Source License

private void addNameField() {
    panel.addComponent(/*  w  w  w .  ja  v a  2s  .  c  o m*/
            LayoutHelper.create(ViewConstants.NAME_LABEL, nameField = new TextField(), LEFT_MARGIN, true));
    nameField.setMaxLength(ViewConstants.MAX_TITLE_LENGTH);
    nameProperty = new ObjectProperty<String>(ViewConstants.EMPTY_STRING, String.class);
    nameField.setPropertyDataSource(nameProperty);
    nameField.setWidth(ViewConstants.FIELD_WIDTH);
}

From source file:de.escidoc.admintool.view.user.UserAddView.java

License:Open Source License

private void addLoginField() {
    panel.addComponent(LayoutHelper.create(ViewConstants.LOGIN_NAME_LABEL, loginNameField = new TextField(),
            LEFT_MARGIN, true));//  w ww.j a  va2  s .  c  o m
    loginNameProperty = new ObjectProperty<String>(ViewConstants.EMPTY_STRING, String.class);
    loginNameField.setPropertyDataSource(loginNameProperty);
    loginNameField.setWidth(ViewConstants.FIELD_WIDTH);
}

From source file:de.escidoc.admintool.view.user.UserEditForm.java

License:Open Source License

private void addLoginNameField() {
    loginNameField = new TextField();
    loginNameField.setMaxLength(ViewConstants.MAX_TITLE_LENGTH);
    loginNameField.setWidth(ViewConstants.FIELD_WIDTH);
    loginNameField.setReadOnly(true);//from ww w  .j a v a  2s .  c  o m
    panel.addComponent(LayoutHelper.create(ViewConstants.LOGIN_NAME_LABEL, loginNameField, 100, false));
}

From source file:de.escidoc.admintool.view.user.UserEditForm.java

License:Open Source License

private void addNameField() {
    nameField = new TextField();
    nameField.setMaxLength(ViewConstants.MAX_TITLE_LENGTH);
    nameField.setWidth(ViewConstants.FIELD_WIDTH);
    nameField.setWriteThrough(false);/*from w w  w .  j  a va  2 s . c  o  m*/
    panel.addComponent(LayoutHelper.create(ViewConstants.NAME_LABEL, nameField, 100, true));
}