List of usage examples for com.vaadin.server FontAwesome SEARCH
FontAwesome SEARCH
To view the source code for com.vaadin.server FontAwesome SEARCH.
Click Source Link
From source file:annis.gui.controlpanel.QueryPanel.java
License:Apache License
public QueryPanel(final AnnisUI ui) { super(4, 5);/*from ww w . j a v a 2 s. c om*/ this.ui = ui; this.lastPublicStatus = "Welcome to ANNIS! " + "A tutorial is available on the right side."; this.state = ui.getQueryState(); setSpacing(true); setMargin(false); setRowExpandRatio(0, 1.0f); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 0.1f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); txtQuery = new AqlCodeEditor(); txtQuery.setPropertyDataSource(state.getAql()); txtQuery.setInputPrompt("Please enter AQL query"); txtQuery.addStyleName("query"); if (ui.getInstanceFont() == null) { txtQuery.addStyleName("default-query-font"); txtQuery.setTextareaStyle("default-query-font"); } else { txtQuery.addStyleName(Helper.CORPUS_FONT); txtQuery.setTextareaStyle(Helper.CORPUS_FONT); } txtQuery.addStyleName("keyboardInput"); txtQuery.setWidth("100%"); txtQuery.setHeight(15f, Unit.EM); txtQuery.setTextChangeTimeout(500); final VirtualKeyboardCodeEditor virtualKeyboard; if (ui.getInstanceConfig().getKeyboardLayout() == null) { virtualKeyboard = null; } else { virtualKeyboard = new VirtualKeyboardCodeEditor(); virtualKeyboard.setKeyboardLayout(ui.getInstanceConfig().getKeyboardLayout()); virtualKeyboard.extend(txtQuery); } txtStatus = new TextArea(); txtStatus.setValue(this.lastPublicStatus); txtStatus.setWidth("100%"); txtStatus.setHeight(4.0f, Unit.EM); txtStatus.addStyleName("border-layout"); txtStatus.setReadOnly(true); piCount = new ProgressBar(); piCount.setIndeterminate(true); piCount.setEnabled(false); piCount.setVisible(false); btShowResult = new Button("Search"); btShowResult.setIcon(FontAwesome.SEARCH); btShowResult.setWidth("100%"); btShowResult.addClickListener(new ShowResultClickListener()); btShowResult.setDescription("<strong>Show Result</strong><br />Ctrl + Enter"); btShowResult.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL); btShowResult.setDisableOnClick(true); VerticalLayout historyListLayout = new VerticalLayout(); historyListLayout.setSizeUndefined(); lstHistory = new ListSelect(); lstHistory.setWidth("200px"); lstHistory.setNullSelectionAllowed(false); lstHistory.setValue(null); lstHistory.addValueChangeListener((ValueChangeListener) this); lstHistory.setImmediate(true); lstHistory.setContainerDataSource(historyContainer); lstHistory.setItemCaptionPropertyId("query"); lstHistory.addStyleName(Helper.CORPUS_FONT); Button btShowMoreHistory = new Button("Show more details", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (historyWindow == null) { historyWindow = new Window("History"); historyWindow.setModal(false); historyWindow.setWidth("400px"); historyWindow.setHeight("250px"); } historyWindow.setContent(new HistoryPanel(state.getHistory(), ui.getQueryController())); if (UI.getCurrent().getWindows().contains(historyWindow)) { historyWindow.bringToFront(); } else { UI.getCurrent().addWindow(historyWindow); } } }); btShowMoreHistory.setWidth("100%"); historyListLayout.addComponent(lstHistory); historyListLayout.addComponent(btShowMoreHistory); historyListLayout.setExpandRatio(lstHistory, 1.0f); historyListLayout.setExpandRatio(btShowMoreHistory, 0.0f); btHistory = new PopupButton("History"); btHistory.setContent(historyListLayout); btHistory.setDescription("<strong>Show History</strong><br />" + "Either use the short overview (arrow down) or click on the button " + "for the extended view."); Button btShowKeyboard = null; if (virtualKeyboard != null) { btShowKeyboard = new Button(); btShowKeyboard.setWidth("100%"); btShowKeyboard.setDescription("Click to show a virtual keyboard"); btShowKeyboard.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btShowKeyboard.addStyleName(ValoTheme.BUTTON_SMALL); btShowKeyboard.setIcon(new ClassResource(VirtualKeyboardCodeEditor.class, "keyboard.png")); btShowKeyboard.addClickListener(new ShowKeyboardClickListener(virtualKeyboard)); } Button btShowQueryBuilder = new Button("Query<br />Builder"); btShowQueryBuilder.setHtmlContentAllowed(true); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_SMALL); btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); btShowQueryBuilder.setIcon(new ThemeResource("images/tango-icons/32x32/document-properties.png")); btShowQueryBuilder.addClickListener(new ShowQueryBuilderClickListener(ui)); VerticalLayout moreActionsLayout = new VerticalLayout(); moreActionsLayout.setWidth("250px"); btMoreActions = new PopupButton("More"); btMoreActions.setContent(moreActionsLayout); // btShowResultNewTab = new Button("Search (open in new tab)"); // btShowResultNewTab.setWidth("100%"); // btShowResultNewTab.addClickListener(new ShowResultInNewTabClickListener()); // btShowResultNewTab.setDescription("<strong>Show Result and open result in new tab</strong><br />Ctrl + Shift + Enter"); // btShowResultNewTab.setDisableOnClick(true); // btShowResultNewTab.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL, ModifierKey.SHIFT); // moreActionsLayout.addComponent(btShowResultNewTab); Button btShowExport = new Button("Export", new ShowExportClickListener(ui)); btShowExport.setIcon(FontAwesome.DOWNLOAD); btShowExport.setWidth("100%"); moreActionsLayout.addComponent(btShowExport); Button btShowFrequency = new Button("Frequency Analysis", new ShowFrequencyClickListener(ui)); btShowFrequency.setIcon(FontAwesome.BAR_CHART_O); btShowFrequency.setWidth("100%"); moreActionsLayout.addComponent(btShowFrequency); /* * We use the grid layout for a better rendering efficiency, but this comes * with the cost of some complexity when defining the positions of the * elements in the layout. * * This grid hopefully helps a little bit in understanding the "magic" * numbers better. * * Q: Query text field * QB: Button to toggle query builder // TODO * KEY: Button to show virtual keyboard * SEA: "Search" button * MOR: "More actions" button * HIST: "History" button * STAT: Text field with the real status * PROG: indefinite progress bar (spinning circle) * * \ 0 | 1 | 2 | 3 * --+-----+---+---+---+----- * 0 | Q | Q | Q | QB * --+-----+-----+-----+----- * 1 | Q | Q | Q | KEY * --+-----+-----+-----+----- * 2 | SEA | MOR | HIST| * --+-----+-----+-----+----- * 3 | STAT| STAT| STAT| PROG */ addComponent(txtQuery, 0, 0, 2, 1); addComponent(txtStatus, 0, 3, 2, 3); addComponent(btShowResult, 0, 2); addComponent(btMoreActions, 1, 2); addComponent(btHistory, 2, 2); addComponent(piCount, 3, 3); addComponent(btShowQueryBuilder, 3, 0); if (btShowKeyboard != null) { addComponent(btShowKeyboard, 3, 1); } // alignment setRowExpandRatio(0, 0.0f); setRowExpandRatio(1, 1.0f); setColumnExpandRatio(0, 1.0f); setColumnExpandRatio(1, 0.0f); setColumnExpandRatio(2, 0.0f); setColumnExpandRatio(3, 0.0f); //setComponentAlignment(btShowQueryBuilder, Alignment.BOTTOM_CENTER); }
From source file:annis.gui.QueryController.java
License:Apache License
/** * Executes a query.//from w ww.j ava2 s . c o m * @param replaceOldTab * @param freshQuery If true the offset and the selected matches are reset before executing the query. */ public void executeSearch(boolean replaceOldTab, boolean freshQuery) { if (freshQuery) { getState().getOffset().setValue(0l); getState().getSelectedMatches().setValue(new TreeSet<Long>()); // get the value for the visible segmentation from the configured context Set<String> selectedCorpora = getState().getSelectedCorpora().getValue(); CorpusConfig config = new CorpusConfig(); if (selectedCorpora != null && !selectedCorpora.isEmpty()) { config = ui.getCorpusConfigWithCache(selectedCorpora.iterator().next()); } if (config.containsKey(SearchOptionsPanel.KEY_DEFAULT_BASE_TEXT_SEGMENTATION)) { String configVal = config.getConfig(SearchOptionsPanel.KEY_DEFAULT_BASE_TEXT_SEGMENTATION); if ("".equals(configVal) || "tok".equals(configVal)) { configVal = null; } getState().getVisibleBaseText().setValue(configVal); } else { getState().getVisibleBaseText().setValue(getState().getContextSegmentation().getValue()); } } // construct a query from the current properties DisplayedResultQuery displayedQuery = getSearchQuery(); searchView.getControlPanel().getQueryPanel().setStatus("Searching..."); cancelSearch(); // cleanup resources VaadinSession session = VaadinSession.getCurrent(); session.setAttribute(IFrameResourceMap.class, new IFrameResourceMap()); if (session.getAttribute(MediaController.class) != null) { session.getAttribute(MediaController.class).clearMediaPlayers(); } searchView.updateFragment(displayedQuery); if (displayedQuery.getCorpora() == null || displayedQuery.getCorpora().isEmpty()) { Notification.show("Please select a corpus", Notification.Type.WARNING_MESSAGE); return; } if ("".equals(displayedQuery.getQuery())) { Notification.show("Empty query", Notification.Type.WARNING_MESSAGE); return; } addHistoryEntry(displayedQuery); AsyncWebResource res = Helper.getAnnisAsyncWebResource(); // // begin execute match fetching // ResultViewPanel oldPanel = searchView.getLastSelectedResultView(); if (replaceOldTab) { // remove old panel from view searchView.closeTab(oldPanel); } ResultViewPanel newResultView = new ResultViewPanel(ui, ui, ui.getInstanceConfig(), displayedQuery); newResultView.getPaging() .addCallback(new SpecificPagingCallback(ui, searchView, newResultView, displayedQuery)); TabSheet.Tab newTab; List<ResultViewPanel> existingResultPanels = getResultPanels(); String caption = existingResultPanels.isEmpty() ? "Query Result" : "Query Result #" + (existingResultPanels.size() + 1); newTab = searchView.getMainTab().addTab(newResultView, caption); newTab.setClosable(true); newTab.setIcon(FontAwesome.SEARCH); searchView.getMainTab().setSelectedTab(newResultView); searchView.notifiyQueryStarted(); Background.run(new ResultFetchJob(displayedQuery, newResultView, ui)); // // end execute match fetching // // // begin execute count // // start count query searchView.getControlPanel().getQueryPanel().setCountIndicatorEnabled(true); AsyncWebResource countRes = res.path("query").path("search").path("count") .queryParam("q", Helper.encodeJersey(displayedQuery.getQuery())) .queryParam("corpora", Helper.encodeJersey(StringUtils.join(displayedQuery.getCorpora(), ","))); Future<MatchAndDocumentCount> futureCount = countRes.get(MatchAndDocumentCount.class); state.getExecutedTasks().put(QueryUIState.QueryType.COUNT, futureCount); Background.run(new CountCallback(newResultView, displayedQuery.getLimit(), ui)); // // end execute count // }
From source file:com.cms.view.ExportContractFromTaxCode.java
private void createButtonGetThongTin() { btnGetThongTin = new Button("Tm kim", FontAwesome.SEARCH); gridThongtinChung.addComponent(btnGetThongTin, 0, 1); gridThongtinChung.setComponentAlignment(btnGetThongTin, Alignment.MIDDLE_LEFT); btnGetThongTin.addClickListener((e) -> { String taxCode = txtTaxCode.getValue(); if (DataUtil.isStringNullOrEmpty(taxCode)) { CommonUtils.showMessageRequired("customer.taxCode"); txtTaxCode.focus();/*from w w w . j a va2s . c o m*/ } else { getCompany(taxCode.trim()); } }); ShortcutUtils.setShortcutKey(btnGetThongTin); }
From source file:com.cms.view.SearchCustomerFromTaxCode.java
private void buildSearchGrid() { leftPanel.setCaption("Tm kim khch hng"); Label lbTaxCode = CommonUtils.buildLabel("M s thu", false); taxCode = CommonUtils.buildTextField(null, 20, "ALT + 1"); taxCode.focus();/* ww w. j av a 2 s. com*/ taxCode.addShortcutListener(new AbstractField.FocusShortcut(taxCode, ShortcutAction.KeyCode.NUM1, ShortcutAction.ModifierKey.ALT)); btnSearch = new Button("Tm kim", FontAwesome.SEARCH); searchGrid = new GridLayout(3, 1); CommonUtils.setBasicAttributeLayout(searchGrid, "Tm kim thng tin theo m s thu", true); searchGrid.addComponent(lbTaxCode, 0, 0); searchGrid.addComponent(taxCode, 1, 0); searchGrid.addComponent(btnSearch, 2, 0); searchGrid.setComponentAlignment(lbTaxCode, Alignment.MIDDLE_RIGHT); searchGrid.setComponentAlignment(taxCode, Alignment.MIDDLE_LEFT); searchGrid.setComponentAlignment(btnSearch, Alignment.MIDDLE_LEFT); leftLayout.addComponent(searchGrid); }
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);/*from ww w . j av a2 s .com*/ 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.ArticleSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);//from w ww. java2 s . c o m layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfTitle = new TextField(BundleUtils.getLanguage("lbl.article.title")); tfTitle.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfTitle); tfShortContent = new TextField(BundleUtils.getLanguage("lbl.article.shortContent")); tfShortContent.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfShortContent); HorizontalLayout hlStatus = new HorizontalLayout(); hlStatus.setCaption(BundleUtils.getLanguage("lbl.status")); hlStatus.addStyleName("horizontal"); hlStatus.setSpacing(true); form.addComponent(hlStatus); tagSuggestFieldUI = new TagSuggestFieldUI(false); tagSuggestFieldUI.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tagSuggestFieldUI); HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }
From source file:com.dungnv.streetfood.view.CategorySearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);/*from w ww . j a v a 2 s.com*/ layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfName = new TextField(BundleUtils.getLanguage("lbl.category.name")); tfName.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfName); tfDescription = new TextField(BundleUtils.getLanguage("lbl.description")); tfDescription.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfDescription); HorizontalLayout hlStatus = new HorizontalLayout(); hlStatus.setCaption(BundleUtils.getLanguage("lbl.status")); hlStatus.addStyleName("horizontal"); hlStatus.setSpacing(true); form.addComponent(hlStatus); cbActive = new CheckBox(BundleUtils.getLanguage("lbl.active")); cbActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbActive); cbInActive = new CheckBox(BundleUtils.getLanguage("lbl.inActive")); cbInActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbInActive); tagSuggestFieldUI = new TagSuggestFieldUI(false); tagSuggestFieldUI.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tagSuggestFieldUI); Map<String, LocaleDTO> mapLocale = ClientServiceImpl.getAllLocales(); if (mapLocale != null && !mapLocale.isEmpty()) { List<LocaleDTO> listLocale = new ArrayList<>(mapLocale.values()); listLocale.stream().map((localeDTO) -> new OptionGroupUI(localeDTO.getLocale()// , localeDTO.getId())).forEach((ogLocale) -> { form.addComponent(ogLocale); listOgLocale.add(ogLocale); }); } HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnExportExcel = new Button(BundleUtils.getLanguage("lbl.exportExcel"), FontAwesome.FILE_EXCEL_O); hlButton.addComponent(btnExportExcel); btnExportXML = new Button(BundleUtils.getLanguage("lbl.exportXML"), FontAwesome.FILE_CODE_O); hlButton.addComponent(btnExportXML); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }
From source file:com.dungnv.streetfood.view.DishSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);// w w w. ja v a 2 s. co m layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfName = new TextField(BundleUtils.getLanguage("lbl.dish.name")); tfName.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfName); tfShortDescription = new TextField(BundleUtils.getLanguage("lbl.dish.shortDescription")); tfShortDescription.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfShortDescription); HorizontalLayout hlStatus = new HorizontalLayout(); hlStatus.setCaption(BundleUtils.getLanguage("lbl.status")); hlStatus.addStyleName("horizontal"); hlStatus.setSpacing(true); form.addComponent(hlStatus); cbActive = new CheckBox(BundleUtils.getLanguage("lbl.active")); cbActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbActive); cbInActive = new CheckBox(BundleUtils.getLanguage("lbl.inActive")); cbInActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbInActive); String regexDouble = "[0-9]*.?[0-9]?"; String regexInteger = "[0-9]*"; tfViewCountFrom = new TextField(); tfViewCountFrom.setWidth(200.0f, Unit.PIXELS); tfViewCountFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfViewCountFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlViewCountFrom = new CSValidator(); vlViewCountFrom.extend(tfViewCountFrom); vlViewCountFrom.setRegExp(regexInteger); vlViewCountFrom.setPreventInvalidTyping(true); tfViewCountFrom.addValidator(new RegexpValidator(regexInteger, "Not a number")); tfViewCountTo = new TextField(); tfViewCountTo.setWidth(200.0f, Unit.PIXELS); tfViewCountTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfViewCountTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlViewCountTo = new CSValidator(); vlViewCountTo.extend(tfViewCountTo); vlViewCountTo.setRegExp(regexInteger); vlViewCountTo.setPreventInvalidTyping(true); tfViewCountTo.addValidator(new RegexpValidator(regexInteger, "Not a number")); HorizontalLayout hlViewCount = new HorizontalLayout(tfViewCountFrom, new Label("-"), tfViewCountTo); hlViewCount.setCaption(BundleUtils.getLanguage("lbl.dish.viewCount")); hlViewCount.setSpacing(true); form.addComponent(hlViewCount); tfCommentCountFrom = new TextField(); tfCommentCountFrom.setWidth(200.0f, Unit.PIXELS); tfCommentCountFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfCommentCountFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlCommentCountFrom = new CSValidator(); vlCommentCountFrom.extend(tfCommentCountFrom); vlCommentCountFrom.setRegExp(regexInteger); vlCommentCountFrom.setPreventInvalidTyping(true); tfCommentCountFrom.addValidator(new RegexpValidator(regexInteger, "Not a number")); tfCommentCountTo = new TextField(); tfCommentCountTo.setWidth(200.0f, Unit.PIXELS); tfCommentCountTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfCommentCountTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlCommentCountTo = new CSValidator(); vlCommentCountTo.extend(tfCommentCountTo); vlCommentCountTo.setRegExp(regexInteger); vlCommentCountTo.setPreventInvalidTyping(true); tfCommentCountTo.addValidator(new RegexpValidator(regexInteger, "Not a number")); HorizontalLayout hlCommentCount = new HorizontalLayout(tfCommentCountFrom, new Label("-"), tfCommentCountTo); hlCommentCount.setCaption(BundleUtils.getLanguage("lbl.dish.commentCount")); hlCommentCount.setSpacing(true); form.addComponent(hlCommentCount); tfShareCountFrom = new TextField(); tfShareCountFrom.setWidth(200.0f, Unit.PIXELS); tfShareCountFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfShareCountFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlShareCountFrom = new CSValidator(); vlShareCountFrom.extend(tfShareCountFrom); vlShareCountFrom.setRegExp(regexInteger); vlShareCountFrom.setPreventInvalidTyping(true); tfShareCountFrom.addValidator(new RegexpValidator(regexInteger, "Not a number")); tfShareCountTo = new TextField(); tfShareCountTo.setWidth(200.0f, Unit.PIXELS); tfShareCountTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfShareCountTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlShareCountTo = new CSValidator(); vlShareCountTo.extend(tfShareCountTo); vlShareCountTo.setRegExp(regexInteger); vlShareCountTo.setPreventInvalidTyping(true); tfShareCountTo.addValidator(new RegexpValidator(regexInteger, "Not a number")); HorizontalLayout hlShareCount = new HorizontalLayout(tfShareCountFrom, new Label("-"), tfShareCountTo); hlShareCount.setCaption(BundleUtils.getLanguage("lbl.dish.shareCount")); hlShareCount.setSpacing(true); form.addComponent(hlShareCount); tfRatingFrom = new TextField(); tfRatingFrom.setWidth(200.0f, Unit.PIXELS); tfRatingFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfRatingFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlRatingFrom = new CSValidator(); vlRatingFrom.extend(tfRatingFrom); vlRatingFrom.setRegExp(regexDouble); vlRatingFrom.setPreventInvalidTyping(true); tfRatingFrom.addValidator(new RegexpValidator(regexDouble, "Not a number")); tfRatingTo = new TextField(); tfRatingTo.setWidth(200.0f, Unit.PIXELS); tfRatingTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfRatingTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlRatingTo = new CSValidator(); vlRatingTo.extend(tfRatingTo); vlRatingTo.setRegExp(regexDouble); vlRatingTo.setPreventInvalidTyping(true); tfRatingTo.addValidator(new RegexpValidator(regexDouble, "Not a number")); HorizontalLayout hlRating = new HorizontalLayout(tfRatingFrom, new Label("-"), tfRatingTo); hlRating.setCaption(BundleUtils.getLanguage("lbl.dish.rating")); hlRating.setSpacing(true); form.addComponent(hlRating); tagSuggestFieldUI = new TagSuggestFieldUI(false); tagSuggestFieldUI.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tagSuggestFieldUI); Map<String, LocaleDTO> mapLocale = ClientServiceImpl.getAllLocales(); if (mapLocale != null && !mapLocale.isEmpty()) { List<LocaleDTO> listLocale = new ArrayList<>(mapLocale.values()); listLocale.stream().map((localeDTO) -> new OptionGroupUI(localeDTO.getLocale()// , localeDTO.getId())).forEach((ogLocale) -> { form.addComponent(ogLocale); listOgLocale.add(ogLocale); }); } HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnExportExcel = new Button(BundleUtils.getLanguage("lbl.exportExcel"), FontAwesome.FILE_EXCEL_O); hlButton.addComponent(btnExportExcel); btnExportXML = new Button(BundleUtils.getLanguage("lbl.exportXML"), FontAwesome.FILE_CODE_O); hlButton.addComponent(btnExportXML); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }
From source file:com.dungnv.streetfood.view.RestaurantSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);/* ww w . ja v a2 s .co m*/ layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfName = new TextField(BundleUtils.getLanguage("lbl.restaurant.name")); tfName.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfName); tfIntroduce = new TextField(BundleUtils.getLanguage("lbl.restaurant.introduce")); tfIntroduce.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfIntroduce); HorizontalLayout hlStatus = new HorizontalLayout(); hlStatus.setCaption(BundleUtils.getLanguage("lbl.status")); hlStatus.addStyleName("horizontal"); hlStatus.setSpacing(true); form.addComponent(hlStatus); cbActive = new CheckBox(BundleUtils.getLanguage("lbl.active")); cbActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbActive); cbInActive = new CheckBox(BundleUtils.getLanguage("lbl.inActive")); cbInActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbInActive); tfAddress = new TextField(BundleUtils.getLanguage("lbl.restaurant.address")); tfAddress.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfAddress); tfPhoneNumber = new TextField(BundleUtils.getLanguage("lbl.restaurant.phoneNumber")); tfPhoneNumber.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfPhoneNumber); tfCapacity = new TextField(BundleUtils.getLanguage("lbl.restaurant.capacity")); tfCapacity.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfCapacity); HorizontalLayout hlCarParking = new HorizontalLayout(); hlCarParking.setCaption(BundleUtils.getLanguage("lbl.restaurant.carParking")); hlCarParking.addStyleName("horizontal"); hlCarParking.setSpacing(true); form.addComponent(hlCarParking); cbCarParkingYes = new CheckBox(BundleUtils.getLanguage("lbl.yes")); cbCarParkingYes.setValue(Boolean.TRUE); hlCarParking.addComponent(cbCarParkingYes); cbCarParkingNo = new CheckBox(BundleUtils.getLanguage("lbl.no")); cbCarParkingNo.setValue(Boolean.TRUE); hlCarParking.addComponent(cbCarParkingNo); HorizontalLayout hlMotobikeParking = new HorizontalLayout(); hlMotobikeParking.setCaption(BundleUtils.getLanguage("lbl.status")); hlMotobikeParking.addStyleName("horizontal"); hlMotobikeParking.setSpacing(true); form.addComponent(hlMotobikeParking); cbMotobikeParkingYes = new CheckBox(BundleUtils.getLanguage("lbl.yes")); cbMotobikeParkingYes.setValue(Boolean.TRUE); hlMotobikeParking.addComponent(cbMotobikeParkingYes); cbMotobikeParkingNo = new CheckBox(BundleUtils.getLanguage("lbl.no")); cbMotobikeParkingNo.setValue(Boolean.TRUE); hlMotobikeParking.addComponent(cbMotobikeParkingNo); tfOperatingTimeStart = new TimeField(); tfOperatingTimeEnd = new TimeField(); HorizontalLayout hlOperatingTime = new HorizontalLayout(tfOperatingTimeStart, new Label(" - "), tfOperatingTimeEnd); hlOperatingTime.setCaption(BundleUtils.getLanguage("lbl.restaurant.operatingTime")); hlOperatingTime.setSpacing(true); form.addComponent(hlOperatingTime); String regexDouble = "[0-9]*.?[0-9]?"; String regexInteger = "[0-9]*"; tfViewCountFrom = new TextField(); tfViewCountFrom.setWidth(200.0f, Unit.PIXELS); tfViewCountFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfViewCountFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlViewCountFrom = new CSValidator(); vlViewCountFrom.extend(tfViewCountFrom); vlViewCountFrom.setRegExp(regexInteger); vlViewCountFrom.setPreventInvalidTyping(true); tfViewCountFrom.addValidator(new RegexpValidator(regexInteger, "Not a number")); tfViewCountTo = new TextField(); tfViewCountTo.setWidth(200.0f, Unit.PIXELS); tfViewCountTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfViewCountTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlViewCountTo = new CSValidator(); vlViewCountTo.extend(tfViewCountTo); vlViewCountTo.setRegExp(regexInteger); vlViewCountTo.setPreventInvalidTyping(true); tfViewCountTo.addValidator(new RegexpValidator(regexInteger, "Not a number")); HorizontalLayout hlViewCount = new HorizontalLayout(tfViewCountFrom, new Label("-"), tfViewCountTo); hlViewCount.setCaption(BundleUtils.getLanguage("lbl.restaurant.viewCount")); hlViewCount.setSpacing(true); form.addComponent(hlViewCount); tfCommentCountFrom = new TextField(); tfCommentCountFrom.setWidth(200.0f, Unit.PIXELS); tfCommentCountFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfCommentCountFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlCommentCountFrom = new CSValidator(); vlCommentCountFrom.extend(tfCommentCountFrom); vlCommentCountFrom.setRegExp(regexInteger); vlCommentCountFrom.setPreventInvalidTyping(true); tfCommentCountFrom.addValidator(new RegexpValidator(regexInteger, "Not a number")); tfCommentCountTo = new TextField(); tfCommentCountTo.setWidth(200.0f, Unit.PIXELS); tfCommentCountTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfCommentCountTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlCommentCountTo = new CSValidator(); vlCommentCountTo.extend(tfCommentCountTo); vlCommentCountTo.setRegExp(regexInteger); vlCommentCountTo.setPreventInvalidTyping(true); tfCommentCountTo.addValidator(new RegexpValidator(regexInteger, "Not a number")); HorizontalLayout hlCommentCount = new HorizontalLayout(tfCommentCountFrom, new Label("-"), tfCommentCountTo); hlCommentCount.setCaption(BundleUtils.getLanguage("lbl.restaurant.commentCount")); hlCommentCount.setSpacing(true); form.addComponent(hlCommentCount); tfShareCountFrom = new TextField(); tfShareCountFrom.setWidth(200.0f, Unit.PIXELS); tfShareCountFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfShareCountFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlShareCountFrom = new CSValidator(); vlShareCountFrom.extend(tfShareCountFrom); vlShareCountFrom.setRegExp(regexInteger); vlShareCountFrom.setPreventInvalidTyping(true); tfShareCountFrom.addValidator(new RegexpValidator(regexInteger, "Not a number")); tfShareCountTo = new TextField(); tfShareCountTo.setWidth(200.0f, Unit.PIXELS); tfShareCountTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfShareCountTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlShareCountTo = new CSValidator(); vlShareCountTo.extend(tfShareCountTo); vlShareCountTo.setRegExp(regexInteger); vlShareCountTo.setPreventInvalidTyping(true); tfShareCountTo.addValidator(new RegexpValidator(regexInteger, "Not a number")); HorizontalLayout hlShareCount = new HorizontalLayout(tfShareCountFrom, new Label("-"), tfShareCountTo); hlShareCount.setCaption(BundleUtils.getLanguage("lbl.restaurant.shareCount")); hlShareCount.setSpacing(true); form.addComponent(hlShareCount); tfRatingFrom = new TextField(); tfRatingFrom.setWidth(200.0f, Unit.PIXELS); tfRatingFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfRatingFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlRatingFrom = new CSValidator(); vlRatingFrom.extend(tfRatingFrom); vlRatingFrom.setRegExp(regexDouble); vlRatingFrom.setPreventInvalidTyping(true); tfRatingFrom.addValidator(new RegexpValidator(regexDouble, "Not a number")); tfRatingTo = new TextField(); tfRatingTo.setWidth(200.0f, Unit.PIXELS); tfRatingTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfRatingTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlRatingTo = new CSValidator(); vlRatingTo.extend(tfRatingTo); vlRatingTo.setRegExp(regexDouble); vlRatingTo.setPreventInvalidTyping(true); tfRatingTo.addValidator(new RegexpValidator(regexDouble, "Not a number")); HorizontalLayout hlRating = new HorizontalLayout(tfRatingFrom, new Label("-"), tfRatingTo); hlRating.setCaption(BundleUtils.getLanguage("lbl.restaurant.rating")); hlRating.setSpacing(true); form.addComponent(hlRating); tfPriceFromVn = new TextField(); tfPriceFromVn.setWidth(200.0f, Unit.PIXELS); tfPriceFromVn.addStyleName(ValoTheme.TEXTFIELD_TINY); tfPriceFromVn.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlPriceFromVn = new CSValidator(); vlPriceFromVn.extend(tfPriceFromVn); vlPriceFromVn.setRegExp(regexDouble); vlPriceFromVn.setPreventInvalidTyping(true); tfPriceFromVn.addValidator(new RegexpValidator(regexDouble, "Not a number")); tfPriceToVn = new TextField(); tfPriceToVn.setWidth(200.0f, Unit.PIXELS); tfPriceToVn.addStyleName(ValoTheme.TEXTFIELD_TINY); tfPriceToVn.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlPriceToVn = new CSValidator(); vlPriceToVn.extend(tfPriceToVn); vlPriceToVn.setRegExp(regexDouble); vlPriceToVn.setPreventInvalidTyping(true); tfPriceToVn.addValidator(new RegexpValidator(regexDouble, "Not a number")); HorizontalLayout hlPriceVn = new HorizontalLayout(tfPriceFromVn, new Label("-"), tfPriceToVn, new Label("VND")); hlPriceVn.setCaption(BundleUtils.getLanguage("lbl.restaurant.priceVn")); hlPriceVn.setSpacing(true); form.addComponent(hlPriceVn); tfPriceFromEn = new TextField(); tfPriceFromEn.setWidth(200.0f, Unit.PIXELS); tfPriceFromEn.addStyleName(ValoTheme.TEXTFIELD_TINY); tfPriceFromEn.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlPriceFromEn = new CSValidator(); vlPriceFromEn.extend(tfPriceFromEn); vlPriceFromEn.setRegExp(regexDouble); vlPriceFromEn.setPreventInvalidTyping(true); tfPriceFromEn.addValidator(new RegexpValidator(regexDouble, "Not a number")); tfPriceToEn = new TextField(); tfPriceToEn.setWidth(200.0f, Unit.PIXELS); tfPriceToEn.addStyleName(ValoTheme.TEXTFIELD_TINY); tfPriceToEn.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlPriceToEn = new CSValidator(); vlPriceToEn.extend(tfPriceToEn); vlPriceToEn.setRegExp(regexDouble); vlPriceToEn.setPreventInvalidTyping(true); tfPriceToEn.addValidator(new RegexpValidator(regexDouble, "Not a number")); HorizontalLayout hlPriceEn = new HorizontalLayout(tfPriceFromEn, new Label("-"), tfPriceToEn, new Label("USD")); hlPriceEn.setCaption(BundleUtils.getLanguage("lbl.restaurant.priceEn")); hlPriceEn.setSpacing(true); form.addComponent(hlPriceEn); tfWaitingTimeFrom = new TextField(); tfWaitingTimeFrom.setWidth(200.0f, Unit.PIXELS); tfWaitingTimeFrom.addStyleName(ValoTheme.TEXTFIELD_TINY); tfWaitingTimeFrom.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlWaitingTimeFrom = new CSValidator(); vlWaitingTimeFrom.extend(tfWaitingTimeFrom); vlWaitingTimeFrom.setRegExp(regexDouble); vlWaitingTimeFrom.setPreventInvalidTyping(true); tfWaitingTimeFrom.addValidator(new RegexpValidator(regexDouble, "Not a number")); tfWaitingTimeTo = new TextField(); tfWaitingTimeTo.setWidth(200.0f, Unit.PIXELS); tfWaitingTimeTo.addStyleName(ValoTheme.TEXTFIELD_TINY); tfWaitingTimeTo.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); CSValidator vlWaitingTimeTo = new CSValidator(); vlWaitingTimeTo.extend(tfWaitingTimeTo); vlWaitingTimeTo.setRegExp(regexDouble); vlWaitingTimeTo.setPreventInvalidTyping(true); tfWaitingTimeTo.addValidator(new RegexpValidator(regexDouble, "Not a number")); HorizontalLayout hlWaitingTime = new HorizontalLayout(tfWaitingTimeFrom, new Label("-"), tfWaitingTimeTo); hlWaitingTime.setCaption(BundleUtils.getLanguage("lbl.dish.waitingTime")); hlWaitingTime.setSpacing(true); form.addComponent(hlWaitingTime); Map<String, LocaleDTO> mapLocale = ClientServiceImpl.getAllLocales(); if (mapLocale != null && !mapLocale.isEmpty()) { List<LocaleDTO> listLocale = new ArrayList<>(mapLocale.values()); listLocale.stream().map((localeDTO) -> new OptionGroupUI(localeDTO.getLocale()// , localeDTO.getId())).forEach((ogLocale) -> { form.addComponent(ogLocale); listOgLocale.add(ogLocale); }); } tagSuggestFieldUI = new TagSuggestFieldUI(false); tagSuggestFieldUI.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tagSuggestFieldUI); HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnExportExcel = new Button(BundleUtils.getLanguage("lbl.exportExcel"), FontAwesome.FILE_EXCEL_O); hlButton.addComponent(btnExportExcel); btnExportXML = new Button(BundleUtils.getLanguage("lbl.exportXML"), FontAwesome.FILE_CODE_O); hlButton.addComponent(btnExportXML); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }
From source file:com.dungnv.streetfood.view.SlideShowSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);/*from w w w . ja v a 2s.com*/ layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfName = new TextField(BundleUtils.getLanguage("lbl.category.name")); tfName.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfName); tfDescription = new TextField(BundleUtils.getLanguage("lbl.slideShow.description")); tfDescription.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfDescription); HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }