List of usage examples for com.vaadin.ui TextField TextField
public TextField()
TextField
with no caption. From source file:com.anphat.list.ui.PopupAddTaxAuthority.java
public PopupAddTaxAuthority() { mainLayout.setImmediate(true);// w w w. ja v a2 s.c o m mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); addTaxAuthorityLayout = new GridLayout(); addTaxAuthorityLayout.setImmediate(true); addTaxAuthorityLayout.setWidth("100.0%"); addTaxAuthorityLayout.setHeight("-1px"); addTaxAuthorityLayout.setMargin(true); addTaxAuthorityLayout.setSpacing(true); addTaxAuthorityLayout.setColumns(4); addTaxAuthorityLayout.setRows(3); setWidth("70.0%"); setHeight("-1px"); setModal(true); // lblId = new Label(); // lblId.setImmediate(true); // lblId.setWidth("100.0%"); // lblId.setHeight("-1px"); // lblId.setValue(BundleUtils.getString("label.TaxAuthority.id")); // addTaxAuthorityLayout.addComponent(lblId, 0, 0); // txtId = new TextField(); // txtId.setImmediate(true); // txtId.setWidth("100.0%"); // txtId.setHeight("-1px"); // addTaxAuthorityLayout.addComponent(txtId, 1, 0); lblMaCqt = new Label(); lblMaCqt.setImmediate(true); lblMaCqt.setWidth("100.0%"); lblMaCqt.setHeight("-1px"); lblMaCqt.setValue(BundleUtils.getString("label.TaxAuthority.maCqt")); addTaxAuthorityLayout.addComponent(lblMaCqt, 0, 0); txtMaCqt = new TextField(); txtMaCqt.setImmediate(true); txtMaCqt.setWidth("100.0%"); txtMaCqt.setHeight("-1px"); addTaxAuthorityLayout.addComponent(txtMaCqt, 1, 0); lblTenCqt = new Label(); lblTenCqt.setImmediate(true); lblTenCqt.setWidth("100.0%"); lblTenCqt.setHeight("-1px"); lblTenCqt.setValue(BundleUtils.getString("label.TaxAuthority.tenCqt")); addTaxAuthorityLayout.addComponent(lblTenCqt, 2, 0); txtTenCqt = new TextField(); txtTenCqt.setImmediate(true); txtTenCqt.setWidth("100.0%"); txtTenCqt.setHeight("-1px"); addTaxAuthorityLayout.addComponent(txtTenCqt, 3, 0); lblMaTinh = new Label(); lblMaTinh.setImmediate(true); lblMaTinh.setWidth("100.0%"); lblMaTinh.setHeight("-1px"); lblMaTinh.setValue(BundleUtils.getString("label.TaxAuthority.maTinh")); addTaxAuthorityLayout.addComponent(lblMaTinh, 0, 1); cboMaTinh = new ComboBox(); cboMaTinh.setImmediate(true); cboMaTinh.setWidth("100.0%"); cboMaTinh.setHeight("-1px"); addTaxAuthorityLayout.addComponent(cboMaTinh, 1, 1); lblMaQuanHuyen = new Label(); lblMaQuanHuyen.setImmediate(true); lblMaQuanHuyen.setWidth("100.0%"); lblMaQuanHuyen.setHeight("-1px"); lblMaQuanHuyen.setValue(BundleUtils.getString("label.TaxAuthority.maQuanHuyen")); addTaxAuthorityLayout.addComponent(lblMaQuanHuyen, 2, 1); txtMaQuanHuyen = new TextField(); txtMaQuanHuyen.setImmediate(true); txtMaQuanHuyen.setWidth("100.0%"); txtMaQuanHuyen.setHeight("-1px"); addTaxAuthorityLayout.addComponent(txtMaQuanHuyen, 3, 1); lblStatus = new Label(); lblStatus.setImmediate(true); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.TaxAuthority.status")); addTaxAuthorityLayout.addComponent(lblStatus, 0, 2); cboStatus = new ComboBox(); cboStatus.setImmediate(true); cboStatus.setWidth("100.0%"); cboStatus.setHeight("-1px"); addTaxAuthorityLayout.addComponent(cboStatus, 1, 2); mainLayout.addComponent(addTaxAuthorityLayout); GridManyButton gridBtnPrint = new GridManyButton( new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_CLOSE }); mainLayout.addComponent(gridBtnPrint); btnSave = gridBtnPrint.getBtnCommon().get(0); btnClose = gridBtnPrint.getBtnCommon().get(1); setContent(mainLayout); }
From source file:com.anphat.list.ui.RolesSearchPanel.java
public void buildSearchLayout() { searchLayout = new GridLayout(); searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info"))); searchLayout.setCaptionAsHtml(true); searchLayout.setImmediate(false);//from w ww .j av a 2 s. c om searchLayout.setWidth("100.0%"); searchLayout.setHeight("-1px"); searchLayout.setMargin(true); searchLayout.setSpacing(true); searchLayout.setColumns(4); searchLayout.setRows(2); searchLayout.setStyleName("custom-feildset"); lblCode = new Label(); lblCode.setImmediate(false); lblCode.setWidth("100.0%"); lblCode.setHeight("-1px"); lblCode.setValue(BundleUtils.getString("label.Roles.code")); searchLayout.addComponent(lblCode, 0, 0); txtCode = new TextField(); txtCode.setImmediate(false); txtCode.setWidth("100.0%"); txtCode.setHeight("-1px"); searchLayout.addComponent(txtCode, 1, 0); lblName = new Label(); lblName.setImmediate(false); lblName.setWidth("100.0%"); lblName.setHeight("-1px"); lblName.setValue(BundleUtils.getString("label.Roles.name")); searchLayout.addComponent(lblName, 2, 0); txtName = new TextField(); txtName.setImmediate(false); txtName.setWidth("100.0%"); txtName.setHeight("-1px"); searchLayout.addComponent(txtName, 3, 0); lblDescription = new Label(); lblDescription.setImmediate(false); lblDescription.setWidth("100.0%"); lblDescription.setHeight("-1px"); lblDescription.setValue(BundleUtils.getString("label.Roles.description")); searchLayout.addComponent(lblDescription, 0, 1); txtDescription = new TextArea(); txtDescription.setImmediate(false); txtDescription.setWidth("100.0%"); txtDescription.setHeight("-1px"); searchLayout.addComponent(txtDescription, 1, 1); lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.Roles.status")); searchLayout.addComponent(lblStatus, 2, 1); cbxStatus = new ComboBox(); cbxStatus.setImmediate(false); cbxStatus.setWidth("100.0%"); cbxStatus.setHeight("-1px"); searchLayout.addComponent(cbxStatus, 3, 1); }
From source file:com.cavisson.gui.dashboard.components.controls.Tables.java
License:Apache License
static void configure(Table table, boolean footer, boolean sized, boolean expandRatios, boolean stripes, boolean verticalLines, boolean horizontalLines, boolean borderless, boolean headers, boolean compact, boolean small, boolean rowIndex, boolean rowCaption, boolean rowIcon, boolean componentsInRows) { table.setSelectable(true);/*from www .j av a 2s.c om*/ table.setMultiSelect(true); table.setSortEnabled(true); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setPageLength(6); table.addActionHandler(ValoThemeUI.getActionHandler()); table.setDragMode(TableDragMode.MULTIROW); table.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent event) { Notification.show(event.getTransferable().toString()); } }); table.setColumnAlignment(ValoThemeUI.DESCRIPTION_PROPERTY, Align.RIGHT); table.setColumnAlignment(ValoThemeUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); table.removeGeneratedColumn("textfield"); table.removeContainerProperty("button"); table.removeGeneratedColumn("button"); table.removeContainerProperty("label"); table.removeGeneratedColumn("label"); table.removeContainerProperty("checkbox"); table.removeGeneratedColumn("checkbox"); table.removeContainerProperty("datefield"); table.removeGeneratedColumn("datefield"); table.removeContainerProperty("combobox"); table.removeGeneratedColumn("combobox"); table.removeContainerProperty("optiongroup"); table.removeGeneratedColumn("optiongroup"); table.removeContainerProperty("slider"); table.removeGeneratedColumn("slider"); table.removeContainerProperty("progress"); table.removeGeneratedColumn("progress"); if (componentsInRows) { table.addContainerProperty("textfield", TextField.class, null); table.addGeneratedColumn("textfield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { TextField tf = new TextField(); tf.setInputPrompt("Type here"); // tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("datefield", TextField.class, null); table.addGeneratedColumn("datefield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { DateField tf = new DateField(); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("combobox", TextField.class, null); table.addGeneratedColumn("combobox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ComboBox tf = new ComboBox(); tf.setInputPrompt("Select"); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("button", Button.class, null); table.addGeneratedColumn("button", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Button b = new Button("Button"); b.addStyleName("small"); return b; } }); table.addContainerProperty("label", TextField.class, null); table.addGeneratedColumn("label", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label("Label component"); label.setSizeUndefined(); label.addStyleName("bold"); return label; } }); table.addContainerProperty("checkbox", TextField.class, null); table.addGeneratedColumn("checkbox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { CheckBox cb = new CheckBox(null, true); return cb; } }); table.addContainerProperty("optiongroup", TextField.class, null); table.addGeneratedColumn("optiongroup", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { OptionGroup op = new OptionGroup(); op.addItem("Male"); op.addItem("Female"); op.addStyleName("horizontal"); return op; } }); table.addContainerProperty("slider", TextField.class, null); table.addGeneratedColumn("slider", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Slider s = new Slider(); s.setValue(30.0); return s; } }); table.addContainerProperty("progress", TextField.class, null); table.addGeneratedColumn("progress", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ProgressBar bar = new ProgressBar(); bar.setValue(0.7f); return bar; } }); } table.setFooterVisible(footer); if (footer) { table.setColumnFooter(ValoThemeUI.CAPTION_PROPERTY, "caption"); table.setColumnFooter(ValoThemeUI.DESCRIPTION_PROPERTY, "description"); table.setColumnFooter(ValoThemeUI.ICON_PROPERTY, "icon"); table.setColumnFooter(ValoThemeUI.INDEX_PROPERTY, "index"); } if (sized) { table.setWidth("400px"); table.setHeight("300px"); } else { table.setSizeUndefined(); } if (expandRatios) { if (!sized) { table.setWidth("100%"); } } table.setColumnExpandRatio(ValoThemeUI.CAPTION_PROPERTY, expandRatios ? 1.0f : 0); table.setColumnExpandRatio(ValoThemeUI.DESCRIPTION_PROPERTY, expandRatios ? 1.0f : 0); if (!stripes) { table.addStyleName("no-stripes"); } else { table.removeStyleName("no-stripes"); } if (!verticalLines) { table.addStyleName("no-vertical-lines"); } else { table.removeStyleName("no-vertical-lines"); } if (!horizontalLines) { table.addStyleName("no-horizontal-lines"); } else { table.removeStyleName("no-horizontal-lines"); } if (borderless) { table.addStyleName("borderless"); } else { table.removeStyleName("borderless"); } if (!headers) { table.addStyleName("no-header"); } else { table.removeStyleName("no-header"); } if (compact) { table.addStyleName("compact"); } else { table.removeStyleName("compact"); } if (small) { table.addStyleName("small"); } else { table.removeStyleName("small"); } if (!rowIndex && !rowCaption && rowIcon) { table.setRowHeaderMode(RowHeaderMode.HIDDEN); } if (rowIndex) { table.setRowHeaderMode(RowHeaderMode.INDEX); } if (rowCaption) { table.setRowHeaderMode(RowHeaderMode.PROPERTY); table.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); } else { table.setItemCaptionPropertyId(null); } if (rowIcon) { table.setRowHeaderMode(RowHeaderMode.ICON_ONLY); table.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); } else { table.setItemIconPropertyId(null); } }
From source file:com.cerebro.provevaadin.ChatOffGame.java
public ChatOffGame() { Panel messagesPanel = new Panel(); messagesPanel.setSizeFull();//from w w w. java 2s .c o m messagesPanel.setContent(messages); this.addComponent(messagesPanel); this.setExpandRatio(messagesPanel, 1.0f); HorizontalLayout sendBar = new HorizontalLayout(); sendBar.setWidth("100%"); final TextField input = new TextField(); input.setWidth("100%"); sendBar.addComponent(input); sendBar.setExpandRatio(input, 1.0f); Button send = new Button("Send"); send.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); send.addClickListener((Button.ClickEvent event) -> { BroadcasterOffGame.broadcast(input.getValue(), FROM); input.setValue(""); }); sendBar.addComponent(send); this.addComponent(sendBar); BroadcasterOffGame.register(this); }
From source file:com.cerebro.provevaadin.ChatOnGame.java
public ChatOnGame(User user) { if (user.getUltimoLuogoPG() != null) { logger.info("Luogo: " + user.getUltimoLuogoPG()); } else {//w w w . j a v a 2s. c o m logger.info("Nessun luogo selezionato"); } Panel messagesPanel = new Panel(); messagesPanel.setSizeFull(); messagesPanel.setContent(messages); this.addComponent(messagesPanel); this.setExpandRatio(messagesPanel, 1.0f); HorizontalLayout sendBar = new HorizontalLayout(); sendBar.setWidth("100%"); final TextField input = new TextField(); input.setWidth("100%"); sendBar.addComponent(input); sendBar.setExpandRatio(input, 1.0f); Button send = new Button("Send"); send.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); send.addClickListener((Button.ClickEvent event) -> { logger.info("Invio del messaggio al server"); BroadcasterOnGame.broadcast(input.getValue(), FROM); input.setValue(""); }); sendBar.addComponent(send); this.addComponent(sendBar); BroadcasterOnGame.register(this); }
From source file:com.cms.component.CustomPageTable.java
public HorizontalLayout createControls(String pageSizeDefault) { this.pageSizeDefault = pageSizeDefault; separatorTotal.setImmediate(true);/* w w w . j a va 2 s . c o m*/ Label itemsPerPageLabel = new Label(BundleUtils.getString("common.table.numberRecord")); for (String numberSize : Constants.PAGE_SIZE_LIST) { itemsPerPageSelect.addItem(numberSize); } itemsPerPageSelect.setImmediate(true); itemsPerPageSelect.setNullSelectionAllowed(false); itemsPerPageSelect.setWidth("50px"); itemsPerPageSelect.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue()))); firePagedChangedEvent(); } }); itemsPerPageSelect.select(pageSizeDefault); Label pageLabel = new Label(BundleUtils.getString("common.table.page"), ContentMode.HTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.setConverter(Integer.class); currentPageTextField .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages())); Label separatorLabel = new Label(" / ", ContentMode.HTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), ContentMode.HTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { currentPageTextField.removeAllValidators(); currentPageTextField .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages())); if (Integer.valueOf(String.valueOf(currentPageTextField.getValue())) <= getTotalAmountOfPages()) { int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page); } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("30px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); HorizontalLayout controlBar = new HorizontalLayout(); HorizontalLayout pageSize = new HorizontalLayout(); HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { setCurrentPage(0); } }); previous = new Button("<", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new Button.ClickListener() { private static final long serialVersionUID = -1927138212640638452L; @Override public void buttonClick(Button.ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(Reindeer.BUTTON_LINK); previous.setStyleName(Reindeer.BUTTON_LINK); next.setStyleName(Reindeer.BUTTON_LINK); last.setStyleName(Reindeer.BUTTON_LINK); itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption"); itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox"); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); separatorTotal.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); itemsPerPageLabel.addStyleName("pagedtable-label"); itemsPerPageSelect.addStyleName("pagedtable-combobox"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); separatorTotal.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.addComponent(itemsPerPageLabel); pageSize.addComponent(itemsPerPageSelect); Label separator = new Label(" / ", ContentMode.HTML); pageSize.addComponent(separator); pageSize.addComponent(separatorTotal); pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(separator, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(separatorTotal, Alignment.MIDDLE_LEFT); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @Override public void pageChanged(PagedTableChangeEvent event) { int abc = event.getCurrentPage(); first.setEnabled(container.getStartIndex() > 0); previous.setEnabled(container.getStartIndex() > 0); next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(String.valueOf(getTotalAmountOfPages())); if (resizePage) { int lenght = getPageLength(); int a = lenght % 5; int b = lenght / 5; if (a != 0) { int pageLenght = 5 * (b + 1); itemsPerPageSelect.setValue(pageLenght); } } separatorTotal.setValue(String.valueOf(container.getRealSize())); } }); return controlBar; }
From source file:com.cms.ui.ChangPasswordUI.java
public ChangPasswordUI() { mainLayout.setImmediate(true);//from www .j a v a2 s. c o m mainLayout.setCaption(BundleUtils.getString("title.changPassword")); mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); setWidth("30.0%"); setHeight("-1px"); setModal(true); txtUserName = new TextField(); txtUserName.setWidth("100%"); txtUserName.setHeight("-1px"); txtUserName.setRequired(true); txtUserName.setCaption(BundleUtils.getString("userName")); txtUserName.setImmediate(false); mainLayout.addComponent(txtUserName); txtPasswordOld = new PasswordField(); txtPasswordOld.setWidth("100%"); txtPasswordOld.setHeight("-1px"); txtPasswordOld.setRequired(true); txtPasswordOld.setCaption(BundleUtils.getString("passwordOld")); txtPasswordOld.setImmediate(false); mainLayout.addComponent(txtPasswordOld); txtPasswordNew = new PasswordField(); txtPasswordNew.setWidth("100%"); txtPasswordNew.setHeight("-1px"); txtPasswordNew.setRequired(true); txtPasswordNew.setCaption(BundleUtils.getString("passwordNew")); txtPasswordNew.setImmediate(false); mainLayout.addComponent(txtPasswordNew); txtConfirmPasswordNew = new PasswordField(); txtConfirmPasswordNew.setWidth("100%"); txtConfirmPasswordNew.setHeight("-1px"); txtConfirmPasswordNew.setRequired(true); txtConfirmPasswordNew.setCaption(BundleUtils.getString("passwordConfirm")); txtConfirmPasswordNew.setImmediate(false); mainLayout.addComponent(txtConfirmPasswordNew); // captcha = new ReCaptcha("6Lfv5OoSAAAAAPEbWhNB0ERopfQpRxr8_5yncOmg", "6Lfv5OoSAAAAAHa4zmExf6w2ja3vm-8ABKgyepq-", // new ReCaptchaOptions() { // { // theme = "white"; // } // }); // mainLayout.addComponent(captcha); GridManyButton gridButton = new GridManyButton(new String[] { BundleUtils.getString("btn.changePassword"), BundleUtils.getString("common.button.cancel") }); btnChange = gridButton.getBtnCommon().get(0); // btnChange.setWidth("100%"); // btnChange.setHeight("-1px"); // btnChange.setCaption(BundleUtils.getString("btn.changePassword")); btnChange.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String userName = txtUserName.getValue(); if (userName == null || userName.equals("")) { Notification.show("Bn cha nhp tn ti khon", Notification.Type.ERROR_MESSAGE); return; } String passwordOld = txtPasswordOld.getValue(); if (passwordOld == null || passwordOld.equals("")) { Notification.show("Bn cha nhp mt khu c", Notification.Type.ERROR_MESSAGE); return; } String passwordNew = txtPasswordNew.getValue(); if (passwordNew == null || passwordNew.equals("")) { Notification.show("Bn cha nhp mt khu mi", Notification.Type.ERROR_MESSAGE); return; } String confirmPassword = txtConfirmPasswordNew.getValue(); if (confirmPassword == null || confirmPassword.equals("")) { Notification.show("Bn cha xc nhn mt khu mi", Notification.Type.ERROR_MESSAGE); return; } if (!passwordNew.equals(confirmPassword)) { Notification.show("Xc nhn cha chnh xc", Notification.Type.ERROR_MESSAGE); return; } Boolean check = checkLogIn(userName, passwordOld); if (!check) { Notification.show("Mt khu c cha chnh xc", Notification.Type.ERROR_MESSAGE); return; } StaffDTO staff = lstStaffDTO.get(0); staff.setPassword(DataUtil.md5(passwordNew)); String message = WSStaff.updateStaff(staff); if (!message.equals("SUCCESS")) { Notification.show("Thay i khng thnh cng", Notification.Type.ERROR_MESSAGE); return; } else { Notification.show("Thay i thnh cng"); close(); DashboardEventBus.post(new DashboardEvent.UserLoggedOutEvent()); } } }); btnChange.setImmediate(false); // buttonLayout.addComponent(btnChange); btnClose = gridButton.getBtnCommon().get(1); // btnChange.setWidth("100%"); // btnClose.setHeight("-1px"); // btnClose.setCaption(BundleUtils.getString("btn.close")); btnClose.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { close(); } }); // buttonLayout.addComponent(btnClose); mainLayout.addComponent(gridButton); mainLayout.setComponentAlignment(gridButton, Alignment.MIDDLE_CENTER); setContent(mainLayout); }
From source file:com.cms.utils.CommonUtils.java
public static TextField buildTextField(String caption, int maxlength, String... valueHint) { TextField returnTextField = new TextField(); if (!DataUtil.isStringNullOrEmpty(caption)) { returnTextField.setCaption(BundleUtils.getString(caption)); }/*from ww w . ja v a 2 s . co m*/ returnTextField.setWidth("100%"); returnTextField.setHeight("-1px"); returnTextField.setImmediate(true); returnTextField.setMaxLength(maxlength); if (valueHint.length > 0) { returnTextField.setInputPrompt(valueHint[0]); } return returnTextField; }
From source file:com.cms.view.CategoryListView.java
public void buildSearchLayout() { searchLayout = new GridLayout(); searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info"))); searchLayout.setCaptionAsHtml(true); searchLayout.setImmediate(true);/*from w ww.j a v a 2 s.co m*/ searchLayout.setWidth("100.0%"); searchLayout.setHeight("-1px"); searchLayout.setMargin(true); searchLayout.setSpacing(true); searchLayout.setColumns(4); searchLayout.setRows(4); searchLayout.setStyleName("custom-feildset"); lblCode = new Label(); lblCode.setImmediate(true); lblCode.setWidth("100.0%"); lblCode.setHeight("-1px"); lblCode.setValue(BundleUtils.getString("label.CategoryList.code")); searchLayout.addComponent(lblCode, 0, 0); txtCode = new TextField(); // txtCode.setRequired(true); txtCode.setImmediate(true); txtCode.setWidth("100.0%"); txtCode.setHeight("-1px"); searchLayout.addComponent(txtCode, 1, 0); lblName = new Label(); lblName.setImmediate(true); lblName.setWidth("100.0%"); lblName.setHeight("-1px"); lblName.setValue(BundleUtils.getString("label.CategoryList.name")); searchLayout.addComponent(lblName, 2, 0); txtName = new TextField(); txtName.setImmediate(true); txtName.setWidth("100.0%"); txtName.setHeight("-1px"); searchLayout.addComponent(txtName, 3, 0); lblReceivedDate = new Label(); lblReceivedDate.setImmediate(true); lblReceivedDate.setWidth("100.0%"); lblReceivedDate.setHeight("-1px"); lblReceivedDate.setValue(BundleUtils.getString("label.CategoryList.receivedDate")); searchLayout.addComponent(lblReceivedDate, 0, 1); dfReceivedDate = new DateField(); // dfReceivedDate.setRequired(true); dfReceivedDate.setImmediate(true); dfReceivedDate.setWidth("100.0%"); dfReceivedDate.setHeight("-1px"); searchLayout.addComponent(dfReceivedDate, 1, 1); lblEndDate = new Label(); lblEndDate.setImmediate(true); lblEndDate.setWidth("100.0%"); lblEndDate.setHeight("-1px"); lblEndDate.setValue(BundleUtils.getString("label.CategoryList.endDate")); searchLayout.addComponent(lblEndDate, 2, 1); dfEndDate = new DateField(); // dfEndDate.setRequired(true); dfEndDate.setImmediate(true); dfEndDate.setWidth("100.0%"); dfEndDate.setHeight("-1px"); searchLayout.addComponent(dfEndDate, 3, 1); lblDescription = new Label(); lblDescription.setImmediate(true); lblDescription.setWidth("100.0%"); lblDescription.setHeight("-1px"); lblDescription.setValue(BundleUtils.getString("label.CategoryList.description")); searchLayout.addComponent(lblDescription, 0, 2); txtDescription = new TextField(); txtDescription.setImmediate(true); txtDescription.setWidth("100.0%"); txtDescription.setHeight("-1px"); searchLayout.addComponent(txtDescription, 1, 2); lblCreator = new Label(); lblCreator.setImmediate(true); lblCreator.setWidth("100.0%"); lblCreator.setHeight("-1px"); lblCreator.setValue(BundleUtils.getString("label.CategoryList.creator")); searchLayout.addComponent(lblCreator, 2, 2); txtCreator = new TextField(); txtCreator.setImmediate(true); txtCreator.setWidth("100.0%"); txtCreator.setHeight("-1px"); searchLayout.addComponent(txtCreator, 3, 2); lblService = new Label(); lblService.setImmediate(true); lblService.setWidth("100.0%"); lblService.setHeight("-1px"); lblService.setValue(BundleUtils.getString("customerStatusForm.service")); searchLayout.addComponent(lblService, 0, 3); cboService = CommonUtils.buildComboBox(); cboService.setImmediate(true); cboService.setWidth("100.0%"); cboService.setHeight("-1px"); searchLayout.addComponent(cboService, 1, 3); }
From source file:com.cms.view.ContractTemplateListView.java
private void buildSearchLayout() { searchLayout = new GridLayout(); searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info"))); searchLayout.setCaptionAsHtml(true); searchLayout.setImmediate(false);//from ww w .j a va2s . c o m searchLayout.setWidth("100.0%"); searchLayout.setHeight("-1px"); searchLayout.setMargin(true); searchLayout.setSpacing(true); searchLayout.setColumns(4); searchLayout.setRows(4); searchLayout.setStyleName("custom-feildset"); lblCode = new Label(); lblCode.setImmediate(false); lblCode.setWidth("100.0%"); lblCode.setHeight("-1px"); lblCode.setValue(BundleUtils.getString("label.ContractTemplateList.code")); searchLayout.addComponent(lblCode, 0, 0); txtCode = new TextField(); txtCode.setImmediate(false); txtCode.setWidth("100.0%"); txtCode.setHeight("-1px"); searchLayout.addComponent(txtCode, 1, 0); lblName = new Label(); lblName.setImmediate(false); lblName.setWidth("100.0%"); lblName.setHeight("-1px"); lblName.setValue(BundleUtils.getString("label.ContractTemplateList.name")); searchLayout.addComponent(lblName, 2, 0); txtName = new TextField(); txtName.setImmediate(false); txtName.setWidth("100.0%"); txtName.setHeight("-1px"); searchLayout.addComponent(txtName, 3, 0); lblPathFile = new Label(); lblPathFile.setImmediate(false); lblPathFile.setWidth("100.0%"); lblPathFile.setHeight("-1px"); lblPathFile.setValue(BundleUtils.getString("label.ContractTemplateList.pathFile")); // searchLayout.addComponent(lblPathFile, 0, 1); txtPathFile = new TextField(); txtPathFile.setImmediate(false); txtPathFile.setWidth("100.0%"); txtPathFile.setHeight("-1px"); // searchLayout.addComponent(txtPathFile, 1, 1); lblCreatedDate = new Label(); lblCreatedDate.setImmediate(false); lblCreatedDate.setWidth("100.0%"); lblCreatedDate.setHeight("-1px"); lblCreatedDate.setValue(BundleUtils.getString("label.ContractTemplateList.createdDate")); // searchLayout.addComponent(lblCreatedDate, 0, 1); popCreatedDate = new PopupDateField(); popCreatedDate.setImmediate(false); popCreatedDate.setWidth("100.0%"); popCreatedDate.setHeight("-1px"); // searchLayout.addComponent(popCreatedDate, 3, 1); lblLastUpdatedDate = new Label(); lblLastUpdatedDate.setImmediate(false); lblLastUpdatedDate.setWidth("100.0%"); lblLastUpdatedDate.setHeight("-1px"); lblLastUpdatedDate.setValue(BundleUtils.getString("label.ContractTemplateList.lastUpdatedDate")); // searchLayout.addComponent(lblLastUpdatedDate, 0, 2); popLastUpdatedDate = new PopupDateField(); popLastUpdatedDate.setImmediate(false); popLastUpdatedDate.setWidth("100.0%"); popLastUpdatedDate.setHeight("-1px"); // searchLayout.addComponent(popLastUpdatedDate, 1, 2); lblService = new Label(); lblService.setImmediate(false); lblService.setWidth("100.0%"); lblService.setHeight("-1px"); lblService.setValue(BundleUtils.getString("label.ContractTemplateList.service")); searchLayout.addComponent(lblService, 0, 1); cboService = new ComboBox(); cboService.setImmediate(false); cboService.setWidth("100.0%"); cboService.setHeight("-1px"); searchLayout.addComponent(cboService, 1, 1); lblProvider = new Label(); lblProvider.setImmediate(false); lblProvider.setWidth("100.0%"); lblProvider.setHeight("-1px"); lblProvider.setValue(BundleUtils.getString("label.ContractTemplateList.provider")); searchLayout.addComponent(lblProvider, 2, 1); cboProvider = new ComboBox(); cboProvider.setImmediate(false); cboProvider.setWidth("100.0%"); cboProvider.setHeight("-1px"); searchLayout.addComponent(cboProvider, 3, 1); lblType = new Label(); lblType.setImmediate(false); lblType.setWidth("100.0%"); lblType.setHeight("-1px"); lblType.setValue(BundleUtils.getString("label.ContractTemplateList.type")); searchLayout.addComponent(lblType, 0, 2); cboType = new ComboBox(); cboType.setImmediate(false); cboType.setWidth("100.0%"); cboType.setHeight("-1px"); searchLayout.addComponent(cboType, 1, 2); lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.ContractTemplateList.status")); searchLayout.addComponent(lblStatus, 2, 2); cbxStatus = new ComboBox(); cbxStatus.setImmediate(false); cbxStatus.setWidth("100.0%"); cbxStatus.setHeight("-1px"); searchLayout.addComponent(cbxStatus, 3, 2); }