/** * Get the given node's {@link State}. * * @param t * the node to get state for * @return state * * @see #getModelObject() * @see Set#contains(Object) */ public State getState(T t) { if (getModelObject().contains(t)) { return State.EXPANDED; } else { return State.COLLAPSED; } }
/** * Collapse the given node, tries to update the affected branch if the change happens on an * {@link AjaxRequestTarget}. * * @param t * the object to collapse * * @see #getModelObject() * @see Set#remove(Object) * @see #updateBranch(Object, IPartialPageRequestHandler) */ public void collapse(T t) { modelChanging(); getModelObject().remove(t); modelChanged(); getRequestCycle().find(IPartialPageRequestHandler.class).ifPresent( target -> updateBranch(t, target) ); }
/** * Expand the given node, tries to update the affected branch if the change happens on an * {@link AjaxRequestTarget}. * * @param t * the node to expand * * @see #getModelObject() * @see Set#add(Object) * @see #updateBranch(Object, IPartialPageRequestHandler) */ public void expand(T t) { modelChanging(); getModelObject().add(t); modelChanged(); getRequestCycle().find(IPartialPageRequestHandler.class).ifPresent( target -> updateBranch(t, target) ); }