Example usage for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode

List of usage examples for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode

Introduction

In this page you can find the example usage for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode.

Prototype

public DefaultMutableTreeNode(Object userObject) 

Source Link

Document

Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object.

Usage

From source file:org.apache.directory.fortress.web.panel.PwPolicyListPanel.java

@SuppressWarnings("Convert2Diamond")
public PwPolicyListPanel(String id) {
    super(id);//from  w  w w  .j  a  v  a 2s.c  o  m
    PwPolicyListModel policyListModel = new PwPolicyListModel(new PwPolicy(""), SecUtils.getSession(this));
    setDefaultModel(policyListModel);
    List<IGridColumn<DefaultTreeModel, DefaultMutableTreeNode, String>> columns = new ArrayList<IGridColumn<DefaultTreeModel, DefaultMutableTreeNode, String>>();
    columns.add(new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Policy Name"), "userObject.name"));

    PropertyColumn minAge = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Min Age"), "userObject.minAge");
    minAge.setInitialSize(60);
    columns.add(minAge);

    PropertyColumn maxAge = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Max Age"), "userObject.maxAge");
    maxAge.setInitialSize(75);
    columns.add(maxAge);

    PropertyColumn inHistory = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("History"), "userObject.inHistory");
    inHistory.setInitialSize(50);
    columns.add(inHistory);

    PropertyColumn minLength = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Min Len"), "userObject.minLength");
    minLength.setInitialSize(60);
    columns.add(minLength);

    PropertyColumn expireWarning = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Expire Warning"), "userObject.expireWarning");
    expireWarning.setInitialSize(115);
    columns.add(expireWarning);

    PropertyColumn graceLoginLimit = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Grace"), "userObject.graceLoginLimit");
    graceLoginLimit.setInitialSize(50);
    columns.add(graceLoginLimit);

    PropertyColumn lockout = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Lockout"), "userObject.lockout");
    lockout.setInitialSize(60);
    columns.add(lockout);

    PropertyColumn lockoutDuration = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Lockout Duration"), "userObject.lockoutDuration");
    lockoutDuration.setInitialSize(125);
    columns.add(lockoutDuration);

    PropertyColumn maxFailure = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Max Failure"), "userObject.maxFailure");
    maxFailure.setInitialSize(80);
    columns.add(maxFailure);

    PropertyColumn failureCountInterval = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Interval"), "userObject.failureCountInterval");
    failureCountInterval.setInitialSize(60);
    columns.add(failureCountInterval);

    PropertyColumn mustChange = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Must Change"), "userObject.mustChange");
    mustChange.setInitialSize(90);
    columns.add(mustChange);

    PropertyColumn allowUserChange = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Allow Change"), "userObject.allowUserChange");
    allowUserChange.setInitialSize(95);
    columns.add(allowUserChange);

    PropertyColumn safeModify = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of("Safe Modify"), "userObject.safeModify");
    safeModify.setInitialSize(90);
    columns.add(safeModify);

    /*
        PropertyColumn checkQuality = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
                    Model.of("Check Quality"), "userObject.checkQuality");
        checkQuality.setInitialSize(100);
        columns.add(checkQuality);
    */

    List<PwPolicy> policies = (List<PwPolicy>) getDefaultModel().getObject();
    treeModel = createTreeModel(policies);
    grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>("policytreegrid", treeModel,
            columns) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        public void selectItem(IModel itemModel, boolean selected) {
            node = (DefaultMutableTreeNode) itemModel.getObject();
            if (!node.isRoot()) {
                PwPolicy policy = (PwPolicy) node.getUserObject();
                log.debug("TreeGrid.addGrid.selectItem selected policy =" + policy.getName());
                if (super.isItemSelected(itemModel)) {
                    log.debug("TreeGrid.addGrid.selectItem item is selected");
                    super.selectItem(itemModel, false);
                } else {
                    super.selectItem(itemModel, true);
                    SelectModelEvent.send(getPage(), this, policy);
                }
            }
        }
    };
    //grid.setContentHeight( 50, SizeUnit.EM );
    grid.setAllowSelectMultiple(false);
    grid.setClickRowToSelect(true);
    grid.setClickRowToDeselect(false);
    grid.setSelectToEdit(false);
    // expand the root node
    grid.getTreeState().expandAll();
    Form listForm = new Form("form");
    listForm.add(grid);
    grid.setOutputMarkupId(true);
    TextField searchValFld = new TextField(GlobalIds.SEARCH_VAL,
            new PropertyModel<String>(this, GlobalIds.SEARCH_VAL));
    listForm.add(searchValFld);

    listForm.add(new AjaxSubmitLink(GlobalIds.SEARCH) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            log.debug(".search onSubmit");
            info("Searching Policies...");
            if (!StringUtils.isNotEmpty(searchVal)) {
                searchVal = "";
            }
            PwPolicy srchPolicy = new PwPolicy(searchVal);
            setDefaultModel(new PwPolicyListModel(srchPolicy, SecUtils.getSession(this)));
            treeModel.reload();
            rootNode.removeAllChildren();
            List<PwPolicy> policies = (List<PwPolicy>) getDefaultModelObject();
            if (CollectionUtils.isNotEmpty(policies)) {
                for (PwPolicy policy : policies)
                    rootNode.add(new DefaultMutableTreeNode(policy));
                info("Search returned " + policies.size() + " matching objects");
            } else {
                info("No matching objects found");
            }
            target.add(grid);
        }

        @Override
        public void onError(AjaxRequestTarget target, Form form) {
            log.warn(".search.onError");
            target.add();
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            AjaxCallListener ajaxCallListener = new AjaxCallListener() {
                /** Default serialVersionUID */
                private static final long serialVersionUID = 1L;

                @Override
                public CharSequence getFailureHandler(Component component) {
                    return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
                }
            };
            attributes.getAjaxCallListeners().add(ajaxCallListener);
        }
    });
    add(listForm);
}

From source file:org.apache.directory.fortress.web.panel.PwPolicyListPanel.java

private DefaultTreeModel createTreeModel(List<PwPolicy> policies) {
    DefaultTreeModel model;//from  w ww . j a  v  a  2s .  co  m
    rootNode = new DefaultMutableTreeNode(null);
    model = new DefaultTreeModel(rootNode);
    if (policies == null)
        log.debug("no Policies found");
    else {
        log.debug("Policies found:" + policies.size());
        for (PwPolicy policy : policies)
            rootNode.add(new DefaultMutableTreeNode(policy));
    }
    return model;
}

From source file:org.apache.directory.fortress.web.panel.PwPolicyListPanel.java

public void add(FortEntity entity) {
    if (getDefaultModelObject() != null) {
        List<PwPolicy> policies = ((List<PwPolicy>) getDefaultModelObject());
        policies.add((PwPolicy) entity);
        treeModel.insertNodeInto(new DefaultMutableTreeNode(entity), rootNode, policies.size());
    }//from ww w.ja v a 2  s . com
}

From source file:org.apache.directory.fortress.web.panel.RoleListPanel.java

public RoleListPanel(String id, final boolean isAdmin) {
    super(id);/*from   w  ww.  ja v  a2 s.c o m*/
    this.isAdmin = isAdmin;
    RoleListModel roleListModel = new RoleListModel(createRole(""), isAdmin, SecUtils.getSession(this));
    setDefaultModel(roleListModel);
    List<IGridColumn<DefaultTreeModel, DefaultMutableTreeNode, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(Model.of("Name"),
            "userObject.name"));

    PropertyColumn description = new PropertyColumn<>(Model.of("Description"), "userObject.Description");
    description.setInitialSize(300);
    columns.add(description);

    PropertyColumn beginDate = new PropertyColumn<>(Model.of("Begin Date"), "userObject.BeginDate");
    beginDate.setInitialSize(80);
    columns.add(beginDate);

    PropertyColumn endDate = new PropertyColumn<>(Model.of("End Date"), "userObject.EndDate");
    endDate.setInitialSize(80);
    columns.add(endDate);

    PropertyColumn beginLockDate = new PropertyColumn<>(Model.of("Begin Lock Dt"), "userObject.BeginLockDate");
    beginLockDate.setInitialSize(80);
    columns.add(beginLockDate);

    PropertyColumn endLockDate = new PropertyColumn<>(Model.of("End Lock Dt"), "userObject.EndLockDate");
    endLockDate.setInitialSize(80);
    columns.add(endLockDate);

    PropertyColumn beginTime = new PropertyColumn<>(Model.of("Begin Tm"), "userObject.BeginTime");
    beginTime.setInitialSize(70);
    columns.add(beginTime);

    PropertyColumn endTime = new PropertyColumn<>(Model.of("End Tm"), "userObject.EndTime");
    endTime.setInitialSize(70);
    columns.add(endTime);

    PropertyColumn dayMask = new PropertyColumn<>(Model.of("DayMask"), "userObject.DayMask");
    dayMask.setInitialSize(80);
    columns.add(dayMask);

    PropertyColumn parents = new PropertyColumn<>(Model.of("Parents"), "userObject.parents");
    parents.setInitialSize(250);
    columns.add(parents);

    List<T> roles = (List<T>) getDefaultModel().getObject();
    treeModel = createTreeModel(roles);
    grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>("roletreegrid", treeModel, columns) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        public void selectItem(IModel itemModel, boolean selected) {
            node = (DefaultMutableTreeNode) itemModel.getObject();
            if (!node.isRoot()) {
                T role = (T) node.getUserObject();
                if (super.isItemSelected(itemModel)) {
                    log.debug("TreeGrid.addGrid.selectItem item is selected");
                    super.selectItem(itemModel, false);
                } else {
                    super.selectItem(itemModel, true);
                    SelectModelEvent.send(getPage(), this, (FortEntity) role);
                }
            }
        }
    };
    //grid.setContentHeight( 50, SizeUnit.EM );
    grid.setAllowSelectMultiple(false);
    grid.setClickRowToSelect(true);
    grid.setClickRowToDeselect(false);
    grid.setSelectToEdit(false);
    // expand the root node
    grid.getTreeState().expandAll();
    Form listForm = new Form("form");
    listForm.add(grid);
    grid.setOutputMarkupId(true);
    TextField searchValFld = new TextField(GlobalIds.SEARCH_VAL,
            new PropertyModel<String>(this, GlobalIds.SEARCH_VAL));
    listForm.add(searchValFld);

    listForm.add(new SecureIndicatingAjaxButton(GlobalIds.SEARCH, GlobalIds.REVIEW_MGR, "findRoles") {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            log.debug(".search onSubmit");
            info("Searching Roles...");
            if (!StringUtils.isNotEmpty(searchVal)) {
                searchVal = "";
            }

            Role srchRole = createRole(searchVal);
            setDefaultModel(new RoleListModel(srchRole, isAdmin, SecUtils.getSession(this)));
            treeModel.reload();
            rootNode.removeAllChildren();
            List<Role> roles = (List<Role>) getDefaultModelObject();
            if (CollectionUtils.isNotEmpty(roles)) {
                for (T role : (List<T>) roles)
                    rootNode.add(new DefaultMutableTreeNode(role));
                info("Search returned " + roles.size() + " matching objects");
            } else {
                info("No matching objects found");
            }
            target.add(grid);
        }

        @Override
        public void onError(AjaxRequestTarget target, Form form) {
            log.warn(".search.onError");
            target.add();
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            AjaxCallListener ajaxCallListener = new AjaxCallListener() {
                /** Default serialVersionUID */
                private static final long serialVersionUID = 1L;

                @Override
                public CharSequence getFailureHandler(Component component) {
                    return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
                }
            };
            attributes.getAjaxCallListeners().add(ajaxCallListener);
        }
    });
    add(listForm);
}

From source file:org.apache.directory.fortress.web.panel.RoleListPanel.java

public void add(FortEntity entity) {
    if (getDefaultModelObject() != null) {
        List<Role> roles = ((List<Role>) getDefaultModelObject());
        roles.add((Role) entity);
        treeModel.insertNodeInto(new DefaultMutableTreeNode(entity), rootNode, roles.size());
    }/*from ww  w  .  ja  va 2 s .  c  o  m*/
}

From source file:org.apache.directory.fortress.web.panel.RoleListPanel.java

private DefaultTreeModel createTreeModel(List<T> roles) {
    DefaultTreeModel model;/*from  w  w w .jav a2s . com*/
    rootNode = new DefaultMutableTreeNode(null);
    model = new DefaultTreeModel(rootNode);
    if (roles == null)
        log.debug("no Roles found");
    else {
        log.debug("Roles found:" + roles.size());
        for (T role : roles)
            rootNode.add(new DefaultMutableTreeNode(role));
    }
    return model;
}

From source file:org.apache.directory.fortress.web.panel.SDListPanel.java

public SDListPanel(String id, final boolean isStatic) {
    super(id);/*from w  ww  .  j  a  va 2s  . c om*/
    SDSet sdSet = new SDSet();
    sdSet.setName("");
    String searchLabel;
    String opName;
    if (isStatic) {
        sdSet.setType(SDSet.SDType.STATIC);
        searchLabel = "SSD Name";
        opName = "ssdRoleSets";
    } else {
        sdSet.setType(SDSet.SDType.DYNAMIC);
        searchLabel = "DSD Name";
        opName = "dsdRoleSets";
    }
    SDListModel sdListModel = new SDListModel(sdSet, SecUtils.getSession(this));
    setDefaultModel(sdListModel);
    List<IGridColumn<DefaultTreeModel, DefaultMutableTreeNode, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String, String>(
            Model.of(searchLabel), "userObject.name"));

    PropertyColumn description = new PropertyColumn<>(Model.of("Description"), "userObject.Description");

    description.setInitialSize(300);
    columns.add(description);

    PropertyColumn cardinality = new PropertyColumn<>(Model.of("Cardinality"), "userObject.Cardinality");
    cardinality.setInitialSize(100);
    columns.add(cardinality);

    PropertyColumn members = new PropertyColumn<>(Model.of("Members"), "userObject.members");
    members.setInitialSize(600);
    columns.add(members);

    List<SDSet> sdSets = (List<SDSet>) getDefaultModel().getObject();
    treeModel = createTreeModel(sdSets);
    grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>("sdtreegrid", treeModel, columns) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        public void selectItem(IModel itemModel, boolean selected) {
            node = (DefaultMutableTreeNode) itemModel.getObject();
            if (!node.isRoot()) {
                SDSet sdSet = (SDSet) node.getUserObject();
                log.debug("TreeGrid.addGrid.selectItem selected sdSet =" + sdSet.getName());
                if (super.isItemSelected(itemModel)) {
                    log.debug("TreeGrid.addGrid.selectItem item is selected");
                    super.selectItem(itemModel, false);
                } else {
                    super.selectItem(itemModel, true);
                    SelectModelEvent.send(getPage(), this, sdSet);
                }
            }
        }
    };
    //grid.setContentHeight( 50, SizeUnit.EM );
    grid.setAllowSelectMultiple(false);
    grid.setClickRowToSelect(true);
    grid.setClickRowToDeselect(false);
    grid.setSelectToEdit(false);
    // expand the root node
    grid.getTreeState().expandAll();
    this.listForm = new Form("form");
    this.listForm.add(grid);
    grid.setOutputMarkupId(true);

    radioGroup = new RadioGroup("searchOptions", new PropertyModel(this, "selectedRadioButton"));
    add(radioGroup);
    Radio nameRb = new Radio("nameRb", new Model(Character.valueOf(NAMES)));
    radioGroup.add(nameRb);
    Radio roleRb = new Radio("roleRb", new Model(Character.valueOf(ROLES)));
    radioGroup.add(roleRb);
    addRoleSearchModal(roleRb);
    radioGroup.setOutputMarkupId(true);
    radioGroup.setRenderBodyOnly(false);
    searchValFld = new TextField(GlobalIds.SEARCH_VAL, new PropertyModel<String>(this, GlobalIds.SEARCH_VAL));
    searchValFld.setOutputMarkupId(true);
    AjaxFormComponentUpdatingBehavior ajaxUpdater = new AjaxFormComponentUpdatingBehavior(GlobalIds.ONBLUR) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            target.add(searchValFld);
        }
    };
    searchValFld.add(ajaxUpdater);
    radioGroup.add(searchValFld);
    this.listForm.add(radioGroup);
    selectedRadioButton = NAMES;
    this.listForm.add(new SecureIndicatingAjaxButton(GlobalIds.SEARCH, GlobalIds.REVIEW_MGR, opName) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            log.debug(".search onSubmit");
            info("Searching SDSets...");
            if (!StringUtils.isNotBlank(searchVal)) {
                searchVal = "";
            }
            final SDSet srchSd = new SDSet();
            if (isStatic) {
                srchSd.setType(SDSet.SDType.STATIC);
            } else {
                srchSd.setType(SDSet.SDType.DYNAMIC);
            }
            switch (selectedRadioButton) {
            case NAMES:
                log.debug(".onSubmit NAMES RB selected");
                srchSd.setName(searchVal);
                break;
            case ROLES:
                log.debug(".onSubmit ROLES RB selected");
                srchSd.setMember(searchVal);
                break;
            }

            setDefaultModel(new SDListModel(srchSd, SecUtils.getSession(this)));
            treeModel.reload();
            rootNode.removeAllChildren();
            List<SDSet> sdSets = (List<SDSet>) getDefaultModelObject();
            if (CollectionUtils.isNotEmpty(sdSets)) {
                for (SDSet sdSet : sdSets)
                    rootNode.add(new DefaultMutableTreeNode(sdSet));
                info("Search returned " + sdSets.size() + " matching objects");
            } else {
                info("No matching objects found");
            }
            target.add(grid);
        }

        @Override
        public void onError(AjaxRequestTarget target, Form form) {
            log.warn(".search.onError");
            target.add();
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            AjaxCallListener ajaxCallListener = new AjaxCallListener() {
                /** Default serialVersionUID */
                private static final long serialVersionUID = 1L;

                @Override
                public CharSequence getFailureHandler(Component component) {
                    return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
                }
            };
            attributes.getAjaxCallListeners().add(ajaxCallListener);
        }
    });
    add(this.listForm);
}

From source file:org.apache.directory.fortress.web.panel.SDListPanel.java

private DefaultTreeModel createTreeModel(List<SDSet> sdSets) {
    DefaultTreeModel model;//  w ww  .  java  2 s .co m
    rootNode = new DefaultMutableTreeNode(null);
    model = new DefaultTreeModel(rootNode);
    if (sdSets == null)
        log.debug("no SDSets found");
    else {
        log.debug("SDSets found:" + sdSets.size());
        for (SDSet sdSet : sdSets)
            rootNode.add(new DefaultMutableTreeNode(sdSet));
    }
    return model;
}

From source file:org.apache.directory.fortress.web.panel.SDListPanel.java

public void add(FortEntity entity) {
    if (getDefaultModelObject() != null) {
        List<SDSet> sdSets = ((List<SDSet>) getDefaultModelObject());
        sdSets.add((SDSet) entity);/*from   w ww  . j  a  v  a2  s.com*/
        treeModel.insertNodeInto(new DefaultMutableTreeNode(entity), rootNode, sdSets.size());
    }
}

From source file:org.apache.directory.fortress.web.panel.UserListPanel.java

private void addButtons() {
    userformsearchfields/*w  ww  .  j  ava2s. c  o m*/
            .add(new SecureIndicatingAjaxButton(GlobalIds.SEARCH, GlobalIds.REVIEW_MGR, GlobalIds.FIND_USERS) {
                /** Default serialVersionUID */
                private static final long serialVersionUID = 1L;

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form form) {
                    LOG.debug(".search.onSubmit selected radio button: " + selectedRadioButton);
                    info("Searching Users...");
                    String searchVal = "";
                    if (StringUtils.isNotEmpty(searchData.getField1())) {
                        searchVal = searchData.getField1();
                    }
                    if (selectedRadioButton.equals(PERMS)) {
                        LOG.debug(".onSubmit PERMS RB selected");

                        Permission srchPerm = new Permission();
                        srchPerm.setObjName(searchData.getField1());
                        srchPerm.setOpName(searchData.getField2());
                        setDefaultModel(new UserListModel(srchPerm, SecUtils.getSession(this)));
                    } else {
                        User srchUser = new User();
                        if (selectedRadioButton.equals(USERS)) {
                            LOG.debug(".onSubmit USERS_PAGE RB selected");
                            srchUser.setUserId(searchVal);
                        } else if (selectedRadioButton.equals(ROLES)) {
                            LOG.debug(".onSubmit ROLES RB selected");
                            srchUser.setRoleName(searchVal);
                        } else if (selectedRadioButton.equals(ADMIN_ROLES)) {
                            LOG.debug(".onSubmit ADMIN ROLES RB selected");
                            srchUser.setAdminRoleName(searchVal);
                        } else if (selectedRadioButton.equals(OUS)) {
                            LOG.debug(".onSubmit OUS RB selected");
                            srchUser.setOu(searchVal);
                        } else if (selectedRadioButton.equals(PERMS)) {
                            LOG.debug(".onSubmit PERMS RB selected");
                        }
                        setDefaultModel(new UserListModel(srchUser, SecUtils.getSession(this)));
                    }

                    treeModel.reload();
                    rootNode.removeAllChildren();
                    List<User> users = (List<User>) getDefaultModelObject();
                    if (CollectionUtils.isNotEmpty(users)) {
                        for (User user : users) {
                            rootNode.add(new DefaultMutableTreeNode(user));
                        }
                        info("Search returned " + users.size() + " matching objects");
                    } else {
                        info("No matching objects found");
                    }
                    target.add(grid);
                }

                @Override
                public void onError(AjaxRequestTarget target, Form form) {
                    LOG.warn(".search.onError");
                    target.add();
                }
            });
    userformsearchfields.add(new AjaxSubmitLink(GlobalIds.CLEAR) {
        /** Default serialVersionUID */
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            setResponsePage(new UserPage());
        }

        @Override
        public void onError(AjaxRequestTarget target, Form form) {
            LOG.warn("UserListPanel.clear.onError");
        }

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            super.updateAjaxAttributes(attributes);
            AjaxCallListener ajaxCallListener = new AjaxCallListener() {
                /** Default serialVersionUID */
                private static final long serialVersionUID = 1L;

                @Override
                public CharSequence getFailureHandler(Component component) {
                    return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
                }
            };
            attributes.getAjaxCallListeners().add(ajaxCallListener);
        }
    });
}