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.cms.view.ObjectsView.java

public void buildSearchLayout() {
    searchLayout = new GridLayout();
    searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info")));
    searchLayout.setCaptionAsHtml(true);
    searchLayout.setImmediate(true);//from   w w w.  java  2s.  co  m
    searchLayout.setWidth("100.0%");
    searchLayout.setHeight("-1px");
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);
    searchLayout.setColumns(4);
    searchLayout.setRows(3);
    searchLayout.setStyleName("custom-feildset");

    lblCode = new Label();
    lblCode.setImmediate(true);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.Objects.code"));
    searchLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(true);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    searchLayout.addComponent(txtCode, 1, 0);
    lblName = new Label();
    lblName.setImmediate(true);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.Objects.name"));
    searchLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setImmediate(true);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    searchLayout.addComponent(txtName, 3, 0);
    lblUrl = new Label();
    lblUrl.setImmediate(true);
    lblUrl.setWidth("100.0%");
    lblUrl.setHeight("-1px");
    lblUrl.setValue(BundleUtils.getString("label.Objects.url"));
    searchLayout.addComponent(lblUrl, 0, 1);

    txtUrl = new TextField();
    txtUrl.setImmediate(true);
    txtUrl.setWidth("100.0%");
    txtUrl.setHeight("-1px");
    searchLayout.addComponent(txtUrl, 1, 1);
    lblDescription = new Label();
    lblDescription.setImmediate(true);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("label.Objects.description"));
    searchLayout.addComponent(lblDescription, 2, 1);

    txtDescription = new TextArea();
    txtDescription.setImmediate(true);
    txtDescription.setWidth("100.0%");
    txtDescription.setHeight("-1px");
    searchLayout.addComponent(txtDescription, 3, 1);
    lblObjectType = new Label();
    lblObjectType.setImmediate(true);
    lblObjectType.setWidth("100.0%");
    lblObjectType.setHeight("-1px");
    lblObjectType.setValue(BundleUtils.getString("label.Objects.objectType"));
    searchLayout.addComponent(lblObjectType, 0, 2);

    txtObjectType = new TextField();
    txtObjectType.setImmediate(true);
    txtObjectType.setWidth("100.0%");
    txtObjectType.setHeight("-1px");
    searchLayout.addComponent(txtObjectType, 1, 2);
    lblStatus = new Label();
    lblStatus.setImmediate(true);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.Objects.status"));
    searchLayout.addComponent(lblStatus, 2, 2);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(true);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    searchLayout.addComponent(cbxStatus, 3, 2);

}

From source file:com.cms.view.PriceInfoView.java

public void buildSearchLayout() {
    searchLayout = new GridLayout();
    searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info")));
    searchLayout.setCaptionAsHtml(true);
    searchLayout.setImmediate(false);/*from ww w  . j av  a 2 s  . com*/
    searchLayout.setWidth("100.0%");
    searchLayout.setHeight("-1px");
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);
    searchLayout.setColumns(4);
    searchLayout.setRows(4);
    searchLayout.setStyleName("custom-feildset");

    lblCode = new Label();
    lblCode.setImmediate(false);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.PriceInfo.code"));
    searchLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(false);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    searchLayout.addComponent(txtCode, 1, 0);
    lblName = new Label();
    lblName.setImmediate(false);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.PriceInfo.name"));
    searchLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setImmediate(false);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    searchLayout.addComponent(txtName, 3, 0);
    lblPrice = new Label();
    lblPrice.setImmediate(false);
    lblPrice.setWidth("100.0%");
    lblPrice.setHeight("-1px");
    lblPrice.setValue(BundleUtils.getString("label.PriceInfo.price"));
    searchLayout.addComponent(lblPrice, 0, 1);

    txtPrice = new TextField();
    txtPrice.setImmediate(false);
    txtPrice.setWidth("100.0%");
    txtPrice.setHeight("-1px");
    searchLayout.addComponent(txtPrice, 1, 1);
    lblTokenPrice = new Label();
    lblTokenPrice.setImmediate(false);
    lblTokenPrice.setWidth("100.0%");
    lblTokenPrice.setHeight("-1px");
    lblTokenPrice.setValue(BundleUtils.getString("label.PriceInfo.tokenPrice"));
    searchLayout.addComponent(lblTokenPrice, 2, 1);

    txtTokenPrice = new TextField();
    txtTokenPrice.setImmediate(false);
    txtTokenPrice.setWidth("100.0%");
    txtTokenPrice.setHeight("-1px");
    searchLayout.addComponent(txtTokenPrice, 3, 1);
    lblProvider = new Label();
    lblProvider.setImmediate(false);
    lblProvider.setWidth("100.0%");
    lblProvider.setHeight("-1px");
    lblProvider.setValue(BundleUtils.getString("label.PriceInfo.provider"));
    searchLayout.addComponent(lblProvider, 0, 2);

    cbxProvider = new ComboBox();
    cbxProvider.setImmediate(false);
    cbxProvider.setWidth("100.0%");
    cbxProvider.setHeight("-1px");
    searchLayout.addComponent(cbxProvider, 1, 2);
    lblType = new Label();
    lblType.setImmediate(false);
    lblType.setWidth("100.0%");
    lblType.setHeight("-1px");
    lblType.setValue(BundleUtils.getString("label.PriceInfo.type"));
    searchLayout.addComponent(lblType, 2, 2);

    cbxType = new ComboBox();
    cbxType.setImmediate(false);
    cbxType.setWidth("100.0%");
    cbxType.setHeight("-1px");
    searchLayout.addComponent(cbxType, 3, 2);
    lblStatus = new Label();
    lblStatus.setImmediate(false);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.PriceInfo.status"));
    searchLayout.addComponent(lblStatus, 0, 3);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(false);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    searchLayout.addComponent(cbxStatus, 1, 3);

}

From source file:com.cms.view.ServicesView.java

public void buildSearchLayout() {
    searchLayout = new GridLayout();
    searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info")));
    searchLayout.setCaptionAsHtml(true);
    searchLayout.setImmediate(false);// w  ww  . j  a  va2s . c  o  m
    searchLayout.setWidth("100.0%");
    searchLayout.setHeight("-1px");
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);
    searchLayout.setColumns(4);
    searchLayout.setRows(10);
    searchLayout.setStyleName("custom-feildset");

    lblCode = new Label();
    lblCode.setImmediate(false);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.Services.code"));
    searchLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(false);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    searchLayout.addComponent(txtCode, 1, 0);
    lblDescription = new Label();
    lblDescription.setImmediate(false);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("label.Services.description"));
    searchLayout.addComponent(lblDescription, 2, 0);

    txtDescription = new TextArea();
    txtDescription.setImmediate(false);
    txtDescription.setWidth("100.0%");
    txtDescription.setHeight("-1px");
    searchLayout.addComponent(txtDescription, 3, 0);
    lblExpiryDate = new Label();
    lblExpiryDate.setImmediate(false);
    lblExpiryDate.setWidth("100.0%");
    lblExpiryDate.setHeight("-1px");
    lblExpiryDate.setValue(BundleUtils.getString("label.Services.expiryDate"));
    searchLayout.addComponent(lblExpiryDate, 0, 1);

    popExpiryDate = new PopupDateField();
    popExpiryDate.setImmediate(false);
    popExpiryDate.setWidth("100.0%");
    popExpiryDate.setHeight("-1px");
    searchLayout.addComponent(popExpiryDate, 1, 1);
    lblIssueDate = new Label();
    lblIssueDate.setImmediate(false);
    lblIssueDate.setWidth("100.0%");
    lblIssueDate.setHeight("-1px");
    lblIssueDate.setValue(BundleUtils.getString("label.Services.issueDate"));
    searchLayout.addComponent(lblIssueDate, 2, 1);

    popIssueDate = new PopupDateField();
    popIssueDate.setImmediate(false);
    popIssueDate.setWidth("100.0%");
    popIssueDate.setHeight("-1px");
    searchLayout.addComponent(popIssueDate, 3, 1);
    lblName = new Label();
    lblName.setImmediate(false);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.Services.name"));
    searchLayout.addComponent(lblName, 0, 2);

    txtName = new TextField();
    txtName.setImmediate(false);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    searchLayout.addComponent(txtName, 1, 2);
    lblServiceGroup = new Label();
    lblServiceGroup.setImmediate(false);
    lblServiceGroup.setWidth("100.0%");
    lblServiceGroup.setHeight("-1px");
    lblServiceGroup.setValue(BundleUtils.getString("label.Services.serviceGroup"));
    searchLayout.addComponent(lblServiceGroup, 2, 2);

    txtServiceGroup = new TextField();
    txtServiceGroup.setImmediate(false);
    txtServiceGroup.setWidth("100.0%");
    txtServiceGroup.setHeight("-1px");
    searchLayout.addComponent(txtServiceGroup, 3, 2);
    lblStatus = new Label();
    lblStatus.setImmediate(false);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.Services.status"));
    searchLayout.addComponent(lblStatus, 0, 3);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(false);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    searchLayout.addComponent(cbxStatus, 1, 3);
    lblType = new Label();
    lblType.setImmediate(false);
    lblType.setWidth("100.0%");
    lblType.setHeight("-1px");
    lblType.setValue(BundleUtils.getString("label.Services.type"));
    searchLayout.addComponent(lblType, 2, 3);

    cbxType = new ComboBox();
    cbxType.setImmediate(false);
    cbxType.setWidth("100.0%");
    cbxType.setHeight("-1px");
    searchLayout.addComponent(cbxType, 3, 3);

}

From source file:com.cms.view.TaxAuthorityView.java

public void buildSearchLayout() {
    searchLayout = new GridLayout();
    searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info")));
    searchLayout.setCaptionAsHtml(true);
    searchLayout.setImmediate(true);/*from  www .  j a  v a 2s.c o  m*/
    searchLayout.setWidth("100.0%");
    searchLayout.setHeight("-1px");
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);
    searchLayout.setColumns(4);
    searchLayout.setRows(3);
    searchLayout.setStyleName("custom-feildset");

    //        lblId = new Label();
    //        lblId.setImmediate(true);
    //        lblId.setWidth("100.0%");
    //        lblId.setHeight("-1px");
    //        lblId.setValue(BundleUtils.getString("label.TaxAuthority.id"));
    //        searchLayout.addComponent(lblId, 0, 0);
    //        txtId = new TextField();
    //        txtId.setImmediate(true);
    //        txtId.setWidth("100.0%");
    //        txtId.setHeight("-1px");
    //        searchLayout.addComponent(txtId, 1, 0);
    lblMaCqt = new Label();
    lblMaCqt.setImmediate(true);
    lblMaCqt.setWidth("100.0%");
    lblMaCqt.setHeight("-1px");
    lblMaCqt.setValue(BundleUtils.getString("label.TaxAuthority.maCqt"));
    searchLayout.addComponent(lblMaCqt, 0, 0);

    txtMaCqt = new TextField();
    txtMaCqt.setImmediate(true);
    txtMaCqt.setWidth("100.0%");
    txtMaCqt.setHeight("-1px");
    searchLayout.addComponent(txtMaCqt, 1, 0);
    lblTenCqt = new Label();
    lblTenCqt.setImmediate(true);
    lblTenCqt.setWidth("100.0%");
    lblTenCqt.setHeight("-1px");
    lblTenCqt.setValue(BundleUtils.getString("label.TaxAuthority.tenCqt"));
    searchLayout.addComponent(lblTenCqt, 2, 0);

    txtTenCqt = new TextField();
    txtTenCqt.setImmediate(true);
    txtTenCqt.setWidth("100.0%");
    txtTenCqt.setHeight("-1px");
    searchLayout.addComponent(txtTenCqt, 3, 0);
    lblMaTinh = new Label();
    lblMaTinh.setImmediate(true);
    lblMaTinh.setWidth("100.0%");
    lblMaTinh.setHeight("-1px");
    lblMaTinh.setValue(BundleUtils.getString("label.TaxAuthority.maTinh"));
    searchLayout.addComponent(lblMaTinh, 0, 1);

    cboMaTinh = new ComboBox();
    cboMaTinh.setImmediate(true);
    cboMaTinh.setWidth("100.0%");
    cboMaTinh.setHeight("-1px");
    searchLayout.addComponent(cboMaTinh, 1, 1);
    lblMaQuanHuyen = new Label();
    lblMaQuanHuyen.setImmediate(true);
    lblMaQuanHuyen.setWidth("100.0%");
    lblMaQuanHuyen.setHeight("-1px");
    lblMaQuanHuyen.setValue(BundleUtils.getString("label.TaxAuthority.maQuanHuyen"));
    searchLayout.addComponent(lblMaQuanHuyen, 2, 1);

    txtMaQuanHuyen = new TextField();
    txtMaQuanHuyen.setImmediate(true);
    txtMaQuanHuyen.setWidth("100.0%");
    txtMaQuanHuyen.setHeight("-1px");
    searchLayout.addComponent(txtMaQuanHuyen, 3, 1);
    lblStatus = new Label();
    lblStatus.setImmediate(true);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.TaxAuthority.status"));
    searchLayout.addComponent(lblStatus, 0, 2);

    cboStatus = new ComboBox();
    cboStatus.setImmediate(true);
    cboStatus.setWidth("100.0%");
    cboStatus.setHeight("-1px");
    searchLayout.addComponent(cboStatus, 1, 2);

}

From source file:com.coatl.pruebas.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Escribe algo aqu:");

    Button button = new Button("Dime que escrib");

    button.addClickListener(new Button.ClickListener() {
        @Override//from  w  ww .  j  a  va 2s  .c o m
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("Click!");
            layout.addComponent(new Label("Usted escribi> " + name.getValue()));
        }
    });

    layout.addComponents(name, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

From source file:com.dungnv.streetfood.ui.MultiSelectUI.java

private void init() {

    txtSearch = new TextField();
    txtSearch.setWidth(100.0f, Unit.PERCENTAGE);
    txtSearch.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
    txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    txtSearch.setIcon(FontAwesome.SEARCH);
    addComponent(txtSearch);/* ww w.ja  v  a2 s.  co m*/

    lsItem = new ListSelect();
    lsItem.setSizeFull();
    lsItem.addStyleName(ValoTheme.COMBOBOX_BORDERLESS);
    lsItem.setItemCaptionPropertyId(searchField);
    lsItem.setRows(10);
    lsItem.setMultiSelect(true);
    lsItem.setImmediate(true);
    lsItem.setItemCaptionMode(ItemCaptionMode.PROPERTY);
    addComponent(lsItem);
}

From source file:com.dungnv.streetfood.view.ArticleView.java

private void init() {
    header = new VerticalLayout();
    header.addStyleName("viewheader");
    header.setSpacing(true);//from   w  w w  .j ava2s . co  m
    header.setId("hehehe");

    titleLabel = new Label(BundleUtils.getLanguage("menu.ARTICLE"));
    titleLabel.setId(TITLE_ID);
    titleLabel.setWidth("100%");
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    header.addComponent(titleLabel);

    btnAdd = new Button();
    btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml());
    btnAdd.setCaptionAsHtml(true);
    btnAdd.addStyleName("float-button");
    //        add.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    //        add.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    //        add.addStyleName(ValoTheme.BUTTON_LARGE);
    header.addComponent(btnAdd);

    HorizontalLayout item = new HorizontalLayout();

    //        item.setSpacing(true);
    item.setWidth("100%");
    header.addComponent(item);

    txtSearch = new TextField();
    txtSearch.setImmediate(true);
    txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT);
    txtSearch.setIcon(FontAwesome.SEARCH);
    txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.article.title.input"));
    txtSearch.setWidth("100%");

    item.addComponent(txtSearch);
    item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT);

    lbAdvanced = new Button();
    lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced"));
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK);
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE);
    item.addComponent(lbAdvanced);
    item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT);

    uiSearchPaged = new CommonSearchPagedUI(1) {
        @Override
        public void cbChanged() {
            this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(false);
                    }
                }
            });
            this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(true);
                    }

                }
            });
        }
    };

    header.addComponent(uiSearchPaged);

    searchLayout = new VerticalLayout();
    //        searchLayout.setSpacing(true);
    searchLayout.setSizeFull();
    header.addComponent(searchLayout);

    searchDetail = new ArticleSearchDetail(this);
}

From source file:com.dungnv.streetfood.view.CategoryView.java

private void init() {
    header = new VerticalLayout();
    header.addStyleName("viewheader");
    header.setSpacing(true);//www .ja v a  2 s.  com
    header.setId("hehehe");

    titleLabel = new Label(BundleUtils.getLanguage("menu.CATEGORY"));
    titleLabel.setId(TITLE_ID);
    titleLabel.setWidth("100%");
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    header.addComponent(titleLabel);

    btnAdd = new Button();
    btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml());
    btnAdd.setCaptionAsHtml(true);
    btnAdd.addStyleName("float-button");
    //        add.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    //        add.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    //        add.addStyleName(ValoTheme.BUTTON_LARGE);
    header.addComponent(btnAdd);

    HorizontalLayout item = new HorizontalLayout();

    //        item.setSpacing(true);
    item.setWidth("100%");
    header.addComponent(item);

    txtSearch = new TextField();
    txtSearch.setImmediate(true);
    txtSearch.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
    txtSearch.setIcon(FontAwesome.SEARCH);
    txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.category.name.input"));
    txtSearch.setWidth("100%");

    item.addComponent(txtSearch);
    item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT);

    lbAdvanced = new Button();
    lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced"));
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK);
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE);
    item.addComponent(lbAdvanced);
    item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT);

    uiSearchPaged = new CommonSearchPagedUI(1) {
        @Override
        public void cbChanged() {
            this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(false);
                    }
                }
            });
            this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(true);
                    }

                }
            });
        }
    };

    header.addComponent(uiSearchPaged);

    searchLayout = new VerticalLayout();
    //        searchLayout.setSpacing(true);
    searchLayout.setSizeFull();
    header.addComponent(searchLayout);

    searchDetail = new CategorySearchDetail(this);
}

From source file:com.dungnv.streetfood.view.DishView.java

private void init() {
    header = new VerticalLayout();
    header.addStyleName("viewheader");
    header.setSpacing(true);/*from ww  w .j  ava  2 s .c om*/
    header.setId("hehehe");

    titleLabel = new Label(BundleUtils.getLanguage("menu.DISH"));
    titleLabel.setId(TITLE_ID);
    titleLabel.setWidth("100%");
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    header.addComponent(titleLabel);

    btnAdd = new Button();
    btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml());
    btnAdd.setCaptionAsHtml(true);
    btnAdd.addStyleName("float-button");
    header.addComponent(btnAdd);

    HorizontalLayout item = new HorizontalLayout();

    //        item.setSpacing(true);
    item.setWidth("100%");
    header.addComponent(item);

    txtSearch = new TextField();
    txtSearch.setImmediate(true);
    txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT);
    txtSearch.setIcon(FontAwesome.SEARCH);
    txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.dish.name.input"));
    txtSearch.setWidth("100%");

    item.addComponent(txtSearch);
    item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT);

    lbAdvanced = new Button();
    lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced"));
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK);
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE);
    item.addComponent(lbAdvanced);
    item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT);

    uiSearchPaged = new CommonSearchPagedUI(1) {
        @Override
        public void cbChanged() {
            this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(false);
                    }
                }
            });
            this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(true);
                    }

                }
            });
        }
    };

    header.addComponent(uiSearchPaged);

    searchLayout = new VerticalLayout();
    //        searchLayout.setSpacing(true);
    searchLayout.setSizeFull();
    header.addComponent(searchLayout);

    searchDetail = new DishSearchDetail(this);
}

From source file:com.dungnv.streetfood.view.RestaurantView.java

private void init() {
    header = new VerticalLayout();
    header.addStyleName("viewheader");
    header.setSpacing(true);// w ww .  j a  va  2 s .com
    header.setId("hehehe");

    titleLabel = new Label(BundleUtils.getLanguage("menu.RESTAURANT"));
    titleLabel.setId(TITLE_ID);
    titleLabel.setWidth("100%");
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    header.addComponent(titleLabel);

    btnAdd = new Button();
    btnAdd.setCaption(FontAwesome.PLUS_CIRCLE.getLabel().setSize3x().getCssHtml());
    btnAdd.setCaptionAsHtml(true);
    btnAdd.addStyleName("float-button");
    //        add.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    //        add.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    //        add.addStyleName(ValoTheme.BUTTON_LARGE);
    header.addComponent(btnAdd);

    HorizontalLayout item = new HorizontalLayout();

    //        item.setSpacing(true);
    item.setWidth("100%");
    header.addComponent(item);

    txtSearch = new TextField();
    txtSearch.setImmediate(true);
    txtSearch.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT);
    txtSearch.setIcon(FontAwesome.SEARCH);
    txtSearch.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    txtSearch.setInputPrompt(BundleUtils.getLanguage("lbl.restaurant.name.input"));
    txtSearch.setWidth("100%");

    item.addComponent(txtSearch);
    item.setComponentAlignment(txtSearch, Alignment.TOP_RIGHT);

    lbAdvanced = new Button();
    lbAdvanced.setCaption(BundleUtils.getLanguage("lbl.search.advanced"));
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LINK);
    lbAdvanced.addStyleName(ValoTheme.BUTTON_LARGE);
    item.addComponent(lbAdvanced);
    item.setComponentAlignment(lbAdvanced, Alignment.BOTTOM_LEFT);

    uiSearchPaged = new CommonSearchPagedUI(1) {
        @Override
        public void cbChanged() {
            this.getCbPaged().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(false);
                    }
                }
            });
            this.getCbRecordPerPage().addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    if (event.getProperty().getValue() != null) {
                        onSearch(true);
                    }

                }
            });
        }
    };

    header.addComponent(uiSearchPaged);

    searchLayout = new VerticalLayout();
    //        searchLayout.setSpacing(true);
    searchLayout.setSizeFull();
    header.addComponent(searchLayout);

    searchDetail = new RestaurantSearchDetail(this);
}