[CVS spice] Removed component that is no longer under active development. The archive is on /home/projects/spice/archive (for spice devs) or can be grabbed out of CVS using the tag PRE_SWINGACTIONS_R
pdonald-yCVjj/[email protected] 11 Jul 2004 12:31:51 -0000
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>spice/sandbox/swingactions</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1"><span id="removed">.cvsignore</span></a></tt></td><td></td><td align="right" id="removed">-7</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt><a href="#file2"><span id="removed">project.properties</span></a></tt></td><td></td><td align="right" id="removed">-69</td><td nowrap="nowrap">1.2 removed</td></tr>
<tr><td><tt><a href="#file3"><span id="removed">project.xml</span></a></tt></td><td></td><td align="right" id="removed">-72</td><td nowrap="nowrap">1.5 removed</td></tr>
<tr class="alt"><td><tt>src/conf/<a href="#file4"><span id="removed">swingactions.dtd</span></a></tt></td><td></td><td align="right" id="removed">-44</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt>src/java/org/codehaus/spice/swingactions/<a href="#file5"><span id="removed">AbstractActionManager.java</span></a></tt></td><td></td><td align="right" id="removed">-173</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file6"><span id="removed">AbstractActionManagerFactory.java</span></a></tt></td><td></td><td align="right" id="removed">-112</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file7"><span id="removed">ActionAdapter.java</span></a></tt></td><td></td><td align="right" id="removed">-147</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file8"><span id="removed">ActionDelegate.java</span></a></tt></td><td></td><td align="right" id="removed">-82</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file9"><span id="removed">ActionManager.java</span></a></tt></td><td></td><td align="right" id="removed">-64</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file10"><span id="removed">ActionManagerFactory.java</span></a></tt></td><td></td><td align="right" id="removed">-44</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file11"><span id="removed">Configurator.java</span></a></tt></td><td></td><td align="right" id="removed">-86</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file12"><span id="removed">InitialActionManagerFactory.java</span></a></tt></td><td></td><td align="right" id="removed">-143</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file13"><span id="removed">XMLActionManager.java</span></a></tt></td><td></td><td align="right" id="removed">-70</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file14"><span id="removed">XMLActionManagerFactory.java</span></a></tt></td><td></td><td align="right" id="removed">-39</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt>src/java/org/codehaus/spice/swingactions/metadata/<a href="#file15"><span id="removed">ActionGroupsMetaData.java</span></a></tt></td><td></td><td align="right" id="removed">-100</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file16"><span id="removed">ActionMetaData.java</span></a></tt></td><td></td><td align="right" id="removed">-132</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file17"><span id="removed">ActionSetMetaData.java</span></a></tt></td><td></td><td align="right" id="removed">-80</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file18"><span id="removed">GroupActionMetaData.java</span></a></tt></td><td></td><td align="right" id="removed">-81</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file19"><span id="removed">SeparatorActionMetaData.java</span></a></tt></td><td></td><td align="right" id="removed">-56</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt>src/java/org/codehaus/spice/swingactions/reader/<a href="#file20"><span id="removed">ConfigReader.java</span></a></tt></td><td></td><td align="right" id="removed">-163</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt>src/test/META-INF/spice/<a href="#file21"><span id="removed">swingactions.properties</span></a></tt></td><td></td><td align="right" id="removed">-3</td><td nowrap="nowrap">1.3 removed</td></tr>
<tr class="alt"><td><tt>src/test/org/codehaus/spice/swingactions/<a href="#file22"><span id="removed">AbstractTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-115</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file23"><span id="removed">ActionManagerFactoryTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-124</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file24"><span id="removed">ActionManagerTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-58</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file25"><span id="removed">ActionTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-237</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<span id="removed">Bean16.gif</span></tt></td><td colspan="2" align="center"><small id="info">[binary]</small></td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<span id="removed">Bean24.gif</span></tt></td><td colspan="2" align="center"><small id="info">[binary]</small></td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file28"><span id="removed">ConfiguratorTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-50</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file29"><span id="removed">SimpleActionManager.java</span></a></tt></td><td></td><td align="right" id="removed">-26</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file30"><span id="removed">SimpleActionManagerFactory.java</span></a></tt></td><td></td><td align="right" id="removed">-36</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file31"><span id="removed">actions.xml</span></a></tt></td><td></td><td align="right" id="removed">-30</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt>src/test/org/codehaus/spice/swingactions/metadata/<a href="#file32"><span id="removed">MetaDataTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-191</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt>src/test/org/codehaus/spice/swingactions/reader/<a href="#file33"><span id="removed">ConfigReaderTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-108</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file34"><span id="removed">swingactions.xml</span></a></tt></td><td></td><td align="right" id="removed">-30</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file35"><span id="removed">swingactions2.xml</span></a></tt></td><td></td><td align="right" id="removed">-61</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr class="alt"><td><tt>xdocs/<a href="#file36"><span id="removed">component.menu</span></a></tt></td><td></td><td align="right" id="removed">-5</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file37"><span id="removed">configuration.xml</span></a></tt></td><td></td><td align="right" id="removed">-43</td><td nowrap="nowrap">1.3 removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file38"><span id="removed">index.xml</span></a></tt></td><td></td><td align="right" id="removed">-16</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td><tt> /<a href="#file39"><span id="removed">tasks.xml</span></a></tt></td><td></td><td align="right" id="removed">-24</td><td nowrap="nowrap">1.1 removed</td></tr>
<tr><td></td><td></td><td align="right" id="removed">-2921</td><td></td></tr>
</table>
<small id="info">39 removed files</small><br />
<pre class="comment">
Removed component that is no longer under active development. The archive is on /home/projects/spice/archive (for spice devs) or can be grabbed out of CVS using the tag PRE_SWINGACTIONS_REMOVE-tag.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>.cvsignore</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N .cvsignore
--- .cvsignore 5 Jul 2003 17:27:19 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,7 +0,0 @@
</small></pre><pre class="diff" id="removed">-dist
-target
-build.properties
-*.log
-*.el
-*.ipr
-*.iws
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>project.properties</b></big> <small id="info">removed after 1.2</small></div>
<pre class="diff"><small id="info">diff -N project.properties
--- project.properties 24 Apr 2004 16:40:04 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
</small></pre><pre class="diff" id="removed">-maven.remote.group=spice
-maven.repo.remote=http://www.ibiblio.com/maven,http://dist.codehaus.org
-
-maven.checkstyle.properties = ${basedir}/../../tools/checkstyle/checkstyle.xml
-maven.checkstyle.license.exists=true
-
-maven.javadoc.links = \
- http://avalon.apache.org/api/, \
- http://dna.jcontainer.org/apidocs/, \
- http://java.sun.com/j2se/1.3/docs/api/
-
-maven.junit.fork=true
-maven.junit.dir=${basedir}/target/test-classes
-
-maven.license.licenseFile=${basedir}/../../LICENSE.txt
-maven.linkcheck.enable=true
-
-maven.xdoc.poweredby.image=
-#maven.xdoc.jsl=target/site.jsl
-
-spice.color1.bright=#FFFFFF
-spice.color1.light=#FFFFCC
-spice.color1.main=#CCCC99
-spice.color1.shaded=#999966
-spice.color1.dark=#666633
-spice.color1.darkest=#333300
-
-maven.ui.body.background=${spice.color1.bright}
-maven.ui.body.foreground=${spice.color1.darkest}
-maven.ui.section.background=${spice.color1.shaded}
-maven.ui.section.foreground=${spice.color1.light}
-maven.ui.subsection.background=${spice.color1.main}
-maven.ui.subsection.foreground=${spice.color1.light}
-maven.ui.table.header.background=${spice.color1.shaded}
-maven.ui.table.header.foreground=${spice.color1.light}
-
-maven.ui.table.row.odd.background=${spice.color1.light}
-maven.ui.table.row.odd.foreground=${spice.color1.dark}
-maven.ui.table.row.even.background=${spice.color1.light}
-maven.ui.table.row.even.foreground=${spice.color1.dark}
-
-maven.ui.banner.background=${spice.color1.bright}
-maven.ui.banner.foreground=${spice.color1.darkest}
-maven.ui.banner.border.top=${spice.color1.bright}
-maven.ui.banner.border.bottom=${spice.color1.shaded}
-
-maven.ui.source.background=${spice.color1.bright}
-maven.ui.source.foreground=${spice.color1.darkest}
-maven.ui.source.border.top=${spice.color1.shaded}
-maven.ui.source.border.bottom=${spice.color1.shaded}
-maven.ui.source.border.right=${spice.color1.shaded}
-maven.ui.source.border.left=${spice.color1.shaded}
-
-maven.ui.navcol.background=${spice.color1.light}
-maven.ui.navcol.background.ns4=${spice.color1.light}
-maven.ui.navcol.foreground=${spice.color1.dark}
-maven.ui.navcol.foreground.ns4=${spice.color1.dark}
-maven.ui.navcol.border.top=${spice.color1.light}
-maven.ui.navcol.border.right=${spice.color1.main}
-maven.ui.navcol.border.bottom=${spice.color1.main}
-
-maven.ui.breadcrumbs.background=${spice.color1.main}
-maven.ui.breadcrumbs.foreground=${spice.color1.dark}
-maven.ui.breadcrumbs.border.top=${spice.color1.light}
-maven.ui.breadcrumbs.border.bottom=${spice.color1.shaded}
-
-maven.ui.href.link=${spice.color1.dark}
-maven.ui.href.link.active=${spice.color1.darkest}
-maven.ui.href.link.selfref=${spice.color1.dark}
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>project.xml</b></big> <small id="info">removed after 1.5</small></div>
<pre class="diff"><small id="info">diff -N project.xml
--- project.xml 24 Apr 2004 16:40:04 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0"?>
-<project>
- <extend>${basedir}/../../project.xml</extend>
- <name>Spice SwingActions</name>
- <id>spice-swingactions</id>
- <package>org.codehaus.spice.${pom.artifactId.substring(11)}</package>
- <currentVersion>0.2</currentVersion>
- <inceptionYear>2003</inceptionYear>
-
- <shortDescription>Component for managing and configuring Swing Actions.</shortDescription>
-
- <description>
- A manager component for Swing Actions which supports configuration via XML
- and includes a factory for Action related Swing Components, such as
- JButton, JMenu etc ...
- </description>
-
- <versions>
- <version>
- <id>0.2</id>
- <name>0.2</name>
- <tag>HEAD</tag>
- </version>
- <version>
- <id>0.1</id>
- <name>0.1</name>
- <tag>SWINGACTIONS_0_1-tag</tag>
- </version>
- </versions>
-
- <dependencies>
- <dependency>
- <id>commons-digester</id>
- <version>1.5</version>
- </dependency>
- <dependency>
- <id>commons-beanutils</id>
- <version>1.6</version>
- </dependency>
- <dependency>
- <id>commons-collections</id>
- <version>2.1</version>
- </dependency>
- <dependency>
- <id>commons-logging</id>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>excalibur</groupId>
- <artifactId>excalibur-i18n</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <id>xml-apis</id>
- <version>1.0.b2</version>
- </dependency>
- <dependency>
- <id>xerces</id>
- <version>2.2.1</version>
- </dependency>
- </dependencies>
-
- <developers>
- <developer>
- <name>Mauro Talevi</name>
- <id>mauro</id>
- <roles>
- <role>Developer</role>
- </roles>
- </developer>
- </developers>
-</project>
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/conf<br /></span>
<div class="fileheader" id="removed"><big><b>swingactions.dtd</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N swingactions.dtd
--- swingactions.dtd 21 Jul 2003 00:02:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
</small></pre><pre class="diff" id="removed">-<!--
- || Created by Mauro Talevi
- -->
-
-<!ELEMENT swingactions (action-set)>
-<!ATTLIST swingactions
- className CDATA #IMPLIED
->
-
-<!--
- Defines the set of Actions
--->
-
-<!ELEMENT action-set (action+)>
-<!ATTLIST action-set
->
-
-<!--
- Defines an Action
-
- id - the id of the action instance
- name - the name of the action instance.
- shortDescription - the short description of the action instance.
- longDescription - the long description of the action instance.
- smallIcon - the path to image for the small icon
- largeIcon - the path to image for the large icon
- commandKey - the command key character
- mnemonicKey - the mnemonic key character
- acceleratorKey - the accelerator key character
--->
-
-<!ELEMENT action>
-<!ATTLIST action
- id CDATA #REQUIRED
- name CDATA #REQUIRED
- shortDescription CDATA #IMPLIED
- longDescription CDATA #IMPLIED
- smallIcon CDATA #IMPLIED
- largeIcon CDATA #IMPLIED
- commandKey CDATA #IMPLIED
- mnemonicKey CDATA #IMPLIED
- acceleratorKey CDATA #IMPLIED
->
-
</pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>AbstractActionManager.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N AbstractActionManager.java
--- AbstractActionManager.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,173 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.HashMap;
-import java.util.NoSuchElementException;
-import javax.swing.Action;
-import javax.swing.ActionMap;
-
-/**
- * <p>ActionActionManager is an abstract implementation of <code>ActionManager</code> which
- * is common to all configurations.
- *
- * @author Mauro Talevi
- */
-public abstract class AbstractActionManager
- implements ActionManager
-{
- /**
- * Empty set of Action objects.
- */
- private static final Action[] EMPY_ACTIONS = new Action[ 0 ];
-
- /** Action map */
- private final ActionMap m_actions = new ActionMap();
-
- /** Delegate map */
- private final HashMap m_delegates = new HashMap();
-
- /**
- * Enables or disables an Action
- *
- * @param actionId the Id of the Action
- * @param enabled the boolean flag -
- * <code>true</code> if Action is enabled
- */
- public void enableAction( final Object actionId,
- final boolean enabled )
- {
- try
- {
- final Action action = getAction( actionId );
- action.setEnabled( enabled );
- }
- catch( NoSuchElementException e )
- {
- // do nothing, Action is not in the map
- }
- }
-
- /**
- * Returns the Action registered with the ActionManager
- *
- * @param actionId the Id of the Action
- */
- public synchronized Action getAction( final Object actionId )
- throws NoSuchElementException
- {
- final Action action = m_actions.get( actionId );
- if( action == null )
- {
- final String message = "Cannot find action for id " + actionId;
- throw new NoSuchElementException( message );
- }
- return action;
- }
-
- /**
- * Returns all the Actions registered with the ActionManager
- */
- public synchronized Action[] getActions()
- {
- final Object[] keys = m_actions.keys();
- if( keys == null )
- {
- return EMPY_ACTIONS;
- }
- final Action[] array = new Action[ keys.length ];
- for( int i = 0; i < keys.length; i++ )
- {
- array[ i ] = m_actions.get( keys[ i ] );
- }
- return array;
- }
-
- /**
- * Adds an Action to the ActionManager
- *
- * @param actionId the Id of the Action
- * @param action the Action being added
- */
- protected synchronized void addAction( final Object actionId,
- final Action action )
- {
- m_actions.put( actionId, action );
- }
-
- /**
- * Removed an Action from the ActionManager
- * @param actionId the Id of the Action
- */
- protected synchronized void removeAction( final Object actionId )
- {
- m_actions.remove( actionId );
- }
-
- /**
- * Adds an ActionListener which handles a given Action
- *
- * @param actionId the Id of the Action
- * @param handler the ActionListener which handles the Action
- */
- public void addHandler( Object actionId, ActionListener handler )
- {
- final ActionDelegate delegate = getActionDelegate( actionId );
- delegate.addActionListener( handler );
- }
-
- /**
- * Removes a handler for a given Action
- *
- * @param actionId the Id of the Action
- * @param handler the ActionListener which handles the Action
- */
- protected void removeHandler( Object actionId, ActionListener handler )
- {
- final ActionDelegate delegate = getActionDelegate( actionId );
- delegate.removeActionListener( handler );
- }
-
- /**
- * Fires ActionEvent wihch will be handled by the
- * registered handlers.
- *
- * @param actionId the Id of the Action being executed
- * @param actionEvent the ActionEvent being fired
- */
- public void fireActionEvent( final Object actionId,
- final ActionEvent actionEvent )
- {
- final ActionDelegate delegate = getActionDelegate( actionId );
- delegate.fireActionEvent( actionEvent );
- }
-
- /**
- * Returns the ActionDelegate for a given Action.
- * If no delegate is found, one is created
- *
- * @param actionId the Id of the Action
- * @return the ActionDelegate
- */
- protected synchronized ActionDelegate getActionDelegate( final Object actionId )
- {
- if( actionId == null )
- {
- throw new NullPointerException( "actionId" );
- }
- ActionDelegate delegate = (ActionDelegate)m_delegates.get( actionId );
- if( delegate == null )
- {
- delegate = new ActionDelegate();
- m_delegates.put( actionId, delegate );
- }
- return delegate;
- }
-}
</pre></div>
<hr /><a name="file6" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>AbstractActionManagerFactory.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N AbstractActionManagerFactory.java
--- AbstractActionManagerFactory.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,112 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-
-/**
- * AbstractActionManagerFactory provides common functionality to
- * the factory implementations.
- *
- * @author Mauro Talevi
- */
-public abstract class AbstractActionManagerFactory
- implements ActionManagerFactory
-{
- /**
- * Creates a ActionManager from a given set of configuration parameters.
- * The configuration map contains entrys specific to the
- * concrete implementation.
- *
- * @param config the parameter map to configuration of the store
- * @return the ActionManager
- * @throws Exception if unable to create the ActionManager
- */
- public ActionManager createActionManager( final Map config )
- throws Exception
- {
- return doCreateActionManager( config );
- }
-
- protected abstract ActionManager doCreateActionManager( Map config )
- throws Exception;
-
- /**
- * Utility method to throw exception indicating input data
- * was invalid.
- *
- * @return never returns
- * @throws Exception indicating input data was invalid
- */
- protected ActionManager missingConfiguration()
- throws Exception
- {
- throw new Exception( "Invalid configuration" );
- }
-
- /**
- * A utility method to retrieve a InputStream from input map.
- * It will systematically go through the following steps to
- * attempt to locate the InputStream stopping at success.
- *
- * <ul>
- * <li>Lookup ActionManagerFactory.URL_LOCATION for
- * string defining URL location of input configuration.</li>
- * <li>Lookup java.net.URL for URL object defining URL location
- * of input configuration.</li>
- * <li>Lookup ActionManagerFactory.FILE_LOCATION for
- * string defining File location of input configuration.</li>
- * <li>Lookup java.io.File for File object defining File location
- * of input configuration.</li>
- * <li>Lookup java.io.InputStream for InputStream object.</li>
- * </ul>
- *
- * @param config the input map
- * @return the InputStream or null if no stream present
- * @throws Exception if there was a problem aquiring stream
- */
- protected InputStream getInputStream( final Map config )
- throws Exception
- {
- final String urlLocation = (String)config.get( URL_LOCATION );
- URL url = null;
- if( null != urlLocation )
- {
- url = new URL( urlLocation );
- }
- if( null == url )
- {
- url = (URL)config.get( URL.class.getName() );
- }
- if( null != url )
- {
- return url.openStream();
- }
-
- final String fileLocation = (String)config.get( FILE_LOCATION );
- File file = null;
- if( null != fileLocation )
- {
- file = new File( fileLocation );
- }
- if( null == file )
- {
- file = (File)config.get( File.class.getName() );
- }
- if( null != file )
- {
- return new FileInputStream( file );
- }
-
- return (InputStream)config.get( InputStream.class.getName() );
- }
-}
</pre></div>
<hr /><a name="file7" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionAdapter.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionAdapter.java
--- ActionAdapter.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,147 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.awt.event.ActionEvent;
-import java.net.URL;
-
-import javax.swing.AbstractAction;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.KeyStroke;
-
-import org.codehaus.spice.swingactions.metadata.ActionMetaData;
-/**
- * ActionAdapter is an adapter of the Action interface
- * which uses the ActionManager to fire ActionEvents for the given action.
- *
- * It also provides utility access methods for fields defined in Action.
- *
- * @author Mauro Talevi
- */
-public class ActionAdapter extends AbstractAction
-{
-
- /** The ActionMetaData describing this Action */
- private final ActionMetaData m_metadata;
- /** The ActionManager with which the Action is being registered */
- private final ActionManager m_manager;
-
- /**
- * Creates an ActionAdapter
- *
- * @param metadata the ActionMetaData describing this Action
- * @param manager the ActionManager with which this Action is being registered
- */
- public ActionAdapter( final ActionMetaData metadata,
- final ActionManager manager )
- {
- super();
- if ( metadata == null )
- {
- throw new NullPointerException( "metadata" );
- }
- m_metadata = metadata;
- setActionValues( metadata );
- if ( manager == null )
- {
- throw new NullPointerException( "manager" );
- }
- m_manager = manager;
- }
-
- /**
- * Returns the ActionMetaData
- */
- public ActionMetaData getMetaData()
- {
- return m_metadata;
- }
-
-
- /**
- * Adapter implementation of ActionListener, which
- * uses the ActionManager to fire the ActionEvent to the
- * registered handlers.
- */
- public void actionPerformed( final ActionEvent event )
- {
- m_manager.fireActionEvent( m_metadata.getValue( ActionMetaData.ID ), event );
- }
-
- /**
- * Sets Action values using the metadata
- * @param metadata the ActionMetaData
- */
- private void setActionValues( final ActionMetaData metadata ){
- String[] keys = metadata.getKeys();
- for ( int i = 0; i < keys.length; i++ )
- {
- final String key = keys[ i ];
- final String value = metadata.getValue( key );
- if ( key.equals( ActionMetaData.SMALL_ICON )
- || key.equals( ActionMetaData.LARGE_ICON ) )
- {
- putValue( key, createIcon( value ) );
- } else if ( key.equals( ActionMetaData.MNEMONIC_KEY ) )
- {
- putValue( key, createCharacter( value ) );
- } else if ( key.equals( ActionMetaData.ACCELERATOR_KEY ) )
- {
- putValue( key, createKeyStroke( value ) );
- } else
- {
- putValue( key, value );
- }
- }
- }
-
- /**
- * Creates Icon from value
- */
- private Icon createIcon( final String value )
- {
- if ( value == null )
- {
- return null;
- }
- final URL resource = getClass().getResource( value );
- if ( resource != null ) {
- return new ImageIcon( resource );
- }
- return null;
- }
-
- /**
- * Creates Character from value
- */
- private Character createCharacter( final String value )
- {
- if ( value == null )
- {
- return null;
- }
- if ( value.length() > 0 ){
- return new Character( value.charAt( 0 ) );
- } else {
- return null;
- }
- }
-
- /**
- * Creates KeyStroke from value
- */
- private KeyStroke createKeyStroke( final String value )
- {
- if ( value == null )
- {
- return null;
- }
- return KeyStroke.getKeyStroke( value );
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file8" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionDelegate.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionDelegate.java
--- ActionDelegate.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-
-package org.codehaus.spice.swingactions;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import javax.swing.event.EventListenerList;
-
-/**
- * ActionDelegate mantains the list of all the <code>ActionListener</code>s for
- * a given <code>Action</code> and is responsible for notifying them when the
- * action is fired.
- *
- * @author Mauro Talevi
- */
-class ActionDelegate
-{
- /** List of all the ActionListeners */
- private EventListenerList m_listeners;
-
- /**
- * Add a ActionListener to the listener list.
- * The listener is registered for all properties.
- *
- * @param listener The ActionListener to be added
- */
- public synchronized void addActionListener( final ActionListener listener )
- {
- if( m_listeners == null )
- {
- m_listeners = new EventListenerList();
- }
- m_listeners.add( ActionListener.class, listener );
- }
-
- /**
- * Remove a ActionListener from the listener list.
- * This removes a ActionListener that was registered for all actions.
- *
- * @param listener The ActionListener to be removed
- */
- public synchronized void removeActionListener( final ActionListener listener )
- {
- if( m_listeners == null )
- {
- return;
- }
- m_listeners.remove( ActionListener.class, listener );
- }
-
- /**
- * Returns the array of registers listeners
- */
- public synchronized ActionListener[] getListeners()
- {
- if( m_listeners == null )
- {
- return new ActionListener[]{};
- }
- return (ActionListener[])m_listeners.getListeners( ActionListener.class );
- }
-
- /**
- * Fire an ActionEvent to any registered listeners.
- *
- * @param event The ActionEvent
- */
- public void fireActionEvent( ActionEvent event )
- {
- final ActionListener[] targets = getListeners();
- for( int i = 0; i < targets.length; i++ )
- {
- targets[ i ].actionPerformed( event );
- }
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file9" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionManager.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionManager.java
--- ActionManager.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,64 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.NoSuchElementException;
-import javax.swing.Action;
-
-/**
- * <p>ActionManager is responsible for managing a set of Actions.
- * Each <code>Action</code> is uniquely identified by an <code>actionId</code>
- * which will tipically be <code>String</code> or a <code>Class</code>,
- * but may be any <code>Object</code> key.</p>
- *
- * @author Mauro Talevi
- */
-public interface ActionManager
-{
- /**
- * Adds an ActionListener which handles a given Action
- *
- * @param actionId the Id of the Action
- * @param handler the ActionListener which handles the Action
- */
- void addHandler( Object actionId, ActionListener handler );
-
- /**
- * Enables or disables an Action
- *
- * @param actionId the Id of the Action
- * @param enabled the boolean flag -
- * <code>true</code> if Action is enabled
- */
- void enableAction( Object actionId, boolean enabled );
-
- /**
- * Returns the Action registered with the ActionManager
- *
- * @param actionId the Id of the Action
- */
- Action getAction( Object actionId )
- throws NoSuchElementException;
-
- /**
- * Returns all the Actions registered with the
- * ActionManager
- */
- Action[] getActions();
-
- /**
- * Fires ActionEvent wihch will be handled by
- * the registered handlers.
- *
- * @param actionId the Id of the Action being executed
- * @param actionEvent the ActionEvent being fired
- */
- void fireActionEvent( Object actionId, ActionEvent actionEvent );
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file10" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionManagerFactory.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionManagerFactory.java
--- ActionManagerFactory.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.util.Map;
-
-/**
- * <p>ActionManagerFactory is a factory interface for ActionManager instances.
- * The factory also acts a configurator.
- * The ActionManager is configured via a map of parameters passed in the
- * create method. ActionManagerFactory defines the keys used to retrieve
- * the elements of the map.</p>
- *
- * @author Mauro Talevi
- */
-public interface ActionManagerFactory
-{
- /**
- * The URL_LOCATION key. Used to define the URL where the configuration
- * for ActionManager can be found.
- */
- String URL_LOCATION = "org.codehaus.spice.swingactions.configuration.url";
-
- /**
- * The FILE_LOCATION key. Used to define the FILE where the configuration
- * for ActionManager can be found.
- */
- String FILE_LOCATION = "org.codehaus.spice.swingactions.configuration.file";
-
- /**
- * Creates a ActionManager from a given set of configuration parameters.
- *
- * @param config the Map of parameters for the configuration of the store
- * @return the ActionManager
- * @throws Exception if unable to create the ActionManager
- */
- ActionManager createActionManager( Map config )
- throws Exception;
-}
</pre></div>
<hr /><a name="file11" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>Configurator.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N Configurator.java
--- Configurator.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,86 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.io.InputStream;
-import java.util.HashMap;
-
-/**
- * Configurator is a collection of utility methods to create and configure
- * ActionManager objects of different types using configuration resources.
- * Presently only XML is supported.
- *
- * @author Mauro Talevi
- */
-public class Configurator
-{
-
- /**
- * Constant used to define XML type
- */
- public static final String XML = "xml";
-
- /**
- * Create and configure a {@link ActionManager} from a specified
- * configuration resource.
- *
- * @param configuratorType the type of the configurator
- * @param resource the String encoding the path of the configuration resource
- * @return the configured ActionManager
- * @throws Exception if unable to create the ActionManager
- */
- public static ActionManager createActionManager( final String configuratorType,
- final String resource )
- throws Exception
- {
- final InitialActionManagerFactory factory = new InitialActionManagerFactory();
- final HashMap data = new HashMap();
- data.put( InitialActionManagerFactory.FACTORY, getFactoryClassName( configuratorType ) );
- data.put( ActionManagerFactory.FILE_LOCATION, resource );
- return factory.createActionManager( data );
- }
-
- /**
- * Create and configure a {@link ActionManager} from a specified
- * configuration resource.
- *
- * @param configuratorType the type of the configurator
- * @param resource the InputStream of the configuration resource
- * @return the configured ActionManager
- * @throws Exception if unable to create the ActionManager
- */
- public static ActionManager createActionManager( final String configuratorType,
- final InputStream resource )
- throws Exception
- {
- final InitialActionManagerFactory factory = new InitialActionManagerFactory();
- final HashMap data = new HashMap();
- data.put( InitialActionManagerFactory.FACTORY, getFactoryClassName( configuratorType ) );
- data.put( InputStream.class.getName(), resource );
- return factory.createActionManager( data );
- }
-
- /**
- * Get the Factory class name of the ActionManagerFactory that corresponds
- * to specified type of Logger.
- *
- * @param type the type of Configurator
- */
- private static String getFactoryClassName( final String type )
- {
- if( XML.equals( type ) )
- {
- return XMLActionManagerFactory.class.getName();
- }
- else
- {
- final String message = "Unknown type " + type;
- throw new IllegalArgumentException( message );
- }
- }
-}
</pre></div>
<hr /><a name="file12" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>InitialActionManagerFactory.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N InitialActionManagerFactory.java
--- InitialActionManagerFactory.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,143 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * InitialActionManagerFactory is used as an intial context factory to
- * to create an ActionManager when the factory type is configurable.
- *
- * @author Mauro Talevi
- * @author Peter Donald
- */
-public class InitialActionManagerFactory implements ActionManagerFactory
-{
- /**
- * The FACTORY key. Used to define the classname of the
- * configurable ActionManagerFactory.
- */
- public static final String FACTORY = "org.codehaus.spice.swingactions.factory";
-
- /**
- * The name of properties file loaded from ClassLoader. This property
- * file will be used to load default configuration settings if user failed
- * to specify them.
- */
- public static final String DEFAULT_PROPERTIES = "META-INF/spice/swingactions.properties";
-
- /**
- * Create ActionManager by first determining the correct ActionManagerFactory
- * to use and then delegating to that factory. See Class Javadocs for the
- * process of locating ActionManager.
- *
- * @param config the input configuration
- * @return the ActionManager
- * @throws Exception if unable to create the ActionManager for any reason.
- */
- public ActionManager createActionManager( final Map config )
- throws Exception
- {
- final ClassLoader classLoader = getClassLoader( config );
-
- String type = (String)config.get( FACTORY );
- Map data = config;
- if( null == type )
- {
- data = loadDefaultConfig( data, classLoader );
- type = (String)data.get( FACTORY );
- }
- final ActionManagerFactory factory =
- createActionManagerFactory( type, classLoader );
- return factory.createActionManager( data );
- }
-
- /**
- * Retrieve the classloader from data map. If no classloader is specified
- * then use ContextClassLoader. If ContextClassLoader not specified then
- * use ClassLoader that loaded this class.
- *
- * @param data the configuration data
- * @return a ClassLoader
- */
- private ClassLoader getClassLoader( final Map data )
- {
- ClassLoader loader = (ClassLoader)data.get( ClassLoader.class.getName() );
- if( null == loader )
- {
- loader = Thread.currentThread().getContextClassLoader();
- if( null == loader )
- {
- loader = InitialActionManagerFactory.class.getClassLoader();
- }
- }
- return loader;
- }
-
- /**
- * Load the default properties for ActionManagerFactory.
- *
- * @param initial the input data
- * @param classLoader the classLoader to load properties files from
- * @return the new configuration data
- * @throws Exception if unable to load properties
- */
- private Map loadDefaultConfig( final Map initial,
- final ClassLoader classLoader )
- throws Exception
- {
- final HashMap map = new HashMap();
-
- final Enumeration resources =
- classLoader.getResources( DEFAULT_PROPERTIES );
- while( resources.hasMoreElements() )
- {
- final URL url = (URL)resources.nextElement();
- final InputStream stream = url.openStream();
- final Properties properties = new Properties();
- properties.load( stream );
- map.putAll( properties );
- }
-
- map.putAll( initial );
- return map;
- }
-
- /**
- * Create a {@link ActionManagerFactory} for specified factory.
- *
- * @param type the class name of the factory to use.
- * @return the created {@link ActionManagerFactory}
- */
- private ActionManagerFactory createActionManagerFactory( final String type,
- final ClassLoader classLoader )
- {
- if( null == type )
- {
- final String message = "No ActionManagerFactory class specified.";
- throw new IllegalStateException( message );
- }
-
- try
- {
- final Class clazz = classLoader.loadClass( type );
- return (ActionManagerFactory)clazz.newInstance();
- }
- catch( final Exception e )
- {
- final String message =
- "Failed to created ActionManagerFactory " + type;
- throw new IllegalArgumentException( message );
- }
- }
-}
</pre></div>
<hr /><a name="file13" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>XMLActionManager.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N XMLActionManager.java
--- XMLActionManager.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,70 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.io.InputStream;
-
-import javax.swing.Action;
-
-import org.codehaus.spice.swingactions.metadata.ActionGroupsMetaData;
-import org.codehaus.spice.swingactions.metadata.ActionMetaData;
-import org.codehaus.spice.swingactions.metadata.ActionSetMetaData;
-import org.codehaus.spice.swingactions.reader.ConfigReader;
-
-/**
- * XMLActionManager is an implementation of <code>ActionManager</code> which
- * supports configuration via XML.
- *
- * @author Mauro Talevi
- */
-public class XMLActionManager
- extends AbstractActionManager
-{
-
- /**
- * Creates an ActionManager from an XML resource
- * @param resource the InputStream containing the XML configuration
- * @throws Exception if the configuration fails
- */
- public XMLActionManager( final InputStream resource )
- throws Exception
- {
- if ( resource == null )
- {
- throw new NullPointerException( "resource" );
- }
- final ConfigReader reader = new ConfigReader();
- reader.parse( resource );
- configureActions( reader.getActionSet() );
- configureGroups( reader.getActionGroups() );
- }
-
- /**
- * Configures ActionManager with the given Action set
- * @param actionSet the ActionSetMetaData
- */
- private void configureActions( final ActionSetMetaData actionSet )
- {
- final ActionMetaData[] actions = actionSet.getActions();
- for ( int i = 0; i < actions.length; i++ )
- {
- final Action action = new ActionAdapter( actions[ i ], this );
- addAction( actions[ i ].getValue( ActionMetaData.ID ), action );
- }
- }
-
- /**
- * Configures ActionManager with the given Action groups
- * @param actionGroups the ActionGroupsMetaData
- */
- private void configureGroups( final ActionGroupsMetaData actionGroups )
- {
- //TODO construct JFactory with actionGroups
- }
-}
-
</pre></div>
<hr /><a name="file14" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>XMLActionManagerFactory.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N XMLActionManagerFactory.java
--- XMLActionManagerFactory.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.io.InputStream;
-import java.util.Map;
-
-/**
- * XMLActionManagerFactory is an implementation of ActionManagerFactory
- * using an XML configuration resource.
- *
- * @author Mauro Talevi
- */
-public class XMLActionManagerFactory
- extends AbstractActionManagerFactory
-{
- /**
- * Creates a ActionManager from a given set of configuration parameters.
- *
- * @param config the Map of parameters for the configuration of the store
- * @return the ActionManager
- * @throws Exception if unable to create the ActionManager
- */
- protected ActionManager doCreateActionManager( final Map config )
- throws Exception
- {
- final InputStream resource = getInputStream( config );
- if( null != resource )
- {
- return new XMLActionManager( resource );
- }
- return missingConfiguration();
- }
-}
</pre></div>
<hr /><a name="file15" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions/metadata<br /></span>
<div class="fileheader" id="removed"><big><b>ActionGroupsMetaData.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionGroupsMetaData.java
--- ActionGroupsMetaData.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,100 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.metadata;
-
-/**
- * Defines the metadata of groups of actions
- *
- * @author Mauro Talevi
- */
-public class ActionGroupsMetaData
-{
-
- /** The action group ids */
- private final String[] m_groupIds;
- /** The action sets - one for each group */
- private final ActionSetMetaData[] m_actionSets;
-
- /**
- * Constructs an ActionGroupsMetaData object from the actionSets
- * @param groupIds the ids of the action groups
- * @param actionSets the action sets corresponding to the groupIds
- */
- public ActionGroupsMetaData(final String[] groupIds,
- final ActionSetMetaData[] actionSets )
- {
- if ( groupIds == null )
- {
- throw new NullPointerException( "groupIds" );
- }
- m_groupIds = groupIds;
- if ( actionSets == null )
- {
- throw new NullPointerException( "actionSets" );
- }
- m_actionSets = actionSets;
- }
-
- /**
- * Returns the group Ids
- * @return the array of Strings
- */
- public String[] getGroupIds()
- {
- return m_groupIds;
- }
-
- /**
- * Returns all the action sets
- * @return the array of ActionSetMetaData
- */
- public ActionSetMetaData[] getActionSets()
- {
- return m_actionSets;
- }
-
- /**
- * Returns the set of action for a given group
- * @param groupId the Id of the group the actions belong to
- * @return the ActionMetaData
- */
- public ActionSetMetaData getActionSet( final String groupId )
- {
- for ( int i = 0; i < m_groupIds.length; i++ )
- {
- if ( m_groupIds[ i ].equals( groupId ) )
- {
- return m_actionSets[ i ];
- }
- }
- return null;
- }
-
- /**
- * String representation
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "[ActionGroupsMetaData groups=[" );
- for ( int i = 0; i < m_groupIds.length; i++ )
- {
- sb.append( "id=" );
- sb.append( m_groupIds[ i ] );
- sb.append( ", actionSet=" );
- sb.append( m_actionSets[ i ].getActions() );
- if ( i < m_groupIds.length - 1 )
- {
- sb.append( "," );
- }
- }
- sb.append( "]" );
- sb.append( "]" );
- return sb.toString();
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file16" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions/metadata<br /></span>
<div class="fileheader" id="removed"><big><b>ActionMetaData.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionMetaData.java
--- ActionMetaData.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,132 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.metadata;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.Action;
-
-/**
- * Defines the metadata of a single action
- *
- * @author Mauro Talevi
- */
-public class ActionMetaData
-{
-
- /** The key used for storing the id the action */
- public static final String ID = "Id";
- /** The key used for storing the name the action */
- public static final String NAME = Action.NAME;
- /** The key used for storing a short description of the action */
- public static final String SHORT_DESCRIPTION = Action.SHORT_DESCRIPTION;
- /** The key used for storing a long description of the action */
- public static final String LONG_DESCRIPTION = Action.LONG_DESCRIPTION;
- /** The key used for storing a small icon for the action */
- public static final String SMALL_ICON = Action.SMALL_ICON;
- /** The key used for storing a large icon for the action */
- public static final String LARGE_ICON = "LargeIcon";
- /** The key used for storing the command key the action */
- public static final String ACTION_COMMAND_KEY = Action.ACTION_COMMAND_KEY;
- /** The key used for storing the accelerator key for the action */
- public static final String ACCELERATOR_KEY = Action.ACCELERATOR_KEY;
- /** The key used for storing the mnemonic key for the action */
- public static final String MNEMONIC_KEY = Action.MNEMONIC_KEY;
-
- /** The list of mandatory keys */
- private static final String[] MANDATORY_KEYS = new String[] { ID, NAME };
-
- /** The map holding the metadata */
- protected final Map m_data;
-
- /**
- * Constructs ActionMetaData object
- */
- public ActionMetaData( final Map data )
- {
- if ( data == null )
- {
- throw new NullPointerException( "data" );
- }
- m_data = data;
- checkData();
- }
-
- /**
- * Returns a data object for a given key
- * @return the metadata Object indexed by the key
- */
- public String[] getKeys()
- {
- final Set keys = m_data.keySet();
- return (String[])keys.toArray(new String[keys.size()]);
- }
-
- /**
- * Returns a data value for a given key
- * @return the value String
- */
- public String getValue( String key )
- {
- return (String)m_data.get( key );
- }
-
- /**
- * Returns the array of mandatory keys
- */
- protected String[] getMandatoryKeys()
- {
- return MANDATORY_KEYS;
- }
-
- /**
- * Checks data for null entries in mandatory entries
- * @throws NullPointerException
- */
- private void checkData()
- {
- final String[] mandatoryKeys = getMandatoryKeys();
- for ( int i = 0; i < mandatoryKeys.length; i++ )
- {
- if ( m_data.get( mandatoryKeys[i] ) == null )
- {
- throw new NullPointerException( mandatoryKeys[i] );
- }
-
- }
- }
-
- /**
- * String representation
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "[ActionMetaData id=" );
- sb.append( getValue( ID ) );
- sb.append( ", name=" );
- sb.append( getValue( NAME ) );
- sb.append( ", shortDescription=" );
- sb.append( getValue( SHORT_DESCRIPTION ) );
- sb.append( ", longDescription=" );
- sb.append( getValue( LONG_DESCRIPTION ) );
- sb.append( ", smallIcon=" );
- sb.append( getValue( SMALL_ICON ) );
- sb.append( ", largeIcon=" );
- sb.append( getValue( LARGE_ICON ) );
- sb.append( ", actionCommandKey=" );
- sb.append( getValue( ACTION_COMMAND_KEY ) );
- sb.append( ", acceleratorKey=" );
- sb.append( getValue( ACCELERATOR_KEY ) );
- sb.append( ", mnemonicKey=" );
- sb.append( getValue( MNEMONIC_KEY ) );
- sb.append( "]" );
- return sb.toString();
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file17" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions/metadata<br /></span>
<div class="fileheader" id="removed"><big><b>ActionSetMetaData.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionSetMetaData.java
--- ActionSetMetaData.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.metadata;
-
-
-/**
- * Defines the metadata of a set of actions
- *
- * @author Mauro Talevi
- */
-public class ActionSetMetaData
-{
-
- /** The actions */
- private final ActionMetaData[] m_actions;
-
- /**
- * Constructs an ActionSetMetaData object from the actions
- * @param actions the array of ActionsMetaData
- */
- public ActionSetMetaData( final ActionMetaData[] actions )
- {
- if ( actions == null )
- {
- throw new NullPointerException( "actions" );
- }
- m_actions = actions;
- }
-
- /**
- * Returns the actions in this set
- * @return the array of ActionMetaData
- */
- public ActionMetaData[] getActions()
- {
- return m_actions;
- }
-
- /**
- * Returns an Action by the Id data value for a given key
- * @return the ActionMetaData
- */
- public ActionMetaData getAction( String id )
- {
- for ( int i = 0; i < m_actions.length; i++ )
- {
- final ActionMetaData action = m_actions[ i ];
- if ( action.getValue( ActionMetaData.ID ).equals( id ))
- {
- return action;
- }
- }
- return null;
- }
-
- /**
- * String representation
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "[ActionSetMetaData ids=[" );
- for ( int i = 0; i < m_actions.length; i++ )
- {
- sb.append( m_actions[ i ].getValue( ActionMetaData.ID ) );
- if ( i < m_actions.length - 1 )
- {
- sb.append( "," );
- }
- }
- sb.append( "]" );
- sb.append( "]" );
- return sb.toString();
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file18" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions/metadata<br /></span>
<div class="fileheader" id="removed"><big><b>GroupActionMetaData.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N GroupActionMetaData.java
--- GroupActionMetaData.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,81 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.metadata;
-
-import java.util.Map;
-
-/**
- * Defines the metadata of a group action, ie an action which
- * is displayed as part of a group, such as in menus, toolbars, etc.
- * It extends ActionMetaData as some of the display data of the action
- * may be overridden when part of the group.
- * Only the id of the action may not be changed.
- *
- * @author Mauro Talevi
- */
-public class GroupActionMetaData extends ActionMetaData
-{
-
- /** The key used for storing the id the group of the action */
- public static final String GROUP_ID = "groupId";
-
- /** The key used for storing the order in the group */
- public static final String GROUP_ORDER = "groupOrder";
-
-
- /** The list of mandatory keys */
- private static final String[] MANDATORY_KEYS = new String[] { GROUP_ID, ID };
-
- /**
- * Constructs GroupActionMetaData object
- */
- public GroupActionMetaData( final Map data )
- {
- super( data );
- }
-
- /**
- * Returns the array of mandatory keys
- */
- protected String[] getMandatoryKeys()
- {
- return MANDATORY_KEYS;
- }
-
- /**
- * String representation
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "[GroupActionMetaData groupId=" );
- sb.append( getValue( GROUP_ID ) );
- sb.append( ", id=" );
- sb.append( getValue( ID ) );
- sb.append( ", groupOrder=" );
- sb.append( getValue( GROUP_ORDER ) );
- sb.append( ", name=" );
- sb.append( getValue( NAME ) );
- sb.append( ", shortDescription=" );
- sb.append( getValue( SHORT_DESCRIPTION ) );
- sb.append( ", longDescription=" );
- sb.append( getValue( LONG_DESCRIPTION ) );
- sb.append( ", smallIcon=" );
- sb.append( getValue( SMALL_ICON ) );
- sb.append( ", largeIcon=" );
- sb.append( getValue( LARGE_ICON ) );
- sb.append( ", actionCommandKey=" );
- sb.append( getValue( ACTION_COMMAND_KEY ) );
- sb.append( ", acceleratorKey=" );
- sb.append( getValue( ACCELERATOR_KEY ) );
- sb.append( ", mnemonicKey=" );
- sb.append( getValue( MNEMONIC_KEY ) );
- sb.append( "]" );
- return sb.toString();
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file19" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions/metadata<br /></span>
<div class="fileheader" id="removed"><big><b>SeparatorActionMetaData.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N SeparatorActionMetaData.java
--- SeparatorActionMetaData.java 24 Apr 2004 16:40:03 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.metadata;
-
-import java.util.Map;
-
-/**
- * Defines the metadata of a separator element in the action group
- *
- * @author Mauro Talevi
- */
-public class SeparatorActionMetaData extends ActionMetaData
-{
-
- /** The bound value of the separator for the action id */
- public static final String SEPARATOR = "separator";
-
- /** The key used for storing the id the group of the action */
- public static final String GROUP_ID = "groupId";
-
- /** The list of mandatory keys */
- private static final String[] MANDATORY_KEYS = new String[] { GROUP_ID };
-
- /**
- * Constructs GroupActionMetaData object
- */
- public SeparatorActionMetaData( final Map data )
- {
- super( data );
- }
-
- /**
- * Returns the array of mandatory keys
- */
- protected String[] getMandatoryKeys()
- {
- return MANDATORY_KEYS;
- }
-
- /**
- * String representation
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "[SeparatorActionMetaData groupId=" );
- sb.append( getValue( GROUP_ID ) );
- sb.append( "]" );
- return sb.toString();
- }
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file20" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/java/org/codehaus/spice/swingactions/reader<br /></span>
<div class="fileheader" id="removed"><big><b>ConfigReader.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ConfigReader.java
--- ConfigReader.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,163 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.reader;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.codehaus.spice.swingactions.metadata.ActionGroupsMetaData;
-import org.codehaus.spice.swingactions.metadata.ActionMetaData;
-import org.codehaus.spice.swingactions.metadata.ActionSetMetaData;
-import org.codehaus.spice.swingactions.metadata.GroupActionMetaData;
-import org.codehaus.spice.swingactions.metadata.SeparatorActionMetaData;
-
-/**
- * ConfigReader is a helper class used by the digester to store
- * the configuration objects as they are created when parsing the XML file.
- *
- * @author Mauro Talevi
- */
-public class ConfigReader {
-
- private Map m_actions;
- private Map m_groups;
- private String m_currentGroupId;
-
- /**
- * Creates a ConfigReader
- */
- public ConfigReader() {
- m_actions = new HashMap();
- m_groups = new HashMap();
- }
-
- /**
- * Adds an Action metadata
- * @param metadata
- */
- public void addActionMetaData( final ActionMetaData metadata )
- {
- m_actions.put( metadata.getValue( ActionMetaData.ID), metadata );
- }
-
- /**
- * Adds a GroupAction metadata
- * @param metadata
- */
- public void addGroupActionMetaData( final GroupActionMetaData metadata )
- {
- final String groupId = metadata.getValue( GroupActionMetaData.GROUP_ID );
- Set groupActions = (Set)m_groups.get( groupId );
- if ( groupActions == null )
- {
- groupActions = new HashSet();
- m_groups.put( groupId, groupActions );
- }
- groupActions.add( metadata );
- }
-
- /**
- * Adds a SeparatorAction metadata
- * @param metadata
- */
- public void addSeparatorActionMetaData( final SeparatorActionMetaData metadata )
- {
- final String groupId = metadata.getValue( SeparatorActionMetaData.GROUP_ID );
- Set groupActions = (Set)m_groups.get( groupId );
- if ( groupActions == null )
- {
- groupActions = new HashSet();
- m_groups.put( groupId, groupActions );
- }
- groupActions.add( metadata );
- }
-
- /**
- * Returns the set of actions parsed
- * @return the ActionSetMetaData
- */
- public ActionSetMetaData getActionSet()
- {
- final ActionMetaData[] actions =
- (ActionMetaData[])m_actions.values().toArray(new ActionMetaData[ m_actions.size() ] );
- return new ActionSetMetaData( actions );
- }
-
- /**
- * Returns the groups of actions parsed
- * @return the ActionGroupsMetaData
- */
- public ActionGroupsMetaData getActionGroups()
- {
- final String[] groupIds = getActionGroupIds();
- final ActionSetMetaData[] actionSets = new ActionSetMetaData[ groupIds.length ];
- for ( int i = 0; i < groupIds.length; i++ )
- {
- actionSets[ i ] = getActionGroup( groupIds[ i ] );
- }
- return new ActionGroupsMetaData( groupIds, actionSets );
- }
-
- /**
- * Returns the action group Ids
- * @return the array of ids of groups
- */
- private String[] getActionGroupIds()
- {
- final Set groupKeys = m_groups.keySet();
- return (String[])groupKeys.toArray(new String[ groupKeys.size() ] );
- }
-
- /**
- * Returns the set of actions for a given group
- * @param groupId the Id of the group
- * @return the ActionSetMetaData
- */
- private ActionSetMetaData getActionGroup( final String groupId )
- {
- final Set groupActions = (Set)m_groups.get( groupId );
- final ActionMetaData[] actions =
- (ActionMetaData[])groupActions.toArray(new ActionMetaData[ groupActions.size() ] );
- return new ActionSetMetaData( actions );
- }
-
-
- /**
- * Returns the current group Id
- * @return the Id of the group being parsed
- */
- public String getCurrentGroupId()
- {
- return m_currentGroupId;
- }
-
- /**
- * Sets the current group Id
- * @param groupId the Id of the group being parsed
- */
- public void setCurrentGroupId( final String groupId )
- {
- m_currentGroupId = groupId;
- }
-
- /**
- * Parses configuration resource adding content to this ConfigReader
- * @param resource the InputStream configuration
- * @throws Exception if parse fails
- */
- public void parse( final InputStream resource) throws Exception {
- throw new Exception("Not yet implemented");
- }
-
-
-
-
-}
</pre></div>
<hr /><a name="file21" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/META-INF/spice<br /></span>
<div class="fileheader" id="removed"><big><b>swingactions.properties</b></big> <small id="info">removed after 1.3</small></div>
<pre class="diff"><small id="info">diff -N swingactions.properties
--- swingactions.properties 24 Apr 2004 16:40:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
</small></pre><pre class="diff" id="removed">-org.codehaus.spice.swingactions.factory=org.codehaus.spice.swingactions.XMLActionManagerFactory
-org.codehaus.spice.swingactions.configuration.file=org/codehaus/spice/swingactions/actions.xml
-
</pre></div>
<hr /><a name="file22" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>AbstractTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N AbstractTestCase.java
--- AbstractTestCase.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,115 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-
-import org.codehaus.spice.swingactions.ActionManager;
-import org.codehaus.spice.swingactions.ActionManagerFactory;
-
-import junit.framework.TestCase;
-
-/**
- * AbstactTestCase
- *
- * @author Mauro Talevi
- */
-public class AbstractTestCase
- extends TestCase
-{
- protected static final String MESSAGE = "Testing Action";
- protected static final String MESSAGE2 = "Testing Action 2";
-
- private File actionsDir;
-
- public AbstractTestCase( final String name )
- {
- super( name );
- }
-
- protected void setUp() throws Exception
- {
- actionsDir = new File( "actions/" );
- actionsDir.mkdirs();
- }
-
- protected final InputStream getResource( final String name )
- {
- return getClass().getResourceAsStream( name );
- }
-
- protected void runInvalidInputData( final ActionManagerFactory factory )
- {
- try
- {
- factory.createActionManager( new HashMap() );
- fail( "Expected createActionManager to fail with invalid input data" );
- }
- catch( Exception e )
- {
- }
- }
-
- protected void runStreamBasedFactoryTest( final String inputFile,
- final ActionManagerFactory factory,
- final String outputFile,
- final HashMap inputData )
- throws Exception
- {
- //URL Should in file: format
- final URL url = getClass().getResource( inputFile );
- assertEquals( "URL is of file type", url.getProtocol(), "file" );
-
- final HashMap config = new HashMap();
- config.put( ActionManagerFactory.URL_LOCATION,
- url.toExternalForm() );
- config.putAll( inputData );
- runFactoryTest( factory,
- config,
- outputFile );
- final HashMap config2 = new HashMap();
- config2.put( URL.class.getName(), url );
- config2.putAll( inputData );
- runFactoryTest( factory,
- config2,
- outputFile );
- final String filename = url.toExternalForm().substring( 5 );
- final HashMap config3 = new HashMap();
- config3.put( ActionManagerFactory.FILE_LOCATION, filename );
- config3.putAll( inputData );
- runFactoryTest( factory,
- config3,
- outputFile );
- final HashMap config4 = new HashMap();
- config4.put( File.class.getName(), new File( filename ) );
- config4.putAll( inputData );
- runFactoryTest( factory,
- config4,
- outputFile );
- final HashMap config5 = new HashMap();
- config5.put( InputStream.class.getName(),
- new FileInputStream( filename ) );
- config5.putAll( inputData );
- runFactoryTest( factory,
- config5,
- outputFile );
- }
-
- protected void runFactoryTest( final ActionManagerFactory factory, final HashMap config, final String filename ) throws Exception
- {
- final ActionManager manager = factory.createActionManager( config );
- }
-
- protected void runManagerTest( final ActionManager manager )
- {
- }
-}
</pre></div>
<hr /><a name="file23" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionManagerFactoryTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionManagerFactoryTestCase.java
--- ActionManagerFactoryTestCase.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,124 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.util.HashMap;
-
-import org.codehaus.spice.swingactions.ActionManager;
-import org.codehaus.spice.swingactions.InitialActionManagerFactory;
-import org.codehaus.spice.swingactions.XMLActionManagerFactory;
-
-/**
- * Test case for ActionManagerFactory
- *
- * @author Mauro Talevi
- * @author Peter Donald
- */
-public class ActionManagerFactoryTestCase
- extends AbstractTestCase
-{
- public ActionManagerFactoryTestCase( final String name )
- {
- super( name );
- }
-
- // InitialActionManagerFactory tests
- public void testInitialActionManagerFactoryFromConfigurerClassLoader()
- throws Exception
- {
- Thread.currentThread().setContextClassLoader( null );
- final HashMap config = new HashMap();
- runFactoryTest( new InitialActionManagerFactory(),
- config,
- "xml" );
- }
-
- public void testInitialActionManagerFactoryUsingDefaults()
- throws Exception
- {
- final HashMap config = new HashMap();
- config.put( ClassLoader.class.getName(),
- ClassLoader.getSystemClassLoader().getParent() );
- final InitialActionManagerFactory factory = new InitialActionManagerFactory();
- try
- {
- factory.createActionManager( config );
- fail( "Expected to not be able to create ActionManagerFactory as no type was specified or on ClassPath" );
- }
- catch( final Exception e )
- {
- }
- }
-
- public void testInitialActionManagerFactoryUsingSpecifiedType()
- throws Exception
- {
- final HashMap config = new HashMap();
- config.put( InitialActionManagerFactory.FACTORY,
- SimpleActionManagerFactory.class.getName() );
- final InitialActionManagerFactory factory = new InitialActionManagerFactory();
- final ActionManager manager = factory.createActionManager( config );
- runManagerTest( manager );
- }
-
- public void testInitialActionManagerFactoryWithInvalidType()
- throws Exception
- {
- final HashMap config = new HashMap();
- config.put( InitialActionManagerFactory.FACTORY, "Blah" );
- final InitialActionManagerFactory factory = new InitialActionManagerFactory();
- try
- {
- factory.createActionManager( config );
- fail( "Expected exception as invalid type specified" );
- }
- catch( final Exception e )
- {
- }
- }
-
- public void testInitialActionManagerFactoryFromSpecifiedClassLoader()
- throws Exception
- {
- Thread.currentThread().setContextClassLoader( null );
- final HashMap config = new HashMap();
- config.put( ClassLoader.class.getName(),
- InitialActionManagerFactory.class.getClassLoader() );
- runFactoryTest( new InitialActionManagerFactory(),
- config,
- "xml" );
- }
-
- public void testInitialActionManagerFactoryFromContextClassLoader()
- throws Exception
- {
- Thread.currentThread().setContextClassLoader( InitialActionManagerFactory.class.getClassLoader() );
- final HashMap config = new HashMap();
- runFactoryTest( new InitialActionManagerFactory(),
- config,
- "xml" );
- }
-
-
- // XMLActionManagerFactory tests
- public void testXMLActionManagerFactoryInvalidInput()
- throws Exception
- {
- runInvalidInputData( new XMLActionManagerFactory() );
- }
-
- public void testXMLActionManagerFactoryWithStreams()
- throws Exception
- {
- runStreamBasedFactoryTest( "actions.xml",
- new SimpleActionManagerFactory(),
- "xml",
- new HashMap() );
- }
-
-}
</pre></div>
<hr /><a name="file24" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionManagerTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionManagerTestCase.java
--- ActionManagerTestCase.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,58 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import org.codehaus.spice.swingactions.ActionManager;
-import org.codehaus.spice.swingactions.XMLActionManager;
-
-
-/**
- * Test case for ActionManager
- *
- * @author Mauro Talevi
- */
-public class ActionManagerTestCase
- extends AbstractTestCase
-{
-
- public ActionManagerTestCase( final String name )
- {
- super( name );
- }
-
-
-
- public void testXMLConfiguration()
- throws Exception
- {
- final ActionManager manager =
- new XMLActionManager( getResource( "actions.xml" ) );
- //runActionTest( "xml", manager );
- }
-
- public void testNullConfiguration()
- throws Exception
- {
- try
- {
- final ActionManager manager =
- new XMLActionManager( null );
- fail( "Expected to get an exception as resource is null." );
- }
- catch( final Exception npe )
- {
- assertEquals( "NPE message",
- "resource",
- npe.getMessage() );
- }
- }
-
-
-
-
-}
</pre></div>
<hr /><a name="file25" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ActionTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ActionTestCase.java
--- ActionTestCase.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,237 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.awt.event.ActionEvent;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.KeyStroke;
-
-import org.codehaus.spice.swingactions.ActionAdapter;
-import org.codehaus.spice.swingactions.ActionManager;
-import org.codehaus.spice.swingactions.metadata.ActionMetaData;
-
-
-/**
- * ActionTestCase
- *
- * @author Mauro Talevi
- */
-public class ActionTestCase
- extends AbstractTestCase
-{
-
- private ActionManager m_manager;
- public ActionTestCase( final String name )
- {
- super( name );
- }
-
- protected void setUp() throws Exception
- {
- m_manager = new SimpleActionManager();
- }
-
- public void testNullMetaData()
- throws Exception
- {
- try
- {
- new ActionAdapter( null, m_manager );
- fail( "Expected to fail due to null metadata" );
- }
- catch( final NullPointerException npe )
- {
- assertEquals( "NPE message",
- "metadata",
- npe.getMessage() );
- }
- }
-
- public void testNullManager()
- throws Exception
- {
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- try
- {
- new ActionAdapter( metadata, null );
- fail( "Expected to fail due to null manager" );
- }
- catch( final NullPointerException npe )
- {
- assertEquals( "NPE message",
- "manager",
- npe.getMessage() );
- }
- }
-
- public void testGetMetaData(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- assertEquals( "Action metadata ", action.getMetaData().toString(), metadata.toString() );
- }
-
- public void testMinimalAction(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- assertEquals( "Action id ", (String)action.getValue( ActionMetaData.ID ), "id" );
- assertEquals( "Action name ", (String)action.getValue( ActionMetaData.NAME ), "name" );
- }
-
- public void testActionWithNullEntries(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SHORT_DESCRIPTION, null );
- data.put( ActionMetaData.LONG_DESCRIPTION, null );
- data.put( ActionMetaData.SMALL_ICON, null );
- data.put( ActionMetaData.LARGE_ICON, null );
- data.put( ActionMetaData.ACCELERATOR_KEY, null );
- data.put( ActionMetaData.MNEMONIC_KEY, null );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- assertNull( "Action shortDescription ", action.getValue( ActionMetaData.SHORT_DESCRIPTION ) );
- assertNull( "Action longDescription ", action.getValue( ActionMetaData.LONG_DESCRIPTION ) );
- assertNull( "Action smallIcon ", action.getValue( ActionMetaData.SMALL_ICON ) );
- assertNull( "Action largeIcon ", action.getValue( ActionMetaData.LARGE_ICON ) );
- assertNull( "Action accelerator ", action.getValue( ActionMetaData.ACCELERATOR_KEY ) );
- assertNull( "Action mnemonic ", action.getValue( ActionMetaData.MNEMONIC_KEY ) );
- }
-
- public void testActionWithDescription(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SHORT_DESCRIPTION, "short description" );
- data.put( ActionMetaData.LONG_DESCRIPTION, "long description" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- assertEquals( "Action shortDescription ", (String)action.getValue( ActionMetaData.SHORT_DESCRIPTION ),
- "short description" );
- assertEquals( "Action longDescription ", (String)action.getValue( ActionMetaData.LONG_DESCRIPTION ),
- "long description" );
- }
-
- public void testActionWithIcon(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SMALL_ICON, "/org/codehaus/spice/swingactions/Bean16.gif" );
- data.put( ActionMetaData.LARGE_ICON, "/org/codehaus/spice/swingactions/Bean24.gif" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- final Icon smallIcon = (Icon)action.getValue( ActionMetaData.SMALL_ICON );
- assertEquals( "Action smallIcon ", smallIcon.toString(),
- getIcon( "/org/codehaus/spice/swingactions/Bean16.gif" ).toString() );
- final Icon largeIcon = (Icon)action.getValue( ActionMetaData.LARGE_ICON );
- assertEquals( "Action largeIcon ", largeIcon.toString(),
- getIcon( "/org/codehaus/spice/swingactions/Bean24.gif" ).toString() );
- }
-
- public void testActionWithInvalidIcon(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SMALL_ICON, "/path/to/inexsistent/icon16.gif" );
- data.put( ActionMetaData.LARGE_ICON, "/path/to/inexsistent/icon24.gif" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- assertNull( "Action smallIcon ", action.getValue( ActionMetaData.SMALL_ICON ) );
- assertNull( "Action largeIcon ", action.getValue( ActionMetaData.LARGE_ICON ) );
- }
-
- public void testActionWithAccelerator(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.ACCELERATOR_KEY, "control A" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- final KeyStroke keyStroke = (KeyStroke)action.getValue( ActionMetaData.ACCELERATOR_KEY );
- assertEquals( "Action accelerator ", keyStroke.toString(),
- KeyStroke.getKeyStroke( "control A" ).toString() );
- }
-
- public void testActionWithInvalidAccelerator(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.ACCELERATOR_KEY, "wrong A" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- assertNull( "Action accelerator ", action.getValue( ActionMetaData.ACCELERATOR_KEY ) );
- }
-
- public void testActionWithMnemonic(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.MNEMONIC_KEY, "A" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- final Character mnemonic = (Character)action.getValue( ActionMetaData.MNEMONIC_KEY );
- assertEquals( "Action mnemonic ", mnemonic.toString(),
- new Character( 'A' ).toString() );
- }
-
- public void testActionWithInvalidMnemonic(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.MNEMONIC_KEY, "" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- final Character mnemonic = (Character)action.getValue( ActionMetaData.MNEMONIC_KEY );
- assertNull( "Action mnemonic ", action.getValue( ActionMetaData.MNEMONIC_KEY ) );
- }
-
- public void testActionPerformed(){
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
-
- final ActionMetaData metadata = new ActionMetaData( data );
- final ActionAdapter action = new ActionAdapter( metadata, m_manager );
- action.actionPerformed( new ActionEvent( this, ActionEvent.ACTION_PERFORMED, "test action") );
- assertTrue( "actionPerformed", true );
- }
-
- private Icon getIcon(final String path)
- {
- final URL resource = getClass().getResource( path );
- if (resource != null)
- {
- return new ImageIcon(resource);
- }
- return null;
- }
-}
</pre></div>
<hr /><a name="file28" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>ConfiguratorTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ConfiguratorTestCase.java
--- ConfiguratorTestCase.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,50 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import org.codehaus.spice.swingactions.Configurator;
-
-
-/**
- * Test case for Configurator
- *
- * @author Mauro Talevi
- * @author Peter Donald
- */
-public class ConfiguratorTestCase
- extends AbstractTestCase
-{
- public ConfiguratorTestCase( final String name )
- {
- super( name );
- }
-
- public void testInvalidConfiguratorType()
- throws Exception
- {
- try
- {
- Configurator.createActionManager( "blah", "org/codehaus/spice/swingactions/actions.xml" );
- fail( "Expected exception as invalid type specified" );
- }
- catch( final Exception e )
- {
- }
- }
-
- public void testXMLConfigurator()
- throws Exception
- {
- runManagerTest( Configurator.createActionManager( Configurator.XML, "org/codehaus/spice/swingactions/actions.xml" ) );
- runManagerTest( Configurator.createActionManager( Configurator.XML, getResource( "actions.xml" ) ) );
- }
-
-
-
-
-}
</pre></div>
<hr /><a name="file29" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>SimpleActionManager.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N SimpleActionManager.java
--- SimpleActionManager.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import org.codehaus.spice.swingactions.AbstractActionManager;
-
-/**
- * SimpleActionManager is an implementation of <code>ActionManager</code> which
- * supports no configuration
- *
- * @author Mauro Talevi
- */
-public class SimpleActionManager
- extends AbstractActionManager
-{
-
- public SimpleActionManager( )
- {
- }
-
-}
</pre></div>
<hr /><a name="file30" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>SimpleActionManagerFactory.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N SimpleActionManagerFactory.java
--- SimpleActionManagerFactory.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions;
-
-import java.util.Map;
-
-import org.codehaus.spice.swingactions.AbstractActionManagerFactory;
-import org.codehaus.spice.swingactions.ActionManager;
-
-/**
- * SimpleActionManagerFactory is an implementation of ActionManagerFactory
- * without using any configuration resource.
- *
- * @author Mauro Talevi
- */
-public class SimpleActionManagerFactory
- extends AbstractActionManagerFactory
-{
- /**
- * Creates a ActionManager from a given set of configuration parameters.
- *
- * @param config the Map of parameters for the configuration of the store
- * @return the ActionManager
- * @throws Exception if unable to create the ActionManager
- */
- protected ActionManager doCreateActionManager( final Map config )
- throws Exception
- {
- return new SimpleActionManager();
- }
-}
</pre></div>
<hr /><a name="file31" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions<br /></span>
<div class="fileheader" id="removed"><big><b>actions.xml</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N actions.xml
--- actions.xml 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!--
- This is the SwingActions test configuration file
--->
-
-<swingactions>
-
- <!-- Action set -->
- <action-set>
- <action id="action-1"
- name="Action 1"
- shortDescription="Action 1 Short Desc"
- longDescription="Action 1 Long Desc"
- smallIcon="/path/to/icon/action1-small.gif"
- largeIcon="/path/to/icon/action1-large.gif"
- commandKey=""
- mnemonicKey="'1'"
- acceleratorKey="CTRL-1"/>
- <action id="action-2"
- name="Action 2"
- shortDescription="Action 2 Short Desc"
- longDescription="Action 2 Long Desc"
- smallIcon="/path/to/icon/action2-small.gif"
- largeIcon="/path/to/icon/action2-large.gif"
- commandKey=""
- mnemonicKey="'2'"
- acceleratorKey="CTRL-2"/>
- </action-set>
-
-</swingactions>
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file32" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions/metadata<br /></span>
<div class="fileheader" id="removed"><big><b>MetaDataTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N MetaDataTestCase.java
--- MetaDataTestCase.java 24 Apr 2004 16:40:05 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,191 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.metadata;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.codehaus.spice.swingactions.metadata.ActionMetaData;
-import org.codehaus.spice.swingactions.metadata.ActionSetMetaData;
-
-import junit.framework.TestCase;
-
-/**
- * TestCase for MetaData
- *
- * @author Mauro Talevi
- */
-public class MetaDataTestCase
- extends TestCase
-{
- public MetaDataTestCase( final String name )
- {
- super( name );
- }
-
- public void testNullDataInAction()
- throws Exception
- {
- try
- {
- new ActionMetaData( null );
- fail( "Expected to fail due to null data" );
- }
- catch( final NullPointerException npe )
- {
- assertEquals( "NPE message",
- "data",
- npe.getMessage() );
- }
- }
-
- public void testNullActionId()
- throws Exception
- {
- try
- {
- final Map data = new HashMap();
- new ActionMetaData( data );
- fail( "Expected to fail due to null Action Id" );
- }
- catch( final NullPointerException npe )
- {
- assertEquals( "NPE message",
- "Id",
- npe.getMessage() );
- }
- }
-
- public void testNullActionName()
- throws Exception
- {
- try
- {
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- new ActionMetaData( data );
- fail( "Expected to fail due to null Action Name" );
- }
- catch( final NullPointerException npe )
- {
- assertEquals( "NPE message",
- "Name",
- npe.getMessage() );
- }
- }
-
- public void testMandatoryActionKeys()
- throws Exception
- {
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- ActionMetaData action = new ActionMetaData( data );
- assertEquals( "ActionMetaData id", action.getValue( ActionMetaData.ID), "id" );
- assertEquals( "ActionMetaData name", action.getValue( ActionMetaData.NAME), "name" );
- }
-
- public void testNonMandatoryActionKeys()
- throws Exception
- {
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SHORT_DESCRIPTION, "shortDescription" );
- data.put( ActionMetaData.LONG_DESCRIPTION, null );
- ActionMetaData action = new ActionMetaData( data );
- assertEquals( "ActionMetaData shortDescription", action.getValue( ActionMetaData.SHORT_DESCRIPTION ), "shortDescription" );
- assertNull( "ActionMetaData longDescription", action.getValue( ActionMetaData.LONG_DESCRIPTION ) );
- assertNull( "ActionMetaData mnemonicKey", action.getValue( ActionMetaData.MNEMONIC_KEY ) );
- }
-
- public void testGetActionKeys()
- throws Exception
- {
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SHORT_DESCRIPTION, "shortDescription" );
- ActionMetaData action = new ActionMetaData( data );
- assertEquals( "ActionMetaData keys", action.getKeys().length, 3 );
- }
-
- public void testActionToString()
- throws Exception
- {
- final Map data = new HashMap();
- data.put( ActionMetaData.ID, "id" );
- data.put( ActionMetaData.NAME, "name" );
- data.put( ActionMetaData.SHORT_DESCRIPTION, "shortDescription" );
- ActionMetaData action = new ActionMetaData( data );
- assertEquals( "ActionMetaData.toString()", action.toString(), "[ActionMetaData id=id, name=name, shortDescription=shortDescription, longDescription=null, smallIcon=null, largeIcon=null, actionCommandKey=null, acceleratorKey=null, mnemonicKey=null]" );
- data.put( ActionMetaData.SMALL_ICON, "/path/to/icon" );
- data.put( ActionMetaData.MNEMONIC_KEY, "'M'" );
- action = new ActionMetaData( data );
- assertEquals( "ActionMetaData.toString()", action.toString(), "[ActionMetaData id=id, name=name, shortDescription=shortDescription, longDescription=null, smallIcon=/path/to/icon, largeIcon=null, actionCommandKey=null, acceleratorKey=null, mnemonicKey='M']" );
- }
-
-
- public void testNullActionSet()
- throws Exception
- {
- try
- {
- new ActionSetMetaData( null );
- fail( "Expected to fail due to null ActionSet" );
- }
- catch( final NullPointerException npe )
- {
- assertEquals( "NPE message",
- "actions",
- npe.getMessage() );
- }
- }
-
- public void testGetActionsFromSet()
- throws Exception
- {
- final ActionSetMetaData actionSet = new ActionSetMetaData( createTwoActions() );
- assertEquals( "Found 2 actions", actionSet.getActions().length, 2 );
- assertEquals( "Action ids", actionSet.toString(), "[ActionSetMetaData ids=[id-1,id-2]]" );
- final ActionMetaData action1 = actionSet.getAction( "id-1" );
- assertEquals( "Action 1 id", action1.getValue( ActionMetaData.ID ), "id-1" );
- final ActionMetaData action2 = actionSet.getAction( "id-2" );
- assertEquals( "Action 2 id", action2.getValue( ActionMetaData.ID ), "id-2" );
- }
-
- public void testActionNotFoundInSet()
- throws Exception
- {
- final ActionSetMetaData actionSet = new ActionSetMetaData( createTwoActions() );
- assertNull( "Action not found", actionSet.getAction( "another-id" ) );
- assertNull( "Action key null", actionSet.getAction( null ) );
- }
-
- public void testEmptyActionSet()
- throws Exception
- {
- final ActionSetMetaData actionSet = new ActionSetMetaData( new ActionMetaData[ 0 ] );
- assertNull( "Action not found", actionSet.getAction( "any-id" ) );
- }
-
-
- private ActionMetaData[] createTwoActions()
- {
- final Map data1 = new HashMap();
- data1.put( ActionMetaData.ID, "id-1" );
- data1.put( ActionMetaData.NAME, "name-1" );
- ActionMetaData action1 = new ActionMetaData( data1 );
- final Map data2 = new HashMap();
- data2.put( ActionMetaData.ID, "id-2" );
- data2.put( ActionMetaData.NAME, "name-2" );
- ActionMetaData action2 = new ActionMetaData( data2 );
- return new ActionMetaData[]{ action1, action2 };
- }
-
-}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file33" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions/reader<br /></span>
<div class="fileheader" id="removed"><big><b>ConfigReaderTestCase.java</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N ConfigReaderTestCase.java
--- ConfigReaderTestCase.java 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,108 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The Spice Group. All rights reserved.
- *
- * This software is published under the terms of the Spice
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.codehaus.spice.swingactions.reader;
-
-
-import java.io.InputStream;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.codehaus.spice.swingactions.metadata.ActionGroupsMetaData;
-import org.codehaus.spice.swingactions.metadata.ActionSetMetaData;
-import org.codehaus.spice.swingactions.reader.ConfigReader;
-
-/**
- * Unit tests ConfigReader
- *
- * @author Mauro Talevi
- */
-public class ConfigReaderTestCase extends TestCase {
-
-
-
- public ConfigReaderTestCase(String name) {
- super(name);
- }
-
- public static Test suite() {
-
- return (new TestSuite(ConfigReaderTestCase.class));
-
- }
-
- public void setUp() {
-
- }
-
- public void tearDown() {
-
-
- }
-
- public void testActions() {
-
- final ConfigReader reader = new ConfigReader();
- try {
- InputStream input = this.getClass().getResourceAsStream
- ("/org/codehaus/spice/swingactions/reader/swingactions.xml");
- assertNotNull("InputStream from swingactions.xml", input);
- reader.parse(input);
- input.close();
- } catch (Throwable t) {
- t.printStackTrace(System.out);
- fail("Exception in parsing: " + t);
- }
-
- final ActionSetMetaData actionSet = reader.getActionSet();
- assertNotNull( "Read actions configurations", actionSet );
- assertEquals( "Found 2 actions", actionSet.getActions().length, 2 );
- assertEquals( "Action 1", actionSet.getAction( "action-1" ).toString(),
- "[ActionMetaData id=action-1, name=Action 1, shortDescription=Action 1 Short Desc, longDescription=Action 1 Long Desc, smallIcon=/path/to/icon/action1-small.gif, largeIcon=/path/to/icon/action1-large.gif, actionCommandKey=, acceleratorKey=CTRL-1, mnemonicKey='1']" );
- assertEquals( "Action 2", actionSet.getAction( "action-2" ).toString(),
- "[ActionMetaData id=action-2, name=Action 2, shortDescription=Action 2 Short Desc, longDescription=Action 2 Long Desc, smallIcon=/path/to/icon/action2-small.gif, largeIcon=/path/to/icon/action2-large.gif, actionCommandKey=, acceleratorKey=CTRL-2, mnemonicKey='2']" );
-
-
- }
-
- public void testActionGroups() {
-
- final ConfigReader reader = new ConfigReader();
- try {
- InputStream input = this.getClass().getResourceAsStream
- ("/org/codehaus/spice/swingactions/reader/swingactions2.xml");
- assertNotNull("InputStream from swingactions2.xml", input);
- reader.parse(input);
- input.close();
- } catch (Throwable t) {
- t.printStackTrace(System.out);
- fail("Exception in parsing: " + t);
- }
-
- final ActionGroupsMetaData actionGroups = reader.getActionGroups();
- final String[] groupIds = actionGroups.getGroupIds();
- assertNotNull( "Read actions configurations", groupIds );
- assertEquals( "Found 2 groups", groupIds.length, 2 );
- final ActionSetMetaData group1 = actionGroups.getActionSet( "group-1" );
- assertEquals( "Found 2 group actions ", group1.getActions().length, 2 );
- String groupAction11 = "[GroupActionMetaData groupId=group-1, id=action-1, groupOrder=1, name=Name of Action 1, shortDescription=null, longDescription=null, smallIcon=null, largeIcon=null, actionCommandKey=null, acceleratorKey=null, mnemonicKey=null]";
- assertEquals( "GroupAction 11", group1.getAction( "action-1" ).toString(), groupAction11 );
- String groupAction12 = "[GroupActionMetaData groupId=group-1, id=action-2, groupOrder=2, name=null, shortDescription=null, longDescription=null, smallIcon=/path/to/group/icon/action2-small.gif, largeIcon=null, actionCommandKey=null, acceleratorKey=null, mnemonicKey=null]";
- assertEquals( "GroupAction 12", group1.getAction( "action-2" ).toString(), groupAction12 );
- final ActionSetMetaData group2 = actionGroups.getActionSet( "group-2" );
- assertEquals( "Found 3 group actions ", group2.getActions().length, 3 );
- String groupAction23 = "[GroupActionMetaData groupId=group-2, id=action-3, groupOrder=2, name=null, shortDescription=Action 3 Short Desc in group-2, longDescription=null, smallIcon=null, largeIcon=null, actionCommandKey=null, acceleratorKey=null, mnemonicKey=null]";
- assertEquals( "GroupAction 23", group2.getAction( "action-3" ).toString(), groupAction23 );
- String groupAction24 = "[GroupActionMetaData groupId=group-2, id=action-4, groupOrder=1, name=null, shortDescription=null, longDescription=null, smallIcon=null, largeIcon=null, actionCommandKey=null, acceleratorKey=null, mnemonicKey='M']";
- assertEquals( "GroupAction 24", group2.getAction( "action-4" ).toString(), groupAction24 );
-
-
- }
-
-}
</pre></div>
<hr /><a name="file34" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions/reader<br /></span>
<div class="fileheader" id="removed"><big><b>swingactions.xml</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N swingactions.xml
--- swingactions.xml 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!--
- This is the SwingActions test configuration file
--->
-
-<swingactions>
-
- <!-- Action set -->
- <action-set>
- <action id="action-1"
- name="Action 1"
- shortDescription="Action 1 Short Desc"
- longDescription="Action 1 Long Desc"
- smallIcon="/path/to/icon/action1-small.gif"
- largeIcon="/path/to/icon/action1-large.gif"
- commandKey=""
- mnemonicKey="'1'"
- acceleratorKey="CTRL-1"/>
- <action id="action-2"
- name="Action 2"
- shortDescription="Action 2 Short Desc"
- longDescription="Action 2 Long Desc"
- smallIcon="/path/to/icon/action2-small.gif"
- largeIcon="/path/to/icon/action2-large.gif"
- commandKey=""
- mnemonicKey="'2'"
- acceleratorKey="CTRL-2"/>
- </action-set>
-
-</swingactions>
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file35" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/src/test/org/codehaus/spice/swingactions/reader<br /></span>
<div class="fileheader" id="removed"><big><b>swingactions2.xml</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N swingactions2.xml
--- swingactions2.xml 24 Apr 2004 16:40:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!--
- This is the SwingActions test configuration file
--->
-
-<swingactions>
-
- <!-- Action set -->
- <action-set>
- <action id="action-1"
- name="Action 1"
- shortDescription="Action 1 Short Desc"
- longDescription="Action 1 Long Desc"
- smallIcon="/path/to/icon/action1-small.gif"
- largeIcon="/path/to/icon/action1-large.gif"
- commandKey=""
- mnemonicKey="'1'"
- acceleratorKey="CTRL-1"/>
- <action id="action-2"
- name="Action 2"
- shortDescription="Action 2 Short Desc"
- longDescription="Action 2 Long Desc"
- smallIcon="/path/to/icon/action2-small.gif"
- largeIcon="/path/to/icon/action2-large.gif"
- commandKey=""
- mnemonicKey="'2'"
- acceleratorKey="CTRL-2"/>
- <action id="action-3"
- name="Action 3"
- shortDescription="Action 3 Short Desc"
- longDescription="Action 3 Long Desc"
- smallIcon="/path/to/icon/action3-small.gif"
- largeIcon="/path/to/icon/action3-large.gif"
- commandKey=""
- mnemonicKey="'3'"
- acceleratorKey="CTRL-3"/>
- <action id="action-4"
- name="Action 4"
- shortDescription="Action 4 Short Desc"
- longDescription="Action 4 Long Desc"
- smallIcon="/path/to/icon/action4-small.gif"
- largeIcon="/path/to/icon/action4-large.gif"
- commandKey=""
- mnemonicKey="'4'"
- acceleratorKey="CTRL-4"/>
- </action-set>
-
- <!-- Action groups -->
- <action-groups>
- <group id="group-1">
- <group-action id="action-1" groupOrder="1" name="Name of Action 1"/>
- <group-action id="action-2" groupOrder="2" smallIcon="/path/to/group/icon/action2-small.gif"/>
- </group>
- <group id="group-2">
- <group-action id="action-3" groupOrder="2" shortDescription="Action 3 Short Desc in group-2"/>
- <separator/>
- <group-action id="action-4" groupOrder="1" mnemonicKey="'M'"/>
- </group>
- </action-groups>
-
-</swingactions>
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file36" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/xdocs<br /></span>
<div class="fileheader" id="removed"><big><b>component.menu</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N component.menu
--- component.menu 16 Jul 2003 08:47:34 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
</small></pre><pre class="diff" id="removed">-
- <menu name="Component">
- <item name="Home" href="/index.html"/>
- <item name="Configuration" href="/configuration.html"/>
- </menu>
</pre></div>
<hr /><a name="file37" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/xdocs<br /></span>
<div class="fileheader" id="removed"><big><b>configuration.xml</b></big> <small id="info">removed after 1.3</small></div>
<pre class="diff"><small id="info">diff -N configuration.xml
--- configuration.xml 24 Apr 2004 16:40:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0"?>
-<document>
-
- <properties>
- <title>SwingActions Configuration</title>
- </properties>
-
- <body>
- <section name="swingactions.properties">
- <p>ActionManager may also be configured via a property found in the jar META-INF:
- <source>
-META-INF/spice/swingactions.properties
- </source>
- and then using the InitialActionManagerFactory as:
- <source>
-final InitialActionManagerFactory factory = new InitialActionManagerFactory();
-return factory.createActionManager( new HashMap() );
- </source>
- </p>
- <p>
- The swingactions.properties file contains the ActionManager factory implementation class name and the
- path the the configuration resource. For example:
- <source>
-org.codehaus.spice.swingactions.factory=org.codehaus.spice.swingactions.XMLActionManagerFactory
-org.codehaus.spice.swingactions.configuration.file=/path/to/actionconfig.xml
- </source>
- </p>
- </section>
- <section name="ActionManagerFactory">
- <p>One can also instantiate directly one of the above ActionManagerFactory classes and call the
- create method with the appropriate configuration parameters.
- The configuration map may contain different resources indexed by the class name:
- </p>
- <p>The possible factory classes are:
- <ul>
- <li>org.w3c.dom.Element</li>
- <li>java.io.InputStream</li>
- </ul>
- </p>
- </section>
- </body>
-
-</document>
</pre></div>
<hr /><a name="file38" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/xdocs<br /></span>
<div class="fileheader" id="removed"><big><b>index.xml</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N index.xml
--- index.xml 5 Jul 2003 17:27:19 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0"?>
-<document>
-
- <properties>
- <title>SwingActions</title>
- </properties>
-
- <body>
- <section name="ActionManager">
- </section>
- <section name="ActionManagerFactory">
- </section>
-
- </body>
-
-</document>
</pre></div>
<hr /><a name="file39" /><div class="file">
<span class="pathname" id="removed">spice/sandbox/swingactions/xdocs<br /></span>
<div class="fileheader" id="removed"><big><b>tasks.xml</b></big> <small id="info">removed after 1.1</small></div>
<pre class="diff"><small id="info">diff -N tasks.xml
--- tasks.xml 5 Jul 2003 17:27:19 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0"?>
-<document>
-
- <properties>
- <title>Tasks</title>
- </properties>
-
- <body>
- <section name="Tasks">
- <p>
- </p>
-
- <subsection name="TODO">
- <p>
- <ul>
- <li>
- </li>
- </ul>
- </p>
- </subsection>
- </section>
-
- </body>
-</document>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.8</small></center>
</body></html>