Permalink
Browse files

initial checking of prototype

  • Loading branch information...
1 parent 2feceb3 commit fb8b02308c880b1907287f620f6ba3768fd6f7e3 @ivaynberg committed Sep 21, 2010
View
@@ -0,0 +1,3 @@
+target
+.project
+.classpath
@@ -0,0 +1,5 @@
+#Tue Sep 21 12:59:57 PDT 2010
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
View
120 pom.xml
@@ -0,0 +1,120 @@
+<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>com.vaynberg</groupId>
+ <artifactId>wicket-tester</artifactId>
+ <packaging>war</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Sandbox for Wicket Tester replacement ideas</name>
+ <description></description>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <dependencies>
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.7R2</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.8</version>
+ </dependency>
+ <!-- WICKET DEPENDENCIES -->
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket</artifactId>
+ <version>${wicket.version}</version>
+ </dependency>
+ <!-- LOGGING DEPENDENCIES - LOG4J -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+
+ <!-- JUNIT DEPENDENCY FOR TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- JETTY DEPENDENCIES FOR TESTING -->
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>${jetty.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <filtering>false</filtering>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <optimize>true</optimize>
+ <debug>true</debug>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <wicket.version>1.5-SNAPSHOT</wicket.version>
+ <jetty.version>6.1.21</jetty.version>
+ </properties>
+</project>
@@ -0,0 +1,11 @@
+<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
+ <head>
+ <title>Wicket Quickstart Archetype Homepage</title>
+ </head>
+ <body>
+ <strong>Wicket Quickstart Archetype Homepage</strong>
+ <br/><br/>
+ <span wicket:id="message">message will be here</span>
+ <a wicket:id="link">link</a>
+ </body>
+</html>
@@ -0,0 +1,55 @@
+package com.vaynberg.tester;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.IAjaxCallDecorator;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+public class HomePage extends WebPage {
+ private int counter = 0;
+
+ public HomePage(final PageParameters parameters) {
+
+ // Add the simplest type of label
+ final Component label;
+ add(label = new Label("message", new PropertyModel(this, "counter"))
+ .setOutputMarkupId(true).setMarkupId("counter"));
+
+ AjaxLink link = new AjaxLink("link") {
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ counter++;
+ target.addComponent(label);
+ }
+
+ @Override
+ protected IAjaxCallDecorator getAjaxCallDecorator() {
+ return new IAjaxCallDecorator() {
+
+ public CharSequence decorateScript(Component component, CharSequence script) {
+ return "print('hello');"+script;
+ }
+
+ public CharSequence decorateOnSuccessScript(Component component,
+ CharSequence script) {
+ return script;
+ }
+
+ public CharSequence decorateOnFailureScript(Component component,
+ CharSequence script) {
+ return script;
+ }
+ };
+ }
+ };
+ link.setOutputMarkupId(true);
+ link.setMarkupId("link");
+ add(link);
+
+ }
+
+}
@@ -0,0 +1,4 @@
+<html>
+<body>
+second
+</body></html>
@@ -0,0 +1,7 @@
+package com.vaynberg.tester;
+
+import org.apache.wicket.markup.html.WebPage;
+
+public class SecondPage extends WebPage {
+
+}
@@ -0,0 +1,39 @@
+package com.vaynberg.tester;
+
+import org.apache.wicket.mock.MockSessionStore;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.session.ISessionStore;
+import org.apache.wicket.util.ValueProvider;
+
+/**
+ * Application object for your web application. If you want to run this
+ * application without deploying, run the Start class.
+ *
+ * @see com.vaynberg.tester.Start#main(String[])
+ */
+public class WicketApplication extends WebApplication {
+ /**
+ * Constructor
+ */
+ public WicketApplication() {
+ }
+
+ /**
+ * @see org.apache.wicket.Application#getHomePage()
+ */
+ public Class<HomePage> getHomePage() {
+ return HomePage.class;
+ }
+
+ @Override
+ public String getConfigurationType() {
+ return DEPLOYMENT;
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ setSessionStoreProvider(ValueProvider.<ISessionStore>of(new MockSessionStore()));
+ }
+
+}
@@ -0,0 +1,12 @@
+log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
+
+log4j.rootLogger=INFO,Stdout
+
+log4j.logger.org.apache.wicket=INFO
+log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
+log4j.logger.org.apache.wicket.version=INFO
+log4j.logger.org.apache.wicket.RequestCycle=INFO
+
+
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <display-name>myproject</display-name>
+
+ <!--
+ There are three means to configure Wickets configuration mode and they are
+ tested in the order given.
+ 1) A system property: -Dwicket.configuration
+ 2) servlet specific <init-param>
+ 3) context specific <context-param>
+ The value might be either "development" (reloading when templates change)
+ or "deployment". If no configuration is found, "development" is the default.
+ -->
+
+ <filter>
+ <filter-name>wicket</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>com.vaynberg.tester.WicketApplication</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>wicket</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+</web-app>
View
@@ -0,0 +1,53 @@
+Envjs({
+ scriptTypes : {
+ '': true, //inline and anonymous
+ 'text/javascript': true,
+ 'text/envjs': false
+ }
+});
+
+function counter() {
+ return document.getElementById('counter').innerHTML;
+}
+
+function checkcounter(val) {
+ if (counter()!=val) throw "counter should be: "+val+" but was: "+counter();
+}
+
+
+window.location='http://localhost:8080/wicket/bookmarkable/com.vaynberg.tester.HomePage';
+
+Wicket.Log = {
+
+ enabled: function() {
+ return true;
+ },
+
+ info: function(msg) {
+ print("INFO: "+msg);
+ },
+
+ error: function(msg) {
+ print("ERROR: "+msg);
+ },
+
+ log: function(msg) {
+ print("LOG: "+msg);
+ }
+ }
+
+checkcounter("0");
+
+link=document.getElementById('link');
+
+if (link==null) { throw "link not found"; }
+
+// dispatch mouse click event
+var evt=document.createEvent("MouseEvents");
+evt.initEvent("click",true,true);
+link.dispatchEvent(evt);
+Envjs.wait(); //not sure if this is needed
+
+checkcounter("1");
+
+
Oops, something went wrong.

0 comments on commit fb8b023

Please sign in to comment.