info.magnolia.ui.workbench.thumbnail
Class ThumbnailContainer

java.lang.Object
  extended by com.vaadin.data.util.AbstractContainer
      extended by com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>
          extended by info.magnolia.ui.workbench.thumbnail.ThumbnailContainer
All Implemented Interfaces:
com.vaadin.data.Container, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.Ordered, Serializable

public class ThumbnailContainer
extends com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>

Container that provides thumbnails lazily.

See Also:
Serialized Form

Nested Class Summary
 class ThumbnailContainer.ThumbnailContainerProperty
          ThumbnailContainer property.
 class ThumbnailContainer.ThumbnailItem
          Thumbnail Item.
 
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractContainer
com.vaadin.data.util.AbstractContainer.BaseItemSetChangeEvent, com.vaadin.data.util.AbstractContainer.BasePropertySetChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.data.Container
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
 
Field Summary
static String THUMBNAIL_PROPERTY_ID
           
protected static String WHERE_TEMPLATE_FOR_PATH
           
 
Constructor Summary
ThumbnailContainer(WorkbenchDefinition workbenchDefinition, ImageProvider imageProvider)
           
 
Method Summary
 boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue)
           
 Object addItem()
           
 com.vaadin.data.Item addItem(Object itemId)
           
protected  List<String> getAllIdentifiers(String workspaceName)
           
 ThumbnailContainer.ThumbnailContainerProperty getContainerProperty(Object itemId, Object propertyId)
           
 Collection<String> getContainerPropertyIds()
           
 ImageProvider getImageProvider()
           
protected  String getMainNodeType()
          Hint: could be dropped once this type bases on AbstractJcrContainer as well (BL-153).
protected  String getQueryWhereClauseNodeTypes()
           
 int getThumbnailHeight()
           
 int getThumbnailWidth()
           
 Class<?> getType(Object propertyId)
           
protected  ThumbnailContainer.ThumbnailItem getUnfilteredItem(Object itemId)
           
 String getWorkspaceName()
           
protected  String prepareFilterQueryStatement()
           
protected  String prepareOrderQueryStatement()
           
protected  String prepareSelectQueryStatement()
           
 void refresh()
           
 boolean removeAllItems()
           
 boolean removeContainerProperty(Object propertyId)
           
 boolean removeItem(Object itemId)
           
 void setThumbnailHeight(int thumbnailHeight)
           
 void setThumbnailWidth(int thumbnailWidth)
           
 void setWorkspaceName(String workspaceName)
           
 
Methods inherited from class com.vaadin.data.util.AbstractInMemoryContainer
addFilter, addItemAfter, addItemAfter, addItemAt, addItemAt, addItemSetChangeListener, addListener, containsId, doFilterContainer, doSort, filterAll, fireItemAdded, fireItemRemoved, firstItemId, getAllItemIds, getContainerFilters, getFilteredItemIds, getFilters, getIdByIndex, getItem, getItemIds, getItemIds, getItemSorter, getSortablePropertyIds, getVisibleItemIds, hasContainerFilters, indexOfId, internalAddItemAfter, internalAddItemAt, internalAddItemAtEnd, internalRemoveAllItems, internalRemoveItem, isFiltered, isFirstId, isLastId, isPropertyFiltered, lastItemId, nextItemId, passesFilters, prevItemId, registerNewItem, removeAllFilters, removeFilter, removeFilters, removeItemSetChangeListener, removeListener, setAllItemIds, setFilteredItemIds, setFilters, setItemSorter, size, sortContainer
 
Methods inherited from class com.vaadin.data.util.AbstractContainer
addListener, addPropertySetChangeListener, fireContainerPropertySetChange, fireContainerPropertySetChange, fireItemSetChange, fireItemSetChange, getItemSetChangeListeners, getListeners, getPropertySetChangeListeners, removeListener, removePropertySetChangeListener, setItemSetChangeListeners, setPropertySetChangeListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THUMBNAIL_PROPERTY_ID

public static final String THUMBNAIL_PROPERTY_ID
See Also:
Constant Field Values

WHERE_TEMPLATE_FOR_PATH

protected static final String WHERE_TEMPLATE_FOR_PATH
See Also:
Constant Field Values
Constructor Detail

ThumbnailContainer

public ThumbnailContainer(WorkbenchDefinition workbenchDefinition,
                          ImageProvider imageProvider)
Method Detail

getContainerPropertyIds

public Collection<String> getContainerPropertyIds()

getContainerProperty

public ThumbnailContainer.ThumbnailContainerProperty getContainerProperty(Object itemId,
                                                                          Object propertyId)

getType

public Class<?> getType(Object propertyId)

getMainNodeType

protected String getMainNodeType()
Hint: could be dropped once this type bases on AbstractJcrContainer as well (BL-153).


prepareSelectQueryStatement

protected String prepareSelectQueryStatement()

prepareFilterQueryStatement

protected String prepareFilterQueryStatement()

prepareOrderQueryStatement

protected String prepareOrderQueryStatement()

getAllIdentifiers

protected List<String> getAllIdentifiers(String workspaceName)
Returns:
a List of JCR identifiers for all the nodes recursively found under initialPath. This method is called in ThumbnailViewImpl.refresh(). You can override it, if you need a different strategy than the default one to fetch the identifiers of the nodes for which thumbnails need to be displayed.
See Also:
LazyThumbnailLayout.refresh()

refresh

public void refresh()

addContainerProperty

public boolean addContainerProperty(Object propertyId,
                                    Class<?> type,
                                    Object defaultValue)
Specified by:
addContainerProperty in interface com.vaadin.data.Container
Overrides:
addContainerProperty in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>

addItem

public com.vaadin.data.Item addItem(Object itemId)
                             throws UnsupportedOperationException
Specified by:
addItem in interface com.vaadin.data.Container
Overrides:
addItem in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>
Throws:
UnsupportedOperationException

addItem

public Object addItem()
               throws UnsupportedOperationException
Specified by:
addItem in interface com.vaadin.data.Container
Overrides:
addItem in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>
Throws:
UnsupportedOperationException

removeItem

public boolean removeItem(Object itemId)
                   throws UnsupportedOperationException
Specified by:
removeItem in interface com.vaadin.data.Container
Overrides:
removeItem in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>
Throws:
UnsupportedOperationException

removeAllItems

public boolean removeAllItems()
                       throws UnsupportedOperationException
Specified by:
removeAllItems in interface com.vaadin.data.Container
Overrides:
removeAllItems in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>
Throws:
UnsupportedOperationException

removeContainerProperty

public boolean removeContainerProperty(Object propertyId)
                                throws UnsupportedOperationException
Specified by:
removeContainerProperty in interface com.vaadin.data.Container
Overrides:
removeContainerProperty in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>
Throws:
UnsupportedOperationException

getUnfilteredItem

protected ThumbnailContainer.ThumbnailItem getUnfilteredItem(Object itemId)
Specified by:
getUnfilteredItem in class com.vaadin.data.util.AbstractInMemoryContainer<String,Object,ThumbnailContainer.ThumbnailItem>

getImageProvider

public ImageProvider getImageProvider()

setThumbnailHeight

public void setThumbnailHeight(int thumbnailHeight)

setThumbnailWidth

public void setThumbnailWidth(int thumbnailWidth)

getThumbnailHeight

public int getThumbnailHeight()

getThumbnailWidth

public int getThumbnailWidth()

getWorkspaceName

public String getWorkspaceName()

setWorkspaceName

public void setWorkspaceName(String workspaceName)

getQueryWhereClauseNodeTypes

protected String getQueryWhereClauseNodeTypes()
Returns:
a String containing the node types to be searched for in a query. All node types declared in a workbench definition are returned unless their hideInList property is true or they are of type mgnl:folder. E.g. assuming a node types declaration like the following
 ...
 + workbench
  + nodeTypes
   + foo
    * name = nt:foo
   + bar
    * name = nt:bar
    * hideInList = true
   + baz
    * name = nt:baz
 ...
 
this method will return the following string [jcr:primaryType] = 'nt:foo' or [jcr:primaryType] = 'baz'. This will eventually be used to restrict the node types to be searched for in list and search views, i.e. select * from [nt:base] where ([jcr:primaryType] = 'nt:foo' or [jcr:primaryType] = 'baz').


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.