/** Sets the selection to only the selected index. * @param index -1 to clear the selection. */ public void setSelectedIndex (int index) { if (index < -1 || index >= items.size) throw new IllegalArgumentException("index must be >= -1 and < " + items.size + ": " + index); if (index == -1) { selection.clear(); } else { selection.set(items.get(index)); } }
/** Sets the selection to only the selected index. * @param index -1 to clear the selection. */ public void setSelectedIndex (int index) { if (index < -1 || index >= items.size) throw new IllegalArgumentException("index must be >= -1 and < " + items.size + ": " + index); if (index == -1) { selection.clear(); } else { selection.set(items.get(index)); } }
public void clearItems () { if (items.size == 0) return; items.clear(); selection.clear(); invalidateHierarchy(); }
public void clearItems () { if (items.size == 0) return; items.clear(); selection.clear(); invalidateHierarchy(); }
public void clearItems () { if (items.size == 0) return; items.clear(); selection.clear(); invalidateHierarchy(); }
public void clearItems () { if (items.size == 0) return; items.clear(); selection.clear(); invalidateHierarchy(); }
/** Removes objects from the selection that are no longer in the items array. If {@link #getRequired()} is true and there is no * selected item, the first item is selected. */ public void validate () { Array<T> array = this.array; if (array.size == 0) { clear(); return; } for (Iterator<T> iter = items().iterator(); iter.hasNext();) { T selected = iter.next(); if (!array.contains(selected, false)) iter.remove(); } if (required && selected.size == 0) set(array.first()); } }
/** Removes objects from the selection that are no longer in the items array. If {@link #getRequired()} is true and there is no * selected item, the first item is selected. */ public void validate () { Array<T> array = this.array; if (array.size == 0) { clear(); return; } for (Iterator<T> iter = items().iterator(); iter.hasNext();) { T selected = iter.next(); if (!array.contains(selected, false)) iter.remove(); } if (required && selected.size == 0) set(array.first()); } }
/** Sets the selection to only the passed item, if it is a possible choice, else selects the first item. */ public void setSelected (T item) { if (items.contains(item, false)) selection.set(item); else if (items.size > 0) selection.set(items.first()); else selection.clear(); }
/** Sets the selection to only the passed item, if it is a possible choice, else selects the first item. */ public void setSelected (T item) { if (items.contains(item, false)) selection.set(item); else if (items.size > 0) selection.set(items.first()); else selection.clear(); }
/** Sets the selection to only the passed item, if it is a possible choice. * @param item May be null. */ public void setSelected (T item) { if (items.contains(item, false)) selection.set(item); else if (selection.getRequired() && items.size > 0) selection.set(items.first()); else selection.clear(); }
/** Sets the selection to only the passed item, if it is a possible choice. * @param item May be null. */ public void setSelected (T item) { if (items.contains(item, false)) selection.set(item); else if (selection.getRequired() && items.size > 0) selection.set(items.first()); else selection.clear(); }
case Keys.A: if (UIUtils.ctrl() && selection.getMultiple()) { selection.clear(); selection.addAll(items); return true;
case Keys.A: if (UIUtils.ctrl() && selection.getMultiple()) { selection.clear(); selection.addAll(items); return true;
/** Sets the selection to only the selected index. * @param index -1 to clear the selection. */ public void setSelectedIndex (int index) { if (index < -1 || index >= items.size) throw new IllegalArgumentException("index must be >= -1 and < " + items.size + ": " + index); if (index == -1) { selection.clear(); } else { selection.set(items.get(index)); } }
public void clearItems () { if (items.size == 0) return; items.clear(); selection.clear(); invalidateHierarchy(); }
public void clearItems () { if (items.size == 0) return; items.clear(); selection.clear(); invalidateHierarchy(); }
public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.A && UIUtils.ctrl() && selection.getMultiple()) { selection.clear(); selection.addAll(items); return true; } return false; }
/** Sets the selection to only the passed item, if it is a possible choice, else selects the first item. */ public void setSelected (T item) { if (items.contains(item, false)) selection.set(item); else if (items.size > 0) selection.set(items.first()); else selection.clear(); }
/** Sets the selection to only the passed item, if it is a possible choice. * @param item May be null. */ public void setSelected (T item) { if (items.contains(item, false)) selection.set(item); else if (selection.getRequired() && items.size > 0) selection.set(items.first()); else selection.clear(); }