Permalink
Browse files

Initial import from SVN

  • Loading branch information...
schst committed May 22, 2012
0 parents commit 2509f3bfd012f34e201ef82f96c09463174a10c3
Showing with 2,498 additions and 0 deletions.
  1. +11 −0 .classpath
  2. +22 −0 .project
  3. +504 −0 LICENSE
  4. +5 −0 build.properties.sample
  5. +55 −0 build.xml
  6. +72 −0 pom.xml
  7. +22 −0 src/main/assembly/bin.xml
  8. +106 −0 src/main/java/net/schst/EventDispatcher/Event.java
  9. +391 −0 src/main/java/net/schst/EventDispatcher/EventDispatcher.java
  10. +8 −0 src/main/java/net/schst/EventDispatcher/EventListener.java
  11. +124 −0 src/main/java/net/schst/EventDispatcher/EventListenerCollection.java
  12. +60 −0 src/main/java/net/schst/EventDispatcher/EventListenerContainer.java
  13. +64 −0 src/main/java/net/schst/EventDispatcher/EventQueue.java
  14. +18 −0 src/test/java/net/schst/EventDispatcher/Examples/BlackListCheck.java
  15. +89 −0 src/test/java/net/schst/EventDispatcher/Examples/CallbackListener.java
  16. +39 −0 src/test/java/net/schst/EventDispatcher/Examples/Customer.java
  17. +40 −0 src/test/java/net/schst/EventDispatcher/Examples/DebugHandler.java
  18. +16 −0 src/test/java/net/schst/EventDispatcher/Examples/EchoHandler.java
  19. +24 −0 src/test/java/net/schst/EventDispatcher/Examples/Example1.java
  20. +23 −0 src/test/java/net/schst/EventDispatcher/Examples/Example2.java
  21. +38 −0 src/test/java/net/schst/EventDispatcher/Examples/ExampleAutoRemove.java
  22. +25 −0 src/test/java/net/schst/EventDispatcher/Examples/ExampleGlobal.java
  23. +36 −0 src/test/java/net/schst/EventDispatcher/Examples/ExampleIntrospect.java
  24. +22 −0 src/test/java/net/schst/EventDispatcher/Examples/ExampleQueue.java
  25. +46 −0 src/test/java/net/schst/EventDispatcher/Examples/ExampleRemove.java
  26. +45 −0 src/test/java/net/schst/EventDispatcher/tests/AddListenersTestCase.java
  27. +36 −0 src/test/java/net/schst/EventDispatcher/tests/AutoRemoveTestCase.java
  28. +66 −0 src/test/java/net/schst/EventDispatcher/tests/CancellingEventsTestCase.java
  29. +29 −0 src/test/java/net/schst/EventDispatcher/tests/EventNamesTestCase.java
  30. +77 −0 src/test/java/net/schst/EventDispatcher/tests/EventQueueTestCase.java
  31. +76 −0 src/test/java/net/schst/EventDispatcher/tests/FactoryMethodsTestCase.java
  32. +29 −0 src/test/java/net/schst/EventDispatcher/tests/GetEventListenersTestCase.java
  33. +116 −0 src/test/java/net/schst/EventDispatcher/tests/RemoveListenerTestCase.java
  34. +24 −0 src/test/java/net/schst/EventDispatcher/tests/ResetTestCase.java
  35. +86 −0 src/test/java/net/schst/EventDispatcher/tests/TriggerEventTestCase.java
  36. +26 −0 src/test/java/net/schst/EventDispatcher/tests/helpers/CaptureEventListener.java
  37. +17 −0 src/test/java/net/schst/EventDispatcher/tests/helpers/CountCaughtEventsListener.java
  38. +10 −0 src/test/java/net/schst/EventDispatcher/tests/helpers/DummyEventListener.java
  39. +1 −0 version.properties
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="var" path="CLOVER_RUNTIME"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
<classpathentry output="target/test-classes" kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>EventDispatcher</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.cenqua.clover.eclipse.cloverjavabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
504 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,5 @@
# Copy this file to build.properties and set
# your local build prefs.
# Which compiler to use: jikes, modern, ...
#build.compiler=jikes
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="eventdispatcher">
<property name="buildpropfile" value="${basedir}/build.properties"/>
<property name="versionpropfile" value="${basedir}/version.properties"/>
<property file="${buildpropfile}"/>
<property file="${versionpropfile}"/>
<property name="build.compiler" value="modern"/>
<property name="builddir" value="${basedir}/build"/>
<property name="distdir" value="${basedir}/dist"/>
<property name="srcdir" value="${basedir}/src/main/java"/>
<property name="jarfile" value="${distdir}/eventdispatcher-${version.number}.jar"/>
<target name="init">
<echo message="Feel free to set properties in file '${buildpropfile}'."/>
<mkdir dir="${distdir}"/>
<mkdir dir="${builddir}"/>
</target>
<target depends="init" name="compile">
<echo message="Compiling sources using compiler '${build.compiler}'."/>
<javac debug="true" deprecation="true" destdir="${builddir}" srcdir="${srcdir}"/>
</target>
<target depends="clean, init, compile" name="clean-compile"/>
<target depends="clean-compile" name="jar">
<echo message="Don't forget to set property 'version.number' in file '${versionpropfile}'."/>
<jar compress="true" jarfile="${jarfile}">
<fileset dir="${builddir}">
<include name="**/*.class"/>
<exclude name="net/schst/EventDispatcher/Examples/**"/>
<exclude name="**/*.java"/>
</fileset>
<fileset dir="${basedir}">
<include name="LICENSE"/>
</fileset>
</jar>
</target>
<target name="clean">
<delete dir="${builddir}"/>
<delete dir="${distdir}"/>
</target>
<target name="all">
<echo message="You called the default target 'all', which in turn calls 'jar'."/>
<echo message="Other possible targets are:"/>
<echo message="clean"/>
<echo message="compile"/>
<echo message="clean-compile"/>
<antcall target="jar"/>
</target>
</project>
72 pom.xml
@@ -0,0 +1,72 @@
<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.schst</groupId>
<artifactId>EventDispatcher</artifactId>
<version>0.12.0</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>schst</id>
<url>http://mvn.java.schst.net/repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>iso8859-1</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptor>src/main/assembly/bin.xml</descriptor>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clover-plugin</artifactId>
<configuration>
<jdk>1.5</jdk>
<licenseFile>/home/schst/clover.license</licenseFile>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-3</version>
</extension>
</extensions>
</build>
<distributionManagement>
<repository>
<id>schst</id>
<url>ftp://mvn.java.schst.net/repository</url>
</repository>
<snapshotRepository>
<id>schst</id>
<url>ftp://mvn.java.schst.net/repository</url>
</snapshotRepository>
</distributionManagement>
</project>
@@ -0,0 +1,22 @@
<assembly>
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>LICENSE*</include>
</includes>
</fileSet>
<fileSet>
<directory>target</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
@@ -0,0 +1,106 @@
package net.schst.EventDispatcher;
/**
* Event class, that contains information about a generic event.
*
* @author Stephan Schmidt <stephan.schmidt@schlund.de>
*/
public class Event {
private String name = null;
private boolean cancelled = false;
private boolean inQueue = false;
private Object context = null;
private Object userInfo = null;
/**
* Create a new event
*
* @param name name of the event
*/
public Event(String name) {
this.name = name;
}
/**
* Create a new event
*
* @param name name of the event
* @param context context of the event
*/
public Event(String name, Object context) {
this.name = name;
this.context = context;
}
/**
* Create a new event
*
* @param name name of the event
* @param context context of the event
* @param userInfo user info for the event
*/
public Event(String name, Object context, Object userInfo) {
this.name = name;
this.context = context;
this.userInfo = userInfo;
}
/**
* Cancel the event
*/
public void cancel() {
this.cancelled = true;
}
/**
* Flag the event as queued
*/
public void queueEvent() {
this.inQueue = true;;
}
/**
* Check, whether the event has been cancelled
*
* @return true, if the event has been cancelled, false otherwise
*/
public boolean isCancelled() {
return this.cancelled;
}
/**
* Check, whether the event already is in a queue
*
* @return true, if the event is queued, false otherwise
*/
public boolean isQueued() {
return this.inQueue;
}
/**
* Get the name of the event
*
* @return name of the event
*/
public String getName() {
return this.name;
}
/**
* Get the event context
*
* @return Context of the ecent
*/
public Object getContext() {
return this.context;
}
/**
* Get the (optional) user info
*
* @return any user info that has been passed to the constructor
*/
public Object getUserInfo() {
return this.userInfo;
}
}
Oops, something went wrong.

0 comments on commit 2509f3b

Please sign in to comment.