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:com.jiangyifen.ec2.ui.mgr.system.tabsheet.DynQueueMemberManagement.java

/**
 * ?(???)/*from  w w  w  .j  a  v a2  s  .  c o  m*/
 */
private void createBottomComponents() {
    HorizontalLayout bottomHLayout = new HorizontalLayout();
    bottomHLayout.setSpacing(true);
    bottomHLayout.setWidth("100%");
    this.addComponent(bottomHLayout);

    // 
    HorizontalLayout bottomLeft = new HorizontalLayout();
    bottomLeft.setSpacing(true);
    bottomLeft.setWidth("-1px");
    bottomHLayout.addComponent(bottomLeft);
    bottomHLayout.setComponentAlignment(bottomLeft, Alignment.MIDDLE_LEFT);

    // ?
    save = new Button("? ", this);
    save.setStyleName("default");
    bottomLeft.addComponent(save);
    bottomLeft.setComponentAlignment(save, Alignment.MIDDLE_LEFT);

    // ?
    cancel = new Button("? ", this);
    bottomLeft.addComponent(cancel);
    bottomLeft.setComponentAlignment(cancel, Alignment.MIDDLE_LEFT);

    // ?
    HorizontalLayout bottomRight = new HorizontalLayout();
    bottomRight.setSpacing(true);
    bottomRight.setWidth("-1px");
    bottomHLayout.addComponent(bottomRight);
    bottomHLayout.setComponentAlignment(bottomRight, Alignment.MIDDLE_RIGHT);

    Label priorityCaption = new Label("<B>?</B>", Label.CONTENT_XHTML);
    priorityCaption.setWidth("-1px");
    bottomRight.addComponent(priorityCaption);
    bottomRight.setComponentAlignment(priorityCaption, Alignment.MIDDLE_RIGHT);

    priorityField = new TextField();
    priorityField.addListener(this);
    priorityField.setWidth("100px");
    priorityField.setImmediate(true);
    priorityField.setWriteThrough(false);
    bottomRight.addComponent(priorityField);
    bottomRight.setComponentAlignment(priorityField, Alignment.MIDDLE_RIGHT);

    // ?????
    setButtonsEnable(false);
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 *  ?(??)//from www .  j  a v  a2  s.com
 * @return
 */

private VerticalLayout createLeftComponents() {
    VerticalLayout leftVLayout = new VerticalLayout();
    leftVLayout.setSpacing(true);
    leftVLayout.setWidth("100%");

    // ?
    HorizontalLayout searchHLayout = new HorizontalLayout();
    searchHLayout.setSpacing(true);
    leftVLayout.addComponent(searchHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    searchHLayout.addComponent(caption);
    searchHLayout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);

    leftKeyword = new TextField();
    leftKeyword.setImmediate(true);
    leftKeyword.setInputPrompt("?");
    leftKeyword.setDescription("?????????????");
    leftKeyword.setStyleName("search");
    leftKeyword.addListener(this);
    leftKeyword.setEnabled(false);
    searchHLayout.addComponent(leftKeyword);
    searchHLayout.setComponentAlignment(leftKeyword, Alignment.MIDDLE_CENTER);

    leftSearch = new Button("?", this);
    leftSearch.setImmediate(true);
    leftSearch.setEnabled(false);
    searchHLayout.addComponent(leftSearch);
    searchHLayout.setComponentAlignment(leftSearch, Alignment.MIDDLE_CENTER);

    // 
    leftTable = new Table("?");
    leftTable.addStyleName("striped");
    leftTable.addStyleName("mydisabled");
    leftTable.setSelectable(true);
    leftTable.setMultiSelect(true);
    leftTable.setWidth("100%");
    leftTable.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
    leftVLayout.addComponent(leftTable);

    leftTableContainer = new BeanItemContainer<User>(User.class);
    leftTableContainer.addNestedContainerProperty("department.name");
    leftTable.setContainerDataSource(leftTableContainer);
    leftTable.setPageLength(10);
    leftTable.setVisibleColumns(VISIBLE_PROPERTIES);
    leftTable.setColumnHeaders(COL_HEADERS);

    return leftVLayout;
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 * ??(????)/*from   ww  w . j  a  v  a2 s  . co  m*/
 * return 
 */
private VerticalLayout createRightComponents() {
    VerticalLayout rightVLayout = new VerticalLayout();
    rightVLayout.setSpacing(true);
    rightVLayout.setWidth("100%");

    // ?
    HorizontalLayout searchHLayout = new HorizontalLayout();
    searchHLayout.setSpacing(true);
    rightVLayout.addComponent(searchHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    searchHLayout.addComponent(caption);
    searchHLayout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);

    rightKeyword = new TextField();
    rightKeyword.setImmediate(true);
    rightKeyword.setInputPrompt("?");
    rightKeyword.setDescription("?????????????");
    rightKeyword.setStyleName("search");
    rightKeyword.addListener(this);
    rightKeyword.setEnabled(false);
    searchHLayout.addComponent(rightKeyword);
    searchHLayout.setComponentAlignment(rightKeyword, Alignment.MIDDLE_CENTER);

    rightSearch = new Button("?", this);
    rightSearch.setImmediate(true);
    rightSearch.setEnabled(false);
    searchHLayout.addComponent(rightSearch);
    searchHLayout.setComponentAlignment(rightSearch, Alignment.MIDDLE_CENTER);

    // 
    rightTable = new Table("");
    rightTable.addStyleName("striped");
    rightTable.addStyleName("mydisabled");
    rightTable.setSelectable(true);
    rightTable.setMultiSelect(true);
    rightTable.setWidth("100%");
    rightTable.setPageLength(10);
    rightTable.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
    rightVLayout.addComponent(rightTable);

    rightTableContainer = new BeanItemContainer<User>(User.class);
    rightTableContainer.addNestedContainerProperty("department.name");
    rightTable.setContainerDataSource(rightTableContainer);
    rightTable.setVisibleColumns(VISIBLE_PROPERTIES);
    rightTable.setColumnHeaders(COL_HEADERS);

    return rightVLayout;
}

From source file:com.jorambarrez.BasicNode.java

License:Apache License

protected void initTextField(String text) {
    textField = new TextField();
    if (text != null) {
        textField.setValue(text);//from  ww  w  . j  a v a  2 s .  com
        textField.selectAll();
    }
    textField.setWidth(100, UNITS_PERCENTAGE); // see explanation above in comments
    textField.addStyleName(STYLE_PROCESS_STEP_TEXTFIELD);
    textField.focus();

    addComponent(textField);
    setComponentAlignment(textField, Alignment.MIDDLE_CENTER);

    // Listeners: for enter key (= accept value), escape (= cancel) and auto expanding

    textField.addShortcutListener(new ShortcutListener(null, KeyCode.ENTER, null) {
        private static final long serialVersionUID = 1L;

        public void handleAction(Object sender, Object target) {
            switchBackToLabel((String) textField.getValue());
        }
    });

    textField.addShortcutListener(new ShortcutListener(null, KeyCode.ESCAPE, null) {
        private static final long serialVersionUID = 1L;

        public void handleAction(Object sender, Object target) {
            switchBackToLabel(originalText);
        }
    });

}

From source file:com.jorambarrez.PropertyPanel.java

License:Apache License

public void showNodeProperties(Node node) {
    currentNode = node;//w  w  w.j av  a2s .com

    title.setValue(node.getText());
    title.setContentMode(Label.CONTENT_DEFAULT);

    // Demo
    propertyLayout.removeAllComponents();
    Label assigneeLabel = new Label("Assignee");
    assigneeLabel.addStyleName(STYLE_BOLD);
    propertyLayout.addComponent(assigneeLabel);
    TextField assigneeTextField = new TextField();
    assigneeTextField.setValue(node.getProperty("Assignee"));
    propertyLayout.addComponent(assigneeTextField);

    Label deadlineLabel = new Label("Deadline");
    deadlineLabel.addStyleName(STYLE_BOLD);
    propertyLayout.addComponent(deadlineLabel);
    DateField deadlineField = new DateField();
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
    try {
        deadlineField.setValue(dateFormat.parseObject(node.getProperty("Deadline")));
        propertyLayout.addComponent(deadlineField);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.klwork.explorer.project.ProjectSearchPanel.java

License:Apache License

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    //CssLayout csslayout2 = new CssLayout();
    CustomLayout csslayout = new CustomLayout("circularButton");
    csslayout.setHeight(24, Unit.PIXELS);
    csslayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(csslayout);//from   w  w w .ja  va2 s. c  o  m

    inputField = new TextField();
    inputField.setWidth(50, Unit.PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt("??");
    inputField.focus();
    csslayout.addComponent(inputField, "searchInput");

    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}

From source file:com.klwork.explorer.ui.business.outproject.ProjectSearchPanel.java

License:Apache License

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    //CssLayout csslayout2 = new CssLayout();
    CustomLayout csslayout = new CustomLayout("circularButton");
    //csslayout.setHeight(24, Unit.PIXELS);
    csslayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(csslayout);//  www  .  j  a v a  2  s  .c om

    inputField = new TextField();
    inputField.setWidth(50, Unit.PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt("??");
    inputField.focus();
    csslayout.addComponent(inputField, "searchInput");

    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}

From source file:com.klwork.explorer.ui.custom.SelectUsersPopupWindow.java

License:Apache License

protected void initSearchField() {
    HorizontalLayout searchLayout = new HorizontalLayout();
    searchLayout.setSpacing(true);//from  www. ja va  2  s. c o m
    windowLayout.addComponent(searchLayout);

    // textfield
    searchField = new TextField();
    searchField.setInputPrompt(i18nManager.getMessage(Messages.PEOPLE_SEARCH));
    searchField.setWidth(180, Unit.PIXELS);
    searchField.focus();
    searchLayout.addComponent(searchField);

    // Logic to change table according to input
    searchField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            searchPeople(event.getText());
        }
    });
    // 
    initSelectMyselfButton(searchLayout);
}

From source file:com.klwork.explorer.ui.custom.TaskListHeader.java

License:Apache License

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    //CssLayout csslayout2 = new CssLayout();
    CustomLayout csslayout = new CustomLayout("circularButton");
    csslayout.setHeight(24, Unit.PIXELS);
    csslayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(csslayout);/*w  ww  .jav  a  2s  . c o m*/

    inputField = new TextField();
    inputField.setWidth(100, Unit.PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
    inputField.focus();
    csslayout.addComponent(inputField, "searchInput");

    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}

From source file:com.klwork.explorer.ui.form.SelectUserField.java

License:Apache License

public SelectUserField(String caption) {
    i18nManager = ViewToolManager.getI18nManager();

    setSpacing(true);/*from w  w  w .  j a v a 2s  . com*/
    setCaption(caption);

    selectedUserLabel = new Label();
    selectedUserLabel.setValue(i18nManager.getMessage(Messages.FORM_USER_NO_USER_SELECTED));
    selectedUserLabel.addStyleName(ExplorerLayout.STYLE_FORM_NO_USER_SELECTED);
    addComponent(selectedUserLabel);

    selectUserButton = new Button();
    selectUserButton.addStyleName(Reindeer.BUTTON_SMALL);
    selectUserButton.setCaption(i18nManager.getMessage(Messages.FORM_USER_SELECT));
    addComponent(selectUserButton);

    selectUserButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            final SelectUsersPopupWindow window = new SelectUsersPopupWindow(
                    i18nManager.getMessage(Messages.FORM_USER_SELECT), false);
            window.addListener(new SubmitEventListener() {
                private static final long serialVersionUID = 1L;

                @Override
                protected void submitted(SubmitEvent event) {
                    String userId = window.getSelectedUserId();
                    setValue(userId);
                }

                @Override
                protected void cancelled(SubmitEvent event) {
                }
            });
            ViewToolManager.showPopupWindow(window);
        }
    });

    // Invisible textfield, only used as wrapped field
    wrappedField = new TextField();
    wrappedField.setVisible(false);
    addComponent(wrappedField);
}