List of usage examples for com.vaadin.ui ComboBox ComboBox
public ComboBox()
From source file:br.com.anteros.mobileserver.app.form.ProcedureForm.java
License:Apache License
private void createFields() { fldId = new TextField(); fldId.setCaption("Id"); fldId.setWidth("100px"); fldId.setStyleName("small"); fldName = new ComboBox(); fldName.setCaption("Nome do procedimento"); fldName.setWidth("400px"); fldName.setRequired(true);/*from w ww . j av a2s . co m*/ fldName.setRequiredError("Informe o nome do procedimento."); fldName.setContainerDataSource(MobileServerData.loadAllProcedures(app)); fldName.setItemCaptionPropertyId(MobileServerData.PROPERTY_NAME); fldName.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); fldName.setItemIconPropertyId(MobileServerData.PROPERTY_ICON); fldName.setImmediate(true); fldName.addListener(this); fldName.setStyleName("small"); fldDescription = new TextField(); fldDescription.setCaption("Descrio do procedimento"); fldDescription.setWidth("500px"); fldDescription.setRequired(true); fldDescription.setRequiredError("Informe a descrio do procedimento."); fldDescription.setStyleName("small"); fldParameterOut = new ComboBox(); fldParameterOut.setCaption("Nome do parmetro retorno"); fldParameterOut.setWidth("250px"); fldParameterOut.setImmediate(true); fldParameterOut.setStyleName("small"); fldParameterOut.setRequired(true); fldParameterOut.setRequiredError("Informe o nome do parmetro de retorno."); procedureForm.addField("fldId", fldId); procedureForm.addField("fldName", fldName); procedureForm.addField("fldDescription", fldDescription); procedureForm.addField("fldParameterOut", fldParameterOut); }
From source file:br.gov.frameworkdemoiselle.vaadin.util.FieldFactory.java
License:Open Source License
/** * Produces a ComboBox./* ww w .j av a 2 s.com*/ * * @param inputPrompt * Field's prompt message. * @param caption * Field's caption. * @param itemCaptionPropertyId * Object's property used as label. * @return Produced field. */ public static ComboBox createComboBox(String inputPrompt, String caption, String itemCaptionPropertyId) { ResourceBundle bundle = Beans.getReference(ResourceBundle.class); ComboBox field = new ComboBox(); field.setItemCaptionPropertyId(itemCaptionPropertyId); setBasicProperties(field, caption); if (Strings.isResourceBundleKeyFormat(inputPrompt)) { field.setInputPrompt(bundle.getString(Strings.removeBraces(inputPrompt))); } else { field.setInputPrompt(inputPrompt); } return field; }
From source file:cb_server.SettingsWindow.java
License:Open Source License
private void fillContent() { if (Settingscontent != null) { content.removeComponent(Settingscontent); Settingscontent = null;/* w ww . j ava 2 s. c o m*/ } Settingscontent = new VerticalLayout(); content.addComponent(Settingscontent); InetAddress addr; QRCode code = null; try { addr = InetAddress.getLocalHost(); //Getting IPAddress of localhost - getHostAddress return IP Address // in textual format String ipAddress = addr.getHostAddress(); ipAddress = ""; // Network Interfaces nach IPv4 Adressen durchsuchen try { Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(nets)) { Enumeration<InetAddress> inetAddresses = netint.getInetAddresses(); for (InetAddress inetAddress : Collections.list(inetAddresses)) { if (inetAddress.isLoopbackAddress()) continue; if (inetAddress instanceof Inet4Address) { System.out.println("InetAddress: " + inetAddress); if (ipAddress.length() > 0) { ipAddress += ";"; } ipAddress += inetAddress; } } } } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } code = new QRCode(); code.setWidth(150, Unit.PIXELS); code.setHeight(150, Unit.PIXELS); code.setValue(ipAddress); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } TabSheet tabSheet = new TabSheet(); tabSheet.setWidth(100, Unit.PERCENTAGE); tabSheet.setHeight(100, Unit.PERCENTAGE); Settingscontent.addComponent(tabSheet); VerticalLayout lay = new VerticalLayout(); // add Lang Spinner langSpinner = new ComboBox(); langSpinner.setCaption("select Lang"); for (Lang lang : Translation.GetLangs(SettingsClass.LanguagePath.getValue())) { langSpinner.addItem(lang.Name); langSpinner.setItemCaption(lang.Name, lang.Name); } langSpinner.setValue(Translation.getLangId()); langSpinner.setNullSelectionAllowed(false); lay.addComponent(langSpinner); lay.addComponent(code); SettingsLinearLayoutPanel info = new SettingsLinearLayoutPanel(); info.setContent(lay, 400); tabSheet.addTab(info, "Info"); // Categorie List zusammen stellen if (Categorys == null) { Categorys = new ArrayList<SettingCategory>(); } Categorys.clear(); SettingCategory[] tmp = SettingCategory.values(); for (SettingCategory item : tmp) { if (item != SettingCategory.Button) { Categorys.add(item); } } Iterator<SettingCategory> iteratorCat = Categorys.iterator(); if (iteratorCat != null && iteratorCat.hasNext()) { ArrayList<SettingBase<?>> SortedSettingList = new ArrayList<SettingBase<?>>(); for (Iterator<SettingBase<?>> it = Config.settings.iterator(); it.hasNext();) { SettingBase<?> setting = it.next(); if (setting.getModus() != SettingModus.Never && (setting.getUsage() == SettingUsage.ALL || setting.getUsage() == SettingUsage.CBS)) { SortedSettingList.add(setting); } } do { int position = 0; SettingCategory cat = iteratorCat.next(); // add Cat eintrge lay = new VerticalLayout(); int entryCount = 0; if (cat == SettingCategory.Login) { final Component view = getLogInButton(position++); lay.addComponent(view); } // int layoutHeight = 0; for (Iterator<SettingBase<?>> it = SortedSettingList.iterator(); it.hasNext();) { SettingBase<?> settingItem = it.next(); if (settingItem.getCategory().name().equals(cat.name())) { if ((settingItem.getModus() == SettingModus.Normal) && (settingItem.getModus() != SettingModus.Never)) { final Component view = getView(settingItem, position++); if (view == null) continue; lay.addComponent(view); entryCount++; Config.settings.indexOf(settingItem); } } } if (entryCount > 0) { SettingsLinearLayoutPanel catPanel = new SettingsLinearLayoutPanel(); catPanel.setContent(lay, 400); tabSheet.addTab(catPanel, cat.name()); // addControlToLinearLayout(lay, 100); } } while (iteratorCat.hasNext()); } }
From source file:ch.bfh.ti.soed.hs16.srs.red.ui.helper.SubWindowReservation.java
License:Open Source License
public SubWindowReservation() { this.layout = new VerticalLayout(); this.id = new Label("id"); this.name = new Label("name"); this.roomTitle = new Label("select room"); this.startTime = new Label("start time"); this.endTime = new Label("end time"); this.textFieldId = new TextField(); this.textFieldName = new TextField(); this.rooms = new ComboBox(); this.dateFieldStart = new DateField(); this.dateFieldEnd = new DateField(); this.buttonSave = new Button("save"); this.buttonDelete = new Button("delete"); dateFieldStart.setResolution(Resolution.MINUTE); dateFieldEnd.setResolution(Resolution.MINUTE); /*--------------------------------- add objects to horizontal container/* w w w .j a va 2s . c om*/ ---------------------------------*/ HorizontalLayout idContainer = new HorizontalLayout(id, textFieldId); HorizontalLayout nameContainer = new HorizontalLayout(name, textFieldName); HorizontalLayout roomContainer = new HorizontalLayout(roomTitle, rooms); HorizontalLayout startContainer = new HorizontalLayout(startTime, dateFieldStart); HorizontalLayout endContainer = new HorizontalLayout(endTime, dateFieldEnd); HorizontalLayout buttons = new HorizontalLayout(buttonSave, buttonDelete); /*--------------------------------- add style names ---------------------------------*/ layout.setPrimaryStyleName(CSS_NAME); idContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); nameContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); roomContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); startContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); endContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); buttons.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); /*--------------------------------- add to root layout ---------------------------------*/ this.layout.addComponents(idContainer, nameContainer, roomContainer, startContainer, endContainer, buttons); }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelAlcance.java
License:Open Source License
public void cargarResultadosAlcances(List<ResultadoAprendizajeBO> list) { tableResultadoAlcance.removeAllItems(); for (int i = 1; i < list.size(); i++) { ComboBox box = new ComboBox(); box.addItem("Introduce"); box.addItem("Ensea"); box.addItem("Aplica"); box.setNullSelectionAllowed(false); box.setTextInputAllowed(false);/* www. java 2 s. c o m*/ tableResultadoAlcance.addItem( new Object[] { list.get(i).getNivelDeConocimiento().getDescripcion(), box }, new Integer(i)); } }
From source file:com.anphat.cms.appparams.ui.DialogCreateAppParams.java
@AutoGenerated private GridLayout buildGridLayout_1() { // common part: create layout gridLayout_1 = new GridLayout(); gridLayout_1.setStyleName("custom-feildset"); gridLayout_1.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("appParam.fieldset.title"))); gridLayout_1.setCaptionAsHtml(true); gridLayout_1.setImmediate(false);/* ww w.ja va2 s .com*/ gridLayout_1.setWidth("100.0%"); gridLayout_1.setHeight("-1px"); gridLayout_1.setMargin(true); gridLayout_1.setSpacing(true); gridLayout_1.setColumns(4); gridLayout_1.setRows(4); // lblParamCode lblParamCode = new Label(); lblParamCode.setImmediate(false); lblParamCode.setWidth("-1px"); lblParamCode.setHeight("-1px"); lblParamCode.setValue(BundleUtils.getString("lb.appParam.code")); gridLayout_1.addComponent(lblParamCode, 0, 0); txtParamCode = new TextField(); txtParamCode.setImmediate(true); txtParamCode.setWidth("100.0%"); txtParamCode.setHeight("-1px"); txtParamCode.setRequired(true); txtParamCode.setMaxLength(50); // StringBuilder messageError = new StringBuilder(); // messageError.append(BundleUtils.getString("lb.appParam.code")); // messageError.append(BundleUtils.getString(" ")); // messageError.append(BundleUtils.getString("message.error.numberformat")); // txtParamCode.addValidator(new RegexpValidator("[0-9]+", messageError.toString())); gridLayout_1.addComponent(txtParamCode, 1, 0); // lblParamName lblParamName = new Label(); lblParamName.setImmediate(false); lblParamName.setWidth("100%"); lblParamName.setHeight("-1px"); lblParamName.setValue(BundleUtils.getString("lb.appParam.name")); gridLayout_1.addComponent(lblParamName, 2, 0); txtParamName = new TextField(); txtParamName.setImmediate(true); txtParamName.setWidth("100.0%"); txtParamName.setHeight("-1px"); txtParamName.setRequired(true); txtParamName.setMaxLength(200); // txtParamName.addValidator(new RegexpValidator("^[a-zA-Z0-9 -_]+$", BundleUtils.getString("lb.appParam.name")+" "+BundleUtils.getString("message.error.special.char"))); gridLayout_1.addComponent(txtParamName, 3, 0); // lblParamType lblParamType = new Label(); lblParamType.setImmediate(false); lblParamType.setWidth("100%"); lblParamType.setHeight("-1px"); lblParamType.setValue(BundleUtils.getString("lb.appParam.type")); gridLayout_1.addComponent(lblParamType, 0, 1); txtParamType = new TextField(); txtParamType.setImmediate(true); txtParamType.setWidth("100.0%"); txtParamType.setHeight("-1px"); txtParamType.setRequired(true); txtParamType.setMaxLength(100); txtParamType.addValidator(new RegexpValidator("^[a-zA-Z0-9-_]+$", BundleUtils.getString("lb.appParam.type") + " " + BundleUtils.getString("message.error.special.char"))); gridLayout_1.addComponent(txtParamType, 1, 1); // lblParamOrder lblParamOrder = new Label(); lblParamOrder.setImmediate(false); lblParamOrder.setWidth("100%"); lblParamOrder.setHeight("-1px"); lblParamOrder.setValue(BundleUtils.getString("lb.appParam.order")); gridLayout_1.addComponent(lblParamOrder, 2, 1); // cboImplementer txtParamOrder = new TextField(); txtParamOrder.setImmediate(true); txtParamOrder.setWidth("100.0%"); txtParamOrder.setHeight("-1px"); txtParamOrder.setMaxLength(5); StringBuilder messageErrorOrder = new StringBuilder(); messageErrorOrder.append(BundleUtils.getString("lb.appParam.order")); messageErrorOrder.append(BundleUtils.getString(" ")); messageErrorOrder.append(BundleUtils.getString("message.error.numberformat")); txtParamOrder.addValidator(new RegexpValidator("[0-9]+", messageErrorOrder.toString())); gridLayout_1.addComponent(txtParamOrder, 3, 1); // lblStatus lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("lb.appParam.status")); gridLayout_1.addComponent(lblStatus, 0, 2); cboStatus = new ComboBox(); cboStatus.setImmediate(true); cboStatus.setTextInputAllowed(false); cboStatus.setFilteringMode(FilteringMode.OFF); cboStatus.setWidth("100.0%"); cboStatus.setHeight("-1px"); cboStatus.setStyleName("notRequireStyle"); gridLayout_1.addComponent(cboStatus, 1, 2); // lblToDate lblParamDesc = new Label(); lblParamDesc.setImmediate(false); lblParamDesc.setWidth("100%"); lblParamDesc.setHeight("-1px"); lblParamDesc.setValue(BundleUtils.getString("lb.appParam.description")); gridLayout_1.addComponent(lblParamDesc, 2, 2); // pdfToDate txtAreaParamDesc = new TextArea(); txtAreaParamDesc.setImmediate(true); txtAreaParamDesc.setWidth("100.0%"); txtAreaParamDesc.setHeight("-1px"); txtAreaParamDesc.setMaxLength(300); // txtAreaParamDesc.addValidator(new StringLengthValidator(BundleUtils.getString("message.error.overlengthString"))); gridLayout_1.addComponent(txtAreaParamDesc, 3, 2); // // btnReset // GridLayout button = new GridLayout(1, 1); // button.setWidth("100%"); // button.setHeight("-1px"); // btnReset = new Button(); // btnReset.setStyleName("v-button-link"); // btnReset.setIcon(new ThemeResource("img/refresh-icon.png")); // btnReset.setImmediate(true); // btnReset.setHeight("-1px"); // btnReset.setDescription(Constants.BUTTON_REFRESH); // button.addComponent(btnReset); // button.setComponentAlignment(btnReset, Alignment.TOP_RIGHT); // gridLayout_1.addComponent(button, 3, 3); return gridLayout_1; }
From source file:com.anphat.cms.appparams.ui.SearchAppParamsForm.java
@AutoGenerated private GridLayout buildGridLayout_1() { // common part: create layout gridLayout_1 = new GridLayout(); gridLayout_1.setStyleName("custom-feildset"); gridLayout_1/*from w w w . j ava 2 s . c o m*/ .setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("appParam.fieldset.title.searchInfo"))); gridLayout_1.setCaptionAsHtml(true); gridLayout_1.setImmediate(false); gridLayout_1.setWidth("100.0%"); gridLayout_1.setHeight("-1px"); gridLayout_1.setMargin(true); gridLayout_1.setSpacing(true); gridLayout_1.setColumns(4); gridLayout_1.setRows(4); // lblParamCode lblParamCode = new Label(); lblParamCode.setImmediate(false); lblParamCode.setWidth("-1px"); lblParamCode.setHeight("-1px"); lblParamCode.setValue(BundleUtils.getString("lb.appParam.code")); gridLayout_1.addComponent(lblParamCode, 0, 0); txtParamCode = new TextField(); txtParamCode.setImmediate(true); txtParamCode.setMaxLength(50); txtParamCode.setWidth("100.0%"); txtParamCode.setHeight("-1px"); gridLayout_1.addComponent(txtParamCode, 1, 0); // lblParamName lblParamName = new Label(); lblParamName.setImmediate(false); lblParamName.setWidth("100%"); lblParamName.setHeight("-1px"); lblParamName.setValue(BundleUtils.getString("lb.appParam.name")); gridLayout_1.addComponent(lblParamName, 2, 0); txtParamName = new TextField(); txtParamName.setImmediate(true); txtParamName.setMaxLength(200); txtParamName.setWidth("100.0%"); txtParamName.setHeight("-1px"); gridLayout_1.addComponent(txtParamName, 3, 0); // lblParamType lblParamType = new Label(); lblParamType.setImmediate(false); lblParamType.setWidth("100%"); lblParamType.setHeight("-1px"); lblParamType.setValue(BundleUtils.getString("lb.appParam.type")); gridLayout_1.addComponent(lblParamType, 0, 1); txtParamType = new TextField(); txtParamType.setImmediate(true); txtParamType.setMaxLength(100); txtParamType.setWidth("100.0%"); txtParamType.setHeight("-1px"); gridLayout_1.addComponent(txtParamType, 1, 1); // lblParamOrder lblParamOrder = new Label(); lblParamOrder.setImmediate(false); lblParamOrder.setWidth("100%"); lblParamOrder.setHeight("-1px"); lblParamOrder.setValue(BundleUtils.getString("lb.appParam.order")); gridLayout_1.addComponent(lblParamOrder, 2, 1); // cboImplementer txtParamOrder = new TextField(); txtParamOrder.setImmediate(true); txtParamOrder.setMaxLength(5); txtParamOrder.setWidth("100.0%"); txtParamOrder.setHeight("-1px"); gridLayout_1.addComponent(txtParamOrder, 3, 1); // lblStatus lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("lb.appParam.status")); gridLayout_1.addComponent(lblStatus, 0, 2); cboStatus = new ComboBox(); cboStatus.setImmediate(true); cboStatus.setTextInputAllowed(false); cboStatus.setFilteringMode(FilteringMode.OFF); cboStatus.setWidth("100.0%"); cboStatus.setHeight("-1px"); gridLayout_1.addComponent(cboStatus, 1, 2); // lblToDate lblParamDesc = new Label(); lblParamDesc.setImmediate(false); lblParamDesc.setWidth("100%"); lblParamDesc.setHeight("-1px"); lblParamDesc.setValue(BundleUtils.getString("lb.appParam.description")); gridLayout_1.addComponent(lblParamDesc, 2, 2); // pdfToDate txtParamDesc = new TextField(); txtParamDesc.setImmediate(true); txtParamDesc.setMaxLength(300); txtParamDesc.setWidth("100.0%"); txtParamDesc.setHeight("-1px"); gridLayout_1.addComponent(txtParamDesc, 3, 2); // btnReset // GridLayout button = new GridLayout(1, 1); // button.setWidth("100%"); // button.setHeight("-1px"); // btnReset = new Button(); // btnReset.setStyleName("v-button-link"); // btnReset.setIcon(new ThemeResource("img/refresh-icon.png")); // btnReset.setImmediate(true); // btnReset.setHeight("-1px"); // btnReset.setDescription(Constants.BUTTON_REFRESH); // button.addComponent(btnReset); // button.setComponentAlignment(btnReset, Alignment.TOP_RIGHT); // gridLayout_1.addComponent(button, 3, 3); return gridLayout_1; }
From source file:com.anphat.list.controller.PopupAddPriceInfo.java
public PopupAddPriceInfo() { setCaption(BundleUtils.getString("dialog.PriceInfo.caption")); mainLayout.setImmediate(true);/*from w w w . ja va 2 s .c o m*/ mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); addPriceInfoLayout = new GridLayout(); CommonUtils.setBasicAttributeLayout(addPriceInfoLayout, BundleUtils.getString("table.PriceInfo.caption"), true); addPriceInfoLayout.setColumns(4); addPriceInfoLayout.setRows(4); setWidth("80.0%"); setHeight("-1px"); setModal(true); lblCode = new Label(); lblCode.setImmediate(false); lblCode.setWidth("100.0%"); lblCode.setHeight("-1px"); lblCode.setValue(BundleUtils.getString("label.PriceInfo.code")); addPriceInfoLayout.addComponent(lblCode, 0, 0); txtCode = new TextField(); txtCode.setImmediate(false); txtCode.setWidth("100.0%"); txtCode.setHeight("-1px"); addPriceInfoLayout.addComponent(txtCode, 1, 0); lblName = new Label(); lblName.setImmediate(false); lblName.setWidth("100.0%"); lblName.setHeight("-1px"); lblName.setValue(BundleUtils.getString("label.PriceInfo.name")); addPriceInfoLayout.addComponent(lblName, 2, 0); txtName = new TextField(); txtName.setImmediate(false); txtName.setWidth("100.0%"); txtName.setHeight("-1px"); addPriceInfoLayout.addComponent(txtName, 3, 0); lblPrice = new Label(); lblPrice.setImmediate(false); lblPrice.setWidth("100.0%"); lblPrice.setHeight("-1px"); lblPrice.setValue(BundleUtils.getString("label.PriceInfo.price")); addPriceInfoLayout.addComponent(lblPrice, 0, 1); txtPrice = new TextField(); txtPrice.setImmediate(false); txtPrice.setWidth("100.0%"); txtPrice.setHeight("-1px"); addPriceInfoLayout.addComponent(txtPrice, 1, 1); lblTokenPrice = new Label(); lblTokenPrice.setImmediate(false); lblTokenPrice.setWidth("100.0%"); lblTokenPrice.setHeight("-1px"); lblTokenPrice.setValue(BundleUtils.getString("label.PriceInfo.tokenPrice")); addPriceInfoLayout.addComponent(lblTokenPrice, 2, 1); txtTokenPrice = new TextField(); txtTokenPrice.setImmediate(false); txtTokenPrice.setWidth("100.0%"); txtTokenPrice.setHeight("-1px"); addPriceInfoLayout.addComponent(txtTokenPrice, 3, 1); lblProvider = new Label(); lblProvider.setImmediate(false); lblProvider.setWidth("100.0%"); lblProvider.setHeight("-1px"); lblProvider.setValue(BundleUtils.getString("label.PriceInfo.provider")); addPriceInfoLayout.addComponent(lblProvider, 0, 2); cbxProvider = new ComboBox(); cbxProvider.setImmediate(false); cbxProvider.setWidth("100.0%"); cbxProvider.setHeight("-1px"); addPriceInfoLayout.addComponent(cbxProvider, 1, 2); lblType = new Label(); lblType.setImmediate(false); lblType.setWidth("100.0%"); lblType.setHeight("-1px"); lblType.setValue(BundleUtils.getString("label.PriceInfo.type")); addPriceInfoLayout.addComponent(lblType, 2, 2); cbxType = new ComboBox(); cbxType.setImmediate(false); cbxType.setWidth("100.0%"); cbxType.setHeight("-1px"); addPriceInfoLayout.addComponent(cbxType, 3, 2); lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.PriceInfo.status")); addPriceInfoLayout.addComponent(lblStatus, 0, 3); cbxStatus = new ComboBox(); cbxStatus.setImmediate(false); cbxStatus.setWidth("100.0%"); cbxStatus.setHeight("-1px"); addPriceInfoLayout.addComponent(cbxStatus, 1, 3); mainLayout.addComponent(addPriceInfoLayout); GridManyButton gridBtnPrint = CommonUtils.getCommonButtonDialog(this); mainLayout.addComponent(gridBtnPrint); btnSave = gridBtnPrint.getBtnCommon().get(0); btnClose = gridBtnPrint.getBtnCommon().get(1); setContent(mainLayout); }
From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java
private void buildSearchLayout(boolean isCustInfo) { // common part: create layout searchLayout = new GridLayout(); searchLayout.setImmediate(true);//from ww w. j a va2 s .c om searchLayout.setStyleName("custom-feildset"); searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("common.searchLabel"))); searchLayout.setCaptionAsHtml(true); searchLayout.setWidth("100.0%"); searchLayout.setHeight("-1px"); searchLayout.setMargin(true); searchLayout.setSpacing(true); // lblCustCode Label lblCustCode = new Label(); lblCustCode.setImmediate(true); lblCustCode.setWidth("100.0%"); lblCustCode.setHeight("-1px"); // tfCustCode txtStaffCode = new TextField(); txtStaffCode.setImmediate(true); txtStaffCode.setWidth("100.0%"); txtStaffCode.setHeight("-1px"); // lblCustName Label lblCustName = new Label(); lblCustName.setImmediate(true); lblCustName.setWidth("100.0%"); lblCustName.setHeight("-1px"); // tfCustName txtStaffName = new TextField(); txtStaffName.setImmediate(true); txtStaffName.setWidth("100.0%"); txtStaffName.setHeight("-1px"); // lblCustCode Label lblEmail = new Label(); lblEmail.setImmediate(true); lblEmail.setWidth("100.0%"); lblEmail.setHeight("-1px"); // tfCustCode txtEmail = new TextField(); txtEmail.setImmediate(true); txtEmail.setWidth("100.0%"); txtEmail.setHeight("-1px"); // lblCustName Label lblTelephone = new Label(); lblTelephone.setImmediate(true); lblTelephone.setWidth("100.0%"); lblTelephone.setHeight("-1px"); // tfCustName txtTelephone = new TextField(); txtTelephone.setImmediate(true); txtTelephone.setWidth("100.0%"); txtTelephone.setHeight("-1px"); // lblCustName Label lblStaffType = new Label(); lblStaffType.setImmediate(true); lblStaffType.setWidth("100.0%"); lblStaffType.setHeight("-1px"); // tfCustName cboStaffType = new ComboBox(); cboStaffType.setImmediate(true); cboStaffType.setWidth("100.0%"); cboStaffType.setHeight("-1px"); if (isCustInfo) { lblCustCode.setValue(BundleUtils.getString("map.staff.customer.staffCode")); lblCustName.setValue(BundleUtils.getString("map.staff.customer.staffName")); lblEmail.setValue(BundleUtils.getString("goods.list.label.email")); lblTelephone.setValue(BundleUtils.getString("lb.deptstaff.common.phone")); lblStaffType.setValue(BundleUtils.getString("map.staff.customer.staffType")); searchLayout.setColumns(6); searchLayout.setRows(2); searchLayout.addComponent(lblCustCode, 0, 0); searchLayout.addComponent(txtStaffCode, 1, 0); searchLayout.addComponent(lblCustName, 2, 0); searchLayout.addComponent(txtStaffName, 3, 0); searchLayout.addComponent(lblEmail, 4, 0); searchLayout.addComponent(txtEmail, 5, 0); searchLayout.addComponent(lblStaffType, 0, 1); searchLayout.addComponent(cboStaffType, 1, 1); searchLayout.addComponent(lblTelephone, 2, 1); searchLayout.addComponent(txtTelephone, 3, 1); } else { lblCustCode.setValue(BundleUtils.getString("map.staff.customer.custCode")); lblCustName.setValue(BundleUtils.getString("map.staff.customer.custName")); lblEmail.setValue(BundleUtils.getString("goods.list.label.email")); lblTelephone.setValue(BundleUtils.getString("lb.deptstaff.common.phone")); searchLayout.setColumns(4); searchLayout.setRows(2); searchLayout.addComponent(lblCustCode, 0, 0); searchLayout.addComponent(txtStaffCode, 1, 0); searchLayout.addComponent(lblCustName, 2, 0); searchLayout.addComponent(txtStaffName, 3, 0); searchLayout.addComponent(lblEmail, 0, 1); searchLayout.addComponent(txtEmail, 1, 1); searchLayout.addComponent(lblTelephone, 2, 1); searchLayout.addComponent(txtTelephone, 3, 1); } }
From source file:com.anphat.list.ui.DialogCreateDepartment.java
@AutoGenerated private GridLayout buildGridLayoutDepartInfo() { // common part: create layout gridLayoutDepartInfo = new GridLayout(); gridLayoutDepartInfo.setStyleName("custom-feildset"); gridLayoutDepartInfo/*w w w. ja va2 s .c om*/ .setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("department.fieldset.title.deptInfo"))); gridLayoutDepartInfo.setCaptionAsHtml(true); gridLayoutDepartInfo.setImmediate(true); gridLayoutDepartInfo.setWidth("100.0%"); gridLayoutDepartInfo.setHeight("-1px"); gridLayoutDepartInfo.setMargin(true); gridLayoutDepartInfo.setSpacing(true); gridLayoutDepartInfo.setColumns(4); gridLayoutDepartInfo.setRows(7); // lblDepartmentCode lblDepartmentCode = new Label(); lblDepartmentCode.setImmediate(true); lblDepartmentCode.setWidth("100.0%"); lblDepartmentCode.setHeight("-1px"); lblDepartmentCode.setValue(BundleUtils.getString("lb.deptstaff.dept.code")); gridLayoutDepartInfo.addComponent(lblDepartmentCode, 0, 0); // txtDepartmentCode txtDepartmentCode = new TextField(); txtDepartmentCode.setImmediate(true); txtDepartmentCode.setWidth("100.0%"); txtDepartmentCode.setHeight("-1px"); txtDepartmentCode.setMaxLength(50); txtDepartmentCode.setRequired(true); txtDepartmentCode.addValidator( new RegexpValidator("^[a-zA-Z0-9-_]+$", BundleUtils.getString("lb.deptstaff.dept.code") + " " + BundleUtils.getString("message.error.code.format"))); gridLayoutDepartInfo.addComponent(txtDepartmentCode, 1, 0); // lblDepartmentName lblDepartmentName = new Label(); lblDepartmentName.setImmediate(true); lblDepartmentName.setWidth("100.0%"); lblDepartmentName.setHeight("-1px"); lblDepartmentName.setValue(BundleUtils.getString("lb.deptstaff.dept.name")); gridLayoutDepartInfo.addComponent(lblDepartmentName, 2, 0); // txtDepartmentName txtDepartmentName = new TextField(); txtDepartmentName.setImmediate(true); txtDepartmentName.setWidth("100.0%"); txtDepartmentName.setHeight("-1px"); txtDepartmentName.setMaxLength(100); txtDepartmentName.setRequired(true); gridLayoutDepartInfo.addComponent(txtDepartmentName, 3, 0); // lblSuperiorUnit // lblSuperiorUnit = new Label(); // lblSuperiorUnit.setImmediate(true); // lblSuperiorUnit.setWidth("100.0%"); // lblSuperiorUnit.setHeight("-1px"); // lblSuperiorUnit.setValue(BundleUtils.getString("lb.deptstaff.dept.level")); // gridLayoutDepartInfo.addComponent(lblSuperiorUnit, 0, 1); // txtSuperiorUnit // txtSuperiorUnit = new TextField(); // txtSuperiorUnit.setImmediate(true); // txtSuperiorUnit.setWidth("100.0%"); // txtSuperiorUnit.setHeight("-1px"); // comboDeptTopLevel = new MappingCombobox(3, 1); // comboDeptTopLevel.getNameCombo().setRequired(true); // gridLayoutDepartInfo.addComponent(comboDeptTopLevel.getLayout(), 1, 1, 3, 1); // lblDescription lblDescription = new Label(); lblDescription.setImmediate(true); lblDescription.setWidth("100.0%"); lblDescription.setHeight("-1px"); lblDescription.setValue(BundleUtils.getString("lb.deptstaff.desc")); gridLayoutDepartInfo.addComponent(lblDescription, 0, 1); // textArea_1 textArea_1 = new TextArea(); textArea_1.setImmediate(true); textArea_1.setWidth("100.0%"); textArea_1.setHeight("-1px"); textArea_1.setMaxLength(300); textArea_1.setStyleName("notRequireStyle"); gridLayoutDepartInfo.addComponent(textArea_1, 1, 1, 3, 1); // lblStatus lblStatus = new Label(); lblStatus.setImmediate(true); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("lb.deptstaff.common.status")); gridLayoutDepartInfo.addComponent(lblStatus, 0, 2); // cbxStatus cbxStatus = new ComboBox(); cbxStatus.setImmediate(true); cbxStatus.setTextInputAllowed(false); cbxStatus.setFilteringMode(FilteringMode.OFF); cbxStatus.setWidth("100.0%"); cbxStatus.setHeight("-1px"); cbxStatus.setRequired(true); gridLayoutDepartInfo.addComponent(cbxStatus, 1, 2); // lblPhoneNumber lblPhoneNumber = new Label(); lblPhoneNumber.setImmediate(true); lblPhoneNumber.setWidth("100.0%"); lblPhoneNumber.setHeight("-1px"); lblPhoneNumber.setValue(BundleUtils.getString("lb.deptstaff.common.phone")); gridLayoutDepartInfo.addComponent(lblPhoneNumber, 2, 2); // txtPhoneNumber txtPhoneNumber = new TextField(); txtPhoneNumber.setImmediate(true); txtPhoneNumber.setInputPrompt(BundleUtils.getString("common.phone.format")); txtPhoneNumber.setWidth("100.0%"); txtPhoneNumber.setHeight("-1px"); txtPhoneNumber.setMaxLength(100); //message // StringBuilder messageErrorOrder = new StringBuilder(); // messageErrorOrder.append(BundleUtils.getString("lb.deptstaff.common.phone")); // messageErrorOrder.append(BundleUtils.getString(" ")); // messageErrorOrder.append(BundleUtils.getString("message.error.phoneformat")); // txtPhoneNumber.addValidator(new RegexpValidator("^\\(?(\\d{3,4})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", messageErrorOrder.toString())); txtPhoneNumber.setStyleName("notRequireStyle"); gridLayoutDepartInfo.addComponent(txtPhoneNumber, 3, 2); // lblFax // lblFax = new Label(); // lblFax.setImmediate(true); // lblFax.setWidth("100.0%"); // lblFax.setHeight("-1px"); // lblFax.setValue(BundleUtils.getString("lb.deptstaff.fax")); // gridLayoutDepartInfo.addComponent(lblFax, 0, 4); // txtFax // txtFax = new TextField(); // txtFax.setImmediate(true); // txtFax.setWidth("100.0%"); // txtFax.setHeight("-1px"); // txtFax.setMaxLength(100); //message // StringBuilder messageErrorFax = new StringBuilder(); // messageErrorFax.append(BundleUtils.getString("lb.deptstaff.fax")); // messageErrorFax.append(BundleUtils.getString(" ")); // messageErrorFax.append(BundleUtils.getString("message.error.numberformat")); // txtFax.addValidator(new RegexpValidator("[0-9]+", messageErrorFax.toString())); // txtFax.setStyleName("notRequireStyle"); // gridLayoutDepartInfo.addComponent(txtFax, 1, 4); // lblEmail lblEmail = new Label(); lblEmail.setImmediate(true); lblEmail.setWidth("100.0%"); lblEmail.setHeight("-1px"); lblEmail.setValue(BundleUtils.getString("lb.deptstaff.common.email")); gridLayoutDepartInfo.addComponent(lblEmail, 2, 3); // txtEmail txtEmail = new TextField(); txtEmail.setImmediate(true); txtEmail.addValidator(new EmailValidator(BundleUtils.getString("common.error.email"))); txtEmail.setRequiredError(BundleUtils.getString("common.error.email")); txtEmail.setInputPrompt(BundleUtils.getString("common.email.hint.format")); txtEmail.setWidth("100.0%"); txtEmail.setHeight("-1px"); txtEmail.setMaxLength(100); txtEmail.setStyleName("notRequireStyle"); gridLayoutDepartInfo.addComponent(txtEmail, 3, 3); // lblAddress lblAddress = new Label(); lblAddress.setImmediate(true); lblAddress.setWidth("100.0%"); lblAddress.setHeight("-1px"); lblAddress.setValue(BundleUtils.getString("lb.deptstaff.dept.addr")); gridLayoutDepartInfo.addComponent(lblAddress, 0, 4); // txtAddress txtAddress = new TextField(); txtAddress.setImmediate(true); txtAddress.setWidth("100.0%"); txtAddress.setHeight("-1px"); txtAddress.setMaxLength(300); // txtAddress.addValidator(new StringLengthValidator(BundleUtils.getString("common.error.length"), 0, 200, true)); txtAddress.setRequired(true); txtAddress.setStyleName("notRequireStyle"); gridLayoutDepartInfo.addComponent(txtAddress, 1, 4, 3, 4); // lblContact // lblContact = new Label(); // lblContact.setImmediate(true); // lblContact.setWidth("100.0%"); // lblContact.setHeight("-1px"); // lblContact.setValue(BundleUtils.getString("lb.deptstaff.contact.person")); // gridLayoutDepartInfo.addComponent(lblContact, 0, 5); // // // txtContact // txtContact = new TextField(); // txtContact.setImmediate(true); // txtContact.setWidth("100.0%"); // txtContact.setHeight("-1px"); // txtContact.setMaxLength(200); // txtContact.setStyleName("notRequireStyle"); // gridLayoutDepartInfo.addComponent(txtContact, 1, 5, 3, 5); return gridLayoutDepartInfo; }