当前位置: 首页>>代码示例>>Java>>正文


Java AbstractCheckBoxModel类代码示例

本文整理汇总了Java中org.apache.wicket.extensions.model.AbstractCheckBoxModel的典型用法代码示例。如果您正苦于以下问题:Java AbstractCheckBoxModel类的具体用法?Java AbstractCheckBoxModel怎么用?Java AbstractCheckBoxModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbstractCheckBoxModel类属于org.apache.wicket.extensions.model包,在下文中一共展示了AbstractCheckBoxModel类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newCheckBox

import org.apache.wicket.extensions.model.AbstractCheckBoxModel; //导入依赖的package包/类
protected CheckBox newCheckBox(String id, final IModel<Boolean> checkModel) {
    final CheckBox checkBox = new CheckBox("check", checkModel) {
        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            if (checkModel.getObject() != null) {
                tag.append("class", uuid, " ");
            }
        }
    };
    if (checkModel.getObject() != null) { // checkModel is null for the "select all" checkbox in the column header
        checkBox.add(new ClickAjaxEventBehavior<Boolean>(checkModel) {
            protected void onEvent(AjaxRequestTarget target, IModel<Boolean> model) {
                AbstractCheckBoxModel m = (AbstractCheckBoxModel) model;
                if (m.isSelected()) {
                    m.unselect();
                } else {
                    m.select();
                }
                target.add(checkBox);
            }
        });
    }
    return checkBox;
}
 
开发者ID:Nocket,项目名称:nocket,代码行数:26,代码来源:AjaxSetCheckBoxColum.java

示例2: newCheckBoxModel

import org.apache.wicket.extensions.model.AbstractCheckBoxModel; //导入依赖的package包/类
@Override
protected IModel<Boolean> newCheckBoxModel(final IModel<T> rowModel) {
    return new AbstractCheckBoxModel() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isSelected() {
            return selected.contains(rowModel.getObject());
        }

        @Override
        public void unselect() {
            selected.remove(rowModel.getObject());
        }

        @Override
        public void select() {
            selected.add(rowModel.getObject());
        }

        @Override
        public void detach() {
            rowModel.detach();
        }
    };
}
 
开发者ID:Nocket,项目名称:nocket,代码行数:27,代码来源:SetCheckBoxColum.java

示例3: buildEditor

import org.apache.wicket.extensions.model.AbstractCheckBoxModel; //导入依赖的package包/类
@Override
public void buildEditor(PanelContainer popup) {

    LabelledPanel labelledPanel = new LabelledPanel(popup.newPanelId());
    popup.addPanel(labelledPanel);
    labelledPanel.setLabel(getName());

    CheckBoxContainerPanel checkBoxContainer = new CheckBoxContainerPanel(labelledPanel.newPanelId());
    labelledPanel.addPanel(checkBoxContainer);
    checkBoxContainer.setMinSelections(1, Model.of("Please make at least one selection."));

    for (final E value : enumClass.getEnumConstants()) {

        if (isVisible(value)) {

            IModel<Boolean> model = new AbstractCheckBoxModel() {
                @Override
                public boolean isSelected() {
                    return selectedValues.contains(value);
                }
                @Override
                public void select() {
                    if (!isSelected()) {
                        selectedValues.add(value);
                    }
                }
                @Override
                public void unselect() {
                    if (isSelected()) {
                        selectedValues.remove(value);
                    }
                }
            };

            checkBoxContainer.addPanel(new CheckBoxPanel(checkBoxContainer.newPanelId(), model)
            .setLabel(EnumUtils.toString(value)));
        }
    }

}
 
开发者ID:jkrasnay,项目名称:panelized,代码行数:41,代码来源:AbstractEnumFilter.java


注:本文中的org.apache.wicket.extensions.model.AbstractCheckBoxModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。