Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.anphat.cms.appparams.ui; import com.vaadin.annotations.AutoGenerated; import com.vaadin.server.VaadinSession; import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import com.cms.utils.BundleUtils; import com.cms.utils.MakeURL; import java.util.Locale; /** * * @author hungkv */ public class SearchAppParamsForm extends CustomComponent { /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ @AutoGenerated private VerticalLayout mainLayout; @AutoGenerated private GridLayout gridLayout_1; @AutoGenerated private ComboBox cboStatus; @AutoGenerated private Label lblStatus; @AutoGenerated private Label lblParamDesc; @AutoGenerated private TextField txtParamType; private TextField txtParamOrder; @AutoGenerated private Label lblParamOrder; @AutoGenerated private Label lblParamType; @AutoGenerated private Label lblParamName; @AutoGenerated private Label lblParamCode; Button btnReset; TextField txtParamCode; TextField txtParamName; TextField txtParamDesc; Locale mlocale = (Locale) VaadinSession.getCurrent().getSession().getAttribute("locale"); /** * The constructor should first build the main layout, set the composition * root and then do any custom initialization. * * The constructor will not be automatically regenerated by the visual * editor. */ public SearchAppParamsForm() { buildMainLayout(); setCompositionRoot(mainLayout); // TODO add user code here } @AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(true); mainLayout.setSpacing(true); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // gridLayout_1 gridLayout_1 = buildGridLayout_1(); mainLayout.addComponent(gridLayout_1); return mainLayout; } @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.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; } // public Button getBtnReset() { // return btnReset; // } // // public void setBtnReset(Button btnReset) { // this.btnReset = btnReset; // } public ComboBox getCboStatus() { return cboStatus; } public void setCboStatus(ComboBox cboStatus) { this.cboStatus = cboStatus; } public TextField getTxtParamType() { return txtParamType; } public void setTxtParamType(TextField txtParamType) { this.txtParamType = txtParamType; } public TextField getTxtParamOrder() { return txtParamOrder; } public void setTxtParamOrder(TextField txtParamOrder) { this.txtParamOrder = txtParamOrder; } public TextField getTxtParamCode() { return txtParamCode; } public void setTxtParamCode(TextField txtParamCode) { this.txtParamCode = txtParamCode; } public TextField getTxtParamName() { return txtParamName; } public void setTxtParamName(TextField txtParamName) { this.txtParamName = txtParamName; } public TextField getTxtParamDesc() { return txtParamDesc; } public void setTxtParamDesc(TextField txtParamDesc) { this.txtParamDesc = txtParamDesc; } }