Java Code Examples for org.apache.wicket.markup.html.form.Form#setOutputMarkupPlaceholderTag()
The following examples show how to use
org.apache.wicket.markup.html.form.Form#setOutputMarkupPlaceholderTag() .
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: ActiveLearningSidebar.java From inception with Apache License 2.0 | 6 votes |
private Form<Void> clearSkippedRecommendationForm() { Form<Void> form = new Form<>(CID_LEARN_FROM_SKIPPED_RECOMMENDATION_FORM); form.add(LambdaBehavior.visibleWhen(() -> { ActiveLearningUserState alState = alStateModel.getObject(); return alState.isSessionActive() && !alState.getSuggestion().isPresent() && activeLearningService.hasSkippedSuggestions( getModelObject().getUser(), alState.getLayer()); })); form.setOutputMarkupPlaceholderTag(true); form.add(new Label(CID_ONLY_SKIPPED_RECOMMENDATION_LABEL, "There are only skipped suggestions. Do you want to learn these again?")); form.add(new LambdaAjaxButton<>(CID_LEARN_SKIPPED_ONES, this::actionClearSkippedRecommendations)); return form; }
Example 2
Source File: ActiveLearningSidebar.java From inception with Apache License 2.0 | 5 votes |
private Form<?> createLearningHistory() { Form<?> learningHistoryForm = new Form<Void>(CID_LEARNING_HISTORY_FORM) { private static final long serialVersionUID = -961690443085882064L; }; learningHistoryForm.add(LambdaBehavior.onConfigure(component -> component .setVisible(alStateModel.getObject().isSessionActive()))); learningHistoryForm.setOutputMarkupPlaceholderTag(true); learningHistoryForm.setOutputMarkupId(true); learningHistoryForm.add(createLearningHistoryListView()); return learningHistoryForm; }
Example 3
Source File: LinkFeatureTraitsEditor.java From webanno with Apache License 2.0 | 4 votes |
public LinkFeatureTraitsEditor(String aId, SlotFeatureSupport aFS, IModel<AnnotationFeature> aFeatureModel) { super(aId, aFeatureModel); // We cannot retain a reference to the actual SlotFeatureSupport instance because that // is not serializable, but we can retain its ID and look it up again from the registry // when required. featureSupportId = aFS.getId(); feature = aFeatureModel; traits = Model.of(readTraits()); Form<Traits> form = new Form<Traits>(MID_FORM, CompoundPropertyModel.of(traits)) { private static final long serialVersionUID = -3109239605783291123L; @Override protected void onSubmit() { super.onSubmit(); // when saving reset the selected tagset if role labels are not enabled if (!traits.getObject().isEnableRoleLabels()) { feature.getObject().setTagset(null); } writeTraits(); } }; form.setOutputMarkupPlaceholderTag(true); add(form); MultiSelect<Tag> defaultSlots = new MultiSelect<Tag>("defaultSlots") { private static final long serialVersionUID = 8231304829756188352L; @Override public void onConfigure(JQueryBehavior aBehavior) { super.onConfigure(aBehavior); //aBehavior.setOption("placeholder", Options.asString(getString("placeholder"))); aBehavior.setOption("filter", Options.asString("contains")); aBehavior.setOption("autoClose", false); } }; defaultSlots.setChoices(LambdaModel.of(this::listTags)); defaultSlots.setChoiceRenderer(new ChoiceRenderer<>("name")); defaultSlots.add(visibleWhen(() -> traits.getObject().isEnableRoleLabels() && feature.getObject().getTagset() != null)); form.add(defaultSlots); CheckBox enableRoleLabels = new CheckBox("enableRoleLabels"); enableRoleLabels.setModel(PropertyModel.of(traits, "enableRoleLabels")); enableRoleLabels.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> target.add(form) )); form.add(enableRoleLabels); DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset"); tagset.setOutputMarkupPlaceholderTag(true); tagset.setOutputMarkupId(true); tagset.setChoiceRenderer(new ChoiceRenderer<>("name")); tagset.setNullValid(true); tagset.setModel(PropertyModel.of(aFeatureModel, "tagset")); tagset.setChoices(LambdaModel.of(() -> annotationService .listTagSets(aFeatureModel.getObject().getProject()))); tagset.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> { traits.getObject().setDefaultSlots(new ArrayList<>()); target.add(form); })); tagset.add(visibleWhen(() -> traits.getObject().isEnableRoleLabels())); form.add(tagset); }
Example 4
Source File: StringFeatureTraitsEditor.java From webanno with Apache License 2.0 | 4 votes |
public StringFeatureTraitsEditor(String aId, UimaPrimitiveFeatureSupport_ImplBase<StringFeatureTraits> aFS, IModel<AnnotationFeature> aFeature) { super(aId, aFeature); // We cannot retain a reference to the actual SlotFeatureSupport instance because that // is not serializable, but we can retain its ID and look it up again from the registry // when required. featureSupportId = aFS.getId(); feature = aFeature; traits = CompoundPropertyModel.of(getFeatureSupport().readTraits(feature.getObject())); keyBindings = newKeyBindingsConfigurationPanel(aFeature); add(keyBindings); Form<StringFeatureTraits> form = new Form<StringFeatureTraits>(MID_FORM, traits) { private static final long serialVersionUID = -3109239605783291123L; @Override protected void onSubmit() { super.onSubmit(); // Tagsets only are allowed for single-row input fields, not for textareas if (traits.getObject().isMultipleRows()) { feature.getObject().setTagset(null); } else { traits.getObject().setDynamicSize(false); } getFeatureSupport().writeTraits(feature.getObject(), traits.getObject()); } }; form.setOutputMarkupPlaceholderTag(true); add(form); NumberTextField<Integer> collapsedRows = new NumberTextField<>("collapsedRows", Integer.class); collapsedRows.setModel(PropertyModel.of(traits, "collapsedRows")); collapsedRows.setMinimum(1); collapsedRows.add(visibleWhen(() -> traits.getObject().isMultipleRows() && !traits.getObject().isDynamicSize())); form.add(collapsedRows); NumberTextField<Integer> expandedRows = new NumberTextField<>("expandedRows", Integer.class); expandedRows.setModel(PropertyModel.of(traits, "expandedRows")); expandedRows.setMinimum(1); expandedRows.add(visibleWhen(() -> traits.getObject().isMultipleRows() && !traits.getObject().isDynamicSize())); form.add(expandedRows); DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset"); tagset.setOutputMarkupPlaceholderTag(true); tagset.setChoiceRenderer(new ChoiceRenderer<>("name")); tagset.setNullValid(true); tagset.setModel(PropertyModel.of(aFeature, "tagset")); tagset.setChoices(LoadableDetachableModel .of(() -> annotationService.listTagSets(aFeature.getObject().getProject()))); tagset.add(visibleWhen(() -> !traits.getObject().isMultipleRows())); // If we change the tagset, the input component for the key bindings may change, so we need // to re-generate the key bindings tagset.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> { KeyBindingsConfigurationPanel newKeyBindings = newKeyBindingsConfigurationPanel( aFeature); keyBindings.replaceWith(newKeyBindings); keyBindings = newKeyBindings; _target.add(keyBindings); })); form.add(tagset); CheckBox multipleRows = new CheckBox("multipleRows"); multipleRows.setModel(PropertyModel.of(traits, "multipleRows")); multipleRows.add( new LambdaAjaxFormComponentUpdatingBehavior("change", target -> target.add(form))); form.add(multipleRows); CheckBox dynamicSize = new CheckBox("dynamicSize"); dynamicSize.setModel(PropertyModel.of(traits, "dynamicSize")); dynamicSize.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> target.add(form) )); dynamicSize.add(visibleWhen(() -> traits.getObject().isMultipleRows())); form.add(dynamicSize); }
Example 5
Source File: DirectoryPanel.java From syncope with Apache License 2.0 | 4 votes |
protected void initResultTable() { // --------------------------- // Result table initialization // --------------------------- updateResultTable(false); // --------------------------- // --------------------------- // Rows-per-page selector // --------------------------- Form<?> paginatorForm = new Form<>("paginator"); paginatorForm.setOutputMarkupPlaceholderTag(true); paginatorForm.setVisible(showPaginator); container.add(paginatorForm); DropDownChoice<Integer> rowsChooser = new DropDownChoice<>( "rowsChooser", new PropertyModel<>(this, "rows"), PreferenceManager.getPaginatorChoices()); rowsChooser.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { PreferenceManager.set(getRequest(), getResponse(), paginatorRowsKey(), String.valueOf(rows)); EventDataWrapper data = new EventDataWrapper(); data.setTarget(target); data.setRows(rows); send(getParent(), Broadcast.BREADTH, data); } }); paginatorForm.add(rowsChooser); // --------------------------- // --------------------------- // Table handling // --------------------------- container.add(getHeader("tablehandling")); // --------------------------- }