/** Returns the list box that it belongs to. * <p>It is the same as {@link #getParent}. */ public Listbox getListbox() { return (Listbox) getParent(); }
/** Sets whether it is selected. */ public void setSelected(boolean selected) { if (_selected != selected) { final Listbox listbox = (Listbox) getParent(); if (listbox != null) { //Note: we don't update it here but let its parent does the job listbox.toggleItemSelection(this); } else { _selected = selected; } } }
/** * Sets the active page in which the specified item is. The active page will * become the page that contains the specified item. * * @param item * the item to show. If the item is null or doesn't belong to * this listbox, nothing happens. * @since 3.0.4 * @see #setActivePage(int) */ public void setActivePage(Listitem item) { if (item != null && item.getParent() == this) { final int pg = item.getIndex() / getPageSize(); if (pg != getActivePage()) setActivePage(pg); } }
/** * Deselects all of the currently selected items and selects the given item. * <p> * It is the same as {@link #setSelectedItem}. * * @param item * the item to select. If null, all items are deselected. */ public void selectItem(Listitem item) { if (item == null) { setSelectedIndex(-1); } else { if (item.getParent() != this) throw new UiException("Not a child: " + item); if (_multiple || !item.isSelected()) setSelectedIndex(item.getIndex()); } }
/** * Deselects the given item without deselecting other items. * * <p>Notice that if you assign a model to a listbox ({@link #setModel}), * you shall not invoke this method directly. Rather, use {@link Selectable} * instead. */ public void removeItemFromSelection(Listitem item) { if (item.getParent() != this) throw new UiException("Not a child: " + item); if (item.isSelected()) { if (!_multiple) { clearSelection(); } else { item.setSelectedDirectly(false); _selItems.remove(item); fixSelectedIndex(0); // ZK-2113: should be same as normal mold // if (inSelectMold()) { // item.smartUpdate("selected", false); // } else { // } smartUpdateSelection(); } } }
public boolean setVisible(boolean visible) { if (isVisible() == visible) return visible; final boolean result = super.setVisible(visible); final Listbox listbox = (Listbox) getParent(); if (listbox != null) { if (listbox.inSelectMold()) listbox.invalidate(); final Listgroup g = listbox.getListgroupAt(getIndex()); if (g == null || g.isOpen()) listbox.addVisibleItemCount(visible ? 1 : -1); } // Bug ZK-485, send after invoking listbox.addVisibleItemCount() smartUpdate("visible", visible); return result; }
if (item.getParent() != this) throw new UiException("Not a child: " + item);
final int jfrom = newItem.getParent() == this ? newItem.getIndex() : -1;
public void render(final Listitem item, final Object data, final int index) { final Listbox listbox = (Listbox) item.getParent(); Template tm = listbox.getTemplate("model"); GroupingInfo info = null;
public void render(final Listitem item, final Object data, final int index) throws Exception { final Listbox listbox = (Listbox) item.getParent(); final int size = listbox.getModel().getSize();