Class OnmsVaadinContainer<T,K extends java.io.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,java.io.Serializable,SelectionChangedListener
- Direct Known Subclasses:
AlarmDaoContainer,ApplicationDaoContainer,ApplicationOutageDaoContainer,BusinessServicesContainer,NodeDaoContainer
public abstract class OnmsVaadinContainer<T,K extends java.io.Serializable> extends java.lang.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 java.io.Serializable>, SelectionChangedListener.Selection
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_PAGE_SIZE
-
Constructor Summary
Constructors Constructor Description OnmsVaadinContainer(java.lang.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(java.lang.String key, java.lang.String value)booleanaddContainerProperty(java.lang.Object propertyId, java.lang.Class<?> type, java.lang.Object defaultValue)java.lang.ObjectaddItem()Can be overridden if you want to support adding items.com.vaadin.v7.data.ItemaddItem(java.lang.Object itemId)Can be overridden if you want to support adding items.java.lang.ObjectaddItemAfter(java.lang.Object previousItemId)com.vaadin.v7.data.ItemaddItemAfter(java.lang.Object previousItemId, java.lang.Object newItemId)java.lang.ObjectaddItemAt(int index)com.vaadin.v7.data.ItemaddItemAt(int index, java.lang.Object newItemId)voidaddItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)voidaddListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)booleancontainsId(java.lang.Object itemId)protected java.util.List<OnmsVaadinContainer.SortEntry>createSortEntries(java.lang.Object[] propertyId, boolean[] ascending)protected voidfireItemSetChangedEvent()java.lang.ObjectfirstItemId()protected OnmsVaadinContainer.CachegetCache()com.vaadin.v7.data.Property<?>getContainerProperty(java.lang.Object itemId, java.lang.Object propertyId)java.util.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(java.lang.Object itemId)java.lang.Class<T>getItemClass()java.util.Collection<?>getItemIds()java.util.List<K>getItemIds(int startIndex, int numberOfItems)protected java.util.List<T>getItemsForCache(OnmsContainerDatasource<T,K> datasource, OnmsVaadinContainer.Page page)protected OnmsVaadinContainer.PagegetPage()java.util.List<Restriction>getRestrictions()java.util.Collection<?>getSortableContainerPropertyIds()This function returnsgetContainerPropertyIds().java.lang.Class<?>getType(java.lang.Object propertyId)intindexOfId(java.lang.Object itemId)booleanisFirstId(java.lang.Object itemId)booleanisLastId(java.lang.Object itemId)java.lang.ObjectlastItemId()java.lang.ObjectnextItemId(java.lang.Object itemId)java.lang.ObjectprevItemId(java.lang.Object itemId)booleanremoveAllItems()booleanremoveContainerProperty(java.lang.Object propertyId)booleanremoveItem(java.lang.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(java.util.List<Restriction> newRestrictions)intsize()voidsort(java.lang.Object[] propertyId, boolean[] ascending)protected voidupdateContainerPropertyIds(java.util.Map<java.lang.Object,java.lang.Class<?>> properties)
-
-
-
Field Detail
-
DEFAULT_PAGE_SIZE
protected static final int DEFAULT_PAGE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OnmsVaadinContainer
public OnmsVaadinContainer(java.lang.Class<T> itemClass, OnmsContainerDatasource<T,K> datasource)
-
-
Method Detail
-
containsId
public boolean containsId(java.lang.Object itemId)
- Specified by:
containsIdin interfacecom.vaadin.v7.data.Container
-
getContainerProperty
public com.vaadin.v7.data.Property<?> getContainerProperty(java.lang.Object itemId, java.lang.Object propertyId)- Specified by:
getContainerPropertyin interfacecom.vaadin.v7.data.Container
-
getContainerPropertyIds
public java.util.Collection<?> getContainerPropertyIds()
- Specified by:
getContainerPropertyIdsin interfacecom.vaadin.v7.data.Container
-
getItem
public com.vaadin.v7.data.Item getItem(java.lang.Object itemId)
- Specified by:
getItemin interfacecom.vaadin.v7.data.Container
-
getItemClass
public java.lang.Class<T> getItemClass()
-
getType
public java.lang.Class<?> getType(java.lang.Object propertyId)
- Specified by:
getTypein interfacecom.vaadin.v7.data.Container
-
removeAllItems
public boolean removeAllItems() throws java.lang.UnsupportedOperationException- Specified by:
removeAllItemsin interfacecom.vaadin.v7.data.Container- Throws:
java.lang.UnsupportedOperationException
-
removeItem
public boolean removeItem(java.lang.Object itemId) throws java.lang.UnsupportedOperationException- Specified by:
removeItemin interfacecom.vaadin.v7.data.Container- Throws:
java.lang.UnsupportedOperationException
-
size
public int size()
- Specified by:
sizein interfacecom.vaadin.v7.data.Container
-
firstItemId
public java.lang.Object firstItemId()
- Specified by:
firstItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
lastItemId
public java.lang.Object lastItemId()
- Specified by:
lastItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
isFirstId
public boolean isFirstId(java.lang.Object itemId)
- Specified by:
isFirstIdin interfacecom.vaadin.v7.data.Container.Ordered
-
isLastId
public boolean isLastId(java.lang.Object itemId)
- Specified by:
isLastIdin interfacecom.vaadin.v7.data.Container.Ordered
-
nextItemId
public java.lang.Object nextItemId(java.lang.Object itemId)
- Specified by:
nextItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
prevItemId
public java.lang.Object prevItemId(java.lang.Object itemId)
- Specified by:
prevItemIdin interfacecom.vaadin.v7.data.Container.Ordered
-
getSortableContainerPropertyIds
public java.util.Collection<?> getSortableContainerPropertyIds()
This function returnsgetContainerPropertyIds().- Specified by:
getSortableContainerPropertyIdsin interfacecom.vaadin.v7.data.Container.Sortable
-
sort
public void sort(java.lang.Object[] propertyId, boolean[] ascending)- Specified by:
sortin interfacecom.vaadin.v7.data.Container.Sortable
-
createSortEntries
protected java.util.List<OnmsVaadinContainer.SortEntry> createSortEntries(java.lang.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(java.util.List<Restriction> newRestrictions)
-
getRestrictions
public java.util.List<Restriction> getRestrictions()
-
addBeanToHibernatePropertyMapping
public void addBeanToHibernatePropertyMapping(java.lang.String key, java.lang.String value)
-
getItemIds
public java.util.Collection<?> getItemIds()
- Specified by:
getItemIdsin interfacecom.vaadin.v7.data.Container
-
getItemIds
public java.util.List<K> getItemIds(int startIndex, int numberOfItems)
- Specified by:
getItemIdsin interfacecom.vaadin.v7.data.Container.Indexed
-
indexOfId
public int indexOfId(java.lang.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 java.lang.Object addItemAt(int index) throws java.lang.UnsupportedOperationException- Specified by:
addItemAtin interfacecom.vaadin.v7.data.Container.Indexed- Throws:
java.lang.UnsupportedOperationException
-
addItemAt
public com.vaadin.v7.data.Item addItemAt(int index, java.lang.Object newItemId) throws java.lang.UnsupportedOperationException- Specified by:
addItemAtin interfacecom.vaadin.v7.data.Container.Indexed- Throws:
java.lang.UnsupportedOperationException
-
addItemAfter
public java.lang.Object addItemAfter(java.lang.Object previousItemId) throws java.lang.UnsupportedOperationException- Specified by:
addItemAfterin interfacecom.vaadin.v7.data.Container.Ordered- Throws:
java.lang.UnsupportedOperationException
-
addItemAfter
public com.vaadin.v7.data.Item addItemAfter(java.lang.Object previousItemId, java.lang.Object newItemId) throws java.lang.UnsupportedOperationException- Specified by:
addItemAfterin interfacecom.vaadin.v7.data.Container.Ordered- Throws:
java.lang.UnsupportedOperationException
-
addContainerProperty
public final boolean addContainerProperty(java.lang.Object propertyId, java.lang.Class<?> type, java.lang.Object defaultValue) throws java.lang.UnsupportedOperationException- Specified by:
addContainerPropertyin interfacecom.vaadin.v7.data.Container- Throws:
java.lang.UnsupportedOperationException
-
addItem
public java.lang.Object addItem() throws java.lang.UnsupportedOperationExceptionCan be overridden if you want to support adding items.- Specified by:
addItemin interfacecom.vaadin.v7.data.Container- Throws:
java.lang.UnsupportedOperationException
-
addItem
public com.vaadin.v7.data.Item addItem(java.lang.Object itemId) throws java.lang.UnsupportedOperationExceptionCan be overridden if you want to support adding items.- Specified by:
addItemin interfacecom.vaadin.v7.data.Container- Throws:
java.lang.UnsupportedOperationException
-
removeContainerProperty
public final boolean removeContainerProperty(java.lang.Object propertyId) throws java.lang.UnsupportedOperationException- Specified by:
removeContainerPropertyin interfacecom.vaadin.v7.data.Container- Throws:
java.lang.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(java.util.Map<java.lang.Object,java.lang.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 java.util.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()
-
-