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 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 Serializable>, SelectionChangedListener.Selection
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_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 void
addAdditionalCriteriaOptions(Criteria criteria, OnmsVaadinContainer.Page page, boolean doOrder)
void
addBeanToHibernatePropertyMapping(String key, String value)
boolean
addContainerProperty(Object propertyId, Class<?> type, Object defaultValue)
Object
addItem()
Can be overridden if you want to support adding items.com.vaadin.v7.data.Item
addItem(Object itemId)
Can be overridden if you want to support adding items.Object
addItemAfter(Object previousItemId)
com.vaadin.v7.data.Item
addItemAfter(Object previousItemId, Object newItemId)
Object
addItemAt(int index)
com.vaadin.v7.data.Item
addItemAt(int index, Object newItemId)
void
addItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
void
addListener(com.vaadin.v7.data.Container.ItemSetChangeListener listener)
boolean
containsId(Object itemId)
protected List<OnmsVaadinContainer.SortEntry>
createSortEntries(Object[] propertyId, boolean[] ascending)
protected void
fireItemSetChangedEvent()
Object
firstItemId()
protected OnmsVaadinContainer.Cache
getCache()
com.vaadin.v7.data.Property<?>
getContainerProperty(Object itemId, Object propertyId)
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(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.Page
getPage()
List<Restriction>
getRestrictions()
Collection<?>
getSortableContainerPropertyIds()
This function returnsgetContainerPropertyIds()
.Class<?>
getType(Object propertyId)
int
indexOfId(Object itemId)
boolean
isFirstId(Object itemId)
boolean
isLastId(Object itemId)
Object
lastItemId()
Object
nextItemId(Object itemId)
Object
prevItemId(Object itemId)
boolean
removeAllItems()
boolean
removeContainerProperty(Object propertyId)
boolean
removeItem(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(List<Restriction> newRestrictions)
int
size()
void
sort(Object[] propertyId, boolean[] ascending)
protected void
updateContainerPropertyIds(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:
containsId
in interfacecom.vaadin.v7.data.Container
-
getContainerProperty
public com.vaadin.v7.data.Property<?> getContainerProperty(Object itemId, Object propertyId)
- Specified by:
getContainerProperty
in interfacecom.vaadin.v7.data.Container
-
getContainerPropertyIds
public Collection<?> getContainerPropertyIds()
- Specified by:
getContainerPropertyIds
in interfacecom.vaadin.v7.data.Container
-
getItem
public com.vaadin.v7.data.Item getItem(Object itemId)
- Specified by:
getItem
in interfacecom.vaadin.v7.data.Container
-
getType
public Class<?> getType(Object propertyId)
- Specified by:
getType
in interfacecom.vaadin.v7.data.Container
-
removeAllItems
public boolean removeAllItems() throws UnsupportedOperationException
- Specified by:
removeAllItems
in interfacecom.vaadin.v7.data.Container
- Throws:
UnsupportedOperationException
-
removeItem
public boolean removeItem(Object itemId) throws UnsupportedOperationException
- Specified by:
removeItem
in interfacecom.vaadin.v7.data.Container
- Throws:
UnsupportedOperationException
-
size
public int size()
- Specified by:
size
in interfacecom.vaadin.v7.data.Container
-
firstItemId
public Object firstItemId()
- Specified by:
firstItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
lastItemId
public Object lastItemId()
- Specified by:
lastItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
isFirstId
public boolean isFirstId(Object itemId)
- Specified by:
isFirstId
in interfacecom.vaadin.v7.data.Container.Ordered
-
isLastId
public boolean isLastId(Object itemId)
- Specified by:
isLastId
in interfacecom.vaadin.v7.data.Container.Ordered
-
nextItemId
public Object nextItemId(Object itemId)
- Specified by:
nextItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
prevItemId
public Object prevItemId(Object itemId)
- Specified by:
prevItemId
in interfacecom.vaadin.v7.data.Container.Ordered
-
getSortableContainerPropertyIds
public Collection<?> getSortableContainerPropertyIds()
This function returnsgetContainerPropertyIds()
.- Specified by:
getSortableContainerPropertyIds
in interfacecom.vaadin.v7.data.Container.Sortable
-
sort
public void sort(Object[] propertyId, boolean[] ascending)
- Specified by:
sort
in 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:
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(List<Restriction> newRestrictions)
-
getRestrictions
public List<Restriction> getRestrictions()
-
addBeanToHibernatePropertyMapping
public void addBeanToHibernatePropertyMapping(String key, String value)
-
getItemIds
public Collection<?> getItemIds()
- Specified by:
getItemIds
in interfacecom.vaadin.v7.data.Container
-
getItemIds
public List<K> getItemIds(int startIndex, int numberOfItems)
- Specified by:
getItemIds
in interfacecom.vaadin.v7.data.Container.Indexed
-
indexOfId
public int indexOfId(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 Object addItemAt(int index) throws UnsupportedOperationException
- Specified by:
addItemAt
in interfacecom.vaadin.v7.data.Container.Indexed
- Throws:
UnsupportedOperationException
-
addItemAt
public com.vaadin.v7.data.Item addItemAt(int index, Object newItemId) throws UnsupportedOperationException
- Specified by:
addItemAt
in interfacecom.vaadin.v7.data.Container.Indexed
- Throws:
UnsupportedOperationException
-
addItemAfter
public Object addItemAfter(Object previousItemId) throws UnsupportedOperationException
- Specified by:
addItemAfter
in interfacecom.vaadin.v7.data.Container.Ordered
- Throws:
UnsupportedOperationException
-
addItemAfter
public com.vaadin.v7.data.Item addItemAfter(Object previousItemId, Object newItemId) throws UnsupportedOperationException
- Specified by:
addItemAfter
in interfacecom.vaadin.v7.data.Container.Ordered
- Throws:
UnsupportedOperationException
-
addContainerProperty
public final boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
- Specified by:
addContainerProperty
in 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:
addItem
in 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:
addItem
in interfacecom.vaadin.v7.data.Container
- Throws:
UnsupportedOperationException
-
removeContainerProperty
public final boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
- Specified by:
removeContainerProperty
in interfacecom.vaadin.v7.data.Container
- Throws:
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(Map<Object,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 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()
-
-