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 class
OnmsVaadinContainer.Cache
protected static class
OnmsVaadinContainer.Page
protected static class
OnmsVaadinContainer.Size
protected static interface
OnmsVaadinContainer.SizeReloadStrategy
protected static class
OnmsVaadinContainer.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 int
DEFAULT_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 void
addAdditionalCriteriaOptions(Criteria criteria, OnmsVaadinContainer.Page page, boolean doOrder)
void
addBeanToHibernatePropertyMapping(java.lang.String key, java.lang.String value)
boolean
addContainerProperty(java.lang.Object propertyId, java.lang.Class<?> type, java.lang.Object defaultValue)
java.lang.Object
addItem()
Can be overridden if you want to support adding items.com.vaadin.v7.data.Item
addItem(java.lang.Object itemId)
Can be overridden if you want to support adding items.java.lang.Object
addItemAfter(java.lang.Object previousItemId)
com.vaadin.v7.data.Item
addItemAfter(java.lang.Object previousItemId, java.lang.Object newItemId)
java.lang.Object
addItemAt(int index)
com.vaadin.v7.data.Item
addItemAt(int index, java.lang.Object newItemId)
void
addItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
void
addListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
boolean
containsId(java.lang.Object itemId)
protected java.util.List<OnmsVaadinContainer.SortEntry>
createSortEntries(java.lang.Object[] propertyId, boolean[] ascending)
protected void
fireItemSetChangedEvent()
java.lang.Object
firstItemId()
protected OnmsVaadinContainer.Cache
getCache()
com.vaadin.v7.data.Property<?>
getContainerProperty(java.lang.Object itemId, java.lang.Object propertyId)
java.util.Collection<?>
getContainerPropertyIds()
protected abstract ContentType
getContentType()
protected Criteria
getCriteria(OnmsVaadinContainer.Page page, boolean doOrder)
Creates aCriteria
object to get data from database.protected abstract K
getId(T bean)
K
getIdByIndex(int index)
com.vaadin.v7.data.Item
getItem(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.Page
getPage()
java.util.List<Restriction>
getRestrictions()
java.util.Collection<?>
getSortableContainerPropertyIds()
This function returnsgetContainerPropertyIds()
.java.lang.Class<?>
getType(java.lang.Object propertyId)
int
indexOfId(java.lang.Object itemId)
boolean
isFirstId(java.lang.Object itemId)
boolean
isLastId(java.lang.Object itemId)
java.lang.Object
lastItemId()
java.lang.Object
nextItemId(java.lang.Object itemId)
java.lang.Object
prevItemId(java.lang.Object itemId)
boolean
removeAllItems()
boolean
removeContainerProperty(java.lang.Object propertyId)
boolean
removeItem(java.lang.Object itemId)
void
removeItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
void
removeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
void
selectionChanged(SelectionChangedListener.Selection newSelection)
Provide a newSelectionChangedListener.Selection
object if the selection has changed.void
setRestrictions(java.util.List<Restriction> newRestrictions)
int
size()
void
sort(java.lang.Object[] propertyId, boolean[] ascending)
protected void
updateContainerPropertyIds(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:
containsId
in interfacecom.vaadin.v7.data.Container
-
getContainerProperty
public com.vaadin.v7.data.Property<?> getContainerProperty(java.lang.Object itemId, java.lang.Object propertyId)
- Specified by:
getContainerProperty
in interfacecom.vaadin.v7.data.Container
-
getContainerPropertyIds
public java.util.Collection<?> getContainerPropertyIds()
- Specified by:
getContainerPropertyIds
in interfacecom.vaadin.v7.data.Container
-
getItem
public com.vaadin.v7.data.Item getItem(java.lang.Object itemId)
- Specified by:
getItem
in interfacecom.vaadin.v7.data.Container
-
getItemClass
public java.lang.Class<T> getItemClass()
-
getType
public java.lang.Class<?> getType(java.lang.Object propertyId)
- Specified by:
getType
in interfacecom.vaadin.v7.data.Container
-
removeAllItems
public boolean removeAllItems() throws java.lang.UnsupportedOperationException
- Specified by:
removeAllItems
in interfacecom.vaadin.v7.data.Container
- Throws:
java.lang.UnsupportedOperationException
-
removeItem
public boolean removeItem(java.lang.Object itemId) throws java.lang.UnsupportedOperationException
- Specified by:
removeItem
in interfacecom.vaadin.v7.data.Container
- Throws:
java.lang.UnsupportedOperationException
-
size
public int size()
- Specified by:
size
in interfacecom.vaadin.v7.data.Container
-
firstItemId
public java.lang.Object firstItemId()
- Specified by:
firstItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
lastItemId
public java.lang.Object lastItemId()
- Specified by:
lastItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
isFirstId
public boolean isFirstId(java.lang.Object itemId)
- Specified by:
isFirstId
in interfacecom.vaadin.v7.data.Container.Ordered
-
isLastId
public boolean isLastId(java.lang.Object itemId)
- Specified by:
isLastId
in interfacecom.vaadin.v7.data.Container.Ordered
-
nextItemId
public java.lang.Object nextItemId(java.lang.Object itemId)
- Specified by:
nextItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
prevItemId
public java.lang.Object prevItemId(java.lang.Object itemId)
- Specified by:
prevItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
getSortableContainerPropertyIds
public java.util.Collection<?> getSortableContainerPropertyIds()
This function returnsgetContainerPropertyIds()
.- Specified by:
getSortableContainerPropertyIds
in interfacecom.vaadin.v7.data.Container.Sortable
-
sort
public void sort(java.lang.Object[] propertyId, boolean[] ascending)
- Specified by:
sort
in 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:
addListener
in interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
removeListener
public void removeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
removeListener
in interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
addItemSetChangeListener
public void addItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
addItemSetChangeListener
in interfacecom.vaadin.v7.data.Container.ItemSetChangeNotifier
-
removeItemSetChangeListener
public void removeItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
- Specified by:
removeItemSetChangeListener
in 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:
getItemIds
in interfacecom.vaadin.v7.data.Container
-
getItemIds
public java.util.List<K> getItemIds(int startIndex, int numberOfItems)
- Specified by:
getItemIds
in interfacecom.vaadin.v7.data.Container.Indexed
-
indexOfId
public int indexOfId(java.lang.Object itemId)
- Specified by:
indexOfId
in interfacecom.vaadin.v7.data.Container.Indexed
-
getIdByIndex
public K getIdByIndex(int index)
- Specified by:
getIdByIndex
in interfacecom.vaadin.v7.data.Container.Indexed
-
addItemAt
public java.lang.Object addItemAt(int index) throws java.lang.UnsupportedOperationException
- Specified by:
addItemAt
in 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:
addItemAt
in 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:
addItemAfter
in 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:
addItemAfter
in 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:
addContainerProperty
in interfacecom.vaadin.v7.data.Container
- Throws:
java.lang.UnsupportedOperationException
-
addItem
public java.lang.Object addItem() throws java.lang.UnsupportedOperationException
Can be overridden if you want to support adding items.- Specified by:
addItem
in interfacecom.vaadin.v7.data.Container
- Throws:
java.lang.UnsupportedOperationException
-
addItem
public com.vaadin.v7.data.Item addItem(java.lang.Object itemId) throws java.lang.UnsupportedOperationException
Can be overridden if you want to support adding items.- Specified by:
addItem
in interfacecom.vaadin.v7.data.Container
- Throws:
java.lang.UnsupportedOperationException
-
removeContainerProperty
public final boolean removeContainerProperty(java.lang.Object propertyId) throws java.lang.UnsupportedOperationException
- Specified by:
removeContainerProperty
in interfacecom.vaadin.v7.data.Container
- Throws:
java.lang.UnsupportedOperationException
-
selectionChanged
public void selectionChanged(SelectionChangedListener.Selection newSelection)
Description copied from interface:SelectionChangedListener
Provide a newSelectionChangedListener.Selection
object if the selection has changed.- Specified by:
selectionChanged
in 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 aCriteria
object 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()
-
-