List of usage examples for com.vaadin.ui HorizontalLayout setCaption
@Override public void setCaption(String caption)
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private HorizontalLayout createVaadinVersionLayout(String newestVersion, Button changeVersionButton, Button updateVaadinVersionButton, ProgressIndicator versionUpgradeProgressIndicator, Button detailsButton) {/*from w w w . j a v a2 s .c o m*/ HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.setCaption("Vaadin Jar Version"); Label vaadinVersionLabel = new Label(); vaadinVersionLabel.setSizeUndefined(); String version = null; try { version = ControlPanelPortletUtil.getPortalVaadinServerVersion(); } catch (FileNotFoundException e) { log.warn("vaadin-server.jar couldn't be read. file not found."); } catch (IOException e) { log.warn("vaadin-server.jar couldn't be read. ", e); } if (version == null) { try { version = ControlPanelPortletUtil.getPortalVaadin6Version(); } catch (IOException e) { log.warn("vaadin.jar couldn't be read."); } } if (version == null) { version = "could not be determined"; } vaadinVersionLabel.setValue(version); layout.addComponent(vaadinVersionLabel); if (version.startsWith("7")) { layout.addComponent(detailsButton); } layout.addComponent(changeVersionButton); Label newestVaadinVersionLabel = new Label(); newestVaadinVersionLabel.setSizeUndefined(); newestVaadinVersionLabel.setValue("(newest stable version: " + newestVersion + ")"); layout.addComponent(newestVaadinVersionLabel); if (!version.equals(newestVersion)) { layout.addComponent(updateVaadinVersionButton); } layout.addComponent(versionUpgradeProgressIndicator); return layout; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private HorizontalLayout createAddonDirectoryLayout() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*from w w w . j a v a 2 s . c o m*/ layout.setCaption("Add-on Directory"); addonLibDirLabel = createAddonLibDirLabel(); layout.addComponent(addonLibDirLabel); refreshButton = createRefreshButton(); layout.addComponent(refreshButton); layout.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT); return layout; }
From source file:com.cavisson.gui.dashboard.components.controls.Forms.java
License:Apache License
public Forms() { setSpacing(true);//from ww w . j a v a2 s .co m setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Montly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.dungnv.streetfood.view.ArticleSearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);//from w w w . jav 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); 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);// ww w . j av 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.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 .j a va 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);//from w w w .j a va 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.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.etest.valo.Forms.java
License:Apache License
public Forms() { setSpacing(true);//from ww w . ja va2s . c o m setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Monthly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.etest.view.testbank.cellitem.CellItemWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);// w ww. j a v a 2s . c o m form.setSpacing(true); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setWidth("100%"); Button helpBtn = new Button("HELP"); helpBtn.setWidthUndefined(); helpBtn.setIcon(FontAwesome.TASKS); helpBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); helpBtn.addStyleName(ValoTheme.BUTTON_SMALL); helpBtn.addClickListener((Button.ClickEvent event) -> { Window sub = new MultipleChoiceHelpViewer(); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } }); hlayout.addComponent(helpBtn); hlayout.setComponentAlignment(helpBtn, Alignment.MIDDLE_RIGHT); form.addComponent(hlayout); bloomsTaxonomy.setCaption("Blooms Class: "); bloomsTaxonomy.setWidth("30%"); form.addComponent(bloomsTaxonomy); stem = new TextArea("Stem: "); stem.setWidth("100%"); stem.setRows(5); stem.setWordwrap(true); form.addComponent(stem); HorizontalLayout h1 = new HorizontalLayout(); h1.setCaption("Option A:"); h1.setWidth("100%"); h1.setSpacing(true); optionA = new CommonTextField("add option A", null); optionA.setWidth("500px"); h1.addComponent(optionA); Button optionABtn = new CommonButton("OPTION A"); optionABtn.setWidth("120px"); optionABtn.addClickListener(updateOptionAndKeyListerner); h1.addComponent(optionABtn); h1.setComponentAlignment(optionABtn, Alignment.MIDDLE_RIGHT); optionABtn.setVisible(isEdit()); form.addComponent(h1); HorizontalLayout h2 = new HorizontalLayout(); h2.setCaption("Key A:"); h2.setWidth("100%"); h2.setSpacing(true); keyA = new CommonTextField("Enter a Key for Option A", null); keyA.setWidth("500px"); h2.addComponent(keyA); Button keyABtn = new CommonButton("KEY A"); keyABtn.setWidth("120px"); keyABtn.addClickListener(updateOptionAndKeyListerner); h2.addComponent(keyABtn); h2.setComponentAlignment(keyABtn, Alignment.MIDDLE_RIGHT); keyABtn.setVisible(isEdit()); form.addComponent(h2); HorizontalLayout h3 = new HorizontalLayout(); h3.setCaption("Option B:"); h3.setWidth("100%"); h3.setSpacing(true); optionB = new CommonTextField("add option B", null); optionB.setWidth("500px"); h3.addComponent(optionB); Button optionBBtn = new CommonButton("OPTION B"); optionBBtn.setWidth("120px"); optionBBtn.addClickListener(updateOptionAndKeyListerner); h3.addComponent(optionBBtn); h3.setComponentAlignment(optionBBtn, Alignment.MIDDLE_RIGHT); optionBBtn.setVisible(isEdit()); form.addComponent(h3); HorizontalLayout h4 = new HorizontalLayout(); h4.setCaption("Key B:"); h4.setWidth("100%"); h4.setSpacing(true); keyB = new CommonTextField("Enter a Key for Option B", null); keyB.setWidth("500px"); h4.addComponent(keyB); Button keyBBtn = new CommonButton("KEY B"); keyBBtn.setWidth("120px"); keyBBtn.addClickListener(updateOptionAndKeyListerner); h4.addComponent(keyBBtn); h4.setComponentAlignment(keyBBtn, Alignment.MIDDLE_RIGHT); keyBBtn.setVisible(isEdit()); form.addComponent(h4); HorizontalLayout h5 = new HorizontalLayout(); h5.setCaption("Option C:"); h5.setWidth("100%"); h5.setSpacing(true); optionC = new CommonTextField("add option C", null); optionC.setWidth("500px"); h5.addComponent(optionC); Button optionCBtn = new CommonButton("OPTION C"); optionCBtn.setWidth("120px"); optionCBtn.addClickListener(updateOptionAndKeyListerner); h5.addComponent(optionCBtn); h5.setComponentAlignment(optionCBtn, Alignment.TOP_RIGHT); optionCBtn.setVisible(isEdit()); form.addComponent(h5); HorizontalLayout h6 = new HorizontalLayout(); h6.setCaption("Key C:"); h6.setWidth("100%"); h6.setSpacing(true); keyC = new CommonTextField("Enter a Key for Option C", null); keyC.setWidth("500px"); h6.addComponent(keyC); Button keyCBtn = new CommonButton("KEY C"); keyCBtn.setWidth("120px"); keyCBtn.addClickListener(updateOptionAndKeyListerner); h6.addComponent(keyCBtn); h6.setComponentAlignment(keyCBtn, Alignment.MIDDLE_RIGHT); keyCBtn.setVisible(isEdit()); form.addComponent(h6); HorizontalLayout h7 = new HorizontalLayout(); h7.setCaption("Option D:"); h7.setWidth("100%"); h7.setSpacing(true); optionD = new CommonTextField("add option D", null); optionD.setWidth("500px"); h7.addComponent(optionD); Button optionDBtn = new CommonButton("OPTION D"); optionDBtn.setWidth("120px"); optionDBtn.addClickListener(updateOptionAndKeyListerner); h7.addComponent(optionDBtn); h7.setComponentAlignment(optionDBtn, Alignment.MIDDLE_RIGHT); optionDBtn.setVisible(isEdit()); form.addComponent(h7); HorizontalLayout h8 = new HorizontalLayout(); h8.setCaption("Key D:"); h8.setWidth("100%"); h8.setSpacing(true); keyD = new CommonTextField("Enter a Key for Option D", null); keyD.setWidth("500px"); h8.addComponent(keyD); Button keyDBtn = new CommonButton("KEY D"); keyDBtn.setWidth("120px"); keyDBtn.addClickListener(updateOptionAndKeyListerner); h8.addComponent(keyDBtn); h8.setComponentAlignment(keyDBtn, Alignment.MIDDLE_RIGHT); keyDBtn.setVisible(isEdit()); form.addComponent(h8); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button save = new Button("SAVE"); save.setWidth("200px"); save.setIcon(FontAwesome.SAVE); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addStyleName(ValoTheme.BUTTON_SMALL); save.addClickListener(buttonClickListener); Button remove = new Button("ARCHIVE/REMOVE ITEM?"); remove.setWidth("200px"); remove.setIcon(FontAwesome.ARCHIVE); remove.addStyleName(ValoTheme.BUTTON_PRIMARY); remove.addStyleName(ValoTheme.BUTTON_SMALL); remove.addClickListener(buttonClickListener); Button approve = new Button("APPROVE ITEM?"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_O_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); Button edit = new Button("UPDATE"); edit.setWidth("200px"); edit.setIcon(FontAwesome.SAVE); edit.addStyleName(ValoTheme.BUTTON_PRIMARY); edit.addStyleName(ValoTheme.BUTTON_SMALL); edit.addClickListener(buttonClickListener); if (getCellItemId() != 0) { CellItem ci = cis.getCellItemById(getCellItemId()); bloomsTaxonomy.setValue(ci.getBloomsClassId()); bloomsTaxonomy.addValueChangeListener((Property.ValueChangeEvent event) -> { isBloomsChanged = true; }); stem.setValue(ci.getItem()); stem.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { if (!stem.getValue().trim().equals(event.getText().trim())) { isStemChanged = true; } }); /** * OPTION A */ optionA.setValue(ci.getOptionA()); isOptionAKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionA()); if (isOptionAKeyExist) { keyA.setValue(k.getItemKey(getCellItemId(), ci.getOptionA())); } keyA.setData(k.getItemKeyId(getCellItemId(), ci.getOptionA())); /** * OPTION B */ optionB.setValue(ci.getOptionB()); isOptionBKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionB()); if (isOptionBKeyExist) { keyB.setValue(k.getItemKey(getCellItemId(), ci.getOptionB())); } keyB.setData(k.getItemKeyId(getCellItemId(), ci.getOptionB())); /** * OPTION C */ optionC.setValue(ci.getOptionC()); isOptionCKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionC()); if (isOptionCKeyExist) { keyC.setValue(k.getItemKey(getCellItemId(), ci.getOptionC())); } keyC.setData(k.getItemKeyId(getCellItemId(), ci.getOptionC())); /** * OPTION D */ optionD.setValue(ci.getOptionD()); isOptionDKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionD()); if (isOptionDKeyExist) { keyD.setValue(k.getItemKey(getCellItemId(), ci.getOptionD())); } keyD.setData(k.getItemKeyId(getCellItemId(), ci.getOptionD())); h.addComponent(remove); h.setComponentAlignment(remove, Alignment.MIDDLE_RIGHT); h.addComponent(approve); h.setComponentAlignment(approve, Alignment.MIDDLE_RIGHT); h.addComponent(edit); h.setComponentAlignment(edit, Alignment.MIDDLE_RIGHT); form.addComponent(h); } else { h.addComponent(save); h.setComponentAlignment(save, Alignment.MIDDLE_RIGHT); form.addComponent(h); } return form; }
From source file:com.fnc.view.ui.AlphaListMainUI.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("50%"); corporation.setCaption("Corporation: "); corporation.addStyleName(ValoTheme.COMBOBOX_SMALL); trade.setCaption("Trade: "); trade.addStyleName(ValoTheme.COMBOBOX_SMALL); branch.setCaption("Branch: "); branch.addStyleName(ValoTheme.COMBOBOX_SMALL); corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption())); form.addComponent(corporation);//w ww .j a v a 2s. co m trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption())); form.addComponent(trade); branch.addValueChangeListener(branchPropertyChangeListener); form.addComponent(branch); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Year: "); h.setWidth("100%"); h.setSpacing(true); h.addComponent(selectYear()); h.addComponent(alphaListButton()); form.addComponent(h); return form; }