org.apache.wicket.markup.html.form.CheckBox Java Examples

The following examples show how to use org.apache.wicket.markup.html.form.CheckBox. 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: SourceViewPanel.java    From onedev with MIT License 7 votes vote down vote up
@Override
public WebMarkupContainer newAdditionalActions(String id) {
	WebMarkupContainer actions = new Fragment(id, "actionsFrag", this);
	if (hasOutline()) {
		actions.add(new CheckBox("outline", Model.of(isOutlineVisibleInitially())).add(new OnChangeAjaxBehavior() {

			@Override
			protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
				super.updateAjaxAttributes(attributes);
				attributes.setMethod(Method.POST);
			}

			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				toggleOutline(target);
			}
			
		}));
	} else {
		actions.add(new WebMarkupContainer("outline").setVisible(false));
	}
	return actions;
}
 
Example #2
Source File: CheckBoxButton.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param id
 * @param model
 * @param labelString If null then a classic checkbox is used.
 * @param wantOnSelectionChangedNotifications if true then wantOnSelectionChangedNotifications method returns true.
 * @see CheckBox#wantOnSelectionChangedNotifications()
 */
public CheckBoxButton(final String id, final IModel<Boolean> model, final String labelString,
    final boolean wantOnSelectionChangedNotifications)
{
  super(id);
  this.wantOnSelectionChangedNotifications = wantOnSelectionChangedNotifications;
  checkBox = new CheckBox(WICKET_ID, model) {
    @Override
    public void onSelectionChanged(final Boolean newSelection)
    {
      CheckBoxButton.this.onSelectionChanged(newSelection);
    }

    @Override
    protected boolean wantOnSelectionChangedNotifications()
    {
      return CheckBoxButton.this.wantOnSelectionChangedNotifications();
    }
  };
  checkBox.setOutputMarkupId(true);
  init(labelString);
  labelContainer.add(checkBox);
}
 
Example #3
Source File: JasperSettingsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
@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 #4
Source File: CleanHistorySettingsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
@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 #5
Source File: QuerySettingsPanel.java    From inception with Apache License 2.0 6 votes vote down vote up
private CheckBox maxQueryLimitCheckbox(String id, IModel<Boolean> aModel)
{
    return new AjaxCheckBox(id, aModel)
    {
        private static final long serialVersionUID = -8390353018496338400L;

        @Override
        public void onUpdate(AjaxRequestTarget aTarget)
        {
            if (getModelObject()) {
                queryLimitField.setModelObject(kbProperties.getHardMaxResults());
                queryLimitField.setEnabled(false);
            }
            else {
                queryLimitField.setEnabled(true);
            }
            aTarget.add(queryLimitField);
        }
    };
}
 
Example #6
Source File: AbstractFilterPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
public AbstractFilterPanel(String id, IModel<T> model, String filterId,
                           IModel<V> entityModel,
                           IVisualizer visualizer,
                           IFilterCriteriaManager manager, IModel<Boolean> join) {
    super(id, model);
    this.filterId = filterId;
    this.entityModel = entityModel;
    this.visualizer = visualizer;
    this.joinModel = join;
    this.manager = manager;
    setOutputMarkupPlaceholderTag(true);
    add(new Label("title", getTitle()));
    CheckBox checkBox = new CheckBox("join", join);
    checkBox.add(new AjaxFormSubmitBehavior("change") {});
    checkBox.setOutputMarkupId(true);
    add(checkBox);
    add(new Label("joinTitle", new ResourceModel("widget.document.filter.join"))
            .setOutputMarkupPlaceholderTag(true));
}
 
Example #7
Source File: BooleanPropertyEditor.java    From onedev with MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(input = new CheckBox("input", Model.of(getModelObject())));
	
	input.add(new AjaxFormComponentUpdatingBehavior("change"){

		@Override
		protected void onUpdate(AjaxRequestTarget target) {
			onPropertyUpdating(target);
		}
		
	});
	input.setLabel(Model.of(getDescriptor().getDisplayName()));
}
 
Example #8
Source File: SynchronizerSettingsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
@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 #9
Source File: InstallWizard.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	add(new CheckBox("allowFrontendRegister"));
	add(new CheckBox("sendEmailAtRegister"));
	add(new CheckBox("sendEmailWithVerficationCode"));
	add(new CheckBox("createDefaultObjects"));
	add(new TextField<String>("mailReferer"));
	add(new TextField<String>("smtpServer"));
	add(new TextField<Integer>("smtpPort").setRequired(true));
	add(new TextField<String>("mailAuthName"));
	add(new PasswordTextField("mailAuthPass").setResetPassword(false).setRequired(false));
	add(new CheckBox("mailUseTls"));
	add(new CheckBox("replyToOrganizer"));
	add(new LangDropDown("defaultLangId"));
}
 
Example #10
Source File: ChainLayerTraitsEditor.java    From webanno with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeForm(Form<ChainLayerTraits> aForm)
{
    aForm.add(new ValidationModeSelect("validationMode", getLayerModel()));
    
    aForm.add(new AnchoringModeSelect("anchoringMode", getLayerModel()));
    
    aForm.add(new OverlapModeSelect("overlapMode", getLayerModel()));
    
    CheckBox linkedListBehavior = new CheckBox("linkedListBehavior");
    linkedListBehavior.setModel(PropertyModel.of(getLayerModel(), "linkedListBehavior"));
    aForm.add(linkedListBehavior);
    
    CheckBox crossSentence = new CheckBox("crossSentence");
    crossSentence.setOutputMarkupPlaceholderTag(true);
    crossSentence.setModel(PropertyModel.of(getLayerModel(), "crossSentence"));
    crossSentence.add(visibleWhen(() -> !isBlank(getLayerModelObject().getType())));
    aForm.add(crossSentence);
    
    TextArea<String> onClickJavascriptAction = new TextArea<String>("onClickJavascriptAction");
    onClickJavascriptAction.setModel(PropertyModel.of(getLayerModel(), "onClickJavascriptAction"));
    onClickJavascriptAction.add(new AttributeModifier("placeholder",
            "alert($PARAM.PID + ' ' + $PARAM.PNAME + ' ' + $PARAM.DOCID + ' ' + "
                    + "$PARAM.DOCNAME + ' ' + $PARAM.fieldname);"));
    aForm.add(onClickJavascriptAction);
}
 
Example #11
Source File: UserSelectionPanel.java    From webanno with Apache License 2.0 6 votes vote down vote up
public UserSelectionPanel(String id, IModel<User> aModel)
{
    super(id);
    setOutputMarkupPlaceholderTag(true);

    overviewList = new OverviewListChoice<>("user");
    overviewList.setChoiceRenderer(new ChoiceRenderer<User>() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object getDisplayValue(User aUser)
        {
            return aUser.getUsername() + (aUser.isEnabled() ? "" : " (disabled)");
        }
    });
    overviewList.setModel(aModel);
    overviewList.setChoices(this::listUsers);
    overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange));
    add(overviewList);

    add(new LambdaAjaxLink("create", this::actionCreate));
    showDisabled = new CheckBox("showDisabled", Model.of(false));
    showDisabled.add(
            new LambdaAjaxFormComponentUpdatingBehavior("change", this::toggleShowDisabled));
    add(showDisabled);
}
 
Example #12
Source File: BooleanEditor.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Construct simple check box editor.
 *
 * @param id         editor id.
 * @param markupProvider markup object.
 * @param model      model.
 * @param labelModel label model
 * @param attrValue  {@link org.yes.cart.domain.entity.AttrValue}
 * @param readOnly  if true this component is read only
 */
public BooleanEditor(final String id,
                     final MarkupContainer markupProvider,
                     final IModel<String> model,
                     final IModel<String> labelModel,
                     final AttrValueWithAttribute attrValue,
                     final boolean readOnly) {

    super(id, "booleanEditor", markupProvider);

    inner = model;

    final CheckBox checkboxField = new CheckBox(EDIT, new PropertyModel<>(this, "innerValue"));
    checkboxField.setLabel(labelModel);
    checkboxField.setRequired(attrValue.getAttribute().isMandatory());
    checkboxField.setEnabled(!readOnly);
    add(checkboxField);
}
 
Example #13
Source File: LayerSelectionPanel.java    From webanno with Apache License 2.0 6 votes vote down vote up
/**
 * Part of <i>forward annotation</i> mode: creates the checkbox to toggle forward annotation
 * mode.
 */
private CheckBox createForwardAnnotationCheckBox()
{
    CheckBox checkbox = new CheckBox("forwardAnnotation");
    checkbox.setOutputMarkupId(true);
    checkbox.add(LambdaBehavior.onConfigure(_this -> {
        // Force-disable forward annotation mode if current layer is not forwardable
        if (!isForwardable()) {
            getModelObject().setForwardAnnotation(false);
        }
    }));
    checkbox.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> 
            owner.getFeatureEditorListPanel().focusForwardAnnotationComponent(_target, true)));
    
    return checkbox;
}
 
Example #14
Source File: CheckBoxPanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param id
 * @param model
 * @param labelString If null then a classic checkbox is used.
 * @param wantOnSelectionChangedNotifications if true then wantOnSelectionChangedNotifications method returns true.
 * @see CheckBox#wantOnSelectionChangedNotifications()
 */
public CheckBoxPanel(final String id, final IModel<Boolean> model, final String labelString,
    final boolean wantOnSelectionChangedNotifications)
{
  super(id);
  this.parentContainer = new WebMarkupContainer("parent");
  add(this.parentContainer);
  this.wantOnSelectionChangedNotifications = wantOnSelectionChangedNotifications;
  checkBox = new CheckBox(WICKET_ID, model) {
    @Override
    public void onSelectionChanged(final Boolean newSelection)
    {
      CheckBoxPanel.this.onSelectionChanged(newSelection);
    }

    @Override
    protected boolean wantOnSelectionChangedNotifications()
    {
      return CheckBoxPanel.this.wantOnSelectionChangedNotifications();
    }
  };
  checkBox.setOutputMarkupId(true);
  this.parentContainer.add(checkBox);
  init(labelString);
}
 
Example #15
Source File: AjaxCheckBoxPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
public AjaxCheckBoxPanel(
        final String id, final String name, final IModel<Boolean> model, final boolean enableOnChange) {

    super(id, name, model);

    field = new CheckBox("checkboxField", model);
    add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true));

    if (enableOnChange && !isReadOnly()) {
        field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

            private static final long serialVersionUID = -1107858522700306810L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                // nothing to do
            }
        });
    }
}
 
Example #16
Source File: MergeDialog.java    From webanno with Apache License 2.0 6 votes vote down vote up
public ContentPanel(String aId, IModel<State> aModel)
{
    super(aId, aModel);

    form = new Form<>("form", aModel);
    form.add(new Label("challenge").setEscapeModelStrings(false));
    form.add(new Label("feedback"));
    form.add(new TextField<>("response"));
    form.add(new CheckBox("mergeIncompleteAnnotations"));
    form.add(new LambdaAjaxButton<>("confirm",
            MergeDialog.this::onConfirmInternal));
    form.add(new LambdaAjaxLink("cancel",
            MergeDialog.this::onCancelInternal));
    
    add(form);
}
 
Example #17
Source File: CustomerListPage.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
public CustomerListPage() {
	FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
	feedbackPanel.setOutputMarkupId(true);
	add(feedbackPanel);
	
	add(new WebSocketBehavior() {

		@Override
		protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) {
			if (message instanceof CustomerChangedEvent) {
				CustomerChangedEvent event = (CustomerChangedEvent)message;
				info("changed/created " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname());
				handler.add(feedbackPanel);
			}
		}

	});
	
	customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter());
	CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel);
	
	queue(new BookmarkablePageLink<Customer>("create", CustomerCreatePage.class));
	
	queue(new ValidationForm<>("form", customerFilterModel));
	queue(new LabeledFormBorder<>(getString("id"), new TextField<>("id")));
	queue(new LabeledFormBorder<>(getString("username"), new UsernameSearchTextField("usernameLike")));
	queue(new LabeledFormBorder<>(getString("firstname"), new TextField<String>("firstnameLike").add(StringValidator.minimumLength(3))));
	queue(new LabeledFormBorder<>(getString("lastname"), new TextField<String>("lastnameLike").add(StringValidator.minimumLength(3))));
	queue(new LabeledFormBorder<>(getString("active"), new CheckBox("active")));
	queue(cancelButton());
	
	customerDataTable(customerDataProvider);

}
 
Example #18
Source File: KrippendorffAlphaAgreementTraitsEditor.java    From webanno with Apache License 2.0 5 votes vote down vote up
public KrippendorffAlphaAgreementTraitsEditor(String aId, IModel<AnnotationFeature> aFeature,
        IModel<KrippendorffAlphaAgreementTraits> aModel)
{
    super(aId, aFeature, aModel);
    
    getForm().add(new CheckBox("excludeIncomplete")
            .setOutputMarkupId(true));
}
 
Example #19
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 #20
Source File: SemesterPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public SemesterForm(String id, Semester sem) {
     super(id, new CompoundPropertyModel<Semester>(sem));
     add(new RequiredTextField<String>(PROP_EID));
     add(new TextField<String>(PROP_TITLE));
     add(new TextField(PROP_START));
     add(new TextField(PROP_END));
     add(new TextField<String>(PROP_DESC){
    
private static final long serialVersionUID = 1L;

@Override
     	    protected boolean shouldTrimInput() {
     	        return false;
     	    }
     });	        
     add(new CheckBox(PROP_CURRENT));
     
     updateButtonModel = new ResourceModel(LABEL_BUTTON_SAVE);
     addButtonModel = new ResourceModel(LABEL_BUTTON_ADD);	        
     okButton = new Button("okbutton", addButtonModel); 
     add(okButton); 
     
     Button cancelButton = new Button("cancelbutton", new ResourceModel(LABEL_BUTTON_CANCEL)){	        
private static final long serialVersionUID = 1L;

@Override
     	public void onSubmit() {
     		clearForm();
     	}
     	
     	@Override
     	public boolean isVisible() {	        	
     		return updateEID != null; // only show when editing
     	}
     };
     cancelButton.setDefaultFormProcessing(false);
     add(cancelButton);
     
 }
 
Example #21
Source File: CheckBoxPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public CheckBoxPanel(final String id, final CheckBox checkBox, final String labelString)
{
  super(id);
  this.checkBox = checkBox;
  add(checkBox);
  init(labelString);
}
 
Example #22
Source File: SemesterPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public SemesterForm(String id, Semester sem) {
     super(id, new CompoundPropertyModel<Semester>(sem));
     add(new RequiredTextField<String>(PROP_EID));
     add(new TextField<String>(PROP_TITLE));
     add(new TextField(PROP_START));
     add(new TextField(PROP_END));
     add(new TextField<String>(PROP_DESC){
    
private static final long serialVersionUID = 1L;

@Override
     	    protected boolean shouldTrimInput() {
     	        return false;
     	    }
     });	        
     add(new CheckBox(PROP_CURRENT));
     
     updateButtonModel = new ResourceModel(LABEL_BUTTON_SAVE);
     addButtonModel = new ResourceModel(LABEL_BUTTON_ADD);	        
     okButton = new Button("okbutton", addButtonModel); 
     add(okButton); 
     
     Button cancelButton = new Button("cancelbutton", new ResourceModel(LABEL_BUTTON_CANCEL)){	        
private static final long serialVersionUID = 1L;

@Override
     	public void onSubmit() {
     		clearForm();
     	}
     	
     	@Override
     	public boolean isVisible() {	        	
     		return updateEID != null; // only show when editing
     	}
     };
     cancelButton.setDefaultFormProcessing(false);
     add(cancelButton);
     
 }
 
Example #23
Source File: CheckBoxButton.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public CheckBoxButton(final String id, final CheckBox checkBox, final String labelString)
{
  super(id);
  this.checkBox = checkBox;
  init(labelString);
  labelContainer.add(checkBox);
}
 
Example #24
Source File: AbstractCheckBoxFilter.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
public CheckBox createTextFieldComponent(String componentId, final IModel<Boolean> model) {
	CheckBox checkBox = new CheckBox("filter", model){

		@Override
		protected boolean wantOnSelectionChangedNotifications() {
			return true;
		}
		
	};
	return checkBox;
}
 
Example #25
Source File: KrippendorffAlphaUnitizingAgreementTraitsEditor.java    From webanno with Apache License 2.0 5 votes vote down vote up
public KrippendorffAlphaUnitizingAgreementTraitsEditor(String aId,
        IModel<AnnotationFeature> aFeature,
        IModel<KrippendorffAlphaUnitizingAgreementTraits> aModel)
{
    super(aId, aFeature, aModel);

    getForm().add(new CheckBox("excludeIncomplete")
            .setOutputMarkupId(true));
}
 
Example #26
Source File: ProjectMiraTemplatePanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
public MiraTemplateDetailForm(String id)
{
    super(id, new CompoundPropertyModel<>(new MiraTemplate()));

    add(new CheckBox("annotateAndRepeat"));

    add(new Button("save")
    {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit()
        {
            template = MiraTemplateDetailForm.this.getModelObject();
            if (isNull(template.getId())) {
                template.setTrainFeature(selectedFeature);
                automationService.createTemplate(template);
                featureModel.setObject(
                        MiraTemplateDetailForm.this.getModelObject().getTrainFeature());
            }
            template.setCurrentLayer(true);
            for (MiraTemplate tmp : automationService
                    .listMiraTemplates(ProjectMiraTemplatePanel.this.getModelObject())) {
                if (tmp.equals(template)) {
                    continue;
                }
                if (tmp.isCurrentLayer()) {
                    tmp.setCurrentLayer(false);
                }
            }
            updateForm();
        }
    });
}
 
Example #27
Source File: ManageUsersPage.java    From webanno with Apache License 2.0 5 votes vote down vote up
public DetailForm(String id, IModel<User> aModel)
{
    super(id, new CompoundPropertyModel<>(aModel));

    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    
    add(new TextField<String>("username")
            .setRequired(true)
            .add(this::validateUsername)
            .add(enabledWhen(() -> isCreate)));
    add(new Label("lastLogin"));
    add(new EmailTextField("email"));
    
    passwordField = new PasswordTextField("password");
    passwordField.setModel(PropertyModel.of(DetailForm.this, "password"));
    passwordField.setRequired(false);
    add(passwordField);
    
    repeatPasswordField = new PasswordTextField("repeatPassword");
    repeatPasswordField.setModel(PropertyModel.of(DetailForm.this, "repeatPassword"));
    repeatPasswordField.setRequired(false);
    add(repeatPasswordField);
    
    add(new EqualPasswordInputValidator(passwordField, repeatPasswordField));
    
    add(new ListMultipleChoice<>("roles", getRoles())
            .add(this::validateRoles)
            .add(visibleWhen(ManageUsersPage.this::isAdmin)));
    
    add(new CheckBox("enabled")
            .add(this::validateEnabled)
            .add(visibleWhen(ManageUsersPage.this::isAdmin))
            .setOutputMarkupPlaceholderTag(true));

    add(new LambdaAjaxButton<>("save", ManageUsersPage.this::actionSave));
    
    add(new LambdaAjaxLink("cancel", ManageUsersPage.this::actionCancel));
}
 
Example #28
Source File: ConceptListPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public ConceptListPanel(String aId, IModel<KnowledgeBase> aKbModel,
        IModel<KBHandle> selectedConceptModel) {
    super(aId, selectedConceptModel);

    setOutputMarkupId(true);

    selectedConcept = selectedConceptModel;
    kbModel = aKbModel;
    preferences = Model.of(new Preferences());

    OverviewListChoice<KBHandle> overviewList = new OverviewListChoice<>("concepts");
    overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));
    overviewList.setModel(selectedConceptModel);
    overviewList.setChoices(LambdaModel.of(this::getConcepts));
    overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
            this::actionSelectionChanged));
    overviewList.setMaxRows(LIST_MAX_ROWS);
    add(overviewList);

    add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size())));

    LambdaAjaxLink addLink = new LambdaAjaxLink("add", target -> send(getPage(),
            Broadcast.BREADTH, new AjaxNewConceptEvent(target)));
    addLink.add(new Label("label", new ResourceModel("concept.list.add")));
    addLink.add(new WriteProtectionBehavior(kbModel));
    add(addLink);

    Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
    form.add(new CheckBox("showAllConcepts").add(
            new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged)));
    add(form);
}
 
Example #29
Source File: ProjectDetailPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
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 #30
Source File: DefaultAgreementTraitsEditor.java    From webanno with Apache License 2.0 5 votes vote down vote up
public DefaultAgreementTraitsEditor(String aId, IModel<AnnotationFeature> aFeature,
        IModel<T> aModel)
{
    super(aId, aModel);
    
    form = new Form<T>("form", CompoundPropertyModel.of(aModel)) {
        private static final long serialVersionUID = -1422265935439298212L;

        @Override
        protected void onSubmit()
        {
            // TODO Auto-generated method stub
            super.onSubmit();
        }
    };
    
    linkCompareBehaviorDropDown = new BootstrapSelect<>("linkCompareBehavior",
            asList(LinkCompareBehavior.values()),
            new EnumChoiceRenderer<>(this));
    linkCompareBehaviorDropDown.add(visibleWhen(() -> 
            aFeature.map(f -> !LinkMode.NONE.equals(f.getLinkMode()))
            .orElse(false).getObject()));
    linkCompareBehaviorDropDown.setOutputMarkupPlaceholderTag(true);
    form.add(linkCompareBehaviorDropDown);

    form.add(new CheckBox("limitToFinishedDocuments").
            setOutputMarkupId(true));
    
    add(form);
}