/// <summary> /// Sets the items visible in the list, clearing the selection if it is no longer valid. If a selection is /// ArraySelection#getRequired(), the first item is selected. /// </summary> /// <returns>The items.</returns> /// <param name="newItems">New items.</param> public void setItems(IList <T> newItems) { Assert.isNotNull(newItems, "newItems cannot be null"); float oldPrefWidth = _prefWidth, oldPrefHeight = _prefHeight; _items.Clear(); _items.AddRange(newItems); _selection.validate(); invalidate(); validate(); if (oldPrefWidth != _prefWidth || oldPrefHeight != _prefHeight) { invalidateHierarchy(); setSize(_prefWidth, _prefHeight); } }
/// <summary> /// Sets the items visible in the select box /// </summary> /// <returns>The items.</returns> /// <param name="newItems">New items.</param> public void setItems(List <T> newItems) { Assert.isNotNull(newItems, "newItems cannot be null"); float oldPrefWidth = preferredWidth; _items.Clear(); _items.AddRange(newItems); _selection.validate(); _selectBoxList.listBox.setItems(_items); invalidate(); validate(); if (oldPrefWidth != _prefWidth) { invalidateHierarchy(); setSize(_prefWidth, _prefHeight); } }