Wednesday, December 6, 2017

Primefaces themes

see https://stackoverflow.com/questions/30253826/how-to-do-themeswitcher-using-primefaces

see https://www.primefaces.org/showcase/ui/misc/themeSwitcher.xhtml


add this to your pom.xml


<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>


in the web.xml the primefaces.THEME should be dynamically assigned:

<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{guestPreferences.theme}</param-value>
</context-param>

use this themeSwitcher in a page

<h:form>
<p:outputLabel for="basic" value="Basic:" />
<p:themeSwitcher id="basic" style="width:165px">
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="[afterdark, afternoon, afterwork, aristo, black-tie, blitzer, bluesky, bootstrap, casablanca, cupertino, cruze, dark-hive, delta, dot-luv, eggplant, excite-bike, flick, glass-x, home, hot-sneaks, humanity, le-frog, midnight, mint-choc, omega, overcast, pepper-grinder, redmond, rocket, sam, smoothness, south-street, start, sunny, swanky-purse, trontastic, ui-darkness, ui-lightness, vader]" var="theme" itemLabel="" itemValue=""/>
</p:themeSwitcher>
</h:form>




No comments: