Java Code Examples for org.apache.wicket.markup.html.form.TextField#add()

The following examples show how to use org.apache.wicket.markup.html.form.TextField#add() . 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: ColorPickerPanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @see org.apache.wicket.Component#onInitialize()
 */
@Override
protected void onInitialize()
{
  super.onInitialize();
  final Form<Void> colorForm = new Form<Void>("colorForm");
  add(colorForm);
  final TextField<String> colorField = new TextField<String>("color", new PropertyModel<String>(this, "selectedColor"));
  colorField.add(new AjaxFormComponentUpdatingBehavior("onChange") {
    private static final long serialVersionUID = 1L;

    /**
     * @see org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior#onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)
     */
    @Override
    protected void onUpdate(final AjaxRequestTarget target)
    {
      onColorUpdate(selectedColor);
    }
  });
  colorForm.add(colorField);
  // colorpicker js
  final JavaScriptTemplate jsTemplate = new JavaScriptTemplate(new PackageTextTemplate(ColorPickerPanel.class, "ColorPicker.js.template"));
  final String javaScript = jsTemplate.asString(new MicroMap<String, String>("markupId", colorField.getMarkupId()));
  add(new Label("template", javaScript).setEscapeModelStrings(false));
}
 
Example 2
Source File: OClassSearchPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupPlaceholderTag(true);
    if ((selectedClassModel == null || selectedClassModel.getObject() == null) && !classesGetter.get().isEmpty())
        selectedClassModel = new OClassModel(classesGetter.get().get(0));

    Form<String> form = new Form<>("form", getModel());
    TextField<String> field = new TextField<>("query", getModel());
    field.setOutputMarkupId(true);
    field.add(AttributeModifier.replace("placeholder", new ResourceModel("page.search.placeholder").getObject()));
    form.add(field);
    form.add(createSearchButton("search"));
    form.add(createTabsPanel("tabs"));
    form.add(resultsContainer = createResultsContainer("resultsContainer"));
    add(form);
    resultsContainer.add(createEmptyLabel("resultsLabel"));
    prepareResults();
}
 
Example 3
Source File: ProjectVersionFormPopupPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
@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 4
Source File: AbstractDestinationPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private void addComponents() {
    add(new Label("name", getString("name")));
    
    TextField<String> displayNameField = new TextField<String>("nameField", new PropertyModel<String>(destination, "name"));
    displayNameField.setLabel(new Model<String>( getString("name")));
    displayNameField.setRequired(true);
    displayNameField.add(new JcrNameValidator());
    add(displayNameField);

    initComponents();
}
 
Example 5
Source File: GeneralWidgetRuntimePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: CopyPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
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 7
Source File: AbstractListForm.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a simple TextField and sets the focus on it. Overwrite this method if you want to add for example an auto completion text field
 * (ajax). Please don't forget to call addSearchFieldTooltip() in your method!
 */
protected TextField< ? > createSearchTextField()
{
  final TextField<String> searchField = new TextField<String>(InputPanel.WICKET_ID, new PropertyModel<String>(getSearchFilter(),
      "searchString"));
  createSearchFieldTooltip(searchField);
  searchField.add(WicketUtils.setFocus());
  return searchField;
}
 
Example 8
Source File: TransferPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
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 9
Source File: DistributionSettingsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
protected void addComponents(Form<Settings> form) {

	final TextField<String> mailServerIpField = new TextField<String>("mailServer.ip");
       form.add(mailServerIpField);
       final TextField<Integer> mailServerPortField = new TextField<Integer>("mailServer.port");
       form.add(mailServerPortField);
       final TextField<String> mailServerSenderField = new TextField<String>("mailServer.from");
       form.add(mailServerSenderField);
       final TextField<String> mailServerUsernameField = new TextField<String>("mailServer.username");
       form.add(mailServerUsernameField);
       final PasswordTextField mailServerPasswordField = new PasswordTextField("mailServer.password");
       mailServerPasswordField.setResetPassword(false);
       mailServerPasswordField.setRequired(false);
       form.add(mailServerPasswordField);
       final CheckBox tlsCheckField = new CheckBox("mailServer.enableTls");
       form.add(tlsCheckField);        
       form.add(new MailServerValidator(new FormComponent[] {mailServerIpField, mailServerPortField, mailServerSenderField}));
       
       final TextField<String> distributorDatePatternField = new TextField<String>("distributor.datePattern");
       distributorDatePatternField.add(new JcrNameValidator(getString("Settings.general.distributorDatePattern.error")));
       form.add(distributorDatePatternField);
       final TextField<String> distributorTimePatternField = new TextField<String>("distributor.timePattern");
       distributorTimePatternField.add(new JcrNameValidator(getString("Settings.general.distributorTimePattern.error")));
       form.add(distributorTimePatternField);
       
       Settings settings = storageService.getSettings();
       oldMailPort = settings.getMailServer().getPort();
       oldMailIp = settings.getMailServer().getIp();
       
}
 
Example 10
Source File: MailPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
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 11
Source File: PaginatePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public PaginatePanel(IModel<Analysis> model) {		
	super(FormPanel.CONTENT_ID);
	
	add(new Label("info", new StringResourceModel("PaginatePanel.info", null, null)));
	
	add(new Label("rows",  new StringResourceModel("PaginatePanel.rows", this, null)));
	TextField<Integer> rowsText = new TextField<Integer>("rowsText", new PropertyModel<Integer>(model.getObject(), "rowsPerPage"));
	rowsText.add(RangeValidator.range(1, 500));
	rowsText.setLabel(new StringResourceModel("PaginatePanel.rows", this, null));
		add(rowsText);		 		 		
}
 
Example 12
Source File: AbstractInfoPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public EditMode(String id, CompoundPropertyModel<T> compoundModel) {
    super(id, "editMode", AbstractInfoPanel.this);
    
    // set up form components
    TextField<String> name = new TextField<>("name", compoundModel.bind("name"));
    name.add(AttributeModifier.append("placeholder",
            new ResourceModel(getNamePlaceholderResourceKey())));
    name.setOutputMarkupId(true);
    focusComponent = name;

    // there exists functionality to cancel the "new KBObject" prompt, but in hindsight, MB
    // thinks this functionality is not really needed in the UI, so the button is hidden
    // here
    LambdaAjaxLink cancelButton = new LambdaAjaxLink("cancel",
            AbstractInfoPanel.this::actionCancel)
                    .onConfigure((_this) -> _this.setVisible(false));
    cancelButton.add(new Label("label", new ResourceModel(getCancelButtonResourceKey())));

    LambdaAjaxButton<T> createButton = new LambdaAjaxButton<>("create",
            AbstractInfoPanel.this::actionCreate);
    createButton.add(new Label("label", new ResourceModel(getCreateButtonResourceKey())));

    Form<T> form = new Form<T>("form", compoundModel);
    form.add(name);
    form.add(cancelButton);
    form.add(createButton);
    form.setDefaultButton(createButton);
    add(form);
}
 
Example 13
Source File: RootConceptsPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
private TextField<String> buildTextField(String id, IModel<IRI> model) {
    IModel<String> adapter = new LambdaModelAdapter<String>(
        () -> model.getObject().stringValue(),
        str -> model.setObject(SimpleValueFactory.getInstance().createIRI(str)));

    TextField<String> iriTextfield = new TextField<>(id, adapter);
    iriTextfield.setOutputMarkupId(true);
    iriTextfield.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> {
        // Do nothing just update the model values
    }));
    iriTextfield.setEnabled(false);
    return iriTextfield;
}
 
Example 14
Source File: CompanyProfileEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public CompanyProfileEdit(String id, CompanyProfile companyProfile) {

		super(id, new Model(companyProfile));

		WebMarkupContainer companyNameContainer = new WebMarkupContainer(
				"companyNameContainer");
		companyNameContainer.add(new Label("companyNameLabel",
				new ResourceModel("profile.business.company.name")));
		TextField companyName = new TextField("companyName",
				new PropertyModel(companyProfile, "companyName"));
		companyName.setOutputMarkupId(true);
		companyNameContainer.add(companyName);
		String companyNameId = companyName.getMarkupId();
		Label companyNameAccessibilityLabel = new Label("companyNameAccessibilityLabel", new ResourceModel("accessibility.profile.companyname.input"));
		companyNameAccessibilityLabel.add(new AttributeAppender("for",new Model(companyNameId)," "));
		companyNameContainer.add(companyNameAccessibilityLabel);

		add(companyNameContainer);

		WebMarkupContainer companyWebAddressContainer = new WebMarkupContainer(
				"companyWebAddressContainer");
		companyWebAddressContainer.add(new Label("companyWebAddressLabel",
				new ResourceModel("profile.business.company.web")));

		TextField companyWebAddress = new TextField("companyWebAddress",
				new PropertyModel(companyProfile, "companyWebAddress")) {

			private static final long serialVersionUID = 1L;

			// add http:// if missing
			@Override
			protected void convertInput() {
				String input = getInput();

				if (StringUtils.isNotBlank(input)
						&& !(input.startsWith("http://") || input
								.startsWith("https://"))) {
					setConvertedInput("http://" + input);
				} else {
					setConvertedInput(StringUtils.isBlank(input) ? null : input);
				}
			}
		};
		companyWebAddress.setOutputMarkupId(true);
		companyWebAddress.add(new UrlValidator());
		companyWebAddressContainer.add(companyWebAddress);
		String companyUrlId = companyWebAddress.getMarkupId();
		Label companyUrlAccessibilityLabel = new Label("companyUrlAccessibilityLabel", new ResourceModel("accessibility.profile.companyurl.input"));
		companyUrlAccessibilityLabel.add(new AttributeAppender("for",new Model(companyUrlId)," "));
		companyWebAddressContainer.add(companyUrlAccessibilityLabel);

		final FeedbackLabel companyWebAddressFeedback = new FeedbackLabel(
				"companyWebAddressFeedback", companyWebAddress);
		companyWebAddressFeedback.setOutputMarkupId(true);
		companyWebAddressContainer.add(companyWebAddressFeedback);
		companyWebAddress.add(new ComponentVisualErrorBehaviour("onblur",
				companyWebAddressFeedback));
		companyWebAddress.add(new AttributeAppender("aria-describedby",new Model(companyWebAddressFeedback.getMarkupId())," "));

		add(companyWebAddressContainer);

		WebMarkupContainer companyDescriptionContainer = new WebMarkupContainer(
				"companyDescriptionContainer");
		companyDescriptionContainer.add(new Label("companyDescriptionLabel",
				new ResourceModel("profile.business.company.description")));
		TextArea companyDescription = new TextArea("companyDescription",
				new PropertyModel(companyProfile, "companyDescription"));
		companyDescription.setOutputMarkupId(true);
		companyDescriptionContainer.add(companyDescription);
		String companyDescriptionId = companyDescription.getMarkupId();
		Label companyDescriptionAccessibilityLabel = new Label("companyDescriptionAccessibilityLabel", new ResourceModel("accessibility.profile.companydescription.input"));
		companyDescriptionAccessibilityLabel.add(new AttributeAppender("for",new Model(companyDescriptionId)," "));
		companyDescriptionContainer.add(companyDescriptionAccessibilityLabel);

		add(companyDescriptionContainer);
	}
 
Example 15
Source File: ConsumerAdministration.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private void init(final boolean edit) {
    addMenuLink(ListConsumers.class, new ResourceModel("menu.list.consumer"), null);
    addMenuLink(ConsumerAdministration.class, new ResourceModel("menu.add.consumer"), null);

    Form consumerForm = new Form<Void>("consumerForm") {
        @Override
        protected void onSubmit() {
            super.onSubmit();
            try {
                if (edit)
                    oAuthAdminService.updateConsumer(consumer);
                else
                    oAuthAdminService.createConsumer(consumer);
                setResponsePage(ListConsumers.class);
                getSession().info(consumer.getName() + " has been saved.");
            } catch (Exception e) {
                error("Couldn't update '" + consumer.getName() + "': " + e.getLocalizedMessage());
            }
        }
    };

    TextField<String> idTextField;
    if (edit) {
        idTextField = new TextField<String>("id");
        idTextField.add(new AttributeModifier("disabled", "disabled"));
        idTextField.setModel(Model.of(consumer.getId()));
    } else {
        idTextField = new RequiredTextField<String>("id", new PropertyModel<String>(consumer, "id"));
    }
    consumerForm.add(idTextField);

    consumerForm.add(new RequiredTextField<String>("name", new PropertyModel<String>(consumer, "name")));
    consumerForm.add(new TextArea<String>("description", new PropertyModel<String>(consumer, "description")));
    consumerForm.add(new TextField<String>("url", new PropertyModel<String>(consumer, "url")));
    consumerForm.add(new TextField<String>("callbackUrl", new PropertyModel<String>(consumer, "callbackUrl")));
    consumerForm.add(new RequiredTextField<String>("secret", new PropertyModel<String>(consumer, "secret")));
    consumerForm.add(new TextField<String>("accessorSecret",
            new PropertyModel<String>(consumer, "accessorSecret")));
    consumerForm.add(new TextField<Integer>("defaultValidity",
            new PropertyModel<Integer>(consumer, "defaultValidity")));

    // Create a list of possible rights as checkboxes, pre-check already granted permissions
    CheckBoxMultipleChoice<String> rightCheckboxes = new CheckBoxMultipleChoice<String>("rights",
            new PropertyModel<Collection<String>>(consumer, "rights"), getAvailableFunctions());
    consumerForm.add(rightCheckboxes);

    add(new Label("consumerName", consumer.getName()));
    add(consumerForm);
}
 
Example 16
Source File: FollowedArtifactNotificationRulesDemoPanel.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
public FollowedArtifactNotificationRulesDemoPanel(String id, IModel<List<ArtifactNotificationRule>> rulesModel) {
	super(id, rulesModel);
	
	add(new Label("title", new ResourceModel("artifact.rules.demo.title")));
	
	add(new Label("demoDescription", new ResourceModel("artifact.rules.demo.text")));
	
	final IModel<String> demoTextModel = Model.of();
	final IModel<Boolean> willNotifyModel = Model.of(false);
	IModel<String> demoResultModel = new LoadableDetachableModel<String>() {
		private static final long serialVersionUID = 1L;

		@Override
		protected String load() {
			if (!StringUtils.hasText(demoTextModel.getObject())) {
				return getString("artifact.rules.demo.label.empty");
			} else if (willNotifyModel.getObject()) {
				return getString("artifact.rules.demo.label.willNotify");
			}
			return getString("artifact.rules.demo.label.willIgnore");
		}
	};
	
	final Label demoResultLabel = new Label("demoResultLabel", demoResultModel);
	demoResultLabel.setOutputMarkupId(true);
	demoResultLabel.add(new AttributeModifier("class", LABEL_INFO_CLASS));
	add(demoResultLabel);
	
	TextField<String> demoInput = new TextField<String>("demoInput", demoTextModel);
	demoInput.add(new OnChangeAjaxBehavior() {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(AjaxRequestTarget target) {
			String version = demoTextModel.getObject();
			boolean willNotify = false;
			String textClass;

			if (StringUtils.hasText(version)) {
				willNotify = artifactNotificationRuleService.checkRulesForVersion(version, getModelObject());
				textClass = (willNotify) ? LABEL_SUCCESS_CLASS : LABEL_ERROR_CLASS;
			} else {
				textClass = LABEL_INFO_CLASS;
			}
			demoResultLabel.add(new AttributeModifier("class", textClass));

			willNotifyModel.setObject(willNotify);
			target.add(demoResultLabel);
		}
	});
	add(demoInput);
}
 
Example 17
Source File: ConsumerAdministration.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private void init(final boolean edit) {
    addMenuLink(ListConsumers.class, new ResourceModel("menu.list.consumer"), null);
    addMenuLink(ConsumerAdministration.class, new ResourceModel("menu.add.consumer"), null);

    Form consumerForm = new Form<Void>("consumerForm") {
        @Override
        protected void onSubmit() {
            super.onSubmit();
            try {
                if (edit)
                    oAuthAdminService.updateConsumer(consumer);
                else
                    oAuthAdminService.createConsumer(consumer);
                setResponsePage(ListConsumers.class);
                getSession().info(consumer.getName() + " has been saved.");
            } catch (Exception e) {
                error("Couldn't update '" + consumer.getName() + "': " + e.getLocalizedMessage());
            }
        }
    };

    TextField<String> idTextField;
    if (edit) {
        idTextField = new TextField<String>("id");
        idTextField.add(new AttributeModifier("disabled", "disabled"));
        idTextField.setModel(Model.of(consumer.getId()));
    } else {
        idTextField = new RequiredTextField<String>("id", new PropertyModel<String>(consumer, "id"));
    }
    consumerForm.add(idTextField);

    consumerForm.add(new RequiredTextField<String>("name", new PropertyModel<String>(consumer, "name")));
    consumerForm.add(new TextArea<String>("description", new PropertyModel<String>(consumer, "description")));
    consumerForm.add(new TextField<String>("url", new PropertyModel<String>(consumer, "url")));
    consumerForm.add(new TextField<String>("callbackUrl", new PropertyModel<String>(consumer, "callbackUrl")));
    consumerForm.add(new RequiredTextField<String>("secret", new PropertyModel<String>(consumer, "secret")));
    consumerForm.add(new TextField<String>("accessorSecret",
            new PropertyModel<String>(consumer, "accessorSecret")));
    consumerForm.add(new TextField<Integer>("defaultValidity",
            new PropertyModel<Integer>(consumer, "defaultValidity")));

    // Create a list of possible rights as checkboxes, pre-check already granted permissions
    CheckBoxMultipleChoice<String> rightCheckboxes = new CheckBoxMultipleChoice<String>("rights",
            new PropertyModel<Collection<String>>(consumer, "rights"), getAvailableFunctions());
    consumerForm.add(rightCheckboxes);

    add(new Label("consumerName", consumer.getName()));
    add(consumerForm);
}
 
Example 18
Source File: GeneralSettingsPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
@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());        
   }
 
Example 19
Source File: ChartRuntimePanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
@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 20
Source File: ElasticSearchProviderTraitsEditor.java    From inception with Apache License 2.0 4 votes vote down vote up
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);
}