-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonas Bandi
committed
Apr 13, 2014
1 parent
b6cad91
commit bc25cac
Showing
26 changed files
with
10,066 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?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> | ||
<groupId>net.jonasbandi.jsworkshop</groupId> | ||
<artifactId>courserater</artifactId> | ||
<packaging>war</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>courserater</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
<version>7.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>courserater-jsf.war</finalName> <!-- stupid IntelliJ requires the folder to end with .war for exploded JBoss deployment --> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.4</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.7</version> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>ro.isdc.wro4j</groupId> | ||
<artifactId>wro4j-maven-plugin</artifactId> | ||
<version>1.6.3</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>jshint</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<options>devel,noarg</options> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>com.samaxes.maven</groupId> | ||
<artifactId>minify-maven-plugin</artifactId> | ||
<version>1.7.1</version> | ||
<executions> | ||
<execution> | ||
<id>default-minify</id> | ||
<phase>process-resources</phase> | ||
<configuration> | ||
<charset>utf-8</charset> | ||
<verbose>true</verbose> | ||
<debug>true</debug> | ||
<jsEngine>closure</jsEngine> | ||
<cssSourceDir>css</cssSourceDir> | ||
<cssSourceFiles> | ||
<!--<cssSourceFile>file-1.css</cssSourceFile>--> | ||
</cssSourceFiles> | ||
<cssFinalFile>style.css</cssFinalFile> | ||
<jsSourceDir>resources/js/app/module/</jsSourceDir> | ||
<jsSourceIncludes> | ||
<jsSourceInclude>**/*.js</jsSourceInclude> | ||
</jsSourceIncludes> | ||
<jsFinalFile>app.js</jsFinalFile> | ||
</configuration> | ||
<goals> | ||
<goal>minify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
<properties></properties> | ||
</project> | ||
|
39 changes: 39 additions & 0 deletions
39
04-Toolchain/02-Java/courserater/src/main/java/jsworkshop/CourseRater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package jsworkshop; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import javax.enterprise.context.SessionScoped; | ||
import javax.inject.Named; | ||
|
||
@Named | ||
@SessionScoped | ||
public class CourseRater implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private int rating = 0; | ||
private List<Rating> ratings = new ArrayList<Rating>(); | ||
|
||
public void rate() { | ||
System.out.println("********** Rate: " + getRating()); | ||
Rating ratingEntity = new Rating(getRating(), new Date()); | ||
ratings.add(ratingEntity); | ||
} | ||
|
||
public List<Rating> getRatings() { | ||
List<Rating> reversed = new ArrayList<Rating>(ratings); | ||
Collections.reverse(reversed); | ||
return reversed; | ||
} | ||
|
||
public int getRating() { | ||
return rating; | ||
} | ||
|
||
public void setRating(int rating) { | ||
this.rating = rating; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
04-Toolchain/02-Java/courserater/src/main/java/jsworkshop/Rating.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package jsworkshop; | ||
|
||
import java.util.Date; | ||
|
||
public class Rating { | ||
|
||
public Rating(Integer rate, Date date) { | ||
this.date = date; | ||
this.rate = rate; | ||
} | ||
|
||
private Integer rate; | ||
private Date date; | ||
|
||
public Integer getRate() { | ||
return rate; | ||
} | ||
|
||
public Date getDate() { | ||
return date; | ||
} | ||
} |
Empty file.
8 changes: 8 additions & 0 deletions
8
04-Toolchain/02-Java/courserater/src/main/webapp/WEB-INF/faces-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
|
||
<faces-config version="2.0" | ||
xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2.0.xsd"> | ||
|
||
</faces-config> |
4 changes: 4 additions & 0 deletions
4
04-Toolchain/02-Java/courserater/src/main/webapp/WEB-INF/jboss-web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jboss-web> | ||
<context-root>/courserater-jsf</context-root> | ||
</jboss-web> |
27 changes: 27 additions & 0 deletions
27
04-Toolchain/02-Java/courserater/src/main/webapp/WEB-INF/web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<web-app version="2.5" | ||
xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> | ||
|
||
<display-name>courserater</display-name> | ||
|
||
|
||
<!-- JSF --> | ||
|
||
<servlet> | ||
<servlet-name>Faces Servlet</servlet-name> | ||
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class> | ||
</servlet> | ||
|
||
<servlet-mapping> | ||
<servlet-name>Faces Servlet</servlet-name> | ||
<url-pattern>*.jsf</url-pattern> | ||
</servlet-mapping> | ||
|
||
<session-config> | ||
<session-timeout>10</session-timeout> | ||
</session-config> | ||
|
||
</web-app> |
8 changes: 8 additions & 0 deletions
8
04-Toolchain/02-Java/courserater/src/main/webapp/WEB-INF/wro.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="US-ASCII"?> | ||
|
||
<groups xmlns="http://www.isdc.ro/wro"> | ||
<group name='all'> | ||
<!--<css>/resources/css/app/**</css>--> | ||
<js>/resources/js/app/module/**</js> | ||
</group> | ||
</groups> |
11 changes: 11 additions & 0 deletions
11
04-Toolchain/02-Java/courserater/src/main/webapp/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | ||
<head> | ||
<title></title> | ||
<meta http-equiv="Refresh" content="0; URL=jsmodule/home.jsf"></meta> | ||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> | ||
</head> | ||
<body></body> | ||
</html> | ||
</html> |
52 changes: 52 additions & 0 deletions
52
04-Toolchain/02-Java/courserater/src/main/webapp/jsmodule/home.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version='1.0' encoding='UTF-8' ?> | ||
<!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://xmlns.jcp.org/jsf/html"> | ||
|
||
|
||
<ui:composition template="template.xhtml" | ||
xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:f="http://java.sun.com/jsf/core"> | ||
|
||
<ui:define name="head"> | ||
<title>JSF and Maven integration</title> | ||
</ui:define> | ||
|
||
<ui:define name="content"> | ||
<div class="hero-unit"> | ||
<h1>Course Rater</h1> | ||
<p>Demonstrating JSF and Maven integration.</p> | ||
</div> | ||
|
||
<h:form id="RatingForm" prependId="false"> | ||
<div class="row-fluid"> | ||
<div class="span6"> | ||
<p> Rate this course: Enter a rating between 1 and 5.</p> | ||
<div class="form-horizontal"> | ||
<h:inputText id="moodNumber" value="#{courseRater.rating}"/> | ||
<h:commandButton id="runCode" value="Rate »" action="#{courseRater.rate}" class="btn btn-primary"> | ||
<f:ajax execute="@form" render="ratings"/> | ||
</h:commandButton> | ||
</div> | ||
<div id="canvas_container"></div> | ||
</div> | ||
<div class="span6"> | ||
<h2>Ratings:</h2> | ||
<h:panelGroup id="ratings"> | ||
<ul > | ||
<ui:repeat value="#{courseRater.ratings}" var="rating" varStatus="loop" > | ||
<li>#{rating.rate} (#{rating.date})</li> | ||
</ui:repeat> | ||
</ul> | ||
</h:panelGroup> | ||
</div> | ||
</div> | ||
</h:form> | ||
</ui:define> | ||
</ui:composition> | ||
|
||
|
||
</html> | ||
|
49 changes: 49 additions & 0 deletions
49
04-Toolchain/02-Java/courserater/src/main/webapp/jsmodule/template.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!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:c="http://java.sun.com/jsp/jstl/core" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:f="http://java.sun.com/jsf/core"> | ||
|
||
<h:head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | ||
|
||
<link rel="stylesheet" href="../resources/css/bootstrap.min.css"></link> | ||
<style> | ||
body { | ||
padding-top: 10px; | ||
padding-bottom: 40px; | ||
} | ||
.hero-unit {padding: 20px; } | ||
</style> | ||
<link rel="stylesheet" href="../resources/css/bootstrap-responsive.min.css"></link> | ||
<ui:insert name="head"/> | ||
</h:head> | ||
|
||
<h:body> | ||
<div class="container"> | ||
|
||
<ui:insert name="content"/> | ||
|
||
<hr/> | ||
<footer> | ||
<p>@JavaScript Workshop</p> | ||
</footer> | ||
</div> | ||
|
||
<h:outputScript library="js/vendor" name="jquery-1.10.1.min.js" /> | ||
<h:outputScript library="js/vendor" name="raphael-2.1.2.min.js" /> | ||
<c:choose> | ||
<c:when test="#{not empty param.jsDebug}"> | ||
<h:outputScript library="js/app/module" name="drawing_module.js"></h:outputScript> | ||
<h:outputScript library="js/app/module" name="rating_widget.js"></h:outputScript> | ||
<h:outputScript library="js/app/module" name="main.js"></h:outputScript> | ||
</c:when> | ||
<c:otherwise> | ||
<h:outputScript library="js/app/module" name="app.min.js"></h:outputScript> | ||
</c:otherwise> | ||
</c:choose> | ||
</h:body> | ||
</html> | ||
|
Oops, something went wrong.