Skip to content

Commit

Permalink
[clipboard.js] Initial commit of integration with Clipboard.js
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-g committed Nov 1, 2016
1 parent 7e592db commit 4e4415f
Show file tree
Hide file tree
Showing 15 changed files with 1,125 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?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">
<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>

Expand Down Expand Up @@ -332,6 +331,7 @@
<module>wicket-facebook-parent</module>
<module>wicket-html5-parent</module>
<module>wicket-servlet3-parent</module>
<module>wicketstuff-clipboard-js-parent</module>
<module>wicketstuff-springreference-parent</module>
<module>wicket-security-parent</module>

Expand Down Expand Up @@ -1193,7 +1193,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
Expand All @@ -1214,7 +1214,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
Expand All @@ -1235,7 +1235,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
Expand Down Expand Up @@ -1345,4 +1345,4 @@
</plugin>
</plugins>
</reporting>
</project>
</project>
3 changes: 3 additions & 0 deletions wicketstuff-clipboard-js-parent/README.md
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/
37 changes: 37 additions & 0 deletions wicketstuff-clipboard-js-parent/pom.xml
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>
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>
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;
}
}
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>
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);
}
}
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
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>
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 wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs/pom.xml
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>
Loading

0 comments on commit 4e4415f

Please sign in to comment.