List of usage examples for com.vaadin.ui FormLayout FormLayout
public FormLayout()
From source file:com.coatl.vaadin.abc.ixABCDialogos.java
ixDefinicionDeForma getForma(String forma, String tipo) { Stack<AbstractComponent> pila = new Stack(); Map<String, AbstractComponent> componentes = new HashMap(); AbstractComponent ultimo = null;//w w w.j a v a 2s .c om String[] cmds = forma.split(" "); for (String cmd : cmds) { cmd = cmd.trim(); if (!cmd.equals("")) { //System.out.println("CMD> [" + cmd + "]"); if (cmd.equals("bConfBorrar")) { agregar(pila, getbConfBorrar()); } else if (cmd.equals("bBorrar")) { agregar(pila, getbBorrar()); } else if (cmd.equals("bGuardar")) { agregar(pila, getbGuardar()); } else if (cmd.equals("bCrear")) { agregar(pila, getbCrear()); } else if (cmd.startsWith("H")) { HorizontalLayout hl = new HorizontalLayout(); if (cmd.contains("m")) { hl.setMargin(true); } agregar(pila, hl); } else if (cmd.startsWith("V")) { VerticalLayout vl = new VerticalLayout(); if (cmd.contains("m")) { vl.setMargin(true); } agregar(pila, vl); } else if (cmd.startsWith("F")) { FormLayout fl = new FormLayout(); if (cmd.contains("m")) { fl.setMargin(true); } agregar(pila, fl); } else if (cmd.equals(".")) { ultimo = pila.pop(); //System.out.println("Sacando de pila a " + ultimo); } else if (cmd.startsWith("'")) { String txt = cmd.substring(1); while (txt.contains("~")) { txt = txt.replace("~", " "); } Label l = new Label(txt); agregar(pila, l); } else { //System.out.println("Buscando columna [" + cmd + "]"); ixDefinicionDeColumna columna = columnas.get(cmd); String claseControl = columna.getClaseControl(); if (claseControl == null) { claseControl = "com.vaadin.ui.TextField"; } AbstractComponent con = null; try { con = (AbstractComponent) this.getClass().getClassLoader().loadClass(claseControl) .newInstance(); } catch (Exception ex) { System.out.println("ERROR INSTANCIANDO> [" + claseControl + "], " + ex); } con.setCaption(this.getTituloColumna(cmd)); if (con != null) { agregar(pila, con); componentes.put(cmd, con); } if (tipo != null) { if (tipo.toLowerCase().equals("c")) { if (columna.isSoloLecturaCrear() || columna.isSoloLectura()) { con.setReadOnly(true); } } if (tipo.toLowerCase().equals("e") || tipo.toLowerCase().equals("g")) { if (columna.isSoloLecturaGuardar() || columna.isSoloLectura()) { con.setReadOnly(true); } } if (tipo.toLowerCase().equals("b")) { con.setReadOnly(true); } } } } } while (pila.size() > 0) { ultimo = pila.pop(); } ixDefinicionDeForma res = new ixDefinicionDeForma(); res.setComponente(ultimo); res.setComponentes(componentes); return res; }
From source file:com.concur.ui.WebApp.java
License:Apache License
private Window createWindow() { FormLayout fl = new FormLayout(); // final SessionGuard sg = new SessionGuard(); // sg.setKeepalive(true); // fl.addComponent(sg); fl.setSizeFull();/* w w w. j av a 2 s.c o m*/ fl.setMargin(true); fl.addComponent(new Label("<h2>ATS Tuple Store -- Demo App<h2/>", Label.CONTENT_XML)); actionField = new NativeSelect("Action:"); actionField.addItem("Authenticate"); actionField.addItem("GetTuple"); actionField.addItem("PutTuple"); actionField.addItem("GetConfigurations"); actionField.select("Authenticate"); fl.addComponent(actionField); tokenField = new TextField("Authentication Token:"); tokenField.setColumns(40); fl.addComponent(tokenField); tupleKeyField = new TextField("TupleKey:"); tupleKeyField.setColumns(40); fl.addComponent(tupleKeyField); tupleDataArea = new TextArea("TupleData:"); tupleDataArea.setColumns(40); tupleDataArea.setRows(5); fl.addComponent(tupleDataArea); Button b = new Button("Send Request"); b.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { submit(); } }); fl.addComponent(b); final Window w = new Window("ATS Tuple Store -- DEMO"); w.setContent(fl); return w; }
From source file:com.demo.tutorial.agenda.ui.SearchView.java
public SearchView(final MyUI app) { this.app = app; setCaption("Buscar Contactos"); setSizeFull();//from w w w . j a va2 s . c o m addStyleName("view"); /* Usar un FormLayout como layout principal para este Panel*/ FormLayout formLayout = new FormLayout(); /* Creando componente UI */ txtTextField = new TextField("Buscar"); cmbFieldtoSearch = new NativeSelect("Campo por buscar"); chkSaveSearch = new CheckBox("Guardar Bsqueda"); txtSearchName = new TextField("Buscar nombre"); Button btnBuscar = new Button("Buscar"); btnBuscar.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { performSearch(); } }); /* Inicializar combo */ for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) { cmbFieldtoSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]); cmbFieldtoSearch.setItemCaption(PersonContainer.NATURAL_COL_ORDER[i], PersonContainer.COL_HEADERS_ENGLISH[i]); } cmbFieldtoSearch.setValue("apPaterno"); cmbFieldtoSearch.setNullSelectionAllowed(false); /* Inicializando save checkbox */ chkSaveSearch.setValue(true); chkSaveSearch.setImmediate(true); chkSaveSearch.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } }); /* chkSaveSearch.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } });*/ /* Aadiendo los componentes creados al formulario */ formLayout.addComponent(txtTextField); formLayout.addComponent(cmbFieldtoSearch); formLayout.addComponent(chkSaveSearch); formLayout.addComponent(txtSearchName); formLayout.addComponent(btnBuscar); setContent(formLayout); }
From source file:com.dungnv.streetfood.ui.CommonSearchPagedUI.java
private final void init() { setWidth("100%"); setStyleName("item-search-box"); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*from ww w . j a va 2 s.c o m*/ this.addComponent(layout); FormLayout form = new FormLayout(); // form.setWidth("100%"); form.setMargin(false); layout.addComponent(form); layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER); cbRecordPerPage = new ComboBox(); cbRecordPerPage.setWidth("65px"); cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY); cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage")); cbRecordPerPage.setTextInputAllowed(false); cbRecordPerPage.addItem(10); cbRecordPerPage.addItem(20); cbRecordPerPage.addItem(30); cbRecordPerPage.addItem(50); cbRecordPerPage.addItem(100); cbRecordPerPage.addItem(200); cbRecordPerPage.select(10); form.addComponent(cbRecordPerPage); cbRecordPerPage.setNullSelectionAllowed(false); btnFastBackward = new Button(); btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD); layout.addComponent(btnFastBackward); layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER); btnBackward = new Button(); btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnBackward.setIcon(FontAwesome.BACKWARD); layout.addComponent(btnBackward); layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER); cbPaged = new ComboBox(); cbPaged.setTextInputAllowed(false); for (int i = 1; i <= pageCount; i++) { cbPaged.addItem(i); } cbPaged.setNullSelectionAllowed(false); cbPaged.select(1); cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY); cbPaged.setWidth("60px"); layout.addComponent(cbPaged); layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER); btnFoward = new Button(); btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFoward.setIcon(FontAwesome.FORWARD); layout.addComponent(btnFoward); layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER); btnFastFoward = new Button(); btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFastFoward.setIcon(FontAwesome.FAST_FORWARD); layout.addComponent(btnFastFoward); layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER); enableComponent(); }
From source file:com.dungnv.streetfood.view.ArticleSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);/*from w w w . j ava 2 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 ww w .j a 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.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);//from ww w . j a v a 2s . 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 .j a v a 2 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); 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 ww .ja v a 2s . 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.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); }
From source file:com.esspl.datagen.ui.TableSelectorView.java
License:Open Source License
protected Component createSelectors() throws SQLException { FormLayout l = new FormLayout(); l.setWidth("100%"); l.setSpacing(false);/*from ww w . ja v a2 s . c om*/ l.setMargin(true, false, true, false); String catalogTerm = (metadataRetriever != null) ? metadataRetriever.getCatalogTerm() : "DataBase"; catalogTerm = catalogTerm.substring(0, 1).toUpperCase() + catalogTerm.substring(1, catalogTerm.length()); List<String> catalogNames = (metadataRetriever != null) ? metadataRetriever.getCatalogs() : new ArrayList<String>(); final ComboBox catalogs = new ComboBox(catalogTerm + ":", catalogNames); catalogs.setWidth("100%"); catalogs.setNullSelectionAllowed(false); catalogs.setImmediate(true); catalogs.setVisible(!catalogNames.isEmpty()); String schemaTerm = (metadataRetriever != null) ? metadataRetriever.getSchemaTerm().toLowerCase() : "DataBase"; schemaTerm = schemaTerm.substring(0, 1).toUpperCase() + schemaTerm.substring(1, schemaTerm.length()); List<String> schemaNames = (metadataRetriever != null) ? metadataRetriever.getSchemas() : new ArrayList<String>(); final ComboBox schemas = new ComboBox(schemaTerm + ":", schemaNames); schemas.setWidth("100%"); schemas.setNullSelectionAllowed(false); schemas.setImmediate(true); schemas.setVisible(!schemaNames.isEmpty()); List<String> tableTypesList = (metadataRetriever != null) ? metadataRetriever.getTableTypes() : new ArrayList<String>(); final ComboBox tableTypes = new ComboBox("Object:", tableTypesList); if (tableTypesList.contains("TABLE")) tableTypes.select("TABLE"); tableTypes.setWidth("100%"); tableTypes.setNullSelectionAllowed(false); tableTypes.setImmediate(true); ValueChangeListener valueChangeListener = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { updateTableList(catalogs, schemas, tableTypes); } }; catalogs.addListener(valueChangeListener); schemas.addListener(valueChangeListener); tableTypes.addListener(valueChangeListener); l.addComponent(catalogs); l.addComponent(schemas); l.addComponent(tableTypes); return l; }