forked from wicketstuff/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clipboard.js] Initial commit of integration with Clipboard.js
- Loading branch information
Showing
15 changed files
with
1,125 additions
and
6 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
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,3 @@ | ||
An integration between Apache Wicket and Clipboard JS - copy text without Flash. | ||
|
||
For more information see https://clipboardjs.com/ |
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,37 @@ | ||
<?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> | ||
<groupId>org.wicketstuff</groupId> | ||
<artifactId>wicketstuff-core</artifactId> | ||
<version>7.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>wicketstuff-clipboardjs-parent</artifactId> | ||
<name>WicketStuff Clipboard JS Parent</name> | ||
|
||
<packaging>pom</packaging> | ||
|
||
<description>Parent project for WicketStuff Clipboard JS</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> | ||
|
||
<modules> | ||
<module>wicketstuff-clipboardjs</module> | ||
<module>wicketstuff-clipboardjs-examples</module> | ||
</modules> | ||
|
||
<developers> | ||
<developer> | ||
<name>Martin Grigorov</name> | ||
</developer> | ||
</developers> | ||
|
||
</project> |
57 changes: 57 additions & 0 deletions
57
wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/pom.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,57 @@ | ||
<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> | ||
<groupId>org.wicketstuff</groupId> | ||
<artifactId>wicketstuff-clipboardjs-parent</artifactId> | ||
<version>7.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>wicketstuff-clipboardjs-examples</artifactId> | ||
<packaging>war</packaging> | ||
<name>WicketStuff Clipboard JS Example</name> | ||
<description>Example usage of WicketStuff Clipboard JS</description> | ||
|
||
<properties> | ||
<javadoc.disabled>true</javadoc.disabled> | ||
<deployment.disabled>true</deployment.disabled> | ||
<sources.disabled>true</sources.disabled> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>wicketstuff-clipboardjs</artifactId> | ||
<version>${project.parent.version}</version> | ||
</dependency> | ||
|
||
<!-- LOGGING DEPENDENCIES - LOG4J --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
</dependency> | ||
|
||
<!-- JUNIT DEPENDENCY FOR TESTING --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
|
||
<!-- JETTY DEPENDENCIES FOR TESTING --> | ||
<dependency> | ||
<groupId>org.eclipse.jetty.aggregate</groupId> | ||
<artifactId>jetty-all-server</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
...js-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsApplication.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,12 @@ | ||
package org.wicketstuff.clipboardjs.example; | ||
|
||
import org.apache.wicket.Page; | ||
import org.apache.wicket.protocol.http.WebApplication; | ||
|
||
public class ClipboardJsApplication extends WebApplication { | ||
@Override | ||
public Class<? extends Page> getHomePage() | ||
{ | ||
return ClipboardJsDemoPage.class; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.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,14 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:wicket="http://wicket.apache.org"> | ||
|
||
<head> | ||
<title>ClipboardJs demo page</title> | ||
</head> | ||
|
||
<body> | ||
<textarea wicket:id="target"></textarea> | ||
<br/> | ||
<button type="button" wicket:id="copyBtn">Copy</button> | ||
</body> | ||
|
||
</html> |
30 changes: 30 additions & 0 deletions
30
...ardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.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,30 @@ | ||
package org.wicketstuff.clipboardjs.example; | ||
|
||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.WebPage; | ||
import org.apache.wicket.markup.html.form.TextArea; | ||
import org.apache.wicket.request.mapper.parameter.PageParameters; | ||
import org.wicketstuff.clipboardjs.ClipboardJsBehavior; | ||
|
||
/** | ||
* Demo page that just adds the default BrowserIdPanel and a feedback panel to show any errors | ||
*/ | ||
public class ClipboardJsDemoPage extends WebPage | ||
{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public ClipboardJsDemoPage(final PageParameters parameters) | ||
{ | ||
super(parameters); | ||
|
||
TextArea target = new TextArea("target"); | ||
add(target); | ||
|
||
final WebMarkupContainer copyBtn = new WebMarkupContainer("copyBtn"); | ||
final ClipboardJsBehavior clipboardJsBehavior = new ClipboardJsBehavior(); | ||
clipboardJsBehavior.setTarget(target); | ||
copyBtn.add(clipboardJsBehavior); | ||
add(copyBtn); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/resources/log4j.properties
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,10 @@ | ||
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 |
23 changes: 23 additions & 0 deletions
23
...tuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/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,23 @@ | ||
<?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>ClipboardJs example</display-name> | ||
|
||
<filter> | ||
<filter-name>wicket.clipboardjs</filter-name> | ||
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> | ||
<init-param> | ||
<param-name>applicationClassName</param-name> | ||
<param-value>org.wicketstuff.clipboardjs.example.ClipboardJsApplication</param-value> | ||
</init-param> | ||
</filter> | ||
|
||
<filter-mapping> | ||
<filter-name>wicket.clipboardjs</filter-name> | ||
<url-pattern>/*</url-pattern> | ||
</filter-mapping> | ||
|
||
</web-app> |
69 changes: 69 additions & 0 deletions
69
...etstuff-clipboardjs-examples/src/test/java/org/wicketstuff/clipboardjs/example/Start.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,69 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.wicketstuff.clipboardjs.example; | ||
|
||
import org.eclipse.jetty.server.Connector; | ||
import org.eclipse.jetty.server.Server; | ||
import org.eclipse.jetty.server.bio.SocketConnector; | ||
import org.eclipse.jetty.webapp.WebAppContext; | ||
|
||
public class Start | ||
{ | ||
|
||
public static void main(final String[] args) throws Exception | ||
{ | ||
final Server server = new Server(); | ||
final SocketConnector connector = new SocketConnector(); | ||
|
||
// Set some timeout options to make debugging easier. | ||
connector.setMaxIdleTime(1000 * 60 * 60); | ||
connector.setSoLingerTime(-1); | ||
connector.setPort(8080); | ||
server.setConnectors(new Connector[] { connector }); | ||
|
||
final WebAppContext bb = new WebAppContext(); | ||
bb.setServer(server); | ||
bb.setContextPath("/"); | ||
bb.setWar("src/main/webapp"); | ||
|
||
// START JMX SERVER | ||
// MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); | ||
// MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); | ||
// server.getContainer().addEventListener(mBeanContainer); | ||
// mBeanContainer.start(); | ||
|
||
server.setHandler(bb); | ||
|
||
try | ||
{ | ||
System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); | ||
server.start(); | ||
System.in.read(); | ||
System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); | ||
// while (System.in.available() == 0) { | ||
// Thread.sleep(5000); | ||
// } | ||
server.stop(); | ||
server.join(); | ||
} | ||
catch (final Exception e) | ||
{ | ||
e.printStackTrace(); | ||
System.exit(100); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs/pom.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,24 @@ | ||
<?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> | ||
<groupId>org.wicketstuff</groupId> | ||
<artifactId>wicketstuff-clipboardjs-parent</artifactId> | ||
<version>7.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>wicketstuff-clipboardjs</artifactId> | ||
<name>WicketStuff Clipboard JS </name> | ||
<description>An integration of Clipboard JS with Apache Wicket</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.