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

The following examples show how to use org.apache.wicket.markup.html.form.TextField#setLabel() . 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: StringEditor.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * 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 2
Source File: MailPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
protected void initBasicComponents() {
	add(new Label("subject", getString("ActionContributor.Run.destination.subject")));

	TextField<String> subjectField = new TextField<String>("subjectField", new PropertyModel<String>(destination,
			"mailSubject"));
	subjectField.setLabel(new Model<String>(getString("ActionContributor.Run.destination.subject")));
	add(subjectField);

	add(new Label("body", getString("ActionContributor.Run.destination.body")));

	TextArea<String> bodyArea = new TextArea<String>("bodyArea", new PropertyModel<String>(destination, "mailBody"));
	bodyArea.setLabel(new Model<String>(getString("ActionContributor.Run.destination.body")));
	add(bodyArea);

	add(new Label("to", getString("ActionContributor.Run.destination.to")));
	addTableLinks();

	provider = new RecipientDataProvider((SmtpDestination) destination);
	recipientsPanel = new RecipientsPanel("recipientsPanel", provider);
	add(recipientsPanel);
			
}
 
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: ArtifactNotificationRuleFormPopupPanel.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, ArtifactNotificationRuleFormPopupPanel.class);
	
	ruleForm = new Form<ArtifactNotificationRule>("form", getModel());
	body.add(ruleForm);
	
	TextField<String> regexField = new RequiredTextField<String>("regex", BindingModel.of(ruleForm.getModel(),
			Binding.artifactNotificationRule().regex()));
	regexField.setLabel(new ResourceModel("artifact.rules.field.regex"));
	ruleForm.add(regexField);
	
	ArtifactNotificationRuleTypeDropDownChoice typeField = new ArtifactNotificationRuleTypeDropDownChoice("type",
			BindingModel.of(ruleForm.getModel(), Binding.artifactNotificationRule().type()));
	typeField.setLabel(new ResourceModel("artifact.rules.field.type"));
	typeField.setRequired(true);
	ruleForm.add(typeField);
	
	return body;
}
 
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: 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 7
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 8
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 9
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 10
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 11
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 12
Source File: UserGroupFormPopupPanel.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, UserGroupFormPopupPanel.class);
	
	userGroupForm = new Form<UserGroup>("form", getModel());
	body.add(userGroupForm);
	
	TextField<String> nameField = new RequiredTextField<String>("name", BindingModel.of(userGroupForm.getModel(),
			Binding.userGroup().name()));
	nameField.setLabel(new ResourceModel("administration.usergroup.field.name"));
	userGroupForm.add(nameField);
	
	TextArea<String> descriptionField = new TextArea<String>("description", BindingModel.of(userGroupForm.getModel(),
			Binding.userGroup().description()));
	descriptionField.setLabel(new ResourceModel("administration.usergroup.field.description"));
	userGroupForm.add(descriptionField);
	
	final CheckGroup<Authority> authorityCheckGroup = new CheckGroup<Authority>("authoritiesGroup",
			BindingModel.of(userGroupForm.getModel(), Binding.userGroup().authorities()), Suppliers2.<Authority>hashSet());
	userGroupForm.add(authorityCheckGroup);
	
	ListView<Authority> authoritiesListView = new ListView<Authority>("authorities",
			Model.ofList(authorityUtils.getPublicAuthorities())) {
		private static final long serialVersionUID = -7557232825932251026L;
		
		@Override
		protected void populateItem(ListItem<Authority> item) {
			Authority authority = item.getModelObject();
			
			Check<Authority> authorityCheck = new Check<Authority>("authorityCheck",
					new GenericEntityModel<Long, Authority>(authority));
			
			authorityCheck.setLabel(new ResourceModel("administration.usergroup.authority." + authority.getName()));
			
			authorityCheckGroup.add(authorityCheck);
			item.add(authorityCheck);
		}
	};
	authorityCheckGroup.add(authoritiesListView);
	
	return body;
}
 
Example 13
Source File: UserFormPopupPanel.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
@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;
}