jsf - PrimeFaces custom text on Menubar -
i using <p:menubar>. i've seen can use 'facet' render custom content, shown in showcase.
what want now, put text left first menuitem.
<h:form> <p:menubar autodisplay="false"> <f:facet name="options"> <p:outputlabel value="my company"/> </f:facet> <p:menuitem value="home" outcome="index.xhtml" icon="ui-icon-pencil" style="float: right;"/> <p:menuitem value="register" outcome="register.xhtml" icon="ui-icon-pencil" style="float: right;"/> <f:facet name="options"> <p:commandbutton action="login.xhtml" value="login" icon="ui-icon-extlink"/> </f:facet> </p:menubar> </h:form> i hope it's clear mean. in case, outputlabel showing on right side of menubar.
in uicomponentbase facets stored in private map<string, uicomponent> facet. when define multiple facets same name "options" summarized 1 uicomponent in map (in case uipanel 2 children: <p:outputlabel ...> , <p:commandbutton ...>).
when debug through org.primefaces.component.tieredmenu.tieredmenurenderer.encodemenu() method (which renders menu) see, menu consists of list <ul> , every menuitem <li> tag. in last step "options" facet rendered last element in list. both tags appear on right.
for example extend org.primefaces.component.tieredmenu.tieredmenurenderer.encodemenu() method in custom renderer class additionally render texts beginning of menu.
Comments
Post a Comment