I'm trying to use a "<pu:menu ..." like the side bar menu and it expects "material" icons encoded like: "" for its icons. I want to build that menu programmatically using a "defaultMenuModel". Question is, when I create a "DefaultSubMenu" and try to set the icon as the string "" then this does not get encoded correctly for the HTML output -- i just get the string. What's the magic formatting for setting such an icon?
I tried using unicode: "\ue6e1" but that's not right of course.
UPDATE: Ok, I still don't know how to encode the numeric codes, however I did find that I could simply use the "material" names -- so to get those names I used this web site: https://glyphsearch.com/?library=material
Selecting the material glyph set and then searched for an icon. Then you just use those names for your icon name rather than the numerical codes.
How to encode material icons programmatically
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
-
- Posts: 409
- Joined: 28 Dec 2011, 17:44
I do not really understand why so "cryptical names" will be used (also in the menu implementation). In version 1.0.9 (perhaps earlier) it is possible to use the names with ui-icon class:
Code: Select all
<i class="ui-icon ui-icon-3d-rotation"></i>
Primefaces 8.0.7 (PF Extensions 8.0)
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Please make the following change in UltimaMenuRenderer.java;
Code: Select all
protected void encodeItemIcon(FacesContext context, String icon) throws IOException {
if(icon != null) {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("i", null);
if(icon.contains("fa fa-")) {
writer.writeAttribute("class", icon, null);
}
else {
writer.writeAttribute("class", "material-icons", null);
writer.write(icon); // Please use write instead of writeText
}
writer.endElement("i");
}
}
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests