I use the sample code from http://www.primefaces.org/showcase-labs ... itcher.jsf
but looks the system cannot find org.primefaces.examples.domain.Theme; Did anybody get same problems?
Question for Theme in Primefaces 3.0 M3
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
This isn't required - It's a class in the showcase, not in PF.
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
-
- Posts: 102
- Joined: 20 Jan 2010, 13:36
But How themeSwitcher works in Primefaces 3.0 M3. I try another sample as following code <p:themeSwitcher initialText="Change Style" buttonPreText="Skin: " />, but it doesn't show anything.
Thanks
Thanks
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
Use this example:
# <p:themeSwitcher style="width:150px">
# <f:selectItem itemLabel="Choose Theme" itemValue="" />
# <f:selectItems value="#{themeSwitcherBean.themes}" />
# </p:themeSwitcher>
themeSwitcherBean.themes is a map in the backing bean.
# <p:themeSwitcher style="width:150px">
# <f:selectItem itemLabel="Choose Theme" itemValue="" />
# <f:selectItems value="#{themeSwitcherBean.themes}" />
# </p:themeSwitcher>
themeSwitcherBean.themes is a map in the backing bean.
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
-
- Posts: 102
- Joined: 20 Jan 2010, 13:36
I tried, but it looks now no any themes be listed. I paste my code.
Page
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui" >
<h:head>
</h:head>
<h:body>
<h:form>
<p:themeSwitcher style="width:150px">
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeSwitcherBean.themes}" />
</p:themeSwitcher>
<p:separator />
<p:commandButton value="Button" />
<p:panel header="Panel">
Panel Content
</p:panel>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton type="button" value="New" image="ui-icon-document" />
<p:commandButton type="button" value="Open" image="ui-icon-folder-open"/>
<p:divider />
<p:commandButton type="button" title="Save" image="ui-icon-disk"/>
<p:commandButton type="button" title="Delete" image="ui-icon-trash"/>
<p:commandButton type="button" title="Print" image="ui-icon-print"/>
</p:toolbarGroup>
<p:divider />
<p:toolbarGroup align="right">
<p:menuButton value="Navigate">
<p:menuitem value="Home" url="http://www.primefaces.org" />
<p:menuitem value="ShowCase" url="http://www.primefaces.org/showcase" />
<p:menuitem value="TouchFaces" url="http://www.primefaces.org/showcase/touch" />
</p:menuButton>
</p:toolbarGroup>
</p:toolbar>
<p:tabView>
<p:tab title="Tab1">Tab1 Content</p:tab>
<p:tab title="Tab2">Tab2 Content</p:tab>
<p:tab title="Tab3">Tab3 Content</p:tab>
</p:tabView>
</h:form>
</h:body>
</html>
Bean
import java.util.Map;
import java.util.TreeMap;
//import javax.annotation.ManagedBean;
//
//import javax.faces.bean.SessionScoped;
import javax.annotation.PostConstruct;
public class ThemeSwitcherBean{
private Map<String, String> themes;
public Map<String, String> getThemes() {
return themes;
}
public void setThemes(Map<String, String> themes) {
this.themes = themes;
}
@PostConstruct
public void init(){
themes = new TreeMap<String, String>();
themes.put("Aristo", "aristo");
themes.put("Black-Tie", "black-tie");
themes.put("Blitzer", "blitzer");
themes.put("Bluesky", "bluesky");
themes.put("Casablanca", "casablanca");
themes.put("Cupertino", "cupertino");
themes.put("Dark-Hive", "dark-hive");
}
}
Page
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui" >
<h:head>
</h:head>
<h:body>
<h:form>
<p:themeSwitcher style="width:150px">
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeSwitcherBean.themes}" />
</p:themeSwitcher>
<p:separator />
<p:commandButton value="Button" />
<p:panel header="Panel">
Panel Content
</p:panel>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton type="button" value="New" image="ui-icon-document" />
<p:commandButton type="button" value="Open" image="ui-icon-folder-open"/>
<p:divider />
<p:commandButton type="button" title="Save" image="ui-icon-disk"/>
<p:commandButton type="button" title="Delete" image="ui-icon-trash"/>
<p:commandButton type="button" title="Print" image="ui-icon-print"/>
</p:toolbarGroup>
<p:divider />
<p:toolbarGroup align="right">
<p:menuButton value="Navigate">
<p:menuitem value="Home" url="http://www.primefaces.org" />
<p:menuitem value="ShowCase" url="http://www.primefaces.org/showcase" />
<p:menuitem value="TouchFaces" url="http://www.primefaces.org/showcase/touch" />
</p:menuButton>
</p:toolbarGroup>
</p:toolbar>
<p:tabView>
<p:tab title="Tab1">Tab1 Content</p:tab>
<p:tab title="Tab2">Tab2 Content</p:tab>
<p:tab title="Tab3">Tab3 Content</p:tab>
</p:tabView>
</h:form>
</h:body>
</html>
Bean
import java.util.Map;
import java.util.TreeMap;
//import javax.annotation.ManagedBean;
//
//import javax.faces.bean.SessionScoped;
import javax.annotation.PostConstruct;
public class ThemeSwitcherBean{
private Map<String, String> themes;
public Map<String, String> getThemes() {
return themes;
}
public void setThemes(Map<String, String> themes) {
this.themes = themes;
}
@PostConstruct
public void init(){
themes = new TreeMap<String, String>();
themes.put("Aristo", "aristo");
themes.put("Black-Tie", "black-tie");
themes.put("Blitzer", "blitzer");
themes.put("Bluesky", "bluesky");
themes.put("Casablanca", "casablanca");
themes.put("Cupertino", "cupertino");
themes.put("Dark-Hive", "dark-hive");
}
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 30 guests