1
看到我的代碼主要面向主題切換器:如何將主題添加到我的項目
theme.xhtml
<h:form>
<h:panelGrid>
<p:themeSwitcher style="width:165px" effect="fade" var="th" id="themePreview" >
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeBean.themesList}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme}"/>
<p:column>
<p:graphicImage value="images/#{th.image}"/>
</p:column>
<p:column>
#{th.name}
</p:column>
</p:themeSwitcher>
</h:panelGrid>
</h:form>
ThemeBean
themesList= new ArrayList<Theme>();
themesList.add(new Theme("afterdark","afterdark.png"));
themesList.add(new Theme("aristo","aristo.png"));
themesList.add(new Theme("eggplant","eggplant.png"));
themesList.add(new Theme("humanity","humanity.png"));
themesList.add(new Theme("sunny","sunny.png"));
}
public List<Theme> getThemesList() {
return themesList;
}
public void setThemesList(List<Theme> themesList) {
this.themesList = themesList;
}
Theme.java
private String name;
private String image;
public Theme(String name, String image)
{
this.setImage(image);
this.setName(name);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
我遵循主要的例子。
我配置在構建路徑XML還
主題罐子,但我沒有得到,甚至在主題切換(列表框)
任何一個可以建議我做什麼
我明白了。謝謝 – swaps 2013-03-07 12:32:51