Java Code Examples for org.apache.wicket.markup.html.form.TextField#setRequired()
The following examples show how to use
org.apache.wicket.markup.html.form.TextField#setRequired() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JasperSettingsPanel.java From nextreports-server with Apache License 2.0 | 6 votes |
@Override protected void addComponents(Form<Settings> form) { final TextField<String> homeField = new TextField<String>("jasper.home"); homeField.setRequired(true); form.add(homeField); final CheckBox checkBoxD = new CheckBox("jasper.detectCellType"); form.add(checkBoxD); final CheckBox checkBoxW = new CheckBox("jasper.whitePageBackground"); form.add(checkBoxW); final CheckBox checkBoxR = new CheckBox("jasper.removeEmptySpaceBetweenRows"); form.add(checkBoxR); }
Example 2
Source File: StringEditor.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Construct simple text editor. * * @param id editor id. * @param markupProvider markup object. * @param model model. * @param labelModel label model * @param errorLabelModel error label model * @param attrValue {@link org.yes.cart.domain.entity.AttrValue} * @param readOnly if true this component is read only */ public StringEditor(final String id, final MarkupContainer markupProvider, final IModel<String> model, final IModel<String> labelModel, final IModel<String> errorLabelModel, final AttrValueWithAttribute attrValue, final boolean readOnly) { super(id, "stringEditor", markupProvider); final TextField textField = new TextField(EDIT, model); textField.setLabel(labelModel); textField.setRequired(attrValue.getAttribute().isMandatory()); textField.setEnabled(!readOnly); if (StringUtils.isNotBlank(attrValue.getAttribute().getRegexp())) { textField.add(new CustomPatternValidator(attrValue.getAttribute().getRegexp(), errorLabelModel)); } textField.add(new AttributeModifier("placeholder", labelModel)); add(textField); }
Example 3
Source File: CleanHistorySettingsPanel.java From nextreports-server with Apache License 2.0 | 6 votes |
@Override protected void addComponents(Form<Settings> form) { final TextField<String> cronField = new TextField<String>("cleanHistory.cronExpression"); cronField.setRequired(true); form.add(cronField); // ContextImage cronImage = new ContextImage("cronImage", "images/information.png"); cronImage.add(new SimpleTooltipBehavior(getString("Settings.synchronizer.cronTooltip"))); form.add(cronImage); // System.out.println("settings = " + form.getModelObject()); final TextField<Integer> daysToKeepField = new TextField<Integer>("cleanHistory.daysToKeep"); form.add(daysToKeepField); // final TextField<Integer> daysToDeleteField = new TextField<Integer>("cleanHistory.daysToDelete"); form.add(daysToDeleteField); // final CheckBox checkBoxEnable = new CheckBox("cleanHistory.shrinkDataFolder"); form.add(checkBoxEnable); // CleanHistorySettings settings = storageService.getSettings().getCleanHistory(); oldCronExpression = String.valueOf(settings.getCronExpression()); }
Example 4
Source File: SynchronizerSettingsPanel.java From nextreports-server with Apache License 2.0 | 6 votes |
@Override protected void addComponents(Form<Settings> form) { final TextField<String> cronField = new TextField<String>("synchronizer.cronExpression"); cronField.setRequired(true); form.add(cronField); ContextImage cronImage = new ContextImage("cronImage","images/information.png"); cronImage.add(new SimpleTooltipBehavior(getString("Settings.synchronizer.cronTooltip"))); form.add(cronImage); final CheckBox checkBoxD = new CheckBox("synchronizer.runOnStartup"); form.add(checkBoxD); final CheckBox checkBoxW = new CheckBox("synchronizer.createUsers"); form.add(checkBoxW); final CheckBox checkBoxR = new CheckBox("synchronizer.deleteUsers"); form.add(checkBoxR); oldCronExpression = String.valueOf(storageService.getSettings().getSynchronizer().getCronExpression()); }
Example 5
Source File: ProjectVersionFormPopupPanel.java From artifact-listener with Apache License 2.0 | 6 votes |
@Override protected Component createBody(String wicketId) { DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, ProjectVersionFormPopupPanel.class); form = new Form<ProjectVersion>("form", getModel()); body.add(form); TextField<String> versionField = new TextField<String>("version", BindingModel.of(getModel(), Binding.projectVersion().version())) { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); setVisible(ProjectVersionFormPopupPanel.this.isAddMode()); } }; versionField.setLabel(new ResourceModel("project.version.field.version")); versionField.setRequired(isAddMode()); versionField.add(new ProjectVersionPatternValidator()); form.add(versionField); form.add(new VersionAdditionalInformationFormComponentPanel("additionalInformationPanel", BindingModel.of(getModel(), Binding.projectVersion().additionalInformation()))); return body; }
Example 6
Source File: ExternalRecommenderTraitsEditor.java From inception with Apache License 2.0 | 5 votes |
public ExternalRecommenderTraitsEditor(String aId, IModel<Recommender> aRecommender) { super(aId, aRecommender); traits = toolFactory.readTraits(aRecommender.getObject()); Form<ExternalRecommenderTraits> form = new Form<ExternalRecommenderTraits>(MID_FORM, CompoundPropertyModel.of(Model.of(traits))) { private static final long serialVersionUID = -3109239605742291123L; @Override protected void onSubmit() { super.onSubmit(); toolFactory.writeTraits(aRecommender.getObject(), traits); } }; TextField<String> remoteUrl = new TextField<>("remoteUrl"); remoteUrl.setRequired(true); remoteUrl.add(new UrlValidator()); form.add(remoteUrl); CheckBox trainable = new CheckBox("trainable"); trainable.setOutputMarkupId(true); trainable.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> _target.add(getTrainingStatesChoice()))); form.add(trainable); getTrainingStatesChoice().add(visibleWhen(() -> trainable.getModelObject() == true)); add(form); }
Example 7
Source File: SchedulerSettingsPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
@Override protected void addComponents(Form<Settings> form) { final TextField<Integer> coreField = new TextField<Integer>("scheduler.corePoolSize"); coreField.setRequired(true); form.add(coreField); final TextField<Integer> maxField = new TextField<Integer>("scheduler.maxPoolSize"); maxField.setRequired(true); form.add(maxField); final TextField<Integer> queueField = new TextField<Integer>("scheduler.queueCapacity"); queueField.setRequired(true); form.add(queueField); }
Example 8
Source File: CopyPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected void initComponents() { add(new Label("fileName", getString("ActionContributor.Run.destination.fileName"))); TextField<String> fileNameField = new TextField<String>("fileNameField", new PropertyModel<String>(destination, "fileName")); fileNameField.setLabel(new Model<String>(getString("ActionContributor.Run.destination.fileName"))); fileNameField.setRequired(true); fileNameField.add(new JcrNameValidator()); add(fileNameField); }
Example 9
Source File: TransferPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected void initComponents() { add(new Label("host", getString("ActionContributor.Run.destination.host"))); TextField<String> hostField = new TextField<String>("hostField", new PropertyModel<String>(destination, "host")); hostField.setLabel(new Model<String>(getString("ActionContributor.Run.destination.host"))); hostField.setRequired(true); hostField.add(new JcrNameValidator()); add(hostField); add(new Label("port", getString("ActionContributor.Run.destination.port"))); TextField<Integer> portField = new TextField<Integer>("portField", new PropertyModel<Integer>(destination, "port")); add(portField); add(new Label("folder", getString("Folder"))); TextField<String> folderField = new TextField<String>("folderField", new PropertyModel<String>(destination, "folder")); add(folderField); add(new Label("username", getString("ActionContributor.Run.destination.username"))); TextField<String> userField = new TextField<String>("userField", new PropertyModel<String>(destination, "username")); add(userField); add(new Label("password", getString("ActionContributor.Run.destination.password"))); PasswordTextField passwordField = new PasswordTextField("passwordField", new PropertyModel<String>(destination, "password")); passwordField.setRequired(false); passwordField.setResetPassword(false); add(passwordField); add(new Label("changedFileName", getString("ActionContributor.Run.destination.changedFileName"))); TextField<String> fileNameField = new TextField<String>("changedFileNameField", new PropertyModel<String>(destination, "changedFileName")); fileNameField.setLabel(new Model<String>(getString("ActionContributor.Run.destination.changedFileName"))); fileNameField.setRequired(false); fileNameField.add(new JcrNameValidator()); add(fileNameField); }
Example 10
Source File: AddEmailPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
public AddEmailPanel(String id) { super(id); TextField<String> editor = new TextField<String>("email", new PropertyModel<String>(this, "email")); editor.setRequired(true); add(editor); }
Example 11
Source File: MailPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected void initSpecificComponents() { add(new Label("changedFileName", getString("ActionContributor.Run.destination.changedFileName"))); TextField<String> fileNameField = new TextField<String>("changedFileNameField", new PropertyModel<String>(destination, "changedFileName")); fileNameField.setLabel(new Model<String>(getString("ActionContributor.Run.destination.changedFileName"))); fileNameField.setRequired(false); fileNameField.add(new JcrNameValidator()); add(fileNameField); }
Example 12
Source File: GeneralWidgetRuntimePanel.java From nextreports-server with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public void addWicketComponents() { TextField<Integer> refreshText = new TextField<Integer>("refreshTime", new PropertyModel(runtimeModel, "refreshTime")); refreshText.setRequired(true); refreshText.add(new ZeroRangeValidator(10, 3600)); add(refreshText); TextField<Integer> timeoutText = new TextField<Integer>("timeout", new PropertyModel(runtimeModel, "timeout")); timeoutText.add(new RangeValidator<Integer>(5, 600)); timeoutText.setLabel(new Model<String>("Timeout")); timeoutText.setRequired(true); add(timeoutText); }
Example 13
Source File: TableWidgetRuntimePanel.java From nextreports-server with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public void addWicketComponents() { super.addWicketComponents(); TextField<Integer> rowsPerPageText = new TextField<Integer>("rowsPerPage", new PropertyModel(runtimeModel, "rowsPerPage")); rowsPerPageText.setRequired(true); rowsPerPageText.add(new RangeValidator<Integer>(5, 100)); add(rowsPerPageText); final CheckBox filterChkBox = new CheckBox("enableFilter", new PropertyModel(runtimeModel, "enableFilter")); add(filterChkBox); }
Example 14
Source File: ProjectDetailPanel.java From webanno with Apache License 2.0 | 5 votes |
public ProjectDetailPanel(String id, IModel<Project> aModel) { super(id, aModel); projectModel = aModel; Form<Project> form = new Form<>("form", CompoundPropertyModel.of(aModel)); add(form); TextField<String> projectNameTextField = new TextField<>("name"); projectNameTextField.setRequired(true); projectNameTextField.add(new ProjectExistsValidator()); projectNameTextField.add(new ProjectNameValidator()); form.add(projectNameTextField); // If we run in development mode, then also show the ID of the project form.add(idLabel = new Label("id")); idLabel.setVisible(RuntimeConfigurationType.DEVELOPMENT .equals(getApplication().getConfigurationType())); form.add(new TextArea<String>("description").setOutputMarkupId(true)); DropDownChoice<ScriptDirection> scriptDirection = new BootstrapSelect<>("scriptDirection"); scriptDirection.setChoiceRenderer(new EnumChoiceRenderer<>(this)); scriptDirection.setChoices(Arrays.asList(ScriptDirection.values())); form.add(scriptDirection); form.add(new CheckBox("disableExport").setOutputMarkupPlaceholderTag(true)); form.add(new CheckBox("anonymousCuration").setOutputMarkupPlaceholderTag(true)); form.add(projectTypes = makeProjectTypeChoice()); form.add(new LambdaAjaxButton<>("save", this::actionSave)); }
Example 15
Source File: PubAnnotationProviderTraitsEditor.java From inception with Apache License 2.0 | 5 votes |
public PubAnnotationProviderTraitsEditor(String aId, IModel<DocumentRepository> aDocumentRepository) { super(aId, aDocumentRepository); documentRepository = aDocumentRepository.getObject(); properties = externalSearchProviderFactory.readTraits(documentRepository); Form<PubAnnotationProviderTraits> form = new Form<PubAnnotationProviderTraits>( MID_FORM, CompoundPropertyModel.of(Model.of(properties))) { private static final long serialVersionUID = -3109239608742291123L; @Override protected void onSubmit() { super.onSubmit(); externalSearchProviderFactory.writeTraits(documentRepository, properties); } }; TextField<String> remoteUrl = new TextField<>("url"); remoteUrl.setRequired(true); remoteUrl.add(new UrlValidator()); form.add(remoteUrl); add(form); }
Example 16
Source File: ChartRuntimePanel.java From nextreports-server with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") public void addWicketComponents() { ChoiceRenderer<String> typeRenderer = new ChoiceRenderer<String>() { @Override public Object getDisplayValue(String chartType) { if (chartType == null) { return ChartUtil.CHART_NONE; } else if (chartType.equals(ChartUtil.CHART_BAR)) { return getString("chart.bar"); } else if (chartType.equals(ChartUtil.CHART_NEGATIVE_BAR)) { return getString("chart.negativebar"); } else if (chartType.equals(ChartUtil.CHART_BAR_COMBO)) { return getString("chart.barcombo"); } else if (chartType.equals(ChartUtil.CHART_HORIZONTAL_BAR)) { return getString("chart.horizontalbar"); } else if (chartType.equals(ChartUtil.CHART_STACKED_BAR)) { return getString("chart.stackedbar"); } else if (chartType.equals(ChartUtil.CHART_STACKED_BAR_COMBO)) { return getString("chart.stackedbarcombo"); } else if (chartType.equals(ChartUtil.CHART_HORIZONTAL_STACKED_BAR)) { return getString("chart.horizontalstackedbar"); } else if (chartType.equals(ChartUtil.CHART_PIE)) { return getString("chart.pie"); } else if (chartType.equals(ChartUtil.CHART_LINE)) { return getString("chart.line"); } else if (chartType.equals(ChartUtil.CHART_AREA)) { return getString("chart.area"); } else if (chartType.equals(ChartUtil.CHART_BUBBLE)) { return getString("chart.bubble"); } else { return ChartUtil.CHART_NONE; } } }; DropDownChoice exportChoice = new DropDownChoice("chartType", new PropertyModel(runtimeModel, "chartType"), ChartUtil.CHART_TYPES, typeRenderer); exportChoice.setRequired(true); add(exportChoice); TextField<Integer> refreshText = new TextField<Integer>("refreshTime", new PropertyModel(runtimeModel, "refreshTime")); refreshText.add(new ZeroRangeValidator(10, 3600)); refreshText.setRequired(true); add(refreshText); TextField<Integer> timeoutText = new TextField<Integer>("timeout", new PropertyModel(runtimeModel, "timeout")); timeoutText.add(new RangeValidator<Integer>(5, 600)); timeoutText.setLabel(new Model<String>("Timeout")); timeoutText.setRequired(true); add(timeoutText); }
Example 17
Source File: RestorePasswordPanel.java From Orienteer with Apache License 2.0 | 4 votes |
private TextField<String> createEmailTextField(String id) { TextField<String> emailTextField = new EmailTextField(id, emailModel); emailTextField.setRequired(true); return emailTextField; }
Example 18
Source File: UserFormPopupPanel.java From artifact-listener with Apache License 2.0 | 4 votes |
@Override protected Component createBody(String wicketId) { DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, UserFormPopupPanel.class); userForm = new Form<User>("form", getModel()); body.add(userForm); TextField<String> emailField = new EmailTextField("email", BindingModel.of(userForm.getModel(), Binding.user().email())) { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); setVisible(UserFormPopupPanel.this.isAddMode()); } }; emailField.setLabel(new ResourceModel("administration.user.field.email")); emailField.setRequired(isAddMode()); userForm.add(emailField); TextField<String> fullNameField = new TextField<String>("fullName", BindingModel.of(userForm.getModel(), Binding.user().fullName())); fullNameField.setLabel(new ResourceModel("administration.user.field.fullName")); userForm.add(fullNameField); WebMarkupContainer passwordContainer = new WebMarkupContainer("passwordContainer") { private static final long serialVersionUID = 2727669661139358058L; @Override protected void onConfigure() { super.onConfigure(); setVisible(UserFormPopupPanel.this.isAddMode()); } }; userForm.add(passwordContainer); CheckBox activeField = new CheckBox("active", BindingModel.of(userForm.getModel(), Binding.user().active())); activeField.setLabel(new ResourceModel("administration.user.field.active")); passwordContainer.add(activeField); newPasswordField = new PasswordTextField("newPassword", Model.of("")); newPasswordField.setLabel(new ResourceModel("administration.user.field.password")); newPasswordField.setRequired(true); passwordContainer.add(newPasswordField); confirmPasswordField = new PasswordTextField("confirmPassword", Model.of("")); confirmPasswordField.setLabel(new ResourceModel("administration.user.field.confirmPassword")); confirmPasswordField.setRequired(true); passwordContainer.add(confirmPasswordField); LocaleDropDownChoice localeField = new LocaleDropDownChoice("locale", BindingModel.of(userForm.getModel(), Binding.user().locale())); localeField.setLabel(new ResourceModel("administration.user.field.locale")); userForm.add(localeField); return body; }
Example 19
Source File: ElasticSearchProviderTraitsEditor.java From inception with Apache License 2.0 | 4 votes |
public ElasticSearchProviderTraitsEditor(String aId, IModel<DocumentRepository> aDocumentRepository) { super(aId, aDocumentRepository); documentRepository = aDocumentRepository.getObject(); properties = externalSearchProviderFactory.readTraits(documentRepository); Form<ElasticSearchProviderTraits> form = new Form<ElasticSearchProviderTraits>( MID_FORM, CompoundPropertyModel.of(Model.of(properties))) { private static final long serialVersionUID = -3109239608742291123L; @Override protected void onSubmit() { super.onSubmit(); externalSearchProviderFactory.writeTraits(documentRepository, properties); } }; TextField<String> remoteUrl = new TextField<>("remoteUrl"); remoteUrl.setRequired(true); remoteUrl.add(new UrlValidator()); form.add(remoteUrl); TextField<String> indexName = new TextField<>("indexName"); indexName.setRequired(true); form.add(indexName); TextField<String> searchPath = new TextField<>("searchPath"); searchPath.setRequired(true); form.add(searchPath); TextField<String> objectType = new TextField<>("objectType"); objectType.setRequired(true); form.add(objectType); TextField<String> defaultField = new TextField<>("defaultField"); objectType.setRequired(true); form.add(defaultField); NumberTextField<Integer> resultSize = new NumberTextField<>("resultSize", Integer.class); resultSize.setMinimum(1); resultSize.setMaximum(10000); resultSize.setRequired(true); form.add(resultSize); NumberTextField<Integer> seed = new NumberTextField<Integer>("seed", Integer.class); seed.setMinimum(0); seed.setMaximum(Integer.MAX_VALUE); seed.add(visibleWhen(() -> properties.isRandomOrder())); seed.add(new AttributeModifier("title", new ResourceModel("seedTooltip"))); seed.setOutputMarkupPlaceholderTag(true); seed.setRequired(true); form.add(seed); CheckBox randomOrder = new CheckBox("randomOrder"); randomOrder.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> t.add(seed, randomOrder))); form.add(randomOrder); add(form); }
Example 20
Source File: GeneralSettingsPanel.java From nextreports-server with Apache License 2.0 | 4 votes |
@Override protected void addComponents(Form<Settings> form) { final TextField<String> urlField = new TextField<String>("baseUrl"); urlField.add(new UrlValidator()); urlField.setRequired(true); form.add(urlField); ContextImage urlImage = new ContextImage("urlImage","images/exclamation.png"); urlImage.add(new SimpleTooltipBehavior(getString("Settings.general.baseUrlTooltip"))); form.add(urlImage); final TextField<String> reportsHomeField = new TextField<String>("reportsHome"); reportsHomeField.setRequired(true); form.add(reportsHomeField); ContextImage homeImage = new ContextImage("homeImage","images/exclamation.png"); homeImage.add(new SimpleTooltipBehavior(getString("Settings.general.reportsHomeTooltip"))); form.add(homeImage); final TextField<String> reportsUrlField = new TextField<String>("reportsUrl"); reportsUrlField.add(new UrlValidator()); reportsUrlField.setRequired(true); form.add(reportsUrlField); ContextImage repImage = new ContextImage("repImage","images/exclamation.png"); repImage.add(new SimpleTooltipBehavior(getString("Settings.general.reportsUrlTooltip"))); form.add(repImage); final TextField<Integer> conTimeoutField = new TextField<Integer>("connectionTimeout"); conTimeoutField.setRequired(true); form.add(conTimeoutField); ContextImage conImage = new ContextImage("conImage","images/information.png"); conImage.add(new SimpleTooltipBehavior(getString("Settings.general.connectTimeoutTooltip"))); form.add(conImage); final TextField<Integer> timeoutField = new TextField<Integer>("queryTimeout"); timeoutField.setRequired(true); form.add(timeoutField); ContextImage timeoutImage = new ContextImage("timeoutImage","images/information.png"); timeoutImage.add(new SimpleTooltipBehavior(getString("Settings.general.queryTimeoutTooltip"))); form.add(timeoutImage); final TextField<Integer> updateIntervalField = new TextField<Integer>("updateInterval"); updateIntervalField.setRequired(true); form.add(updateIntervalField); ContextImage updateImage = new ContextImage("updateImage","images/information.png"); updateImage.add(new SimpleTooltipBehavior(getString("Settings.general.updateIntervalTooltip"))); form.add(updateImage); final TextField<Integer> pollingIntervalField = new TextField<Integer>("pollingInterval"); pollingIntervalField.setRequired(true); form.add(pollingIntervalField); ContextImage poolingImage = new ContextImage("pollingImage","images/information.png"); poolingImage.add(new SimpleTooltipBehavior(getString("Settings.general.pollingIntervalTooltip"))); form.add(poolingImage); final TextField<Integer> uploadSizeField = new TextField<Integer>("uploadSize"); uploadSizeField.setRequired(true); form.add(uploadSizeField); ContextImage uploadSizeImage = new ContextImage("uploadSizeImage","images/information.png"); uploadSizeImage.add(new SimpleTooltipBehavior(getString("Settings.general.uploadSizeTooltip"))); form.add(uploadSizeImage); final CheckBox autoOpenField = new CheckBox("autoOpen"); form.add(autoOpenField); Settings settings = storageService.getSettings(); oldReportsHome = String.valueOf(settings.getReportsHome()); }