public abstract class AbstractAssetContainer
extends info.magnolia.ui.workbench.container.AbstractContainer
implements com.vaadin.data.Container.Sortable, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeNotifier, info.magnolia.ui.workbench.container.Refreshable
AssetProvider
implementations. Implements a simple mechanism
for lazy loading items and a cache for items and item ids.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractAssetContainer.BaseItemSetChangeEvent
Basic itemSet change event.
|
info.magnolia.ui.workbench.container.AbstractContainer.ItemSetChangeEvent, info.magnolia.ui.workbench.container.AbstractContainer.PropertySetChangeEvent
com.vaadin.data.Container.Indexed.ItemAddEvent, com.vaadin.data.Container.Indexed.ItemRemoveEvent
com.vaadin.data.Container.Editor, com.vaadin.data.Container.Filter, com.vaadin.data.Container.Filterable, com.vaadin.data.Container.Hierarchical, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeEvent, com.vaadin.data.Container.ItemSetChangeListener, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.Ordered, com.vaadin.data.Container.PropertySetChangeEvent, com.vaadin.data.Container.PropertySetChangeListener, com.vaadin.data.Container.PropertySetChangeNotifier, com.vaadin.data.Container.SimpleFilterable, com.vaadin.data.Container.Sortable, com.vaadin.data.Container.Viewer
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_RATIO |
static int |
DEFAULT_PAGE_LENGTH |
Constructor and Description |
---|
AbstractAssetContainer(AssetContentConnector assetContentConnector) |
Modifier and Type | Method and Description |
---|---|
Object |
addItem() |
com.vaadin.data.Item |
addItem(Object itemId) |
Object |
addItemAfter(Object previousItemId) |
com.vaadin.data.Item |
addItemAfter(Object previousItemId,
Object newItemId) |
Object |
addItemAt(int index) |
com.vaadin.data.Item |
addItemAt(int index,
Object newItemId) |
void |
addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener) |
void |
addListener(com.vaadin.data.Container.ItemSetChangeListener listener) |
void |
addSortableProperty(String sortableProperty) |
protected void |
clearItemIndexes() |
protected info.magnolia.dam.api.AssetQuery |
constructQuery(long pageSize,
long offset,
boolean considerSorting) |
boolean |
containsId(Object itemId) |
void |
fireItemSetChange() |
Object |
firstItemId() |
protected info.magnolia.dam.api.Item |
getAssetItem(Object itemKey) |
info.magnolia.dam.api.AssetProvider |
getAssetProvider() |
int |
getCacheRatio() |
com.vaadin.data.Property<?> |
getContainerProperty(Object itemId,
Object propertyId) |
protected int |
getCurrentOffset() |
protected info.magnolia.dam.api.AssetQuery.OrderBy |
getDefaultOrderBy(String property) |
info.magnolia.dam.api.ItemKey |
getIdByIndex(int index) |
com.vaadin.data.util.BeanItem<info.magnolia.dam.api.Item> |
getItem(Object itemId) |
Collection<String> |
getItemIds() |
List<?> |
getItemIds(int startIndex,
int numberOfItems) |
int |
getPageLength() |
List<String> |
getSortableContainerPropertyIds() |
int |
indexOfId(Object itemId) |
boolean |
isFirstId(Object itemId) |
boolean |
isLastId(Object itemId) |
Object |
lastItemId() |
Object |
nextItemId(Object itemId) |
Object |
prevItemId(Object itemId) |
void |
refresh()
Refreshes the container - clears all caches and resets size and offset.
|
boolean |
removeAllItems() |
boolean |
removeItem(Object itemId) |
void |
removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener) |
void |
removeListener(com.vaadin.data.Container.ItemSetChangeListener listener) |
protected void |
resetOffset() |
void |
setAssetProvider(info.magnolia.dam.api.AssetProvider assetProvider) |
void |
setCacheRatio(int cacheRatio) |
void |
setPageLength(int pageLength) |
protected void |
setSize(int size) |
int |
size() |
void |
sort(Object[] propertyId,
boolean[] ascending) |
addContainerProperty, getContainerPropertyIds, getType, removeContainerProperty
public static final int DEFAULT_PAGE_LENGTH
public static final int DEFAULT_CACHE_RATIO
@Inject public AbstractAssetContainer(AssetContentConnector assetContentConnector)
public void setAssetProvider(info.magnolia.dam.api.AssetProvider assetProvider)
public info.magnolia.dam.api.AssetProvider getAssetProvider()
public int getPageLength()
public void setPageLength(int pageLength)
public int getCacheRatio()
public void setCacheRatio(int cacheRatio)
public void addSortableProperty(String sortableProperty)
public int size()
size
in interface com.vaadin.data.Container
public com.vaadin.data.util.BeanItem<info.magnolia.dam.api.Item> getItem(Object itemId)
getItem
in interface com.vaadin.data.Container
public boolean containsId(Object itemId)
containsId
in interface com.vaadin.data.Container
public com.vaadin.data.Property<?> getContainerProperty(Object itemId, Object propertyId)
getContainerProperty
in interface com.vaadin.data.Container
public Collection<String> getItemIds()
getItemIds
in interface com.vaadin.data.Container
public com.vaadin.data.Item addItem(Object itemId) throws UnsupportedOperationException
addItem
in interface com.vaadin.data.Container
UnsupportedOperationException
public Object addItem() throws UnsupportedOperationException
addItem
in interface com.vaadin.data.Container
UnsupportedOperationException
public boolean removeAllItems() throws UnsupportedOperationException
removeAllItems
in interface com.vaadin.data.Container
UnsupportedOperationException
public boolean removeItem(Object itemId) throws UnsupportedOperationException
removeItem
in interface com.vaadin.data.Container
UnsupportedOperationException
public void refresh()
refresh
in interface info.magnolia.ui.workbench.container.Refreshable
public void addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
addItemSetChangeListener
in interface com.vaadin.data.Container.ItemSetChangeNotifier
public void addListener(com.vaadin.data.Container.ItemSetChangeListener listener)
addListener
in interface com.vaadin.data.Container.ItemSetChangeNotifier
public void removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
removeItemSetChangeListener
in interface com.vaadin.data.Container.ItemSetChangeNotifier
public void removeListener(com.vaadin.data.Container.ItemSetChangeListener listener)
removeListener
in interface com.vaadin.data.Container.ItemSetChangeNotifier
public void fireItemSetChange()
public Object nextItemId(Object itemId)
nextItemId
in interface com.vaadin.data.Container.Ordered
public Object prevItemId(Object itemId)
prevItemId
in interface com.vaadin.data.Container.Ordered
public Object firstItemId()
firstItemId
in interface com.vaadin.data.Container.Ordered
public Object lastItemId()
lastItemId
in interface com.vaadin.data.Container.Ordered
public boolean isFirstId(Object itemId)
isFirstId
in interface com.vaadin.data.Container.Ordered
public boolean isLastId(Object itemId)
isLastId
in interface com.vaadin.data.Container.Ordered
public com.vaadin.data.Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
addItemAfter
in interface com.vaadin.data.Container.Ordered
UnsupportedOperationException
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
addItemAfter
in interface com.vaadin.data.Container.Ordered
UnsupportedOperationException
protected final info.magnolia.dam.api.AssetQuery constructQuery(long pageSize, long offset, boolean considerSorting)
considerSorting
- an optional ORDER BY
is added if this parameter is true
.protected info.magnolia.dam.api.AssetQuery.OrderBy getDefaultOrderBy(String property)
AssetQuery.OrderBy
object for the passed in property to be used for the default order by clause.protected info.magnolia.dam.api.Item getAssetItem(Object itemKey)
protected void resetOffset()
protected void clearItemIndexes()
protected int getCurrentOffset()
protected void setSize(int size)
public int indexOfId(Object itemId)
indexOfId
in interface com.vaadin.data.Container.Indexed
public info.magnolia.dam.api.ItemKey getIdByIndex(int index)
getIdByIndex
in interface com.vaadin.data.Container.Indexed
public List<?> getItemIds(int startIndex, int numberOfItems)
getItemIds
in interface com.vaadin.data.Container.Indexed
public com.vaadin.data.Item addItemAt(int index, Object newItemId) throws UnsupportedOperationException
addItemAt
in interface com.vaadin.data.Container.Indexed
UnsupportedOperationException
public Object addItemAt(int index) throws UnsupportedOperationException
addItemAt
in interface com.vaadin.data.Container.Indexed
UnsupportedOperationException
public void sort(Object[] propertyId, boolean[] ascending)
sort
in interface com.vaadin.data.Container.Sortable
Copyright © 2016 Magnolia International Ltd.. All rights reserved.