@Override protected Item getUnfilteredItem(Object itemId) { if (itemId != null && items.containsKey(itemId)) { return new IndexedContainerItem(itemId); } return null; }
/** * Tests if the given object is the same as the this object. Two Items * got from a list container with the same ID are equal. * * @param obj * an object to compare with this object * @return <code>true</code> if the given object is the same as this * object, <code>false</code> if not */ @Override public boolean equals(Object obj) { if (obj == null || !obj.getClass().equals(IndexedContainerItem.class)) { return false; } final IndexedContainerItem li = (IndexedContainerItem) obj; return getHost() == li.getHost() && itemId.equals(li.itemId); }
/** * Gets the <code>String</code> representation of the contents of the * Item. The format of the string is a space separated catenation of the * <code>String</code> representations of the values of the Properties * contained by the Item. * * @return <code>String</code> representation of the Item contents */ @Override public String toString() { String retValue = ""; for (final Iterator<?> i = propertyIds.iterator(); i.hasNext();) { final Object propertyId = i.next(); retValue += getItemProperty(propertyId).getValue(); if (i.hasNext()) { retValue += " "; } } return retValue; }
@Override public Item addItem(Object itemId) { Item item = internalAddItemAtEnd(itemId, new IndexedContainerItem(itemId), false); if (item == null) { return null; } else if (!isFiltered()) { // always the last item fireItemAdded(size() - 1, itemId, item); } else if (passesFilters(itemId) && !containsId(itemId)) { getFilteredItemIds().add(itemId); // always the last item fireItemAdded(size() - 1, itemId, item); } return item; }
@Override public Item addItemAfter(Object previousItemId, Object newItemId) { return internalAddItemAfter(previousItemId, newItemId, new IndexedContainerItem(newItemId), true); }
@Override public Item addItemAt(int index, Object newItemId) { return internalAddItemAt(index, newItemId, new IndexedContainerItem(newItemId), true); }
public IndexedContainer(Collection<?> itemIds) { this(); if (items != null) { for (final Iterator<?> i = itemIds.iterator(); i.hasNext();) { Object itemId = i.next(); internalAddItemAtEnd(itemId, new IndexedContainerItem(itemId), false); } filterAll(); } }