Skip to content

Commit

Permalink
project updated to RichFaces 5.0.0-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
ppitonak committed May 29, 2013
1 parent 0261e63 commit d660df2
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 125 deletions.
75 changes: 16 additions & 59 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<!--
JBoss, Home of Professional Open Source Copyright 2010-2011, Red Hat, Inc. and individual contributors by the
JBoss, Home of Professional Open Source Copyright 2010-2013, Red Hat, Inc. and individual contributors by the
@authors tag. See the copyright.txt in the distribution for a full listing of individual contributors. This is
free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later
Expand All @@ -19,7 +19,7 @@
<groupId>org.richfaces.examples</groupId>
<artifactId>tictactoe</artifactId>
<name>Tic-Tac-Toe Game</name>
<version>4.3.2-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<description>A sample RichFaces 4 application.</description>
<url>http://jboss.org/richfaces</url>
Expand All @@ -45,7 +45,7 @@
<developers>
<developer>
<name>Pavol Pitonak</name>
<email>ppitonak@redhat.com</email>
<email>ppitonak @ redhat.com</email>
<timezone>+1</timezone>
</developer>
</developers>
Expand All @@ -71,43 +71,25 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version.richfaces>4.3.1.Final</version.richfaces>

<version.richfaces>5.0.0-SNAPSHOT</version.richfaces>
<version.jboss.javaee.6.spec>3.0.2.Final</version.jboss.javaee.6.spec>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${version.richfaces}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Dependencies for RichFaces -->
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>

<!-- Dependencies for bean validation -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
<groupId>org.richfaces</groupId>
<artifactId>richfaces</artifactId>
<version>${version.richfaces}</version>
</dependency>

<!-- Dependencies for JavaServer Faces -->
<!-- Dependencies for JEE APIs -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>${version.jboss.javaee.6.spec}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>

Expand All @@ -128,12 +110,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
Expand All @@ -144,34 +125,10 @@
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<SCM-Revision>${buildNumber}</SCM-Revision>
<SCM-Timestamp>${timestamp}</SCM-Timestamp>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<revisionOnScmFailure>unknown</revisionOnScmFailure>
<timestampFormat>{0,date,MMM dd, yyyy H:mm:ss zzz}</timestampFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/richfaces/examples/tictactoe/Character.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
* Copyright 2010-2011, Red Hat, Inc. and individual contributors
* Copyright 2010-2013, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Expand All @@ -24,8 +24,7 @@
/**
* Enum representing character with which a player plays.
*
* @author <a href="mailto:[email protected]">Pavol Pitonak</a>
* @version $Revision$
* @author <a href="https://community.jboss.org/people/ppitonak">Pavol Pitonak</a>
*/
public enum Character {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
* Copyright 2010-2011, Red Hat, Inc. and individual contributors
* Copyright 2010-2013, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Expand All @@ -24,8 +24,7 @@
/**
* Enum representing state of one playing field.
*
* @author <a href="mailto:[email protected]">Pavol Pitonak</a>
* @version $Revision$
* @author <a href="https://community.jboss.org/people/ppitonak">Pavol Pitonak</a>
*/
public enum FieldState {

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/richfaces/examples/tictactoe/GameBean.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
* Copyright 2010-2011, Red Hat, Inc. and individual contributors
* Copyright 2010-2013, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Expand Down Expand Up @@ -32,13 +32,13 @@
/**
* The main managed bean. It stores the playing area, information about players and game logic.
*
* @author <a href="mailto:[email protected]">Pavol Pitonak</a>
* @version $Revision$
* @author <a href="https://community.jboss.org/people/ppitonak">Pavol Pitonak</a>
*/
@ManagedBean
@SessionScoped
public class GameBean implements Serializable {

private static final long serialVersionUID = 4250174819706242032L;
// number of image on which the user clicked
private int imageNumber;
// number of player who clicked (0 or 1)
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/richfaces/examples/tictactoe/Player.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
* Copyright 2010-2011, Red Hat, Inc. and individual contributors
* Copyright 2010-2013, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Expand All @@ -24,8 +24,7 @@
/**
* Bean holding information about a player.
*
* @author <a href="mailto:[email protected]">Pavol Pitonak</a>
* @version $Revision$
* @author <a href="https://community.jboss.org/people/ppitonak">Pavol Pitonak</a>
*/
public class Player {

Expand Down
13 changes: 0 additions & 13 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,4 @@
<param-name>org.richfaces.skin</param-name>
<param-value>ruby</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
80 changes: 40 additions & 40 deletions src/main/webapp/index.xhtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:r="http://richfaces.org/rich"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">

<!--
JBoss, Home of Professional Open Source
Copyright 2010-2011, Red Hat, Inc. and individual contributors
Copyright 2010-2013, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
Expand Down Expand Up @@ -36,45 +36,45 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
<h:form id="form" prependId="true">
<h:panelGrid columns="2" columnClasses="main-part, main-part">

<rich:dataGrid id="playingArea" value="#{gameBean.fieldStates}" var="field" columns="3"
iterationStatusVar="status" styleClass="playingArea">
<a4j:commandButton id="field" image="/resources/images/#{fn:toLowerCase(field)}.png"
<r:dataGrid id="playingArea" value="#{gameBean.fieldStates}" var="field" columns="3" iterationStatusVar="status"
styleClass="playingArea">
<r:commandButton id="field" image="/resources/images/#{fn:toLowerCase(field)}.png"
action="#{gameBean.click}" render="@form">
<a4j:param assignTo="#{gameBean.imageNumber}" name="imageNo" value="#{status.index}" />
</a4j:commandButton>
</rich:dataGrid>
<r:param assignTo="#{gameBean.imageNumber}" name="imageNo" value="#{status.index}" />
</r:commandButton>
</r:dataGrid>

<rich:tabPanel switchType="ajax" style="width: 300px;">
<rich:tab id="settings" header="Settings">
<r:tabPanel switchType="ajax" style="width: 300px;">
<r:tab id="settings" header="Settings">

<rich:dataTable id="settingsTable" value="#{gameBean.players}" var="player" rowKeyVar="playerNumber"
<r:dataTable id="settingsTable" value="#{gameBean.players}" var="player" rowKeyVar="playerNumber"
stateVar="width: 100%">

<rich:column id="playerNoColumn" style="padding-left: 6px; padding-right: 6px;">
<r:column id="playerNoColumn" style="padding-left: 6px; padding-right: 6px;">
<h:outputText value="#{playerNumber == 0 ? 'X' : 'O'}" />
</rich:column>
</r:column>

<rich:column id="nameColumn" style="width: 100px;">
<r:column id="nameColumn" style="width: 100px;">
<f:facet name="header">Name</f:facet>
<rich:inplaceInput id="name" value="#{player.name}" required="true">
<a4j:ajax event="change" render="name" />
</rich:inplaceInput>
</rich:column>
<r:inplaceInput id="name" value="#{player.name}" required="true">
<r:ajax event="change" render="name" />
</r:inplaceInput>
</r:column>

<rich:column id="typeColumn" style="width: 100px;">
<r:column id="typeColumn" style="width: 100px;">
<f:facet name="header">Player Type</f:facet>
<h:selectOneMenu id="playerType#{playerNumber}" value="#{player.type}" style="width: 100%;">
<f:selectItems value="#{gameBean.playersItems}" />
<a4j:ajax render="playingArea" event="change" listener="#{gameBean.newGameListener}" />
<r:ajax render="playingArea" event="change" listener="#{gameBean.newGameListener}" />
</h:selectOneMenu>
</rich:column>
</r:column>

<rich:column id="firstColumn" style="width: 70px;">
<r:column id="firstColumn" style="width: 70px;">
<f:facet name="header">
First
<h:graphicImage id="swap" library="images" name="swap.png" height="24" width="24"
style="vertical-align: middle;" alt="Swap players' order">
<a4j:ajax event="click" render="settings playingArea"
<r:ajax event="click" render="settings playingArea"
listener="#{gameBean.selectFirstPlayer}" />
</h:graphicImage>
</f:facet>
Expand All @@ -83,29 +83,29 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
style="margin-left: auto; margin-right: auto;">
<f:selectItem itemValue="true" />
</h:selectOneRadio>
</rich:column>
</r:column>

</rich:dataTable>
<a4j:commandButton id="newGameButton" action="#{gameBean.newGame}" value="New Game"
</r:dataTable>
<r:commandButton id="newGameButton" action="#{gameBean.newGame}" value="New Game"
render="playingArea, statsForm" style="float: left, bottom; margin-top: 5px;" />

</rich:tab>
</r:tab>

<rich:tab id="stats" header="Statistics">
<rich:dataTable value="#{gameBean.players}" var="player" style="width: 100%">
<r:tab id="stats" header="Statistics">
<r:dataTable value="#{gameBean.players}" var="player" style="width: 100%">

<rich:column>
<r:column>
#{player.name}
<f:facet name="footer">ties</f:facet>
</rich:column>
</r:column>

<rich:column style="text-align: center; width: 35px;" footerClass="center-text">
<r:column style="text-align: center; width: 35px;" footerClass="center-text">
<f:facet name="header">Wins</f:facet>
#{player.wins}
<f:facet name="footer">#{gameBean.ties}</f:facet>
</rich:column>
</r:column>

<rich:column style="text-align: center; width: 35px;" footerClass="center-text">
<r:column style="text-align: center; width: 35px;" footerClass="center-text">
<f:facet name="header">%</f:facet>
<h:outputText value="#{gameBean.games == 0 ? 0 : (player.wins / gameBean.games * 100)}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
Expand All @@ -115,16 +115,16 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</f:facet>
</rich:column>
</r:column>

</rich:dataTable>
</r:dataTable>

<a4j:commandButton action="#{gameBean.newGame}" value="New Game" render="playingArea stats"
<r:commandButton action="#{gameBean.newGame}" value="New Game" render="playingArea stats"
style="float: left, bottom; margin-top: 5px;" />
<a4j:commandButton action="#{gameBean.clearStats}" value="Clear Stats" render="stats"
<r:commandButton action="#{gameBean.clearStats}" value="Clear Stats" render="stats"
style="float: right; margin-top: 5px;" />
</rich:tab>
</rich:tabPanel>
</r:tab>
</r:tabPanel>

</h:panelGrid>
</h:form>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/templates/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!--
JBoss, Home of Professional Open Source
Copyright 2010-2011, Red Hat, Inc. and individual contributors
Copyright 2010-2013, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
Expand Down

0 comments on commit d660df2

Please sign in to comment.