List of usage examples for com.vaadin.ui TextField setMaxLength
public void setMaxLength(int maxLength)
From source file:dhbw.clippinggorilla.userinterface.windows.ActivateWindow.java
public static Window get() { Window window = new Window(); window.setModal(true);/*from ww w . j a v a2 s. co m*/ window.setResizable(false); window.setDraggable(false); window.setCaption(Language.get(Word.ACTIVATION_CODE)); window.addCloseShortcut(ShortcutAction.KeyCode.ENTER, null); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setMargin(false); windowLayout.setSizeUndefined(); FormLayout forms = new FormLayout(); forms.setMargin(true); forms.setSizeUndefined(); Button save = new Button(Language.get(Word.ACTIVATE)); TextField activationCode = new TextField(Language.get(Word.ACTIVATION_CODE)); activationCode.setMaxLength(6); activationCode.focus(); activationCode.addValueChangeListener(e -> { if (activationCode.getValue().length() > 5) { save.setEnabled(true); activationCode.setComponentError(null); } else { save.setEnabled(false); activationCode.setComponentError(new UserError(Language.get(Word.ACTIVATION_CODE_SIX_CHARS), AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(Language.get(Word.ACTIVATION_CODE_SIX_CHARS)); } }); forms.addComponent(activationCode); Button resendMail = new Button(Language.get(Word.RESEND_ACTIVATION_CODE)); resendMail.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); resendMail.addClickListener(ce -> { try { UserUtils.resendActivationMail(UserUtils.getCurrent()); VaadinUtils.infoNotification(Language.get(Word.RESEND_ACTIVATION_CODE_SUCCESSFUL)); } catch (EmailException ex) { VaadinUtils.errorNotification(Language.get(Word.RESEND_ACTIVATION_CODE_FAILED)); } }); forms.addComponent(resendMail); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL)); cancel.setIcon(VaadinIcons.CLOSE); cancel.addClickListener(ce -> { window.close(); }); cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null); save.setEnabled(false); save.setIcon(VaadinIcons.CHECK); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addClickListener(ce -> { try { String code = activationCode.getValue(); User user = UserUtils.getCurrent(); if (UserUtils.activateUser(user, code)) { VaadinUtils.infoNotification(Language.get(Word.ACTIVATION_SUCCESSFUL)); window.close(); } else { activationCode.setValue(""); VaadinUtils.errorNotification(Language.get(Word.ACTIVATION_FAILED)); } } catch (NumberFormatException e) { } }); save.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); footer.setSizeUndefined(); footer.setWidth("100%"); footer.addComponents(placeholder, cancel, save); footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER); windowLayout.addComponent(forms); windowLayout.addComponent(footer); window.setContent(windowLayout); return window; }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
public GroupProfileWindow(GroupInterestProfile p, Runnable onClose, boolean isAdmin) { VerticalLayout profileSettingsLayout = new VerticalLayout(); GridLayout windowContent;/*from w ww. j av a2 s .co m*/ Button buttonSave = new Button(); if (isAdmin) { windowContent = new GridLayout(3, 3); TextField textFieldName = new TextField(); Language.set(Word.NAME, textFieldName); textFieldName.setWidth("100%"); textFieldName.setValue(p.getName()); textFieldName.setMaxLength(255); Language.set(Word.SAVE, buttonSave); buttonSave.setIcon(VaadinIcons.CHECK); buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSave.addClickListener(ce -> { GroupInterestProfileUtils.changeName(p, textFieldName.getValue()); GroupInterestProfileUtils.changeSources(p, p.getSources()); GroupInterestProfileUtils.changeCategories(p, p.getCategories()); GroupInterestProfileUtils.changeAllTags(p, p.getTags()); VaadinUtils.infoNotification(Language.get(Word.SUCCESSFULLY_SAVED)); close(); onClose.run(); }); Label placeholder2 = new Label(); placeholder2.setWidth("100%"); windowContent.addComponents(textFieldName, placeholder2); windowContent.setComponentAlignment(textFieldName, Alignment.MIDDLE_LEFT); windowContent.addComponent(getSources(p, true), 0, 1, 1, 1); windowContent.addComponent(getCategories(p, true), 2, 1); windowContent.addComponent(getTags(p, true), 0, 2, 2, 2); } else { windowContent = new GridLayout(3, 2); Language.set(Word.CLOSE, buttonSave); buttonSave.setIcon(VaadinIcons.CLOSE); buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSave.addClickListener(ce -> { close(); onClose.run(); }); windowContent.addComponent(getSources(p, false), 0, 0, 1, 0); windowContent.addComponent(getCategories(p, false), 2, 0); windowContent.addComponent(getTags(p, false), 0, 1, 2, 1); } buttonSave.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); Label placeholder = new Label(); Label labelHelp = new Label(Language.get(Word.HELP_TEXT), ContentMode.HTML); labelHelp.setWidth("500px"); PopupView popupHelp = new PopupView(null, labelHelp); Button buttonHelp = new Button(Language.get(Word.HELP), VaadinIcons.QUESTION); buttonHelp.addClickListener(ce -> { popupHelp.setPopupVisible(true); }); GridLayout footer; if (isAdmin) { footer = new GridLayout(4, 1); footer.addComponents(buttonHelp, popupHelp, placeholder, buttonSave); footer.setColumnExpandRatio(2, 5); } else { footer = new GridLayout(2, 1); footer.addComponents(placeholder, buttonSave); footer.setColumnExpandRatio(0, 5); } footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth("100%"); footer.addStyleName("menubar"); footer.setComponentAlignment(buttonSave, Alignment.MIDDLE_CENTER); windowContent.setWidth("100%"); windowContent.setSpacing(true); windowContent.setMargin(true); windowContent.addStyleName("profiles"); profileSettingsLayout.addComponents(windowContent, footer); profileSettingsLayout.setMargin(false); profileSettingsLayout.setSpacing(false); profileSettingsLayout.setWidth("100%"); setContent(profileSettingsLayout); center(); setWidthUndefined(); setCaption(p.getName()); setWidth("950px"); }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
public Component getSources(GroupInterestProfile profile, boolean isAdmin) { VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setWidth("100%"); VerticalLayout sourcesLayout = new VerticalLayout(); sourcesLayout.setWidth("100%"); Panel sourcesPanel = new Panel(sourcesLayout); List<CheckBox> checkBoxes = new ArrayList<>(); HashMap<String, GridLayout> sourceLayouts = new HashMap<>(); profile.getSources().entrySet().stream() .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> { Source source = e.getKey(); boolean enabled = e.getValue(); GridLayout sourceLayout = new GridLayout(5, 1); sourceLayout.setSizeFull(); CheckBox sourceSelected = new CheckBox(); sourceSelected.setValue(enabled); sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE); sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue())); sourceSelected.setEnabled(isAdmin); checkBoxes.add(sourceSelected); Image sourceLogo = new Image(); sourceLogo.addStyleName("logosmall"); sourceLogo.setSource(new ExternalResource(source.getLogo())); if (isAdmin) { sourceLogo.addClickListener(c -> { sourceSelected.setValue(!sourceSelected.getValue()); profile.getSources().replace(source, sourceSelected.getValue()); });/*from ww w. j a v a2 s. co m*/ } VerticalLayout layoutLogo = new VerticalLayout(sourceLogo); layoutLogo.setWidth("150px"); layoutLogo.setHeight("50px"); layoutLogo.setMargin(false); layoutLogo.setSpacing(false); layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT); Label labelHeadLine = new Label( source.getCategory().getIcon().getHtml() + " " + source.getName(), ContentMode.HTML); labelHeadLine.addStyleName(ValoTheme.LABEL_H3); Label labelDescription = new Label(source.getDescription(), ContentMode.HTML); labelDescription.setWidth("300px"); PopupView popup = new PopupView(null, labelDescription); Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O); buttonDescription.addClickListener(ce -> { popup.setPopupVisible(true); }); sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription); sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER); sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER); sourceLayout.setColumnExpandRatio(2, 5); sourceLayout.setSpacing(true); sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "") .replaceAll("_", ""), sourceLayout); sourcesLayout.addComponent(sourceLayout); }); sourcesPanel.setContent(sourcesLayout); sourcesPanel.setHeight("100%"); sourcesPanel.setCaption(Language.get(Word.SOURCES)); Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s)); windowLayout.addComponent(sourcesPanel); windowLayout.setExpandRatio(sourcesPanel, 1); windowLayout.setSpacing(false); windowLayout.setMargin(false); CheckBox checkBoxSelectAll = new CheckBox(); Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s)); checkBoxSelectAll.setWidth("100%"); checkBoxSelectAll.addValueChangeListener(e -> { profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue()); checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue())); }); checkBoxSelectAll.setEnabled(isAdmin); TextField textFieldSearch = new TextField(); Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s)); textFieldSearch.setWidth("100%"); textFieldSearch.setMaxLength(255); textFieldSearch.setPlaceholder(Language.get(Word.SEARCH)); textFieldSearch.addValueChangeListener(searchValue -> { sourceLayouts.forEach((sourceName, sourceLayout) -> { if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "") .replaceAll("-", "").replaceAll("_", ""))) { sourcesLayout.removeComponent(sourceLayout); } else { sourcesLayout.addComponent(sourceLayout); } }); }); Label placeholder = new Label(); placeholder.setWidth("100%"); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.setMargin(new MarginInfo(true, false, false, false)); footer.addStyleName("menubar"); footer.setWidth("100%"); footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder); footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT); footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER); windowLayout.addComponent(footer); windowLayout.setHeight("350px"); return windowLayout; }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
private Component getAddTagGroup(GroupInterestProfile profile, boolean included) { CssLayout newTagGroup = new CssLayout(); newTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldTag = new TextField(); textFieldTag.setWidth("325px"); textFieldTag.setMaxLength(255); Language.setCustom(Word.NEW_TAG, s -> textFieldTag.setPlaceholder(s)); Button buttonAddTag = new Button(VaadinIcons.PLUS); buttonAddTag.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); buttonAddTag.addClickListener(event -> { addRow(profile, included, textFieldTag.getValue(), true); profile.getTags().put(textFieldTag.getValue(), included); textFieldTag.clear();//from w ww . j a v a 2 s. c o m }); textFieldTag.addFocusListener(f -> buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null)); textFieldTag.addBlurListener(f -> buttonAddTag.removeClickShortcut()); newTagGroup.addComponents(textFieldTag, buttonAddTag); newTagGroup.setWidth("100%"); return newTagGroup; }
From source file:dhbw.clippinggorilla.userinterface.windows.PasswordRecoveryWindow.java
public void changeWindow() { String errorMsg;/*from www . ja va2 s . co m*/ if (emailOrUsername.getValue().contains("@")) { errorMsg = UserUtils.checkEmailOnFormalCorrectness(emailOrUsername.getValue().toLowerCase()); } else { errorMsg = UserUtils.checkUsernameOnFormalCorrectness(emailOrUsername.getValue()); } if (errorMsg.isEmpty()) { VaadinUtils.middleInfoNotification(Language.get(Word.IF_USER_EXIST_CHECK_MAIL)); try { String stringEmailOrUsername = emailOrUsername.getValue(); if (stringEmailOrUsername.contains("@")) { stringEmailOrUsername = stringEmailOrUsername.toLowerCase(); } String token = UserUtils.initiateForgottenPasswordRecovery(stringEmailOrUsername); forms.removeAllComponents(); TextField resetCode = new TextField(Language.get(Word.RESET_CODE)); resetCode.setMaxLength(6); resetCode.addValueChangeListener(e -> { if (resetCode.getValue().length() > 5) { resetCode.setComponentError(null); setError(resetCode, false); } else { resetCode.setComponentError(new UserError(Language.get(Word.RESET_CODE_SIX_CHARS), AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(Language.get(Word.RESET_CODE_SIX_CHARS)); setError(resetCode, true); } }); ProgressBar strength = new ProgressBar(); PasswordField pw1 = new PasswordField(Language.get(Word.PASSWORD)); pw1.setMaxLength(51); pw1.addValueChangeListener(e -> { String pwErrorMsg = UserUtils.checkPassword(e.getValue()); strength.setValue(UserUtils.calculatePasswordStrength(e.getValue())); if (!pwErrorMsg.isEmpty()) { pw1.setComponentError(new UserError(pwErrorMsg, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.ERROR)); VaadinUtils.infoNotification(pwErrorMsg); setError(pw1, true); } else { pw1.setComponentError(null); setError(pw1, false); } }); strength.setWidth("184px"); strength.setHeight("1px"); PasswordField pw2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN)); pw2.setMaxLength(51); pw2.addValueChangeListener(e -> { String pwErrorMsg = UserUtils.checkSecondPassword(pw1.getValue(), e.getValue()); if (!pwErrorMsg.isEmpty()) { pw2.setComponentError(new UserError(pwErrorMsg, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.ERROR)); VaadinUtils.infoNotification(pwErrorMsg); setError(pw2, true); } else { pw2.setComponentError(null); setError(pw2, false); } }); send.setCaption(Language.get(Word.RESET)); send.setEnabled(false); sendListener.remove(); send.addClickListener(ce -> { try { UserUtils.executeForgottenPasswordRecovery(emailOrUsername.getValue(), resetCode.getValue(), token, pw1.getValue(), pw2.getValue()); VaadinUtils.infoNotification(Language.get(Word.RESET_SUCCESSFUL)); close(); } catch (PasswordChangeException ex) { VaadinUtils.infoNotification(Language.get(Word.RESET_FAILED)); } }); forms.addComponents(resetCode, pw1, strength, pw2); center(); } catch (UserNotFoundException e) { VaadinUtils.errorNotification(Language.get(Word.RESET_FAILED)); } } else { VaadinUtils.infoNotification(errorMsg); } }
From source file:dhbw.clippinggorilla.userinterface.windows.RegisterWindow.java
public RegisterWindow() { setModal(true);//from w w w. j av a 2 s . c o m setResizable(false); setDraggable(false); setCaption(Language.get(Word.REGISTER)); addCloseShortcut(KeyCode.ENTER, null); Button save = new Button(Language.get(Word.REGISTER)); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setMargin(false); windowLayout.setSizeUndefined(); FormLayout forms = new FormLayout(); forms.setMargin(true); forms.setSizeUndefined(); TextField firstName = new TextField(Language.get(Word.FIRST_NAME)); firstName.focus(); firstName.setMaxLength(20); firstName.addValueChangeListener(event -> { String firstNameError = UserUtils.checkName(event.getValue()); if (!firstNameError.isEmpty()) { firstName.setComponentError(new UserError(firstNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(firstNameError); save.setEnabled(setError(firstName, true)); } else { firstName.setComponentError(null); boolean enabled = setError(firstName, false); save.setEnabled(enabled); } }); forms.addComponent(firstName); TextField lastName = new TextField(Language.get(Word.LAST_NAME)); lastName.setMaxLength(20); lastName.addValueChangeListener(event -> { String lastNameError = UserUtils.checkName(event.getValue()); if (!lastNameError.isEmpty()) { lastName.setComponentError(new UserError(lastNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(lastNameError); save.setEnabled(setError(lastName, true)); } else { lastName.setComponentError(null); save.setEnabled(setError(lastName, false)); } }); forms.addComponent(lastName); TextField userName = new TextField(Language.get(Word.USERNAME)); userName.setMaxLength(20); userName.addValueChangeListener(event -> { String userNameError = UserUtils.checkUsername(event.getValue()); if (!userNameError.isEmpty()) { userName.setComponentError(new UserError(userNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(userNameError); save.setEnabled(setError(userName, true)); } else { userName.setComponentError(null); save.setEnabled(setError(userName, false)); } }); forms.addComponent(userName); TextField email1 = new TextField(Language.get(Word.EMAIL)); email1.setMaxLength(256); email1.addValueChangeListener(event -> { String email1Error = UserUtils.checkEmail(event.getValue().toLowerCase()); if (!email1Error.isEmpty()) { email1.setComponentError(new UserError(email1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email1Error); save.setEnabled(setError(email1, true)); } else { email1.setComponentError(null); save.setEnabled(setError(email1, false)); } }); forms.addComponent(email1); TextField email2 = new TextField(Language.get(Word.EMAIL_AGAIN)); email2.setMaxLength(256); email2.addValueChangeListener(event -> { String email2Error = UserUtils.checkEmail(event.getValue().toLowerCase()) + UserUtils.checkSecondEmail(email1.getValue().toLowerCase(), event.getValue().toLowerCase()); if (!email2Error.isEmpty()) { email2.setComponentError(new UserError(email2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email2Error); save.setEnabled(setError(email2, true)); } else { email2.setComponentError(null); save.setEnabled(setError(email2, false)); } }); forms.addComponent(email2); ProgressBar strength = new ProgressBar(); PasswordField password1 = new PasswordField(Language.get(Word.PASSWORD)); password1.setMaxLength(51); password1.addValueChangeListener(event -> { String password1Error = UserUtils.checkPassword(event.getValue()); strength.setValue(UserUtils.calculatePasswordStrength(event.getValue())); if (!password1Error.isEmpty()) { password1.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password1Error); save.setEnabled(setError(password1, true)); } else { password1.setComponentError(null); save.setEnabled(setError(password1, false)); } }); forms.addComponent(password1); strength.setWidth("184px"); strength.setHeight("1px"); forms.addComponent(strength); PasswordField password2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN)); password2.setMaxLength(51); password2.addValueChangeListener(event -> { String password2Error = UserUtils.checkPassword(event.getValue()) + UserUtils.checkSecondPassword(password1.getValue(), event.getValue()); if (!password2Error.isEmpty()) { password2.setComponentError(new UserError(password2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password2Error); save.setEnabled(setError(password2, true)); } else { password2.setComponentError(null); save.setEnabled(setError(password2, false)); } }); forms.addComponent(password2); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Unit.PERCENTAGE); Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL)); cancel.setIcon(VaadinIcons.CLOSE); cancel.addClickListener(ce -> { close(); }); cancel.setClickShortcut(KeyCode.ESCAPE, null); save.setEnabled(false); save.setIcon(VaadinIcons.CHECK); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addClickListener(ce -> { try { User user = UserUtils.registerUser(userName.getValue(), password1.getValue(), password2.getValue(), email1.getValue().toLowerCase(), email2.getValue().toLowerCase(), firstName.getValue(), lastName.getValue()); UserUtils.setCurrentUser(user); close(); UI.getCurrent().addWindow(ActivateWindow.get()); } catch (UserCreationException ex) { Log.error("Registration failed", ex); VaadinUtils.errorNotification(Language.get(Word.REG_FAILED)); } }); save.setClickShortcut(KeyCode.ENTER, null); footer.addComponents(placeholder, cancel, save); footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER); windowLayout.addComponent(forms); windowLayout.addComponent(footer); setContent(windowLayout); }
From source file:fr.amapj.view.views.gestioncontrat.editorpart.GestionContratEditorPart.java
License:Open Source License
private void drawDetailPaiement() { setStepTitle("les informations sur le paiement"); // Liste des validators IValidator notNull = new NotNullValidator(); IValidator len_0_2048 = new StringLengthValidator(0, 2048); IValidator len_0_255 = new StringLengthValidator(0, 255); if (modeleContrat.gestionPaiement == GestionPaiement.GESTION_STANDARD) { addTextField("Ordre du chque", "libCheque", len_0_255); if (modeleContrat.frequence == FrequenceLivraison.UNE_SEULE_LIVRAISON) { PopupDateField p = addDateField("Date de remise du chque", "dateRemiseCheque", notNull); p.setValue(modeleContrat.dateDebut); } else {/*from w ww .j a va 2 s .c om*/ PopupDateField p = addDateField("Date de remise des chques", "dateRemiseCheque", notNull); p.setValue(modeleContrat.dateFinInscription); p = addDateField("Date du premier paiement", "premierCheque", notNull); p.setValue(proposeDatePremierPaiement()); p = addDateField("Date du dernier paiement", "dernierCheque", notNull); p.setValue(proposeDateDernierPaiement()); } } else { TextField f = (TextField) addTextField("Texte affich dans la fentre paiement", "textPaiement", len_0_2048); f.setMaxLength(2048); f.setHeight(5, Unit.CM); } }
From source file:fr.amapj.view.views.gestioncontrat.editorpart.ModifPaiementContratEditorPart.java
License:Open Source License
private void addFieldPaiement() { IValidator len_0_255 = new StringLengthValidator(0, 255); setStepTitle("les informations sur le paiement"); if (modeleContrat.gestionPaiement == GestionPaiement.GESTION_STANDARD) { addTextField("Ordre du chque", "libCheque", len_0_255); if (modeleContrat.frequence == FrequenceLivraison.UNE_SEULE_LIVRAISON) { PopupDateField p = addDateField("Date de remise du chque", "dateRemiseCheque"); if (modeleContrat.getDateRemiseCheque() == null) { p.setValue(modeleContrat.dateDebut); }/*from w w w.jav a 2 s .com*/ } else { PopupDateField p = addDateField("Date de remise des chques", "dateRemiseCheque"); if (modeleContrat.getDateRemiseCheque() == null) { p.setValue(modeleContrat.dateFinInscription); } p = addDateField("Date du premier paiement", "premierCheque"); if (modeleContrat.getPremierCheque() == null) { p.setValue(DateUtils.firstDayInMonth(modeleContrat.dateDebut)); } p = addDateField("Date du dernier paiement", "dernierCheque"); if (modeleContrat.getDernierCheque() == null) { p.setValue(DateUtils.firstDayInMonth(modeleContrat.dateFin)); } } } else { TextField f = (TextField) addTextField("Texte affich dans la fentre paiement", "textPaiement"); f.setMaxLength(2048); f.setHeight(5, Unit.CM); } }
From source file:io.subutai.plugin.accumulo.ui.wizard.ConfigurationStep.java
public static TextField getTextField(String caption, String prompt, int maxLength) { TextField textField = new TextField(caption); textField.setInputPrompt(prompt);// w w w.j av a 2 s.com textField.setMaxLength(maxLength); textField.setRequired(true); return textField; }
From source file:org.balisunrise.spilumba.layout.GridLayout.java
License:Open Source License
private Field createField(Property prop) { switch (prop.getType()) { case TEXT://from www. j a v a 2 s.c o m TextField tf = new TextField(); tf.setCaption(prop.getLabel()); tf.setMaxLength(prop.getMaxLength()); return tf; default: throw new AssertionError(); } }