Search in sources :

Example 1 with CheckBoxMultipleChoice

use of org.apache.wicket.markup.html.form.CheckBoxMultipleChoice in project wicket by apache.

the class EnhancedPageView method addTreeControls.

private void addTreeControls() {
    Form<Void> form = new Form<>("form");
    add(form);
    form.add(new CheckBox("showStateless", new PropertyModel<Boolean>(this, "showStatefulAndParentsOnly")));
    form.add(new CheckBox("showBehaviors", new PropertyModel<Boolean>(this, "showBehaviors")));
    form.add(new CheckBoxMultipleChoice<>("visibleColumns", new PropertyModel<List<IColumn<TreeNode, Void>>>(this, "visibleColumns"), allColumns).setSuffix(" "));
    form.add(new AjaxFallbackButton("submit", form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onAfterSubmit(Optional<AjaxRequestTarget> target) {
            target.ifPresent(t -> t.add(componentTree));
        }
    });
    add(new AjaxFallbackLink<Void>("expandAll") {

        private static final long serialVersionUID = 1L;

        public void onClick(Optional<AjaxRequestTarget> targetOptional) {
            expandState.expandAll();
            targetOptional.ifPresent(target -> target.add(componentTree));
        }
    });
    add(new AjaxFallbackLink<Void>("collapseAll") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(Optional<AjaxRequestTarget> targetOptional) {
            expandState.collapseAll();
            targetOptional.ifPresent(target -> target.add(componentTree));
        }
    });
}
Also used : Form(org.apache.wicket.markup.html.form.Form) Arrays(java.util.Arrays) Behavior(org.apache.wicket.behavior.Behavior) WicketObjects(org.apache.wicket.core.util.lang.WicketObjects) Page(org.apache.wicket.Page) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PageView(org.apache.wicket.markup.html.debug.PageView) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) OddEvenItem(org.apache.wicket.markup.repeater.OddEvenItem) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) AjaxFallbackButton(org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBoxMultipleChoice(org.apache.wicket.markup.html.form.CheckBoxMultipleChoice) Strings(org.apache.wicket.util.string.Strings) IModel(org.apache.wicket.model.IModel) Label(org.apache.wicket.markup.html.basic.Label) AbstractTree(org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree) Iterator(java.util.Iterator) SortableTreeProvider(org.apache.wicket.extensions.markup.html.repeater.util.SortableTreeProvider) Collection(java.util.Collection) IClusterable(org.apache.wicket.util.io.IClusterable) GenericPanel(org.apache.wicket.markup.html.panel.GenericPanel) Model(org.apache.wicket.model.Model) Set(java.util.Set) Component(org.apache.wicket.Component) MarkupContainer(org.apache.wicket.MarkupContainer) LoadableDetachableModel(org.apache.wicket.model.LoadableDetachableModel) PageReference(org.apache.wicket.PageReference) DefaultTableTree(org.apache.wicket.extensions.markup.html.repeater.tree.DefaultTableTree) List(java.util.List) TreeColumn(org.apache.wicket.extensions.markup.html.repeater.tree.table.TreeColumn) PropertyModel(org.apache.wicket.model.PropertyModel) Bytes(org.apache.wicket.util.lang.Bytes) Item(org.apache.wicket.markup.repeater.Item) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Optional(java.util.Optional) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) Comparator(java.util.Comparator) Collections(java.util.Collections) Form(org.apache.wicket.markup.html.form.Form) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxFallbackButton(org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ArrayList(java.util.ArrayList) List(java.util.List) CheckBoxMultipleChoice(org.apache.wicket.markup.html.form.CheckBoxMultipleChoice)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Component (org.apache.wicket.Component)1 MarkupContainer (org.apache.wicket.MarkupContainer)1 Page (org.apache.wicket.Page)1 PageReference (org.apache.wicket.PageReference)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxFallbackLink (org.apache.wicket.ajax.markup.html.AjaxFallbackLink)1 AjaxFallbackButton (org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton)1 Behavior (org.apache.wicket.behavior.Behavior)1 WicketObjects (org.apache.wicket.core.util.lang.WicketObjects)1 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)1