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
0 parents
commit 4c4b0d6
Showing
148 changed files
with
3,966 additions
and
0 deletions.
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
test-output | |||
bin | |||
.classpath | |||
.project | |||
.settings | |||
target | |||
.metadata |
Empty file.
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,149 @@ | |||
<?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> | |||
<artifactId>exanpe-t5-demo</artifactId> | |||
<groupId>fr.exanpe</groupId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
<packaging>war</packaging> | |||
<name>exanpe-t5-demo</name> | |||
<description>Showcase for exanpe-t5-lib project.</description> | |||
|
|||
<dependencies> | |||
|
|||
<dependency> | |||
<groupId>fr.exanpe</groupId> | |||
<artifactId>exanpe-t5-lib</artifactId> | |||
<version>1.0.0-SNAPSHOT</version> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>org.apache.tapestry</groupId> | |||
<artifactId>tapestry-core</artifactId> | |||
<version>${tapestry-release-version}</version> | |||
</dependency> | |||
<!-- A dependency on either JUnit or TestNG is required, or the surefire | |||
plugin (which runs the tests) will fail, preventing Maven from packaging | |||
the WAR. Tapestry includes a large number of testing facilities designed | |||
for use with TestNG (http://testng.org/), so it's recommended. --> | |||
<dependency> | |||
<groupId>org.testng</groupId> | |||
<artifactId>testng</artifactId> | |||
<version>5.12.1</version> | |||
<scope>test</scope> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>org.easymock</groupId> | |||
<artifactId>easymock</artifactId> | |||
<version>2.5.2</version> | |||
<scope>test</scope> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>org.apache.tapestry</groupId> | |||
<artifactId>tapestry-test</artifactId> | |||
<version>${tapestry-release-version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>commons-io</groupId> | |||
<artifactId>commons-io</artifactId> | |||
<version>2.0.1</version> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>commons-lang</groupId> | |||
<artifactId>commons-lang</artifactId> | |||
<version>2.6</version> | |||
</dependency> | |||
|
|||
|
|||
<!-- Provided by the servlet container, but sometimes referenced in the | |||
application code. --> | |||
<dependency> | |||
<groupId>javax.servlet</groupId> | |||
<artifactId>servlet-api</artifactId> | |||
<version>2.5</version> | |||
<scope>provided</scope> | |||
</dependency> | |||
|
|||
</dependencies> | |||
|
|||
<developers> | |||
<developer> | |||
<id>lguerin</id> | |||
<name>Laurent Guerin</name> | |||
<email>zlau.dreamcat@gmail.com</email> | |||
</developer> | |||
<developer> | |||
<id>jmaupoux</id> | |||
<name>Julien Maupoux</name> | |||
<email>attonnnn@gmail.com</email> | |||
</developer> | |||
</developers> | |||
|
|||
<build> | |||
<finalName>exanpe-t5-demo</finalName> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<configuration> | |||
<source>1.5</source> | |||
<target>1.5</target> | |||
<optimize>true</optimize> | |||
</configuration> | |||
</plugin> | |||
|
|||
<!-- Run the application using "mvn jetty:run" --> | |||
<plugin> | |||
<groupId>org.mortbay.jetty</groupId> | |||
<artifactId>maven-jetty-plugin</artifactId> | |||
<version>6.1.16</version> | |||
<configuration> | |||
<!-- Log to the console. --> | |||
<requestLog implementation="org.mortbay.jetty.NCSARequestLog"> | |||
<!-- This doesn't do anything for Jetty, but is a workaround for a | |||
Maven bug that prevents the requestLog from being set. --> | |||
<append>true</append> | |||
</requestLog> | |||
</configuration> | |||
</plugin> | |||
<plugin> | |||
<groupId>net.kindleit</groupId> | |||
<artifactId>maven-gae-plugin</artifactId> | |||
<version>0.8.4</version> | |||
<configuration> | |||
<serverId>gae</serverId> | |||
</configuration> | |||
<dependencies> | |||
<dependency> | |||
<groupId>net.kindleit</groupId> | |||
<artifactId>gae-runtime</artifactId> | |||
<version>${gae.version}</version> | |||
<type>pom</type> | |||
</dependency> | |||
</dependencies> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
|
|||
<pluginRepositories> | |||
|
|||
<!-- As above, this can be commented out when access to the snapshot version | |||
of a Tapestry Maven plugin is not required. --> | |||
<pluginRepository> | |||
<id>apache-snapshots</id> | |||
<url>http://repository.apache.org/snapshots/</url> | |||
</pluginRepository> | |||
|
|||
</pluginRepositories> | |||
|
|||
<properties> | |||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
<tapestry-release-version>5.2.6</tapestry-release-version> | |||
<gae.version>1.5.1</gae.version> | |||
</properties> | |||
</project> |
41 changes: 41 additions & 0 deletions
41
src/main/java/fr/exanpe/t5/demo/components/ComponentDemoLayout.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
package fr.exanpe.t5.demo.components; | |||
|
|||
import org.apache.tapestry5.BindingConstants; | |||
import org.apache.tapestry5.Block; | |||
import org.apache.tapestry5.annotations.Import; | |||
import org.apache.tapestry5.annotations.Parameter; | |||
import org.apache.tapestry5.annotations.Property; | |||
import org.apache.tapestry5.ioc.annotations.Inject; | |||
import org.apache.tapestry5.services.javascript.JavaScriptSupport; | |||
|
|||
/** | |||
* Layout component for pages of application exanpe-t5-demo. | |||
*/ | |||
@Import(stylesheet="context:layout/layout.css") | |||
public class ComponentDemoLayout | |||
{ | |||
|
|||
@Property | |||
@Parameter(required = true, allowNull = false, defaultPrefix = BindingConstants.LITERAL) | |||
private String title; | |||
|
|||
@Property | |||
@Parameter | |||
private Block description; | |||
|
|||
@Property | |||
@Parameter | |||
private Block code; | |||
|
|||
@Property | |||
@Parameter | |||
private Block javacode; | |||
|
|||
@Property | |||
@Parameter | |||
private Block notice; | |||
|
|||
@Inject | |||
private JavaScriptSupport javaScriptSupport; | |||
|
|||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/fr/exanpe/t5/demo/components/HighlightBody.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
package fr.exanpe.t5.demo.components; | |||
|
|||
import org.apache.tapestry5.BindingConstants; | |||
import org.apache.tapestry5.annotations.Import; | |||
import org.apache.tapestry5.annotations.Parameter; | |||
import org.apache.tapestry5.annotations.Property; | |||
|
|||
@Import(stylesheet="context:css/github.css", library={"context:js/highlight.js", "context:js/exanpe-demo.js"}) | |||
public class HighlightBody { | |||
|
|||
@Property | |||
@Parameter(defaultPrefix = BindingConstants.LITERAL, required = true, allowNull = false, value="xml") | |||
private String type; | |||
|
|||
|
|||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/fr/exanpe/t5/demo/components/HighlightTMLPage.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
package fr.exanpe.t5.demo.components; | |||
|
|||
import java.io.IOException; | |||
import java.io.InputStream; | |||
|
|||
import org.apache.commons.io.IOUtils; | |||
import org.apache.tapestry5.BindingConstants; | |||
import org.apache.tapestry5.PersistenceConstants; | |||
import org.apache.tapestry5.annotations.AfterRender; | |||
import org.apache.tapestry5.annotations.Import; | |||
import org.apache.tapestry5.annotations.Parameter; | |||
import org.apache.tapestry5.annotations.Persist; | |||
import org.apache.tapestry5.annotations.Property; | |||
import org.apache.tapestry5.annotations.SetupRender; | |||
import org.apache.tapestry5.ioc.annotations.Inject; | |||
import org.apache.tapestry5.services.RequestGlobals; | |||
|
|||
@Import(stylesheet="context:css/github.css", library={"context:js/highlight.js", "context:js/exanpe-demo.js"}) | |||
public class HighlightTMLPage { | |||
|
|||
@Property | |||
@Parameter(defaultPrefix = BindingConstants.LITERAL, required = true, allowNull = false, value="<p:code>") | |||
private String codeStart; | |||
|
|||
@Property | |||
@Parameter(defaultPrefix = BindingConstants.LITERAL, required = true, allowNull = false, value="</p:code>") | |||
private String codeEnd; | |||
|
|||
@Property | |||
private String highlight; | |||
|
|||
@Inject | |||
private RequestGlobals request; | |||
|
|||
@SetupRender | |||
public void init() throws IOException{ | |||
InputStream stream = request.getHTTPServletRequest().getSession().getServletContext().getResourceAsStream("/"+request.getActivePageName()+".tml"); | |||
|
|||
String s = IOUtils.toString(stream); | |||
|
|||
int start = s.indexOf(codeStart); | |||
if(start == -1) | |||
throw new IllegalStateException("The hightlight component requires a "+codeStart+" tag in the calling page"); | |||
|
|||
highlight = s.substring(start+codeStart.length(), s.indexOf(codeEnd)); | |||
} | |||
|
|||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,44 @@ | |||
package fr.exanpe.t5.demo.components; | |||
|
|||
import org.apache.tapestry5.*; | |||
import org.apache.tapestry5.annotations.*; | |||
import org.apache.tapestry5.ioc.annotations.*; | |||
import org.apache.tapestry5.BindingConstants; | |||
|
|||
/** | |||
* Layout component for pages of application exanpe-t5-demo. | |||
*/ | |||
@Import(stylesheet="context:layout/layout.css") | |||
public class Layout | |||
{ | |||
/** The page title, for the <title> element and the <h1> element. */ | |||
@Property | |||
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) | |||
private String title; | |||
|
|||
@Property | |||
private String pageName; | |||
|
|||
@Property | |||
@Parameter(defaultPrefix = BindingConstants.LITERAL) | |||
private String sidebarTitle; | |||
|
|||
@Property | |||
@Parameter(defaultPrefix = BindingConstants.LITERAL) | |||
private Block sidebar; | |||
|
|||
@Inject | |||
private ComponentResources resources; | |||
|
|||
public String getClassForPageName() | |||
{ | |||
return resources.getPageName().equalsIgnoreCase(pageName) | |||
? "current_page_item" | |||
: null; | |||
} | |||
|
|||
public String[] getPageNames() | |||
{ | |||
return new String[] { "Index", "About", "Contact" }; | |||
} | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
package fr.exanpe.t5.demo.data; | |||
|
|||
import java.io.Serializable; | |||
|
|||
public enum CountryEnum implements Serializable | |||
{ | |||
FRANCE(new String[] | |||
{ "Paris", "Lyon", "Marseille" }), UK(new String[] | |||
{ "London", "Liverpool", "Manchester" }), USA(new String[] | |||
{ "New York", "Washington", "Los Angeles", "San Francisco", "Miami" }); | |||
|
|||
private final String[] cities; | |||
|
|||
private CountryEnum(String[] cities) | |||
{ | |||
this.cities = cities; | |||
} | |||
|
|||
public String[] getCities() | |||
{ | |||
return cities; | |||
} | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
package fr.exanpe.t5.demo.data; | |||
|
|||
public enum FranceCityEnum | |||
{ | |||
PARIS, LYON, NANTES; | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
package fr.exanpe.t5.demo.data; | |||
|
|||
public enum ThirdEnum | |||
{ | |||
HOUSE, FLAT, CAVE; | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
package fr.exanpe.t5.demo.data; | |||
|
|||
public enum UKCityEnum | |||
{ | |||
LONDON, MANCHESTER, LIVERPOOL; | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
package fr.exanpe.t5.demo.data; | |||
|
|||
public enum USACityEnum | |||
{ | |||
NEW_YORK, WASHINGTON, LOS_ANGELES, SAN_FRANCISCO, MIAMI; | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
package fr.exanpe.t5.demo.data; | |||
|
|||
import org.apache.tapestry5.beaneditor.NonVisual; | |||
|
|||
public class User | |||
{ | |||
@NonVisual | |||
private long id; | |||
|
|||
private String firstName; | |||
|
|||
private String lastName; | |||
|
|||
private int age; | |||
|
|||
public long getId() { return id; } | |||
|
|||
public void setId(long id) { this.id = id; } | |||
|
|||
public String getFirstName() { return firstName; } | |||
|
|||
public void setFirstName(String firstName) { this.firstName = firstName; } | |||
|
|||
public String getLastName() { return lastName; } | |||
|
|||
public void setLastName(String lastName) { this.lastName = lastName; } | |||
|
|||
public int getAge() { return age; } | |||
|
|||
public void setAge(int age) { this.age = age; } | |||
} |
Oops, something went wrong.