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

The following are Jave code examples for showing how to use setLabel() of the org.apache.wicket.markup.html.form.TextField class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: owsi-core-parent   File: UserSearchPanel.java   Source Code and License Vote up 7 votes
public UserSearchPanel(String id, IPageable pageable, AbstractUserDataProvider<User> dataProvider) {
	super(id);
	
	// Quick search
	add(new UserQuickSearchComponent("userQuickSearch"));
	
	// Search form
	Form<Void> form = new PageableSearchForm<Void>("form", pageable);
	
	TextField<String> searchInput = new TextField<String>("searchInput", dataProvider.getNameModel());
	searchInput.setLabel(new ResourceModel("user.portfolio.search.name"));
	searchInput.add(new LabelPlaceholderBehavior());
	form.add(searchInput);
	
	CheckBox active = new CheckBox("includeInactive", dataProvider.getIncludeInactivesModel());
	active.setLabel(new ResourceModel("user.portfolio.search.includeInactive"));
	form.add(active);
	
	add(form);
}
 
Example 2
Project: owsi-core-parent   File: AddUserPopupPanel.java   Source Code and License Vote up 6 votes
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, AddUserPopupPanel.class);
	
	addUserForm = new Form<User>("addUserForm", getModel());
	body.add(addUserForm);
	
	TextField<String> userName = new RequiredTextField<String>("userName", BindingModel.of(addUserForm.getModel(), Bindings.user().userName()));
	userName.setLabel(new ResourceModel("widgets.modal.user.userName"));
	addUserForm.add(userName);
	
	TextField<String> firstName = new RequiredTextField<String>("firstName", BindingModel.of(addUserForm.getModel(), Bindings.user().firstName()));
	firstName.setLabel(new ResourceModel("widgets.modal.user.firstName"));
	addUserForm.add(firstName);
	
	TextField<String> lastName = new RequiredTextField<String>("lastName", BindingModel.of(addUserForm.getModel(), Bindings.user().lastName()));
	lastName.setLabel(new ResourceModel("widgets.modal.user.lastName"));
	addUserForm.add(lastName);
	
	EmailTextField email = new EmailTextField("email", BindingModel.of(addUserForm.getModel(), Bindings.user().email()));
	email.setRequired(true);
	email.setLabel(new ResourceModel("widgets.modal.user.email"));
	addUserForm.add(email);
	
	return body;
}
 
Example 3
Project: MBaaS   File: StringPanel.java   Source Code and License Vote up 5 votes
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<String> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(name));
    field.add(StringValidator.maximumLength(255));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 4
Project: MBaaS   File: DoublePanel.java   Source Code and License Vote up 5 votes
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Double> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.add(RangeValidator.range(Double.MIN_VALUE, Double.MAX_VALUE));
    field.setType(Double.class);
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 5
Project: MBaaS   File: CharacterPanel.java   Source Code and License Vote up 5 votes
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Character> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name), Character.class);
    field.add(AttributeModifier.replace("maxlength", "1"));
    field.setType(Character.class);
    field.setLabel(Model.of(name));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 6
Project: MBaaS   File: LongPanel.java   Source Code and License Vote up 5 votes
@Override
protected void onInitialize() {
    super.onInitialize();
    Label label = new Label("label", this.name);
    this.add(label);
    TextField<Long> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
    field.setLabel(Model.of(name));
    field.setType(Long.class);
    field.add(RangeValidator.range(Long.MIN_VALUE, Long.MAX_VALUE));
    TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
    this.add(field);
    this.add(feedback);
}
 
Example 7
Project: elpaaso-core   File: LogicalOnlineStorageServicePanel.java   Source Code and License Vote up 5 votes
private void initComponents() {

    	getServiceForm().add(new CacheActivatedImage("logicalOnlineStorageServicePanelIcon",new ResourceModel("onlineStorage-icon").getObject()));
    	// Online help link
    	String completeHelpUrl = "";
    	try {
    		completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null).getString() 
        			+ new StringResourceModel("portal.designer.logical.service.online_manual." + getLogicalModelType(), null).getString();
    	} catch (Exception e) {
    		//do nothing
    	}
    	ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    	getServiceForm().add(onlineHelpLink);
    	if (completeHelpUrl.isEmpty()) {
    		onlineHelpLink.setVisible(false);
    	}
    	
        // FUNCTIONNAL PARAMETERS
        RequiredTextField<String> label = new RequiredTextField<String>("label");
        label.setLabel(new StringResourceModel("portal.designer.service.storage.label",null));
        label.add(new PropertyValidator<>());
        getServiceForm().add(label);

        TextField<String> serviceName = new TextField<String>("serviceName");
        serviceName.setLabel(new StringResourceModel("portal.designer.service.storage.name", null));
        serviceName.add(new PropertyValidator<>());
        getServiceForm().add(serviceName);

        TextField storageCapacityMb = new TextField("storageCapacityMb");
        storageCapacityMb.setLabel(new StringResourceModel("portal.designer.service.storage.storageCapacityMb",null));
        storageCapacityMb.add(new AttributeModifier("class","small"));
        storageCapacityMb.add(new PropertyValidator<>());
        getServiceForm().add(storageCapacityMb);

    }
 
Example 8
Project: elpaaso-core   File: LogicalRelationalDatabasePanel.java   Source Code and License Vote up 5 votes
private void initComponents() {
	 getServiceForm().add(new CacheActivatedImage("logicalRelationnalDatabasePanelIcon",new ResourceModel("onlinedatabase.icon").getObject()));
	// Online help link
	String completeHelpUrl = "";
	try {
		completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null).getString() 
    			+ new StringResourceModel("portal.designer.logical.service.online_manual.relationaldatabase", null).getString();
	} catch (Exception e) {
		//do nothing
	}
	ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
	getServiceForm().add(onlineHelpLink);
	if (completeHelpUrl.isEmpty()) {
		onlineHelpLink.setVisible(false);
	}
	
    // FUNCTIONNAL PARAMETERS
    final RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.reldb.label",null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    TextField<String> serviceName = new TextField<String>("serviceName");
    serviceName.setLabel(new StringResourceModel("portal.designer.service.reldb.serviceName",null));
    serviceName.add(new PropertyValidator<>());
    getServiceForm().add(serviceName);

    DropDownChoice<LogicalRelationalServiceSqlDialectEnum> sqlVersion = new DropDownChoice<LogicalRelationalServiceSqlDialectEnum>("sqlVersion", Arrays.asList(LogicalRelationalServiceSqlDialectEnum.values()));
    sqlVersion.setLabel(new StringResourceModel("portal.designer.service.reldb.sqlVersion",null));
    sqlVersion.add(new PropertyValidator<>());
    getServiceForm().add(sqlVersion);


    // SLO
    TextField capacityMo = new TextField("capacityMo");
    capacityMo.setLabel(new StringResourceModel("portal.designer.service.reldb.capacityMo",null));
    capacityMo.add(new AttributeModifier("class","small"));
    capacityMo.add(new PropertyValidator<>());
    getServiceForm().add(capacityMo);
}
 
Example 9
Project: engerek   File: TextFormGroup.java   Source Code and License Vote up 4 votes
private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, final boolean required,
	final boolean markAsRequired) {
      WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
      add(labelContainer);

      Label l = new Label(ID_LABEL, label);
      if (StringUtils.isNotEmpty(labelSize)) {
          labelContainer.add(AttributeAppender.prepend("class", labelSize));
      }
      labelContainer.add(l);

      Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
      tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

          @Override
          public String getObject() {
              return getString(tooltipKey);
          }
      }));
      tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
      tooltipLabel.add(new VisibleEnableBehaviour(){

          @Override
          public boolean isVisible() {
              return tooltipKey != null;
          }
      });
      tooltipLabel.setOutputMarkupId(true);
      tooltipLabel.setOutputMarkupPlaceholderTag(true);
      labelContainer.add(tooltipLabel);

WebMarkupContainer requiredContainer = new WebMarkupContainer(ID_REQUIRED);
requiredContainer.add(new VisibleEnableBehaviour() {
	@Override
	public boolean isVisible() {
		return markAsRequired;
	}
});
labelContainer.add(requiredContainer);

WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
      if (StringUtils.isNotEmpty(textSize)) {
          textWrapper.add(AttributeAppender.prepend("class", textSize));
      }
      add(textWrapper);

      TextField text = createText(getModel(), label, required);
      text.setLabel(label);
      textWrapper.add(text);

      FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ContainerFeedbackMessageFilter(this));
      feedback.setOutputMarkupId(true);
      textWrapper.add(feedback);
  }
 
Example 10
Project: engerek   File: MultiValueTextFormGroup.java   Source Code and License Vote up 4 votes
private void initLayout(final IModel<String> label, final String labelSize, final String textSize,
                        final boolean required) {
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        l.add(AttributeAppender.prepend("class", labelSize));
    }
    add(l);

    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> item) {
            WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
            textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    StringBuilder sb = new StringBuilder();
                    if (StringUtils.isNotEmpty(textSize)) {
                        sb.append(textSize).append(' ');
                    }
                    if (item.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) {
                        sb.append(getOffsetClass()).append(' ');
                        sb.append(CLASS_MULTI_VALUE);
                    }

                    return sb.toString();
                }
            }));
            item.add(textWrapper);

            TextField text = new TextField(ID_TEXT, createTextModel(item.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("blur") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            text.setRequired(required);
            text.add(AttributeAppender.replace("placeholder", label));
            text.setLabel(label);
            textWrapper.add(text);

            FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
            textWrapper.add(feedback);

            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) {
                        return CLASS_MULTI_VALUE;
                    }

                    return null;
                }
            }));
            item.add(buttonGroup);

            initButtons(buttonGroup, item);
        }
    };
    add(repeater);
}
 
Example 11
Project: owsi-core-parent   File: EditUserPopupPanel.java   Source Code and License Vote up 4 votes
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, EditUserPopupPanel.class);
	
	userEditForm = new Form<User>("userEditForm", getModel());
	body.add(userEditForm);
	
	TextField<String> userNameField = new RequiredTextField<String>("userName",
			BindingModel.of(getModel(), Bindings.user().userName()));
	userNameField.setLabel(new ResourceModel("user.username"));
	userEditForm.add(userNameField);
	
	TextField<String> firstNameField = new RequiredTextField<String>("firstName",
			BindingModel.of(getModel(), Bindings.user().firstName()));
	firstNameField.setLabel(new ResourceModel("user.firstname"));
	userEditForm.add(firstNameField);
	
	TextField<String> lastNameField = new RequiredTextField<String>("lastName",
			BindingModel.of(getModel(), Bindings.user().lastName()));
	lastNameField.setLabel(new ResourceModel("user.lastname"));
	userEditForm.add(lastNameField);
	
	TextField<String> emailField = new RequiredTextField<String>("email",
			BindingModel.of(getModel(), Bindings.user().email()));
	emailField.setLabel(new ResourceModel("user.email"));
	userEditForm.add(emailField);
	
	CheckBox activeCheckBox = new CheckBox("active", BindingModel.of(getModel(), Bindings.user().active()));
	activeCheckBox.setLabel(new ResourceModel("user.active"));
	userEditForm.add(activeCheckBox);
	
	TextField<String> phoneNumberField = new RequiredTextField<String>("phoneNumber",
			BindingModel.of(getModel(), Bindings.user().phoneNumber()));
	phoneNumberField.setLabel(new ResourceModel("user.phone"));
	userEditForm.add(phoneNumberField);
	
	TextField<String> gsmNumberField = new TextField<String>("gsmNumber",
			BindingModel.of(getModel(), Bindings.user().gsmNumber()));
	gsmNumberField.setLabel(new ResourceModel("user.phone"));
	userEditForm.add(gsmNumberField);
	
	TextField<String> faxNumberField = new TextField<String>("faxNumber",
			BindingModel.of(getModel(), Bindings.user().faxNumber()));
	faxNumberField.setLabel(new ResourceModel("user.phone"));
	userEditForm.add(faxNumberField);
	
	return body;
}
 
Example 12
Project: elpaaso-core   File: ApplicationCreatePanel.java   Source Code and License Vote up 4 votes
private void createAppForm() {

        appForm = new Form<>("appForm", new CompoundPropertyModel<>(new FirstApplicationReleaseInfos()));

        TextField<String> appLabel = new TextField<>("appLabel");
        appLabel.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.label.label"));

        appLabel.add(new AbstractValidator<String>() {
            @Override
            protected void onValidate(IValidatable<String> iValidatable) {
                if(!parentPage.isApplicationLabelUnique(iValidatable.getValue())) {
                    error(iValidatable);
                }
            }

            @Override
            protected String resourceKey() {
                return "portal.application.label.non.unique";
            }

            @Override
            protected Map<String, Object> variablesMap(IValidatable<String> stringIValidatable) {
                Map<String, Object> map = super.variablesMap(stringIValidatable);
                map.put("label", stringIValidatable.getValue());
                return map;
            }
        });
        appLabel.add(new PropertyValidator<>());
        appForm.add(appLabel);

        TextField<String> appCode = new TextField<>("appCode");
        appCode.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.code.label"));
        appCode.add(new PropertyValidator<>());
        appForm.add(appCode);

        TextArea<String> appDescription = new TextArea<>("appDescription");
        appDescription.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.description.label"));
        appDescription.add(new PropertyValidator<>());
        appForm.add(appDescription);

        RadioGroup<Boolean> appVisibility = new RadioGroup<>("appPublic");
        appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-public", new Model<>(Boolean.TRUE)));
        appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-private", new Model<>(Boolean.FALSE)));
        appVisibility.add(new PropertyValidator<>());
        appForm.add(appVisibility);
        appForm.add(new CacheActivatedImage("imageHelp.visibilityField", new ResourceModel("image.help").getObject()));

        TextField<String> members = new TextField<>("members");
        members.add(new PropertyValidator<>());
        appForm.add(members);
        appForm.add(new CacheActivatedImage("imageHelp.membersField", new ResourceModel("image.help").getObject()));

        releaseFiedsetPanel = new ReleaseFieldsetPanel("releaseFieldsetPanel", parentPage, manageApplicationRelease);
        appForm.add(releaseFiedsetPanel);

        createFormButtons(appForm);

        // set default visibility to private
        appForm.getModelObject().setAppPublic(Boolean.FALSE);

        add(appForm);
    }
 
Example 13
Project: elpaaso-core   File: LogicalSoapConsumerPanel.java   Source Code and License Vote up 4 votes
private void initComponent() {

    	getServiceForm().add(new CacheActivatedImage("logicalSoapConsummerPanelIcon",new ResourceModel("webserviceconsumer.icon").getObject()));
    	// Online help link
    	String completeHelpUrl = "";
    	try {
    		completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null).getString() 
        			+ new StringResourceModel("portal.designer.logical.service.online_manual." + getLogicalModelType(), null).getString();
    	} catch (Exception e) {
    		//do nothing
    	}
    	ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    	getServiceForm().add(onlineHelpLink);
    	if (completeHelpUrl.isEmpty()) {
    		onlineHelpLink.setVisible(false);
    	}
    	
        // FUNCTIONNAL PARAMETERS
        RequiredTextField<String> label = new RequiredTextField<String>("label");
        label.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.label",null));
        label.add(new PropertyValidator<>());
        getServiceForm().add(label);

        TextField<String> jndiPrefix = new TextField<String>("jndiPrefix");
        jndiPrefix.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.jndiPrefix",null));
        jndiPrefix.add(new PropertyValidator<>());
        getServiceForm().add(jndiPrefix);

        DropDownChoice<LogicalSoapConsumer.SoapServiceDomainEnum> domain = new DropDownChoice<LogicalSoapConsumer.SoapServiceDomainEnum>("wsDomain", Arrays.asList(LogicalSoapConsumer.SoapServiceDomainEnum.values()));
        domain.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.wsdomain",null));
        domain.add(new PropertyValidator<>());
        getServiceForm().add(domain);

        TextField<String> serviceProviderName = new TextField<String>("serviceProviderName");
        serviceProviderName.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.serviceProviderName",null));
        serviceProviderName.add(new PropertyValidator<>());
        getServiceForm().add(serviceProviderName);

        TextField<String> serviceName = new TextField<String>("serviceName");
        serviceName.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.serviceName",null));
        serviceName.add(new PropertyValidator<>());
        getServiceForm().add(serviceName);

        TextField serviceMinorVersion = new TextField("serviceMinorVersion");
        serviceMinorVersion.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.serviceMinorVersion",null));
        serviceMinorVersion.add(new AttributeModifier("class","small"));
        serviceMinorVersion.add(new PropertyValidator<>());
        getServiceForm().add(serviceMinorVersion);

        TextField serviceMajorVersion = new TextField("serviceMajorVersion");
        serviceMajorVersion.setLabel(new StringResourceModel("portal.designer.service.wsc_soap.serviceMajorVersion",null));
        serviceMajorVersion.add(new AttributeModifier("class","small"));
        serviceMajorVersion.add(new PropertyValidator<>());
        getServiceForm().add(serviceMajorVersion);

    }
 
Example 14
Project: elpaaso-core   File: LogicalWebGuiServicePanel.java   Source Code and License Vote up 4 votes
private void initComponents() {

    	getServiceForm().add(new CacheActivatedImage("logicalWebGuiPanelIcon",new ResourceModel("webui.icon").getObject()));
    	// Online help link
    	String completeHelpUrl = "";
    	try {
    		completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null).getString() 
        			+ new StringResourceModel("portal.designer.logical.service.online_manual.webgui", null).getString();
    	} catch (Exception e) {
    		//do nothing
    	}
    	ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    	getServiceForm().add(onlineHelpLink);
    	if (completeHelpUrl.isEmpty()) {
    		onlineHelpLink.setVisible(false);
    	}
    	
        // FUNCTIONNAL PARAMETERS
        // Service label
        RequiredTextField<String> label = new RequiredTextField<String>("label");
        label.setLabel(new StringResourceModel("portal.designer.service.gui.label",null));
        label.add(new PropertyValidator<>());
        getServiceForm().add(label);

        // Service context root
        RequiredTextField<String> contextRoot = new RequiredTextField<String>("contextRoot.value");
        contextRoot.setLabel(new StringResourceModel("portal.designer.service.gui.contextroot",null));
        contextRoot.add(new PropertyValidator<>());
        getServiceForm().add(contextRoot);

        // Service stateful state
        CheckBox statefulCb = new CheckBox("stateful");
        statefulCb.setLabel(new StringResourceModel("portal.designer.service.gui.stateful",null));
        statefulCb.add(new PropertyValidator<>());
        getServiceForm().add(statefulCb);

        // SLO
        // Service secure state
        CheckBox secureCb = new CheckBox("secure");
//        secureCb.setEnabled(false);
        secureCb.setLabel(new StringResourceModel("portal.designer.service.gui.secure",null));
        secureCb.add(new AttributeAppender("title", new StringResourceModel("portal.designer.service.notAvailable", null), " "));
        secureCb.add(new PropertyValidator<>());
        getServiceForm().add(secureCb);

        // Service max number of sessions
        TextField maxNumberSessions = new TextField("maxNumberSessions");
        maxNumberSessions.setLabel(new StringResourceModel("portal.designer.service.gui.maxNumberSessions",null));
        maxNumberSessions.add(new AttributeModifier("class", "small"));
        maxNumberSessions.add(new PropertyValidator<>());
        getServiceForm().add(maxNumberSessions);

        // Service max request per seconds
        final TextField maxReqPerSeconds = new TextField("maxReqPerSeconds");
        maxReqPerSeconds.setLabel(new StringResourceModel("portal.designer.service.gui.maxReqPerSeconds",null));
        maxReqPerSeconds.add(new AttributeAppender("title", new StringResourceModel("portal.designer.service.notAvailable", null), " "));
        maxReqPerSeconds.add(new PropertyValidator<>());
        getServiceForm().add(maxReqPerSeconds);

    }
 
Example 15
Project: elpaaso-core   File: LogicalConfigServicePanel.java   Source Code and License Vote up 4 votes
private void initComponents() {

    	getServiceForm().add(new CacheActivatedImage("logicalconfig-icon",new ResourceModel("cfconfigservice.icon").getObject()));
    	// Online help link
    	String completeHelpUrl = "";
    	try {
    		completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null).getString() 
        			+ new StringResourceModel("portal.designer.logical.service.online_manual." + getLogicalModelType(), null).getString();
    	} catch (Exception e) {
    		//do nothing
    	}
    	ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
    	ExternalLink onlineHelpLinkOverride = new ExternalLink("onlineHelpLinkOverride", completeHelpUrl);

    	if (completeHelpUrl.isEmpty()) {
    		onlineHelpLink.setVisible(false);
    		onlineHelpLinkOverride.setVisible(false);
    	}

    	// Creates 2 blocks only for good displaying : Read more... juste after description (not possible with span wicket:id=descriptionLabel).
    	WebMarkupContainer descriptionBlock = new WebMarkupContainer("descriptionBlock");
    	descriptionBlock.add(onlineHelpLink);
    	getServiceForm().add(descriptionBlock);
    	
    	WebMarkupContainer overrideDescriptionBlock = new WebMarkupContainer("overrideDescriptionBlock");
    	overrideDescriptionBlock.add(onlineHelpLinkOverride);
    	getServiceForm().add(overrideDescriptionBlock);

        if (configOverride) {
        	descriptionBlock.setVisible(false);
        } else {
        	overrideDescriptionBlock.setVisible(false);
        }

    	
        // FUNCTIONNAL PARAMETERS    
        RequiredTextField<String> label = new RequiredTextField<>("label");
        label.setLabel(new StringResourceModel("portal.designer.service.config.label",null));
        label.add(new PropertyValidator<>());
        getServiceForm().add(label);

        TextField<String> keyPrefix = new TextField<>("keyPrefix", String.class);
        keyPrefix.setConvertEmptyInputStringToNull(false);
        keyPrefix.setLabel(new StringResourceModel("portal.designer.service.config.keyPrefix", null));
        keyPrefix.add(new PropertyValidator<>());
        getServiceForm().add(keyPrefix);

        configSetContent = new CodeMirrorTextArea<>("configSetContent", readOnly && !configOverride);

        configSetContent.setLabel(new StringResourceModel("portal.designer.service.config.configSetContent", null));
        configSetContent.add(new PropertyValidator<>());
        getServiceForm().add(configSetContent);

        configSetContent.add(new ConfigDuplicateKeysValidator());
        configSetContent.add(new ConfigMaxSizeValidator());
        configSetContent.add(new ConfigMaxNumberKeysValidator());
        configSetContent.add(new InvalidCharsetValidator());

    }
 
Example 16
Project: elpaaso-core   File: LogicalQueueReceiveServicePanel.java   Source Code and License Vote up 4 votes
public LogicalQueueReceiveServicePanel(String id, IModel<LogicalQueueReceiveService> model, Page parentPage,
        boolean isNew, boolean readOnly, boolean configOverride) {
    super(id, model, parentPage, isNew, readOnly, configOverride);

    getServiceForm().add(new CacheActivatedImage("logicalqueuereceiveServicePanelIcon",new ResourceModel("queuereceive.icon").getObject()));
	// Online help link
	String completeHelpUrl = "";
	try {
		completeHelpUrl = new StringResourceModel("portal.designer.logical.service.online_manual.baseUrl", null).getString() 
    			+ new StringResourceModel("portal.designer.logical.service.online_manual." + getLogicalModelType(), null).getString();
	} catch (Exception e) {
		//do nothing
	}
	ExternalLink onlineHelpLink = new ExternalLink("onlineHelpLink", completeHelpUrl);
	getServiceForm().add(onlineHelpLink);
	if (completeHelpUrl.isEmpty()) {
		onlineHelpLink.setVisible(false);
	}
	
    // FUNCTIONNAL PARAMETERS
    RequiredTextField<String> label = new RequiredTextField<String>("label");
    label.setLabel(new StringResourceModel("portal.designer.service.queue_receive.label",null));
    label.add(new PropertyValidator<>());
    getServiceForm().add(label);

    TextField<String> serviceName = new TextField<String>("serviceName");
    serviceName.setLabel(new StringResourceModel("portal.designer.service.queue_receive.serviceName",null));
    serviceName.add(new PropertyValidator<>());
    getServiceForm().add(serviceName);

    TextField serviceVersion = new TextField("serviceVersion");
    serviceVersion.setLabel(new StringResourceModel("portal.designer.service.queue_receive.serviceVersion",null));
    serviceVersion.add(new PropertyValidator<>());
    getServiceForm().add(serviceVersion);

    TextField<String> jndiQueueName = new TextField<String>("jndiQueueName");
    jndiQueueName.setLabel(new StringResourceModel("portal.designer.service.queue_receive.jndiQueueName",null));
    jndiQueueName.add(new AttributeAppender("title", new StringResourceModel("portal.designer.service.queue_receive.preferredJNDI", null), " "));
    jndiQueueName.add(new PropertyValidator<>());
    getServiceForm().add(jndiQueueName);

    DropDownChoice<Long> msgMaxSizeKB = new DropDownChoice<Long>("msgMaxSizeKB", Arrays.asList(maxMsgSizeList));
    msgMaxSizeKB.add(defaultDropDownUpdateBehavior());
    getServiceForm().add(msgMaxSizeKB);
    msgMaxSizeKB.setLabel(new StringResourceModel("portal.designer.service.queue_receive.msgMaxSizeKB",null));
    msgMaxSizeKB.add(new PropertyValidator<>());

    DropDownChoice<Long> maxNbMsgPerDay = new DropDownChoice<Long>("maxNbMsgPerDay", Arrays.asList(maxNbMsgPerDayList));
    maxNbMsgPerDay.add(defaultDropDownUpdateBehavior());
    getServiceForm().add(maxNbMsgPerDay);
    maxNbMsgPerDay.setLabel(new StringResourceModel("portal.designer.service.queue_receive.maxNbMsgPerDay",null));
    maxNbMsgPerDay.add(new PropertyValidator<>());

    DropDownChoice<Long> nbRetentionDay = new DropDownChoice<Long>("nbRetentionDay", Arrays.asList(nbRetentionDayList));
    nbRetentionDay.add(defaultDropDownUpdateBehavior());
    getServiceForm().add(nbRetentionDay);
    nbRetentionDay.setLabel(new StringResourceModel("portal.designer.service.queue_receive.nbRetentionDay",null));
    nbRetentionDay.add(new PropertyValidator<>());
}