Skip to content
Snippets Groups Projects
Commit 13007f21 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

ThemeSwitcher implemented.

parent 6eceba53
No related branches found
No related tags found
No related merge requests found
......@@ -56,12 +56,158 @@
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.0.RC1</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>black-tie</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>blitzer</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>bluesky</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>casablanca</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>cupertino</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>dark-hive</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>dot-luv</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>eggplant</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>excite-bike</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>flick</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>hot-sneaks</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>humanity</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>le-frog</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>midnight</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>mint-choc</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>overcast</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>pepper-grinder</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>redmond</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>rocket</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>sam</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>smoothness</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>south-street</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>start</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>sunny</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>swanky-purse</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>trontastic</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>ui-darkness</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>ui-lightness</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>vader</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>glass-x</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>kieker</groupId>
<artifactId>kieker</artifactId>
......
package kieker.webgui.beans;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
/**
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@SessionScoped
public class CurrentThemeBean {
private String theme;
public CurrentThemeBean() {
theme = "glass-x";
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
if (params.containsKey("theme")) {
theme = params.get("theme");
}
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
}
package kieker.webgui.beans;
import java.util.Map;
import java.util.TreeMap;
import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
/**
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@ApplicationScoped
public class ThemeSwitcherBean {
private Map<String, String> themes;
public Map<String, String> getThemes() {
return 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");
themes.put("Dot-Luv", "dot-luv");
themes.put("Eggplant", "eggplant");
themes.put("Excite-Bike", "excite-bike");
themes.put("Flick", "flick");
themes.put("Glass-X", "glass-x");
themes.put("Hot-Sneaks", "hot-sneaks");
themes.put("Humanity", "humanity");
themes.put("Le-Frog", "le-frog");
themes.put("Midnight", "midnight");
themes.put("Mint-Choc", "mint-choc");
themes.put("Overcast", "overcast");
themes.put("Pepper-Grinder", "pepper-grinder");
themes.put("Redmond", "redmond");
themes.put("Rocket", "rocket");
themes.put("Sam", "sam");
themes.put("Smoothness", "smoothness");
themes.put("South-Street", "south-street");
themes.put("Start", "start");
themes.put("Sunny", "sunny");
themes.put("Swanky-Purse", "swanky-purse");
themes.put("Trontastic", "trontastic");
themes.put("UI-Darkness", "ui-darkness");
themes.put("UI-Lightness", "ui-lightness");
themes.put("Vader", "vader");
}
}
......@@ -6,7 +6,7 @@
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>glass-x</param-value>
<param-value>#{currentThemeBean.theme}</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
......
......@@ -21,6 +21,7 @@
<p:menubar>
<p:submenu label="File">
<p:menuitem value="New Project" onclick="NewProjectDialog.show();" ajax="true" update="ProjectsList"/>
<p:menuitem value="Settings" onclick="SettingsDialog.show();" ajax="true"/>
</p:submenu>
<p:submenu label="Help">
......@@ -118,6 +119,7 @@
<a href="http://www.kieker-monitoring.net/">https://se.informatik.uni-kiel.de/kieker/</a>
</p:dialog>
<!-- This is the dialog to create a new project. -->
<p:dialog id="NewProjectDialog" header="New Project" resizable="false" modal="true" widgetVar="NewProjectDialog" >
<p:ajax event="close" update="NewProjectDialog" listener="#{stringBean.clear()}" />
......@@ -129,6 +131,22 @@
</center>
</h:form>
</p:dialog>
<!-- This is the dialog for settings and properties. -->
<p:dialog id="SettingsDialog" header="Settings" resizable="false" modal="true" widgetVar="SettingsDialog">
<h:form>
<h:panelGrid columns="2" cellpadding="10">
<h:outputText value="Look and Feel:" />
<p:themeSwitcher value="#{currentThemeBean.theme}" style="width:150px" effect="fade" >
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeSwitcherBean.themes}" />
</p:themeSwitcher>
</h:panelGrid>
<center>
<p:commandButton value="Okay" oncomplete="SettingsDialog.hide();"/>
</center>
</h:form>
</p:dialog>
</f:view>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment