List of usage examples for com.vaadin.data.validator IntegerRangeValidator IntegerRangeValidator
public IntegerRangeValidator(String errorMessage, Integer minValue, Integer maxValue)
From source file:annis.gui.ExportPanel.java
License:Apache License
public ExportPanel(QueryPanel queryPanel, QueryController controller, QueryUIState state) { super(2, 3);/* www . j a va2 s . co m*/ this.queryPanel = queryPanel; this.controller = controller; this.state = state; this.eventBus = new EventBus(); this.eventBus.register(ExportPanel.this); this.formLayout = new FormLayout(); formLayout.setWidth("-1px"); setWidth("99%"); setHeight("-1px"); initHelpMessages(); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 1.0f); cbExporter = new ComboBox("Exporter"); cbExporter.setNewItemsAllowed(false); cbExporter.setNullSelectionAllowed(false); cbExporter.setImmediate(true); for (Exporter e : SearchView.EXPORTER) { cbExporter.addItem(e.getClass().getSimpleName()); } cbExporter.setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); cbExporter.addValueChangeListener(new ExporterSelectionHelpListener()); formLayout.addComponent(cbExporter); addComponent(formLayout, 0, 0); lblHelp = new Label(help4Exporter.get((String) cbExporter.getValue())); lblHelp.setContentMode(ContentMode.HTML); addComponent(lblHelp, 1, 0); cbLeftContext = new ComboBox("Left Context"); cbRightContext = new ComboBox("Right Context"); cbLeftContext.setNullSelectionAllowed(false); cbRightContext.setNullSelectionAllowed(false); cbLeftContext.setNewItemsAllowed(true); cbRightContext.setNewItemsAllowed(true); cbLeftContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); cbRightContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); for (Integer i : SearchOptionsPanel.PREDEFINED_CONTEXTS) { cbLeftContext.addItem(i); cbRightContext.addItem(i); } cbLeftContext.setValue(5); cbRightContext.setValue(5); formLayout.addComponent(cbLeftContext); formLayout.addComponent(cbRightContext); txtAnnotationKeys = new TextField("Annotation Keys"); txtAnnotationKeys.setDescription("Some exporters will use this comma " + "seperated list of annotation keys to limit the exported data to these " + "annotations."); formLayout.addComponent(new HelpButton(txtAnnotationKeys)); txtParameters = new TextField("Parameters"); txtParameters.setDescription( "You can input special parameters " + "for certain exporters. See the description of each exporter " + "(? button above) for specific parameter settings."); formLayout.addComponent(new HelpButton(txtParameters)); btExport = new Button("Perform Export"); btExport.setIcon(FontAwesome.PLAY); btExport.setDisableOnClick(true); btExport.addClickListener(new ExportButtonListener()); btCancel = new Button("Cancel Export"); btCancel.setIcon(FontAwesome.TIMES_CIRCLE); btCancel.setEnabled(false); btCancel.addClickListener(new CancelButtonListener()); btCancel.setVisible(SearchView.EXPORTER[0].isCancelable()); btDownload = new Button("Download"); btDownload.setDescription("Click here to start the actual download."); btDownload.setIcon(FontAwesome.DOWNLOAD); btDownload.setDisableOnClick(true); btDownload.setEnabled(false); HorizontalLayout layoutExportButtons = new HorizontalLayout(btExport, btCancel, btDownload); addComponent(layoutExportButtons, 0, 1, 1, 1); VerticalLayout vLayout = new VerticalLayout(); addComponent(vLayout, 0, 2, 1, 2); progressBar = new ProgressBar(); progressBar.setVisible(false); progressBar.setIndeterminate(true); vLayout.addComponent(progressBar); progressLabel = new Label(); vLayout.addComponent(progressLabel); if (state != null) { cbLeftContext.setPropertyDataSource(state.getLeftContext()); cbRightContext.setPropertyDataSource(state.getRightContext()); cbExporter.setPropertyDataSource(state.getExporterName()); state.getExporterName().setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); txtAnnotationKeys.setConverter(new CommaSeperatedStringConverterList()); txtAnnotationKeys.setPropertyDataSource(state.getExportAnnotationKeys()); txtParameters.setPropertyDataSource(state.getExportParameters()); } }
From source file:com.cms.component.CustomPageTable.java
public HorizontalLayout createControls(String pageSizeDefault) { this.pageSizeDefault = pageSizeDefault; separatorTotal.setImmediate(true);/*from w w w . j a va2 s.co 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.vaadHL.example.jpa.FormTst.java
License:Apache License
public FormTst(IWinPermChecker masterPermChecker, MWLaunchMode launchMode, EntityManager em, LazyEntityContainer<?> container, Object rowId, IAppContext appContext, boolean readOnlyW) { super("M001", "Form Window Title", masterPermChecker, launchMode, em, container, rowId, appContext, readOnlyW, null);/*ww w . j a va 2 s. com*/ // It is very important to include this if (!approvedToOpen) return; setWidth("920px"); setHeight("500px"); fFirstName.setCaption(getI18S("fFirstName")); fFirstName.addValidator(new StringLengthValidator(getI18S("FNlEN"), 1, 15, false)); fFirstName.setRequiredError(getI18S("valReq")); tfLastName.addValidator(new StringLengthValidator(getI18S("LNLEN"), 1, 20, false)); tfLastName.setCaption(getI18S("tfLastName")); tfLastName.setRequiredError(getI18S("valReq")); tfYearOfBirth.setCaption(getI18S("tfYearOfBirth")); tfYearOfBirth.setConverter(new StringToPlainIntegerConverter()); String tfYearOfBirthMsg = getI18S("yearVal"); tfYearOfBirth.addValidator(new IntegerRangeValidator(tfYearOfBirthMsg, 1920, 2010)); tfYearOfBirth.setRequiredError(tfYearOfBirthMsg); }
From source file:com.yoncabt.ebr.ui.ReportWindow.java
private void showFields(ReportDefinition definition, final Window w, final FormLayout fl) throws AssertionError, JSONException { fl.removeAllComponents();//ww w. jav a 2 s . co m w.setCaption(definition.getCaption()); for (ReportParam param : definition.getReportParams()) { AbstractField comp = null; if (param.getInputType() == InputType.COMBO) { ComboBox f = new ComboBox(param.getLabel()); param.getLovData().forEach((k, v) -> { f.addItem(k); f.setItemCaption(k, (String) v); }); comp = f; } else { switch (param.getFieldType()) { case STRING: { TextField f = new TextField(param.getLabel()); comp = f; break; } case INTEGER: { TextField f = new TextField(param.getLabel()); f.addValidator(new IntegerRangeValidator("Say kontrol", (Integer) param.getMin(), (Integer) param.getMax())); comp = f; break; } case LONG: { TextField f = new TextField(param.getLabel()); f.addValidator(new LongRangeValidator("Say kontrol", (Long) param.getMin(), (Long) param.getMax())); comp = f; break; } case DOUBLE: { TextField f = new TextField(param.getLabel()); f.addValidator(new DoubleRangeValidator("Say kontrol", (Double) param.getMin(), (Double) param.getMax())); comp = f; break; } case DATE: { DateField f = new DateField(param.getLabel()); f.setDateFormat(param.getFormat()); comp = f; break; } default: { throw new AssertionError(param.getName() + " in tipi tannmyor :" + param.getJavaType()); } } } if (param.getDefaultValue() != null) { comp.setValue(param.getDefaultValue()); } comp.setImmediate(true); comp.setValidationVisible(false); comp.setId(param.getName()); fl.addComponent(comp); } if (report instanceof SQLReport) { reportType.addItem(ReportOutputFormat.xls); reportType.setItemCaption(ReportOutputFormat.xls, ReportOutputFormat.xls.getTypeName()); } else { for (ReportOutputFormat value : ReportOutputFormat.values()) { reportType.addItem(value); reportType.setItemCaption(value, value.getTypeName()); } } reportType.setValue(ReportOutputFormat.xls); fl.addComponent(reportType); fl.addComponent(reportLocale); fl.addComponent(email); }
From source file:org.apache.openaz.xacml.admin.view.components.RangeEditorComponent.java
License:Apache License
private Validator setupValidator(Identifier id) { if (logger.isTraceEnabled()) { logger.trace("setupValidator: " + id); }/* w w w . j av a2 s. c om*/ // // Get our min/max objects // ConstraintValue min = (ConstraintValue) self.comboBoxMin.getData(); ConstraintValue max = (ConstraintValue) self.comboBoxMax.getData(); Object minObject = self.comboBoxMin.getConvertedValue(); Object maxObject = self.comboBoxMax.getConvertedValue(); logger.debug("Converted values: " + minObject + " " + maxObject); // // Get our min/max values // String minValue = self.textFieldMin.getValue(); String maxValue = self.textFieldMax.getValue(); // // What is our datatype? // if (id.equals(XACML3.ID_DATATYPE_INTEGER)) { Integer minimum = null; Integer maximum = null; boolean minInclusive = true; boolean maxInclusive = true; if (min.getProperty() != null) { if (minValue != null && minValue.length() > 0) { minimum = Integer.parseInt(minValue); } if (min.getProperty().equals("minInclusive")) { minInclusive = true; } else if (min.getProperty().equals("minExclusive")) { minInclusive = false; } } if (max.getProperty() != null) { if (maxValue != null && maxValue.length() > 0) { maximum = Integer.parseInt(maxValue); } if (max.getProperty().equals("maxInclusive")) { maxInclusive = true; } else if (max.getProperty().equals("maxExclusive")) { maxInclusive = false; } } IntegerRangeValidator validator = new IntegerRangeValidator("The value is NOT within the range", minimum, maximum); validator.setMinValueIncluded(minInclusive); validator.setMaxValueIncluded(maxInclusive); return validator; } if (id.equals(XACML3.ID_DATATYPE_DOUBLE)) { Double minimum = null; Double maximum = null; boolean minInclusive = true; boolean maxInclusive = true; if (min.getProperty() != null) { if (minValue != null && minValue.length() > 0) { minimum = Double.parseDouble(minValue); } if (min.getProperty().equals("minInclusive")) { minInclusive = true; } else if (min.getProperty().equals("minExclusive")) { minInclusive = false; } } if (max.getProperty() != null) { if (maxValue != null && maxValue.length() > 0) { maximum = Double.parseDouble(maxValue); } if (max.getProperty().equals("maxInclusive")) { maxInclusive = true; } else if (max.getProperty().equals("maxExclusive")) { maxInclusive = false; } } DoubleRangeValidator validator = new DoubleRangeValidator("The value is NOT within the range", minimum, maximum); validator.setMinValueIncluded(minInclusive); validator.setMaxValueIncluded(maxInclusive); return validator; } return null; }
From source file:org.apache.openaz.xacml.admin.view.windows.ColumnSelectionWindow.java
License:Apache License
protected void initializeText() { ///*w w w . ja v a2 s .c o m*/ // Add a validator // this.textFieldColumn.addValidator( new IntegerRangeValidator("Please enter an integer greater than or equal to 0.", 0, null)); // // Respond to text changing to setup the button // this.textFieldColumn.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { if (event.getText() != null && event.getText().isEmpty() == false) { self.buttonSave.setEnabled(true); } else { self.buttonSave.setEnabled(false); } } }); }
From source file:org.bubblecloud.ilves.site.SiteFields.java
License:Apache License
/** * Initialize field descriptors if not done yet. */// ww w . j a v a 2 s . c o m public static synchronized void initialize() { if (initialized) { return; } initialized = true; SiteFields.add(Company.class, new FieldDescriptor("url", "Site URL", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("host", "Host Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("termsAndConditions", "Terms & Conditions", TextArea.class, null, 100, null, String.class, "", false, true, false)); SiteFields.add(Company.class, new FieldDescriptor("companyName", "Company Name", TextField.class, null, -1, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("companyCode", "Company Code", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("iban", "IBAN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("bic", "BIC", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("phoneNumber", "Phone Number", TextField.class, null, 150, null, String.class, "", false, true, true)); SiteFields.add( Company.class, new FieldDescriptor("salesEmailAddress", "Sales Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Company.class, new FieldDescriptor("supportEmailAddress", "Support Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Company.class, new FieldDescriptor("invoicingEmailAddress", "Invoicing Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Company.class, new FieldDescriptor("selfRegistration", "Self Registration", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("emailPasswordReset", "Email Password Reset", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("maxFailedLoginCount", "Max Failed Logins", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, false, true, false) .addValidator(new IntegerRangeValidator("Invalid value", 0, 10))); SiteFields.add(Company.class, new FieldDescriptor("passwordValidityPeriodDays", "Password Validity Period", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, false, true, true) .addValidator(new IntegerRangeValidator("Invalid value", 0, 10))); SiteFields.add(Company.class, new FieldDescriptor("openIdLogin", "Open ID Login", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("certificateLogin", "Certificate Login", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("gaTrackingId", "GA Tracking ID", TextField.class, null, 100, null, String.class, "", false, true, false)); SiteFields.add(Company.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Company.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("firstName", "First Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("lastName", "Last Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("phoneNumber", "Phone Number", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add( Customer.class, new FieldDescriptor("emailAddress", "Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Customer.class, new FieldDescriptor("memberGroup", "Members", GroupField.class, null, 100, null, Group.class, null, true, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("adminGroup", "Admins", GroupField.class, null, 100, null, Group.class, null, true, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("company", "Is Company", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("companyName", "Company Name", TextField.class, null, -1, null, String.class, "", false, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("companyCode", "Company Code", TextField.class, null, 100, null, String.class, "", false, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("addressLineOne", "Line #1", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("addressLineTwo", "Line #2", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("addressLineThree", "Line #3", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("city", "City", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("postalCode", "Postal Code", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("country", "Country", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Group.class, new FieldDescriptor("name", "Name", TextField.class, null, 200, null, String.class, "", false, true, true)); SiteFields.add(Group.class, new FieldDescriptor("description", "Description", TextField.class, null, -1, null, String.class, "", false, true, true)); SiteFields.add(Group.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Group.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("firstName", "First Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("lastName", "Last Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("emailAddress", "Email Address", TextField.class, null, -1, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(User.class, new FieldDescriptor("emailAddressValidated", "Email Validated", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(User.class, new FieldDescriptor("passwordHash", "Password", PasswordField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("passwordExpirationDate", "Password Expiration", DatePartField.class, new DatePartConverter(), 100, null, Date.class, null, true, true, false)); SiteFields.add(User.class, new FieldDescriptor("phoneNumber", "Phone Number", TextField.class, null, 150, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("lockedOut", "Locked Out", CheckBox.class, null, 100, null, Boolean.class, false, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("failedLoginCount", "Failed Logins", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("openIdIdentifier", "Open ID Identifier", TextField.class, null, -1, null, String.class, "", false, true, false)); SiteFields.add(User.class, new FieldDescriptor("certificate", "Certificate (ASCII X.509)", TextArea.class, new CertificateConverter(), 200, null, String.class, "", false, true, false)); SiteFields.add(User.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(GroupMember.class, new FieldDescriptor("group", "Group", GroupField.class, null, 100, null, Group.class, null, false, true, true)); SiteFields.add(GroupMember.class, new FieldDescriptor("user", "User", UserField.class, null, 100, null, User.class, null, false, true, true)); SiteFields.add(GroupMember.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("address", "LDAP Address", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("port", "LDAP Port", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("loginDn", "LDAP Login DN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("loginPassword", "LDAP Login Password", PasswordField.class, null, 100, null, String.class, "", false, false, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("userEmailAttribute", "LDAP User Email Attribute", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("userSearchBaseDn", "LDAP User search Base DN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("groupSearchBaseDn", "LDAP Group search Base DN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("remoteLocalGroupMapping", "Remote-Local Group Mapping", TextField.class, null, 200, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("requiredRemoteGroup", "Required Remote Group", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("subNetWhiteList", "Sub Net White List", TextField.class, null, 200, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("enabled", "Enabled", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); }
From source file:org.vaadin.addons.sitekit.site.SiteFields.java
License:Apache License
/** * Initialize field descriptors if not done yet. * @param localizationProvider the localization provider *///from ww w . j av a2 s . com public static synchronized void initialize() { if (initialized) { return; } initialized = true; SiteFields.add(Company.class, new FieldDescriptor("url", "Site URL", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("host", "Host Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("termsAndConditions", "Terms & Conditions", TextArea.class, null, 100, null, String.class, "", false, true, false)); SiteFields.add(Company.class, new FieldDescriptor("companyName", "Company Name", TextField.class, null, -1, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("companyCode", "Company Code", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("iban", "IBAN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("bic", "BIC", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("phoneNumber", "Phone Number", TextField.class, null, 150, null, String.class, "", false, true, true)); SiteFields.add( Company.class, new FieldDescriptor("salesEmailAddress", "Sales Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Company.class, new FieldDescriptor("supportEmailAddress", "Support Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Company.class, new FieldDescriptor("invoicingEmailAddress", "Invoicing Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Company.class, new FieldDescriptor("emailPasswordReset", "Email Password Reset", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("maxFailedLoginCount", "Max Failed Logins", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, false, true, false) .addValidator(new IntegerRangeValidator("Invalid value", 0, 10))); SiteFields.add(Company.class, new FieldDescriptor("openIdLogin", "Open ID Login", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Company.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Company.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("firstName", "First Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("lastName", "Last Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("phoneNumber", "Phone Number", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add( Customer.class, new FieldDescriptor("emailAddress", "Email Address", TextField.class, null, 150, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(Customer.class, new FieldDescriptor("memberGroup", "Members", GroupField.class, null, 100, null, Group.class, null, true, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("adminGroup", "Admins", GroupField.class, null, 100, null, Group.class, null, true, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("company", "Is Company", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("companyName", "Company Name", TextField.class, null, -1, null, String.class, "", false, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("companyCode", "Company Code", TextField.class, null, 100, null, String.class, "", false, true, false)); SiteFields.add(Customer.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Customer.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("addressLineOne", "Line #1", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("addressLineTwo", "Line #2", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("addressLineThree", "Line #3", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("city", "City", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("postalCode", "Postal Code", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(PostalAddress.class, new FieldDescriptor("country", "Country", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(Group.class, new FieldDescriptor("name", "Name", TextField.class, null, 200, null, String.class, "", false, true, true)); SiteFields.add(Group.class, new FieldDescriptor("description", "Description", TextField.class, null, -1, null, String.class, "", false, true, true)); SiteFields.add(Group.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(Group.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("firstName", "First Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("lastName", "Last Name", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("emailAddress", "Email Address", TextField.class, null, -1, null, String.class, "", false, true, true), new EmailValidator("Email address is not valid.")); SiteFields.add(User.class, new FieldDescriptor("emailAddressValidated", "Email Validated", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(User.class, new FieldDescriptor("passwordHash", "Password", PasswordField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("phoneNumber", "Phone Number", TextField.class, null, 150, null, String.class, "", false, true, true)); SiteFields.add(User.class, new FieldDescriptor("lockedOut", "Locked Out", CheckBox.class, null, 100, null, Boolean.class, false, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("failedLoginCount", "Failed Logins", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("openIdIdentifier", "Open ID Identifier", TextField.class, null, -1, null, String.class, "", false, true, false)); SiteFields.add(User.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(User.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(GroupMember.class, new FieldDescriptor("group", "Group", GroupField.class, null, 100, null, Group.class, null, false, true, true)); SiteFields.add(GroupMember.class, new FieldDescriptor("user", "User", UserField.class, null, 100, null, User.class, null, false, true, true)); SiteFields.add(GroupMember.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("address", "LDAP Address", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("port", "LDAP Port", TextField.class, new StringToIntegerConverter(), 50, null, Integer.class, null, false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("loginDn", "LDAP Login DN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("loginPassword", "LDAP Login Password", PasswordField.class, null, 100, null, String.class, "", false, false, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("userEmailAttribute", "LDAP User Email Attribute", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("userSearchBaseDn", "LDAP User search Base DN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("groupSearchBaseDn", "LDAP Group search Base DN", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("remoteLocalGroupMapping", "Remote-Local Group Mapping", TextField.class, null, 200, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("requiredRemoteGroup", "Required Remote Group", TextField.class, null, 100, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("subNetWhiteList", "Sub Net White List", TextField.class, null, 200, null, String.class, "", false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("enabled", "Enabled", CheckBox.class, null, 100, null, Boolean.class, false, false, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("created", "Created", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); SiteFields.add(UserDirectory.class, new FieldDescriptor("modified", "Modified", TimestampField.class, new TimestampConverter(), 150, null, Date.class, null, true, true, true)); }
From source file:qbic.vaadincomponents.ParameterComponent.java
License:Open Source License
public void buildForm(final Workflow workFlow) { parameterForm.removeAllComponents(); parameterFieldGroup = new FieldGroup(); inputListFieldGroup = new FieldGroup(); /*// w ww. j a va2s . com * for (Map.Entry<String, Parameter> entry : workFlow.getData().getData().entrySet()) { * FileParameter param = (FileParameter) entry.getValue(); FileNameValidator fileNameValidator = * new FileNameValidator("Please provide a valid file path"); TextField newField = * createInputField(param, fileNameValidator); * * parameterForm.addComponent(newField); inputListFieldGroup.bind(newField, entry.getKey()); // * Have to set it here because field gets cleared upon binding * newField.setValue(param.getValue().toString()); } */ for (Map.Entry<String, Parameter> entry : workFlow.getParameters().getParams().entrySet()) { if (entry.getValue() instanceof FloatParameter) { FloatParameter param = (FloatParameter) entry.getValue(); FloatRangeValidator floatValidator = new FloatRangeValidator( String.format("Parameter has to be in the range of %s to %s", param.getMinimum(), param.getMaximum()), param.getMinimum(), param.getMaximum()); TextField newField = createParameterField(param, floatValidator, new StringToFloatConverter()); parameterForm.addComponent(newField); parameterFieldGroup.bind(newField, entry.getKey()); // Have to set it here because field gets cleared upon binding newField.setValue(param.getValue().toString()); newField.setRequired(param.isRequired()); } else if (entry.getValue() instanceof IntParameter) { IntParameter param = (IntParameter) entry.getValue(); IntegerRangeValidator intValidator = new IntegerRangeValidator( String.format("Parameter has to be in the range of %s to %s", param.getMinimum(), param.getMaximum()), param.getMinimum(), param.getMaximum()); TextField newField = createParameterField(param, intValidator, new StringToIntegerConverter()); parameterForm.addComponent(newField); parameterFieldGroup.bind(newField, entry.getKey()); // Have to set it here because field gets cleared upon binding newField.setValue(param.getValue().toString()); newField.setRequired(param.isRequired()); } else if (entry.getValue() instanceof StringParameter) { StringParameter param = (StringParameter) entry.getValue(); if (param.getRange().size() == 0) { TextField newField = createInputField(param, null); parameterForm.addComponent(newField); parameterFieldGroup.bind(newField, entry.getKey()); // Have to set it here because field gets cleared upon binding newField.setValue(param.getValue().toString()); newField.setRequired(param.isRequired()); } else { ComboBox newField = createStringSelectionParameterField(param); parameterForm.addComponent(newField); parameterFieldGroup.bind(newField, entry.getKey()); // Have to set it here because field gets cleared upon binding newField.setValue(param.getValue().toString()); newField.setRequired(param.isRequired()); } } else if (entry.getValue() instanceof BooleanParameter) { BooleanParameter param = (BooleanParameter) entry.getValue(); CheckBox newField = createParameterCheckBox(param); newField.setValue((boolean) param.getValue()); parameterForm.addComponent(newField); parameterFieldGroup.bind(newField, entry.getKey()); // Have to set it here because field gets cleared upon binding newField.setValue((Boolean) param.getValue()); newField.setRequired(param.isRequired()); } } }
From source file:sph.vaadin.ui.videojs.VideojsSeekToController.java
License:Apache License
/** * Creates and sets up all UI components. */// ww w .ja v a 2 s. c o m private void doLayout() { HorizontalLayout compositionRoot = new HorizontalLayout(); compositionRoot.setMargin(true); compositionRoot.setSpacing(true); compositionRoot.setDefaultComponentAlignment(Alignment.BOTTOM_CENTER); hoursField = createTextField("00", 2); minutesField = createTextField("00", 2); secondsField = createTextField("00", 2); //hoursField.addValidator(new IntegerRangeValidator("Virheellinen aika tunnit", 0, 2)); minutesField.addValidator(new IntegerRangeValidator("Requires an integer between 0-59", 0, 59)); secondsField.addValidator(new IntegerRangeValidator("Requires an integer between 0-59", 0, 59)); compositionRoot.addComponents(hoursField, new Label(":"), minutesField, new Label(":"), secondsField, seekBtn); compositionRoot.setCaption("Seekto"); this.setCompositionRoot(compositionRoot); }