Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEAMFACES-238 : Theme handling (from Seam 2) #69

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 139 additions & 133 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,133 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>seam-faces-parent</artifactId>
<groupId>org.jboss.seam.faces</groupId>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>seam-faces-api</artifactId>

<packaging>jar</packaging>
<name>Seam Faces API</name>
<!-- url required for JAR Manifest -->
<url>${project.parent.url}</url>

<dependencies>
<dependency>
<groupId>org.jboss.solder</groupId>
<artifactId>solder-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.security</groupId>
<artifactId>seam-security-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<!-- JBoss Java EE 6.0 spec bom uses wrong groupId
<groupId>javax.faces</groupId>
-->
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.4-b07</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_2.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.interceptor</groupId>
<artifactId>jboss-interceptors-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf2</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>

<build>
<plugins>
<!-- No tests in the api, skip phase -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>distribution</id>
<activation>
<property>
<name>release</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<detectOfflineLinks>false</detectOfflineLinks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>code-coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonatype.maven.plugin</groupId>
<artifactId>emma4it-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>seam-faces-parent</artifactId>
<groupId>org.jboss.seam.faces</groupId>
<version>3.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>seam-faces-api</artifactId>

<packaging>jar</packaging>
<name>Seam Faces API</name>
<!-- url required for JAR Manifest -->
<url>${project.parent.url}</url>

<dependencies>
<dependency>
<groupId>org.jboss.solder</groupId>
<artifactId>solder-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.security</groupId>
<artifactId>seam-security-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<!-- JBoss Java EE 6.0 spec bom uses wrong groupId
<groupId>javax.faces</groupId>
-->
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.4-b07</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_2.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.interceptor</groupId>
<artifactId>jboss-interceptors-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf2</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>

<build>
<plugins>
<!-- No tests in the api, skip phase -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>distribution</id>
<activation>
<property>
<name>release</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<detectOfflineLinks>false</detectOfflineLinks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>code-coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonatype.maven.plugin</groupId>
<artifactId>emma4it-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
14 changes: 14 additions & 0 deletions api/src/main/java/org/jboss/seam/faces/theme/Theme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.jboss.seam.faces.theme;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.inject.Qualifier;

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
public @interface Theme {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.jboss.seam.faces.theme;

public class ThemeChangedEvent {
private String themeName;

public ThemeChangedEvent(String themeName) {
this.themeName = themeName;
}

public String getThemeName() {
return themeName;
}
}
55 changes: 55 additions & 0 deletions api/src/main/java/org/jboss/seam/faces/theme/ThemeConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.jboss.seam.faces.theme;

import javax.enterprise.context.ApplicationScoped;


@ApplicationScoped
public class ThemeConfig {

private String[] availableThemes;
public static final int DEFAULT_MAX_AGE = 31536000; // 1 year in seconds
private boolean cookieEnabled = true;
private int cookieMaxAge = DEFAULT_MAX_AGE;
private String cookiePath = "/";
private String cookieName = "org.jboss.seam.core.Theme";

public boolean isCookieEnabled() {
return cookieEnabled;
}

public void setCookieEnabled(boolean cookieEnabled) {
this.cookieEnabled = cookieEnabled;
}

public int getCookieMaxAge() {
return cookieMaxAge;
}

public void setCookieMaxAge(int cookieMaxAge) {
this.cookieMaxAge = cookieMaxAge;
}

public String getCookiePath() {
return cookiePath;
}

public void setCookiePath(String cookiePath) {
this.cookiePath = cookiePath;
}

public String getCookieName() {
return cookieName;
}

public void setCookieName(String cookieName) {
this.cookieName = cookieName;
}

public String[] getAvailableThemes() {
return availableThemes;
}

public void setAvailableThemes(String[] availableThemes) {
this.availableThemes = availableThemes;
}
}
Loading