Class OnmsVaadinContainer<T,K extends Serializable>
- java.lang.Object
-
- org.opennms.features.topology.api.browsers.OnmsVaadinContainer<T,K>
-
- Type Parameters:
T- The type of the elements in the container.K- the key of the elements in the container.
- All Implemented Interfaces:
com.vaadin.v7.data.Container,com.vaadin.v7.data.Container.Indexed,com.vaadin.v7.data.Container.ItemSetChangeNotifier,com.vaadin.v7.data.Container.Ordered,com.vaadin.v7.data.Container.Sortable,Serializable,SelectionChangedListener
- Direct Known Subclasses:
AlarmDaoContainer,ApplicationDaoContainer,ApplicationOutageDaoContainer,BusinessServicesContainer,NodeDaoContainer
public abstract class OnmsVaadinContainer<T,K extends Serializable> extends Object implements com.vaadin.v7.data.Container, com.vaadin.v7.data.Container.Sortable, com.vaadin.v7.data.Container.Ordered, com.vaadin.v7.data.Container.Indexed, com.vaadin.v7.data.Container.ItemSetChangeNotifier, SelectionChangedListener
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classOnmsVaadinContainer.Cacheprotected static classOnmsVaadinContainer.Pageprotected static classOnmsVaadinContainer.Sizeprotected static interfaceOnmsVaadinContainer.SizeReloadStrategyprotected static classOnmsVaadinContainer.SortEntry-
Nested classes/interfaces inherited from interface com.vaadin.v7.data.Container
com.vaadin.v7.data.Container.Editor, com.vaadin.v7.data.Container.Filter, com.vaadin.v7.data.Container.Filterable, com.vaadin.v7.data.Container.Hierarchical, com.vaadin.v7.data.Container.Indexed, com.vaadin.v7.data.Container.ItemSetChangeEvent, com.vaadin.v7.data.Container.ItemSetChangeListener, com.vaadin.v7.data.Container.ItemSetChangeNotifier, com.vaadin.v7.data.Container.Ordered, com.vaadin.v7.data.Container.PropertySetChangeEvent, com.vaadin.v7.data.Container.PropertySetChangeListener, com.vaadin.v7.data.Container.PropertySetChangeNotifier, com.vaadin.v7.data.Container.SimpleFilterable, com.vaadin.v7.data.Container.Sortable, com.vaadin.v7.data.Container.Viewer
-
Nested classes/interfaces inherited from interface com.vaadin.v7.data.Container.Indexed
com.vaadin.v7.data.Container.Indexed.ItemAddEvent, com.vaadin.v7.data.Container.Indexed.ItemRemoveEvent
-
Nested classes/interfaces inherited from interface org.opennms.features.topology.api.browsers.SelectionChangedListener
SelectionChangedListener.AlarmNodeIdSelection, SelectionChangedListener.IdSelection<T extends Serializable>, SelectionChangedListener.Selection
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_PAGE_SIZE
-
Constructor Summary
Constructors Constructor Description OnmsVaadinContainer(Class<T> itemClass, OnmsContainerDatasource<T,K> datasource)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddAdditionalCriteriaOptions(Criteria criteria, OnmsVaadinContainer.Page page, boolean doOrder)voidaddBeanToHibernatePropertyMapping(String key, String value)booleanaddContainerProperty(Object propertyId, Class<?> type, Object defaultValue)ObjectaddItem()Can be overridden if you want to support adding items.com.vaadin.v7.data.ItemaddItem(Object itemId)Can be overridden if you want to support adding items.ObjectaddItemAfter(Object previousItemId)com.vaadin.v7.data.ItemaddItemAfter(Object previousItemId, Object newItemId)ObjectaddItemAt(int index)com.vaadin.v7.data.ItemaddItemAt(int index, Object newItemId)voidaddItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)voidaddListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)booleancontainsId(Object itemId)protected List<OnmsVaadinContainer.SortEntry>createSortEntries(Object[] propertyId, boolean[] ascending)protected voidfireItemSetChangedEvent()ObjectfirstItemId()protected OnmsVaadinContainer.CachegetCache()com.vaadin.v7.data.Property<?>getContainerProperty(Object itemId, Object propertyId)Collection<?>getContainerPropertyIds()protected abstract ContentTypegetContentType()protected CriteriagetCriteria(OnmsVaadinContainer.Page page, boolean doOrder)Creates aCriteriaobject to get data from database.protected abstract KgetId(T bean)KgetIdByIndex(int index)com.vaadin.v7.data.ItemgetItem(Object itemId)Class<T>getItemClass()Collection<?>getItemIds()List<K>getItemIds(int startIndex, int numberOfItems)protected List<T>getItemsForCache(OnmsContainerDatasource<T,K> datasource, OnmsVaadinContainer.Page page)protected OnmsVaadinContainer.PagegetPage()List<Restriction>getRestrictions()Collection<?>getSortableContainerPropertyIds()This function returnsgetContainerPropertyIds().Class<?>getType(Object propertyId)intindexOfId(Object itemId)booleanisFirstId(Object itemId)booleanisLastId(Object itemId)ObjectlastItemId()ObjectnextItemId(Object itemId)ObjectprevItemId(Object itemId)booleanremoveAllItems()booleanremoveContainerProperty(Object propertyId)booleanremoveItem(Object itemId)voidremoveItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)voidremoveListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)voidselectionChanged(SelectionChangedListener.Selection newSelection)Provide a newSelectionChangedListener.Selectionobject if the selection has changed.voidsetRestrictions(List<Restriction> newRestrictions)intsize()voidsort(Object[] propertyId, boolean[] ascending)protected voidupdateContainerPropertyIds(Map<Object,Class<?>> properties)
-
-
-
Field Detail
-
DEFAULT_PAGE_SIZE
protected static final int DEFAULT_PAGE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OnmsVaadinContainer
public OnmsVaadinContainer(Class<T> itemClass, OnmsContainerDatasource<T,K> datasource)
-
-
Method Detail
-
containsId
public boolean containsId(Object itemId)
- Specified by:
containsIdin interfacecom.vaadin.v7.data.Container
-
getContainerProperty
public com.vaadin.v7.data.Property<?> getContainerProperty(Object itemId, Object propertyId)
- Specified by:
getContainerPropertyin interfacecom.vaadin.v7.data.Container
-
getContainerPropertyIds
public Collection<?> getContainerPropertyIds()
- Specified by:
getContainerPropertyIdsin interfacecom.vaadin.v7.data.Container
-
getItem
public com.vaadin.v7.data.Item getItem(Object itemId)
- Specified by:
getItemin interfacecom.vaadin.v7.data.Container
-
getType
public Class<?> getType(Object propertyId)
- Specified by:
getTypein interfacecom.vaadin.v7.data.Container
-
removeAllItems
public boolean removeAllItems() throws UnsupportedOperationException- Specified by:
removeAllItemsin interfacecom.vaadin.v7.data.Container- Throws:
UnsupportedOperationException
-
removeItem
public boolean removeItem(Object itemId) throws UnsupportedOperationException
- Specified by:
removeItemin interfacecom.vaadin.v7.data.Container- Throws:
UnsupportedOperationException
-
size
public int size()
- Specified by:
sizein interfacecom.vaadin.v7.data.Container
-
firstItemId
public Object firstItemId()
- Specified by:
firstItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
lastItemId
public Object lastItemId()
- Specified by:
lastItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
isFirstId
public boolean isFirstId(Object itemId)
- Specified by:
isFirstIdin interfacecom.vaadin.v7.data.Container.Ordered
-
isLastId
public boolean isLastId(Object itemId)
- Specified by:
isLastIdin interfacecom.vaadin.v7.data.Container.Ordered
-
nextItemId
public Object nextItemId(Object itemId)
- Specified by:
nextItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
prevItemId
public Object prevItemId(Object itemId)
- Specified by:
prevItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
getSortableContainerPropertyIds
public Collection<?> getSortableContainerPropertyIds()
This function returnsgetContainerPropertyIds().- Specified by:
getSortableContainerPropertyIdsin interfacecom.vaadin.v7.data.Container.Sortable
-
sort
public void sort(Object[] propertyId, boolean[] ascending)
- Specified by:
sortin interfacecom.vaadin.v7.data.Container.Sortable
-
createSortEntries
protected List<OnmsVaadinContainer.SortEntry> createSortEntries(Object[] propertyId, boolean[] ascending)
-
addListener
public void addListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
addListenerin interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
removeListener
public void removeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
removeListenerin interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
addItemSetChangeListener
public void addItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
addItemSetChangeListenerin interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
removeItemSetChangeListener
public void removeItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
removeItemSetChangeListenerin interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
fireItemSetChangedEvent
protected void fireItemSetChangedEvent()
-
setRestrictions
public void setRestrictions(List<Restriction> newRestrictions)
-
getRestrictions
public List<Restriction> getRestrictions()
-
addBeanToHibernatePropertyMapping
public void addBeanToHibernatePropertyMapping(String key, String value)
-
getItemIds
public Collection<?> getItemIds()
- Specified by:
getItemIdsin interfacecom.vaadin.v7.data.Container
-
getItemIds
public List<K> getItemIds(int startIndex, int numberOfItems)
- Specified by:
getItemIdsin interfacecom.vaadin.v7.data.Container.Indexed
-
indexOfId
public int indexOfId(Object itemId)
- Specified by:
indexOfIdin interfacecom.vaadin.v7.data.Container.Indexed
-
getIdByIndex
public K getIdByIndex(int index)
- Specified by:
getIdByIndexin interfacecom.vaadin.v7.data.Container.Indexed
-
addItemAt
public Object addItemAt(int index) throws UnsupportedOperationException
- Specified by:
addItemAtin interfacecom.vaadin.v7.data.Container.Indexed- Throws:
UnsupportedOperationException
-
addItemAt
public com.vaadin.v7.data.Item addItemAt(int index, Object newItemId) throws UnsupportedOperationException- Specified by:
addItemAtin interfacecom.vaadin.v7.data.Container.Indexed- Throws:
UnsupportedOperationException
-
addItemAfter
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
- Specified by:
addItemAfterin interfacecom.vaadin.v7.data.Container.Ordered- Throws:
UnsupportedOperationException
-
addItemAfter
public com.vaadin.v7.data.Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
- Specified by:
addItemAfterin interfacecom.vaadin.v7.data.Container.Ordered- Throws:
UnsupportedOperationException
-
addContainerProperty
public final boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
- Specified by:
addContainerPropertyin interfacecom.vaadin.v7.data.Container- Throws:
UnsupportedOperationException
-
addItem
public Object addItem() throws UnsupportedOperationException
Can be overridden if you want to support adding items.- Specified by:
addItemin interfacecom.vaadin.v7.data.Container- Throws:
UnsupportedOperationException
-
addItem
public com.vaadin.v7.data.Item addItem(Object itemId) throws UnsupportedOperationException
Can be overridden if you want to support adding items.- Specified by:
addItemin interfacecom.vaadin.v7.data.Container- Throws:
UnsupportedOperationException
-
removeContainerProperty
public final boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
- Specified by:
removeContainerPropertyin interfacecom.vaadin.v7.data.Container- Throws:
UnsupportedOperationException
-
selectionChanged
public void selectionChanged(SelectionChangedListener.Selection newSelection)
Description copied from interface:SelectionChangedListenerProvide a newSelectionChangedListener.Selectionobject if the selection has changed.- Specified by:
selectionChangedin interfaceSelectionChangedListener- Parameters:
newSelection- The new selection.
-
updateContainerPropertyIds
protected void updateContainerPropertyIds(Map<Object,Class<?>> properties)
-
getCriteria
protected Criteria getCriteria(OnmsVaadinContainer.Page page, boolean doOrder)
Creates aCriteriaobject to get data from database. If considerPaging is set Limit and offset values are added as restriction.- Parameters:
page-doOrder-- Returns:
-
addAdditionalCriteriaOptions
protected void addAdditionalCriteriaOptions(Criteria criteria, OnmsVaadinContainer.Page page, boolean doOrder)
-
getItemsForCache
protected List<T> getItemsForCache(OnmsContainerDatasource<T,K> datasource, OnmsVaadinContainer.Page page)
-
getCache
protected OnmsVaadinContainer.Cache getCache()
-
getPage
protected OnmsVaadinContainer.Page getPage()
-
getContentType
protected abstract ContentType getContentType()
-
-