Class DefaultSelectorSectionRenderer
java.lang.Object
de.hybris.platform.cockpit.components.navigationarea.renderer.AbstractNavigationAreaSectionRenderer
de.hybris.platform.cockpit.components.navigationarea.renderer.DefaultSelectorSectionRenderer
- All Implemented Interfaces:
SectionRenderer
- Direct Known Subclasses:
CmsCatalogSelectorSectionRenderer,DefaultSectionSelectorSectionRenderer
Default selector section renderer. Provides a default internal list item renderer which makes use of the Cockpit framework's
LabelService for rendering values.
The internal renderer for rendering selector items used by this section renderer can easily be replaced. However, in order for
the general selector functionality to work correctly, you need to set the value of the Listitem passed to the
ListitemRenderer#render(Listitem, Object) method to the corresponding TypedObject, just as in the example
below.
Example: Custom list item renderer
public void render(final Listitem li, final Object value) throws Exception
{
if (value instanceof TypedObject)
{
li.setValue(value);
...
final Listcell cell = new Listcell(someText);
li.appendChild(cell);
cell.setSclass("cockpitSelectorItem");
}
else
{
LOG.warn("Can not render item since it is not a TypedObject");
}
}
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected SelectorSectionstatic final StringAn additional style class used for selector items.static final StringThe normal style class used for selector items.static final StringStyle class of the cockpit selector component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<TypedObject>extractSelectedItems(Set<Object> listValues) Extracts the selectedTypedObjects corresponding to the selector's current selection.org.zkoss.zul.ListitemRendererReturns the list renderer used for rendering the list items displayed in the selector.protected SelectorSectionReturns the last section which this renderer rendered.voidrender(SectionPanel panel, org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component captionComponent, Section section) voidsetListRenderer(org.zkoss.zul.ListitemRenderer listRenderer) Sets the list item renderer to be used when rendering list items tolistRenderer.Methods inherited from class de.hybris.platform.cockpit.components.navigationarea.renderer.AbstractNavigationAreaSectionRenderer
createBrowserItemTooltip, createList, getNavigationArea, getSectionPanelModel, setNavigationArea
-
Field Details
-
EMPTY_MESSAGE
- See Also:
-
lastSection
-
SELECTOR_SCLASS
Style class of the cockpit selector component. -
SELECTOR_ITEM_SCLASS
The normal style class used for selector items. -
SELECTOR_ACTIVE_ITEM_SCLASS
An additional style class used for selector items.
-
-
Constructor Details
-
DefaultSelectorSectionRenderer
public DefaultSelectorSectionRenderer()
-
-
Method Details
-
render
public void render(SectionPanel panel, org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component captionComponent, Section section) - Specified by:
renderin interfaceSectionRenderer- Specified by:
renderin classAbstractNavigationAreaSectionRenderer
-
setListRenderer
public void setListRenderer(org.zkoss.zul.ListitemRenderer listRenderer) Sets the list item renderer to be used when rendering list items tolistRenderer. Note: Calling this method with anullargument, will cause the default fallback renderer to be used when rendering.- Parameters:
listRenderer- the renderer to use ornullif the fallback renderer should be used
-
getListRenderer
public org.zkoss.zul.ListitemRenderer getListRenderer()Returns the list renderer used for rendering the list items displayed in the selector.- Returns:
- the list renderer used
-
extractSelectedItems
Extracts the selectedTypedObjects corresponding to the selector's current selection.- Parameters:
listValues- the selected ZK items e.g.Listitems- Returns:
- the real selected values
-
getSection
Returns the last section which this renderer rendered.- Returns:
- the last section
-