@Override
    protected Component newContentComponent(final String _id,
                                            final IModel<UIClassification> _model)
    {
        return new CheckedFolder<UIClassification>(_id, this, _model)
        {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(final AjaxRequestTarget _target)
            {
                final boolean selected = getModelObject().isSelected();
                final ClassificationTreePanel parent = findParent(ClassificationTreePanel.class);
                // Don't do that if it is a filter
                if (parent != null && !getModelObject().isMultipleSelect() && !selected) {
                    // select event ensure that there are no other objects selected by cleaning it totally
                    UIClassification uiClass = getModelObject();
                    while (!uiClass.isBase()) {
                        uiClass = uiClass.getParent();
                    }
                    toggleDown(uiClass, false);
                }

                // unselect event ensure that no children are selected
                if (selected) {
                    toggleDown(getModelObject(), false);
                } else {
                    toggleUp(getModelObject(), true);
                }
                _target.add(ClassificationTree.this);
                if (parent != null) {
                    parent.modelChanged();
                }
            }

            private void toggleUp(final UIClassification _uiClass,
                                  final boolean _selected)
            {
                UIClassification uiClass = _uiClass;
                uiClass.setSelected(_selected);
                while (!uiClass.isBase()) {
                    uiClass = uiClass.getParent();
                    uiClass.setSelected(_selected);
                }
            }

            private void toggleDown(final UIClassification _uiClass,
                                    final boolean _selected)
            {
                _uiClass.setSelected(_selected);
                for (final UIClassification child : _uiClass.getChildren()) {
                    toggleDown(child, _selected);
                }
            }

            @Override
            protected IModel<Boolean> newCheckBoxModel(final IModel<UIClassification> _model)
            {
                return Model.of(_model.getObject().isSelected());
            }
        };
    }
@Override
    protected Component newContentComponent(final String _id,
                                            final IModel<UIClassification> _model)
    {
        return new CheckedFolder<UIClassification>(_id, this, _model)
        {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(final AjaxRequestTarget _target)
            {
                final boolean selected = getModelObject().isSelected();
                final ClassificationTreePanel parent = findParent(ClassificationTreePanel.class);
                
                if (parent != null && !getModelObject().isMultipleSelect() && !selected) {
                    
                    UIClassification uiClass = getModelObject();
                    while (!uiClass.isBase()) {
                        uiClass = uiClass.getParent();
                    }
                    toggleDown(uiClass, false);
                }

                
                if (selected) {
                    toggleDown(getModelObject(), false);
                } else {
                    toggleUp(getModelObject(), true);
                }
                _target.add(ClassificationTree.this);
                if (parent != null) {
                    parent.modelChanged();
                }
            }

            private void toggleUp(final UIClassification _uiClass,
                                  final boolean _selected)
            {
                UIClassification uiClass = _uiClass;
                uiClass.setSelected(_selected);
                while (!uiClass.isBase()) {
                    uiClass = uiClass.getParent();
                    uiClass.setSelected(_selected);
                }
            }

            private void toggleDown(final UIClassification _uiClass,
                                    final boolean _selected)
            {
                _uiClass.setSelected(_selected);
                for (final UIClassification child : _uiClass.getChildren()) {
                    toggleDown(child, _selected);
                }
            }

            @Override
            protected IModel<Boolean> newCheckBoxModel(final IModel<UIClassification> _model)
            {
                return Model.of(_model.getObject().isSelected());
            }
        };
    }
@ Override protected Component newContentComponent ( final String _id , final IModel < UIClassification > _model ) { return new CheckedFolder < UIClassification > ( _id , this , _model ) { private static final long serialVersionUID = 1L ; @ Override protected void onUpdate ( final AjaxRequestTarget _target ) { final boolean selected = getModelObject ( ) . isSelected ( ) ; final ClassificationTreePanel parent = findParent ( ClassificationTreePanel . class ) ; // Don't do that if it is a filter if ( parent != null && ! getModelObject ( ) . isMultipleSelect ( ) && ! selected ) { // select event ensure that there are no other objects selected by cleaning it totally UIClassification uiClass = getModelObject ( ) ; while ( ! uiClass . isBase ( ) ) { uiClass = uiClass . getParent ( ) ; } toggleDown ( uiClass , false ) ; } // unselect event ensure that no children are selected if ( selected ) { toggleDown ( getModelObject ( ) , false ) ; } else { toggleUp ( getModelObject ( ) , true ) ; } _target . add ( ClassificationTree . this ) ; if ( parent != null ) { parent . modelChanged ( ) ; } } private void toggleUp ( final UIClassification _uiClass , final boolean _selected ) { UIClassification uiClass = _uiClass ; uiClass . setSelected ( _selected ) ; while ( ! uiClass . isBase ( ) ) { uiClass = uiClass . getParent ( ) ; uiClass . setSelected ( _selected ) ; } } private void toggleDown ( final UIClassification _uiClass , final boolean _selected ) { _uiClass . setSelected ( _selected ) ; for ( final UIClassification child : _uiClass . getChildren ( ) ) { toggleDown ( child , _selected ) ; } } @ Override protected IModel < Boolean > newCheckBoxModel ( final IModel < UIClassification > _model ) { return Model . of ( _model . getObject ( ) . isSelected ( ) ) ; } } ; }
/*
(non-Javadoc)
@see org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree#
newContentComponent(java.lang.String, org.apache.wicket.model.IModel)
/ * ( non - Javadoc )