/** * Collapses the given item and removes its sub-hierarchy. Calling this * method will have no effect if the row is already collapsed. * {@code syncAndRefresh} indicates whether the changes should be * synchronised to the client and the data provider be notified. * * @param item * the item to collapse * @param syncAndRefresh * {@code true} if the changes should be synchronised to the * client and the data provider should be notified of the * changes, {@code false} otherwise. */ public void collapse(T item, boolean syncAndRefresh) { Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) : null; doCollapse(item, index, syncAndRefresh); }
/** * Expands the given item. Calling this method will have no effect if the * item is already expanded or if it has no children. {@code syncAndRefresh} * indicates whether the changes should be synchronised to the client and * the data provider be notified. * * @param item * the item to expand * @param syncAndRefresh * {@code true} if the changes should be synchronised to the * client and the data provider should be notified of the * changes, {@code * false} otherwise. */ public void expand(T item, boolean syncAndRefresh) { Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) : null; doExpand(item, index, syncAndRefresh); }