public class CollectionPreviewController extends DefaultWidgetController
Pageable pageable
. In order to setPage a comprehensive item representation controller relies on
Base configuration where one can specified its name,
description and a graphical representation.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
COMP_ID_ITEMLIST |
protected static String |
ENTRY_DESCR |
protected static String |
ENTRY_IMG_FALLBACK |
protected static String |
ENTRY_IMG_URL |
protected static String |
ENTRY_NAME |
protected static String |
MODEL_ITEM_SELECTED_INDEX |
protected static String |
MODEL_PAGEABLE |
protected static String |
MODEL_PAGEABLE_LIST |
static String |
SOCKET_IN_PAGEABLE |
static String |
SOCKET_SELECTED_ITEM |
static String |
WIDGET_SETTING_ASYNC |
static String |
WIDGET_SETTING_CONFIG_CONTEXT |
protected static String |
YW_COLLECTION_PREVIEW_EMPTY_LIST |
| Constructor and Description |
|---|
CollectionPreviewController() |
| Modifier and Type | Method and Description |
|---|---|
protected <T> List<T> |
convertAllPagesIntoSingleList(Pageable<T> pageable) |
protected org.zkoss.zk.ui.Component |
createEntry(Object entry,
Base config) |
protected Pageable |
createPageableInstance(List<?> allResults,
int pageSize,
String typeCode)
Creates new instance of
Pageable |
CockpitComponentDefinitionService |
getComponentDefinitionService() |
protected int |
getIndexToSelectAfterRemoval(int currentIndex,
int removedIndex)
Returns new index of item to select based on currently selected and removed items or -1 if currently selected item
has been removed
|
org.zkoss.zul.Listbox |
getItemList() |
LabelService |
getLabelService() |
ObjectPreviewService |
getObjectPreviewService() |
protected Pageable<?> |
getPageableCopyWithResultList(List<?> allResults) |
protected Map<String,Object> |
getRendererProps(Object entry,
Base baseConfig)
Returns a map with all the key/value pairs which should be passed to the zul template used for rendering.
|
TypeFacade |
getTypeFacade() |
protected Widget |
getWidget(Widgetslot widgetslot) |
protected String |
getWidgetResourcePath() |
void |
handleObjectDeletedEvent(CockpitEvent event) |
void |
handleObjectUpdatedEvent(CockpitEvent event) |
void |
initialize(org.zkoss.zk.ui.Component comp)
Override this method to do initialization stuff for your widget, like initialize widget settings, restore view
state from viewmodel, etc.
|
protected Base |
loadConfiguration(String typeCode)
Loads the UI configuration for component with code "configContext" and for the specified
type, typeCode.
|
protected void |
render(Pageable<?> pageable,
List<?> genericObjectList)
Renders the provided entries as a list - each item is represented by base configuration where one can
configure name, description and an image representation.
|
void |
selectEntry(org.zkoss.zk.ui.event.SelectEvent<org.zkoss.zk.ui.Component,?> event)
Call back method for select events.
|
protected void |
selectItem(Integer position) |
void |
setPageable(Pageable<?> pageable)
Called whenever a socket event is sent to the "pageable" socket.
|
protected void |
setPageable(Pageable<?> pageable,
boolean synch)
Renders the entries in the pageable object (if any)
Thread-safety is provided |
protected void |
setResultList(List<?> allResults,
Integer indexToSelect)
Changes current
MODEL_PAGEABLE to its copy with passed as an argument collection of available elements and
selects an element with provided index |
protected void |
setResultList(List<?> allResults,
Integer indexToSelect,
boolean synch)
Changes current
MODEL_PAGEABLE to its copy with passed as an argument collection of available elements and
selects an element with provided index |
void |
setSelectedItem(Object itemToSelect) |
protected void |
updatePreviewCollection(CockpitEvent event) |
protected void |
updatePreviewCollection(Pageable pageable,
CockpitEvent event,
Object updatedObject) |
doAfterCompose, doBeforeCompose, doBeforeComposeChildren, executeOperation, getDragAndDropStrategy, getLabel, getLabel, getModel, getValue, getWidgetDragAndDropStrategyRepository, getWidgetInstanceManager, getWidgetRoot, getWidgetSettings, getWidgetslot, getWidgetTitle, getWidgetUtils, initDragAndDropAwareness, initWidgetSetting, initWidgetSetting, initWidgetSetting, initWidgetSetting, initWidgetSetting, invokeListenerMethod, onSocketInput, preInitialize, sendOutput, sendOutputAfterOperation, sendOutputAfterOperation, sendOutputAfterOperation, setValue, setWidgetInstanceManager, setWidgetTitlescanEventListenersalert, didActivate, getPage, willClone, willPassivatepublic static final String SOCKET_IN_PAGEABLE
public static final String SOCKET_SELECTED_ITEM
public static final String WIDGET_SETTING_CONFIG_CONTEXT
public static final String WIDGET_SETTING_ASYNC
protected static final String ENTRY_NAME
protected static final String ENTRY_DESCR
protected static final String ENTRY_IMG_URL
protected static final String ENTRY_IMG_FALLBACK
protected static final String YW_COLLECTION_PREVIEW_EMPTY_LIST
protected static final String COMP_ID_ITEMLIST
protected static final String MODEL_PAGEABLE
protected static final String MODEL_PAGEABLE_LIST
protected static final String MODEL_ITEM_SELECTED_INDEX
public void initialize(org.zkoss.zk.ui.Component comp)
DefaultWidgetControllerDefaultWidgetController.doAfterCompose(Component) everytime your widget
view is created. See GenericForwardComposer.doAfterCompose(Component) for more details.initialize in class DefaultWidgetControllerpublic void setPageable(Pageable<?> pageable)
pageable - the pageable object to setPageprotected void setPageable(Pageable<?> pageable, boolean synch)
pageable - the pageable object to setPagesynch - when true renders entries synchronouslypublic void selectEntry(org.zkoss.zk.ui.event.SelectEvent<org.zkoss.zk.ui.Component,?> event)
event - the select eventpublic void setSelectedItem(Object itemToSelect)
protected void render(Pageable<?> pageable, List<?> genericObjectList)
pageable - used to resolve the relevant type code (if any) and other paging informationgenericObjectList - the objects to be renderedpublic void handleObjectUpdatedEvent(CockpitEvent event)
public void handleObjectDeletedEvent(CockpitEvent event)
protected void updatePreviewCollection(CockpitEvent event)
protected void updatePreviewCollection(Pageable pageable, CockpitEvent event, Object updatedObject)
protected int getIndexToSelectAfterRemoval(int currentIndex,
int removedIndex)
currentIndex - index of currently selected itemremovedIndex - index of removed itemprotected void setResultList(List<?> allResults, Integer indexToSelect)
MODEL_PAGEABLE to its copy with passed as an argument collection of available elements and
selects an element with provided indexallResults - collection of available elements to be set on the MODEL_PAGEABLE.indexToSelect - index of an element to be selectedprotected void setResultList(List<?> allResults, Integer indexToSelect, boolean synch)
MODEL_PAGEABLE to its copy with passed as an argument collection of available elements and
selects an element with provided indexallResults - collection of available elements to be set on the MODEL_PAGEABLE.indexToSelect - index of an element to be selectedsynch - when true renders entries synchronouslyprotected Pageable<?> getPageableCopyWithResultList(List<?> allResults)
protected Pageable createPageableInstance(List<?> allResults, int pageSize, String typeCode)
PageableallResults - collection of all elements available in the preview. The collection is exposed through
Pageable.getAllResults()pageSize - typeCode - Pageable with provided parametersprotected String getWidgetResourcePath()
protected Widget getWidget(Widgetslot widgetslot)
protected Base loadConfiguration(String typeCode)
typeCode - the type code for which the configuration should be loadedprotected Map<String,Object> getRendererProps(Object entry, Base baseConfig)
entry - the object to be renderedbaseConfig - the UI configuration to be used when renderingprotected void selectItem(Integer position)
protected <T> List<T> convertAllPagesIntoSingleList(Pageable<T> pageable)
public LabelService getLabelService()
public TypeFacade getTypeFacade()
public CockpitComponentDefinitionService getComponentDefinitionService()
public org.zkoss.zul.Listbox getItemList()
public ObjectPreviewService getObjectPreviewService()
Copyright © 2018. All rights reserved.