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
public class DefaultSelectorSectionRenderer extends AbstractNavigationAreaSectionRenderer
Default selector section renderer. Provides a default internal list item renderer which makes use of the Cockpit framework'sLabelServicefor 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 theListitempassed to theListitemRenderer#render(Listitem, Object)method to the correspondingTypedObject, 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:
setListRenderer(ListitemRenderer)
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringEMPTY_MESSAGEprotected SelectorSectionlastSectionstatic java.lang.StringSELECTOR_ACTIVE_ITEM_SCLASSAn additional style class used for selector items.static java.lang.StringSELECTOR_ITEM_SCLASSThe normal style class used for selector items.static java.lang.StringSELECTOR_SCLASSStyle class of the cockpit selector component.
-
Constructor Summary
Constructors Constructor Description DefaultSelectorSectionRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<TypedObject>extractSelectedItems(java.util.Set<java.lang.Object> listValues)Extracts the selectedTypedObjects corresponding to the selector's current selection.org.zkoss.zul.ListitemRenderergetListRenderer()Returns the list renderer used for rendering the list items displayed in the selector.protected SelectorSectiongetSection()Returns 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 Detail
-
EMPTY_MESSAGE
protected static final java.lang.String EMPTY_MESSAGE
- See Also:
- Constant Field Values
-
lastSection
protected SelectorSection lastSection
-
SELECTOR_SCLASS
public static final java.lang.String SELECTOR_SCLASS
Style class of the cockpit selector component.
-
SELECTOR_ITEM_SCLASS
public static final java.lang.String SELECTOR_ITEM_SCLASS
The normal style class used for selector items.
-
SELECTOR_ACTIVE_ITEM_SCLASS
public static final java.lang.String SELECTOR_ACTIVE_ITEM_SCLASS
An additional style class used for selector items.- See Also:
SELECTOR_ITEM_SCLASS,SELECTOR_SCLASS, Constant Field Values
-
-
Method Detail
-
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
protected java.util.List<TypedObject> extractSelectedItems(java.util.Set<java.lang.Object> listValues)
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
protected SelectorSection getSection()
Returns the last section which this renderer rendered.- Returns:
- the last section
-
-