[Japi-cvs] SF.net SVN: japi:[899] tools
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2009-02-15 15:41:59
|
Revision: 899
http://japi.svn.sourceforge.net/japi/?rev=899&view=rev
Author: christianhujer
Date: 2009-02-15 15:41:47 +0000 (Sun, 15 Feb 2009)
Log Message:
-----------
Moved action classes from net.sf.japi.swing to net.sf.japi.swing.action.
Makes subpackages of net.sf.japi.swing look better and more independent of the action stuff.
Modified Paths:
--------------
games/jmines/trunk/src/prj/net/sf/japi/games/jmines/JMines.java
historic/trunk/src/app/net/sf/japi/swing/LookAndFeelManager.java
historic/trunk/src/doc/guide/swing/action/basic/src/ex/Application.java
historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java
historic/trunk/src/doc/guide/swing/prefs/keys/src/ex/PrefsExampleApp.java
historic/trunk/src/doc/guide/swing/tod/src/ex/TodExampleApp.java
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java
libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java
libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/ActionBuilderFactoryTest.java
libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/DefaultActionBuilderTest.java
libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/ReflectionActionTest.java
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
libs/swing-bookmarks/trunk/src/prj/net/sf/japi/swing/bookmarks/BookmarkManager.java
libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontChooser.java
libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontPreview.java
libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontStyleListCellRenderer.java
libs/swing-keyprefs/trunk/src/prj/net/sf/japi/swing/prefs/keys/ActionKeyDisplay.java
libs/swing-keyprefs/trunk/src/prj/net/sf/japi/swing/prefs/keys/ActionMapNode.java
libs/swing-keyprefs/trunk/src/prj/net/sf/japi/swing/prefs/keys/KeyStrokePrefs.java
libs/swing-keyprefs/trunk/src/prj/net/sf/japi/swing/prefs/keys/KeyStrokeRootNode.java
libs/swing-keyprefs/trunk/src/prj/net/sf/japi/swing/prefs/keys/KeyStrokeTreeTableModel.java
libs/swing-list/trunk/src/prj/net/sf/japi/swing/list/ListControlPanel.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JSAXErrorHandler.java
libs/swing-prefs/trunk/src/prj/net/sf/japi/swing/prefs/PreferencesPane.java
libs/swing-prefs/trunk/src/tst/test/net/sf/japi/swing/prefs/MockActionBuilder.java
libs/swing-prefs/trunk/src/tst/test/net/sf/japi/swing/prefs/PreferencesPaneTest.java
libs/swing-recent/trunk/src/prj/net/sf/japi/swing/recent/RecentURLsMenu.java
libs/swing-tod/trunk/src/prj/net/sf/japi/swing/tod/TipOfTheDayManager.java
progs/batcher/trunk/src/prj/net/sf/japi/progs/batcher/Main.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/QuestionCollectionGUI.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/InternalFrameManager.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/MenuManager.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/OpenURLPane.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/ToolBarManager.java
progs/jeduca/trunk/src/prj/net/sf/japi/swing/LookAndFeelManager.java
progs/jtype/trunk/src/prj/net/sf/japi/jtype/PerformancePane.java
progs/pffhtrain/trunk/src/prj/net/sf/japi/pffhtrain/PffhTrain.java
tools/fontbrowser/trunk/src/prj/net/sf/japi/tools/fontbrowser/FontBrowser.java
tools/keystrokes/trunk/src/prj/net/sf/japi/tools/keystrokes/KeyStrokes.java
tools/prefsbrowser/trunk/src/prj/net/sf/japi/tools/prefsbrowser/PrefsBrowser.java
tools/prefsbrowser/trunk/src/prj/net/sf/japi/tools/prefsbrowser/PrefsTreeTableModel.java
tools/string2bytes/trunk/src/prj/net/sf/japi/string2bytes/CodecSelectionPanel.java
tools/string2bytes/trunk/src/prj/net/sf/japi/string2bytes/DoubleListController.java
tools/string2bytes/trunk/src/prj/net/sf/japi/string2bytes/ListOrderController.java
tools/string2bytes/trunk/src/prj/net/sf/japi/string2bytes/String2Bytes.java
Added Paths:
-----------
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionBuilder.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionBuilderFactory.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionMethod.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionProvider.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ComponentFactory.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DefaultActionBuilder.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DisposeAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DummyAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/DummyActionBuilder.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/IconManager.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/NamedActionMap.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ReflectionAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ToggleAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/action.properties
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/action_de.properties
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/package-info.java
Removed Paths:
-------------
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilder.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilderFactory.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionMethod.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionProvider.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ComponentFactory.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/DefaultActionBuilder.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/DisposeAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/DummyAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/DummyActionBuilder.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/IconManager.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/NamedActionMap.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ReflectionAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ToggleAction.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action.properties
libs/swing-action/trunk/src/prj/net/sf/japi/swing/action_de.properties
libs/swing-action/trunk/src/prj/net/sf/japi/swing/package-info.java
Modified: games/jmines/trunk/src/prj/net/sf/japi/games/jmines/JMines.java
===================================================================
--- games/jmines/trunk/src/prj/net/sf/japi/games/jmines/JMines.java 2009-02-15 14:24:43 UTC (rev 898)
+++ games/jmines/trunk/src/prj/net/sf/japi/games/jmines/JMines.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -19,7 +19,7 @@
import javax.swing.JApplet;
import javax.swing.JComponent;
-import net.sf.japi.swing.ActionMethod;
+import net.sf.japi.swing.action.ActionMethod;
/** A MineSweeper implementation in Java.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
Modified: historic/trunk/src/app/net/sf/japi/swing/LookAndFeelManager.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/swing/LookAndFeelManager.java 2009-02-15 14:24:43 UTC (rev 898)
+++ historic/trunk/src/app/net/sf/japi/swing/LookAndFeelManager.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -39,6 +39,7 @@
import static javax.swing.UIManager.getLookAndFeel;
import static javax.swing.UIManager.installLookAndFeel;
import static javax.swing.UIManager.setLookAndFeel;
+import net.sf.japi.swing.action.ActionBuilderFactory;
/** A class that manages look and feel and provides a corresponding menu.
* If you want your frames and dialogs to be default look and feel decorated, you currently must invoke the corresponding method {@link
Modified: historic/trunk/src/doc/guide/swing/action/basic/src/ex/Application.java
===================================================================
--- historic/trunk/src/doc/guide/swing/action/basic/src/ex/Application.java 2009-02-15 14:24:43 UTC (rev 898)
+++ historic/trunk/src/doc/guide/swing/action/basic/src/ex/Application.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -4,9 +4,9 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
-import net.sf.japi.swing.ActionBuilder;
-import net.sf.japi.swing.ActionBuilderFactory;
-import net.sf.japi.swing.ActionMethod;
+import net.sf.japi.swing.action.ActionBuilder;
+import net.sf.japi.swing.action.ActionBuilderFactory;
+import net.sf.japi.swing.action.ActionMethod;
/** Example application. */
public class Application extends WindowAdapter {
@@ -53,7 +53,8 @@
// Implement this method for closing the current document
}
- @ActionMethod public void fileQuit() {
+ @ActionMethod
+ public void fileQuit() {
// Change this method for asking whether to really quit the application
frame.dispose();
}
Modified: historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java
===================================================================
--- historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java 2009-02-15 14:24:43 UTC (rev 898)
+++ historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -16,10 +16,10 @@
import javax.swing.JTextPane;
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
import javax.swing.text.DefaultEditorKit;
-import net.sf.japi.swing.ActionBuilder;
-import net.sf.japi.swing.ActionBuilderFactory;
-import net.sf.japi.swing.ActionMethod;
-import net.sf.japi.swing.ActionProvider;
+import net.sf.japi.swing.action.ActionBuilder;
+import net.sf.japi.swing.action.ActionBuilderFactory;
+import net.sf.japi.swing.action.ActionMethod;
+import net.sf.japi.swing.action.ActionProvider;
import org.jetbrains.annotations.Nullable;
public class Editor implements ActionProvider {
@@ -74,7 +74,8 @@
}
/** Action method. */
- @ActionMethod public void fileNew() {
+ @ActionMethod
+ public void fileNew() {
textPane.setText("");
file = null;
}
Modified: historic/trunk/src/doc/guide/swing/prefs/keys/src/ex/PrefsExampleApp.java
===================================================================
--- historic/trunk/src/doc/guide/swing/prefs/keys/src/ex/PrefsExampleApp.java 2009-02-15 14:24:43 UTC (rev 898)
+++ historic/trunk/src/doc/guide/swing/prefs/keys/src/ex/PrefsExampleApp.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,7 +1,7 @@
package ex;
-import net.sf.japi.swing.ActionBuilder;
-import net.sf.japi.swing.ActionBuilderFactory;
+import net.sf.japi.swing.action.ActionBuilder;
+import net.sf.japi.swing.action.ActionBuilderFactory;
import net.sf.japi.swing.prefs.PreferencesGroup;
import static net.sf.japi.swing.prefs.PreferencesPane.showPreferencesDialog;
import net.sf.japi.swing.prefs.keys.KeyStrokePrefs;
Modified: historic/trunk/src/doc/guide/swing/tod/src/ex/TodExampleApp.java
===================================================================
--- historic/trunk/src/doc/guide/swing/tod/src/ex/TodExampleApp.java 2009-02-15 14:24:43 UTC (rev 898)
+++ historic/trunk/src/doc/guide/swing/tod/src/ex/TodExampleApp.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -3,8 +3,8 @@
import javax.swing.JButton;
import javax.swing.JFrame;
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
-import net.sf.japi.swing.ActionBuilder;
-import net.sf.japi.swing.ActionBuilderFactory;
+import net.sf.japi.swing.action.ActionBuilder;
+import net.sf.japi.swing.action.ActionBuilderFactory;
import net.sf.japi.swing.tod.TipOfTheDayManager;
public class TodExampleApp {
Modified: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/OutputConfigurator.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -34,8 +34,8 @@
import javax.swing.SpinnerNumberModel;
import net.sf.japi.midi.MidiUtils;
import net.sf.japi.midi.OutputConfiguration;
-import net.sf.japi.swing.ActionBuilder;
-import net.sf.japi.swing.ActionBuilderFactory;
+import net.sf.japi.swing.action.ActionBuilder;
+import net.sf.japi.swing.action.ActionBuilderFactory;
import org.jetbrains.annotations.Nullable;
/** UI component for configuring a midi output.
Modified: libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -42,10 +42,9 @@
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
-import javax.swing.SwingConstants;
import javax.swing.UIManager;
-import net.sf.japi.swing.ActionBuilder;
-import net.sf.japi.swing.ActionBuilderFactory;
+import net.sf.japi.swing.action.ActionBuilder;
+import net.sf.japi.swing.action.ActionBuilderFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Deleted: libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilder.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilder.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilder.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,525 +0,0 @@
-/*
- * Copyright (C) 2009 Christian Hujer.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package net.sf.japi.swing;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.prefs.Preferences;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ActionMap;
-import javax.swing.Icon;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPopupMenu;
-import javax.swing.JToolBar;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/** Interface for creating and initializing {@link Action}s that are localized, user configurable and may invoke their final methods using Reflection;
- * also handles extremely much useful stuff for i18n/l10n.
- * It is meant as a general service for creating Action objects that have some comfort for the programmer in several aspects:
- * <ul>
- * <li>Allow zero or more ResourceBundles to be used when creating Actions</li>
- * <li>Allow zero or more UserPreferences to be used when creating Actions</li>
- * <li>Manage an ActionMap to which created Actions are automatically added</li>
- * </ul>
- * You may choose to use one or more ActionBuilders, depending on the size of your application.
- * You may use to spread Action configuration information accross one or more ResourceBundles and one or more Preferences, as you wish.
- * When looking for values, the Preferences are queried first, in addition order, after that the ResourceBundles, again in addition order, until
- * a value was found. The behaviour when no value was found is undefined.
- * <h3>Usage</h3>
- * The recommended usage is to
- * <ol>
- * <li>
- * create and initialize an ActionBuilder similar as the following example code, put it somewhere at the start of your program:
- * <pre>
- * ActionBuilder myActionBuilder = ActionBuilder.getActionBuilder("MyApplication");
- * myActionBuilder.addBundle("com.mycompany.mypackage.myresource"); // not always required
- * myActionBuilder.addPref(MyClass.class);
- * </pre>
- * </li>
- * <li>
- * then use the ActionBuilder from anywhere within the application like this:
- * <pre>
- * ActionBuilder myActionBuilder = ActionBuilder.getActionBuilder("MyApplication");
- * Action myAction = myActionBuilder.createAction("load", this);
- * </pre>
- * </li>
- * </ol>
- * <p>
- * All actions created or initialized by an instance of this class are optionally put into that instance's {@link ActionMap}.
- * If they are stored, you can use that map for later retrieval.
- * </p>
- * <h4>Usage Notes: Builder Name</h4>
- * <ul>
- * <li>
- * The builder name is used to try to load a resource bundle when a bundle is created.
- * The builder name is used as package name for the bundle, the bundle name itself is "action".
- * Example: When calling <code>ActionBuilder.getActionBuilder("net.sf.japi.swing");</code> for the first time, it is tried to load a
- * {@link ResourceBundle} named <code>net.sf.japi.swing.actions</code> for that <code>ActionBuilder</code>.
- * This automatism has been implemented to save you from the need of initializing an ActionBuilder before use.
- * </li>
- * </ul>
- * <h4>Usage Notes: Action Key / Action Name</h4>
- * The key you supply as first argument of {@link #createAction(boolean, String, Object)} determines several things:
- * <ul>
- * <li>The base name for the different keys in the preferences / resource bundle and other known Action Keys:
- * <table border="1">
- * <tr><th>What</th><th>Preferences / Bundle key</th><th>Action key if stored in an action</th></tr>
- * <tr><td>An (somewhat unique) ID</td><td>(<var>basename</var> itself)</td><td>{@link #ACTION_ID}</td></tr>
- * <tr><td>The icon</td><td><code><var>basename</var> + ".icon"</code></td><td>{@link Action#SMALL_ICON}</td></tr>
- * <tr><td>The tooltip help</td><td><code><var>basename</var> + ".shortdescription"</code></td><td>{@link Action#SHORT_DESCRIPTION}</td></tr>
- * <tr><td>The long help</td><td><code><var>basename</var> + ".longdescription"</code></td><td>{@link Action#LONG_DESCRIPTION}</td></tr>
- * <tr><td>The text label</td><td><code><var>basename</var> + ".text"</code></td><td>{@link Action#NAME}</td></tr>
- * <tr><td>The keyboard accelerator</td><td><code><var>basename</var> + ".accel"</code></td><td>{@link Action#ACCELERATOR_KEY}</td></tr>
- * <tr><td>The alternate keyboard accelerator</td><td><code><var>basename</var> + ".accel2"</code></td><td>{@link #ACCELERATOR_KEY_2}</td></tr>
- * <tr><td>The mnemonic</td><td><code><var>basename</var> + ".mnemonic"</code></td><td>{@link Action#MNEMONIC_KEY}</td></tr>
- * <tr><td>The method name</td><td></td><td>{@link ReflectionAction#REFLECTION_METHOD_NAME}</td></tr>
- * <tr><td>The method</td><td></td><td>{@link ReflectionAction#REFLECTION_METHOD}</td></tr>
- * <tr><td>The boolean property name</td><td></td><td>{@link ToggleAction#REFLECTION_PROPERTY_NAME}</td></tr>
- * <tr><td>The target instance</td><td></td><td>{@link ReflectionAction#REFLECTION_TARGET}</td></tr>
- * <tr><td>Exception handler dialogs</td><td><code><var>basename</var> + ".exception." + <var>exception class name</var> + ...</code><br/>The message can be formatted with 1 parameter that will be the localized message of the thrown exception.</td><td>n/a</td></tr>
- * </table>
- * </li>
- * </ul>
- * <p>Some methods are not related to actions, yet take base keys:</p>
- * <ul>
- * <li>The methods for dialogs, e.g. {@link #showMessageDialog(Component, String, Object...)}:
- * <table border="1">
- * <tr><th>What</th><th>Preferences / Bundle key</th></tr>
- * <tr><td>Dialog title</td><td><code><var>basename</var> + ".title"</code></td></tr>
- * <tr><td>Dialog message</td><td><code><var>basename</var> + ".message"</code></td></tr>
- * <tr><td>Dialog messagetype </td><td><code><var>basename</var> + ".messagetype"</code><br/>The message type should be one of the message types defined in {@link JOptionPane}, e.g. {@link JOptionPane#PLAIN_MESSAGE}.</td></tr>
- * </table>
- * </li>
- * </ul>
- * <h4>Final Notes</h4>
- * <ul>
- * <li>
- * If by having read all this you think it might often be a good idea to use a package name as a builder name: this is completely right and the
- * most common way of using an ActionBuilder.
- * </li>
- * <li>
- * If you think you're too lazy to hold your own ActionBuilder reference and instead more often call {@link ActionBuilderFactory#getActionBuilder(String)}, just go ahead
- * and do so.
- * Looking up created ActionBuilders is extremely fast, and of course they are initialized exactly once, not more.
- * </li>
- * </ul>
- * @see AbstractAction
- * @see Action
- * @see Preferences
- * @see ResourceBundle
- * @todo think about toolbar interaction
- * @todo think about toolbar configuration
- * @todo whether a dialog is a onetime dialog should be a property and user configurable
- * @todo Implement serialization.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public interface ActionBuilder {
-
- /** The key used for storing a somewhat unique id for this Action. */
- @NotNull String ACTION_ID = "ActionID";
-
- /** The key used for storing an alternative accelerator for this Action.
- * Currently unused.
- */
- @NotNull String ACCELERATOR_KEY_2 = "AcceleratorKey2";
-
- /** Add a ResourceBundle to the list of used bundles.
- * @param baseName the base name of the resource bundle, a fully qualified class name
- * @see ResourceBundle#getBundle(String)
- */
- void addBundle(@NotNull String baseName);
-
- /** Get the ActionMap.
- * @return ActionMap
- */
- @NotNull ActionMap getActionMap();
-
- /** Add a ResourceBundle to the list of used bundles.
- * @param bundle ResourceBundle to add
- * @throws NullPointerException if <code>bundle == null</code>
- */
- void addBundle(@NotNull ResourceBundle bundle) throws NullPointerException;
-
- /** Add a parent to the list of used parents.
- * @param parent Parent to use if lookups failed in this ActionBuilder
- * WARNING: Adding a descendents as parents of ancestors or vice versa will result in endless recursion and thus stack overflow!
- * @throws NullPointerException if <code>parent == null</code>
- */
- void addParent(@NotNull ActionBuilder parent) throws NullPointerException;
-
- /** Add a Preferences to the list of used preferences.
- * @param pref Preferences to add
- * @throws NullPointerException if <code>pref == null</code>
- */
- void addPref(@NotNull Preferences pref) throws NullPointerException;
-
- /** Add a Preferences to the list of used preferences.
- * @param clazz the class whose package a user preference node is desired
- * @see Preferences#userNodeForPackage(Class)
- * @throws NullPointerException if <code>clazz == null</code>
- */
- void addPref(@NotNull Class<?> clazz);
-
- /** Creates actions.
- * This is a loop variant of {@link #createAction(boolean,String)}.
- * The actions created can be retrieved using {@link #getAction(String)} or via the ActionMap returned by {@link #getActionMap()}.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param keys Keys of actions to create
- * @return Array with created actions
- * @throws NullPointerException in case keys is or contains <code>null</code>
- */
- Action[] createActions(boolean store, @NotNull String... keys) throws NullPointerException;
-
- /** Create an Action.
- * The created Action is automatically stored together with all other Actions created by this Builder instance in an ActionMap, which you can
- * retreive using {@link #getActionMap()}.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param key Key for Action, which is used as basename for access to Preferences and ResourceBundles and as ActionMap key (may not be
- * <code>null</code>)
- * @return created Action, which is a dummy in the sense that its {@link Action#actionPerformed(ActionEvent)} method does not do anything
- * @throws NullPointerException in case <var>key</var> was <code>null</code>
- * @see #createAction(boolean,String,Object)
- * @see #createToggle(boolean,String,Object)
- * @see #initAction(boolean,Action,String)
- */
- Action createAction(boolean store, @NotNull String key) throws NullPointerException;
-
- /** Initialize an Action.
- * This is a convenience method for Action users which want to use the services provided by this {@link ActionBuilder} class but need more
- * sophisticated Action objects they created on their own.
- * So you can simply create an Action and pass it to this Initialization method to fill its data.
- * The initialized Action is automatically stored together with all other Actions created by this Builder instance in an ActionMap, which you can
- * retreive using {@link #getActionMap()}.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param action Action to fill
- * @param key Key for Action, which is used as basename for access to Preferences and ResourceBundles and as ActionMap key (may not be <code>null</code>)
- * @return the supplied Action object (<var>action</var>) is returned for convenience
- * @throws NullPointerException in case <var>key</var> was <code>null</code>
- */
- @SuppressWarnings({"NestedAssignment"})
- @NotNull Action initAction(boolean store, @NotNull Action action, @NotNull String key) throws NullPointerException;
-
- /** Get a String.
- * First looks one pref after another, in their addition order.
- * Then looks one bundle after another, in their addition order.
- * @param key Key to get String for
- * @return the first value found or <code>null</code> if no value could be found
- * @throws NullPointerException if <var>key</var> is <code>null</code>
- */
- @Nullable String getString(@NotNull String key) throws NullPointerException;
-
- /** Get a String from the preferences, ignoring the resource bundles.
- * @param key Key to get String for
- * @return the first value found or <code>null</code> if no value could be found
- * @throws NullPointerException if <var>key</var> is <code>null</code>
- */
- @Nullable String getStringFromPrefs(@NotNull String key) throws NullPointerException;
-
- /** Get a String from the resource bundles, ignoring the preferences.
- * @param key Key to get String for
- * @return the first value found or <code>null</code> if no value could be found
- * @throws NullPointerException if <var>key</var> is <code>null</code>
- */
- @Nullable String getStringFromBundles(@NotNull String key) throws NullPointerException;
-
- /** Creates actions.
- * This is a loop variant of {@link #createAction(boolean,String,Object)}.
- * The actions created can be retrieved using {@link #getAction(String)} or via the ActionMap returned by {@link #getActionMap()}.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param target Target object
- * @param keys Keys of actions to create
- * @return Array with created actions
- * @throws NullPointerException in case keys is or contains <code>null</code>
- */
- Action[] createActions(boolean store, Object target, String... keys) throws NullPointerException;
-
- /** Create an Action.
- * The created Action is automatically stored together with all other Actions created by this Builder instance in an ActionMap, which you can
- * retreive using {@link #getActionMap()}.
- * The supplied object needs to have a zero argument method named <var>key</var>.
- * You may pass <code>null</code> as object, which means that the object the method is invoked on is not defined yet.
- * You may safely use the Action, it will not throw any Exceptions upon {@link Action#actionPerformed(ActionEvent)} but simply silently do nothing.
- * The desired object can be set later using <code>action.putValue({@link ReflectionAction#REFLECTION_TARGET}, <var>object</var>)</code>.
- * <p />
- * Users of this method can assume that the returned object behaves quite like {@link ReflectionAction}.
- * Whether or not this method returns an instance of {@link ReflectionAction} should not be relied on.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param key Key for Action, which is used as basename for access to Preferences and ResourceBundles, as ActionMap key and as Reflection Method
- * name within the supplied object (may not be <code>null</code>)
- * @param object Instance to invoke method on if the Action was activated ({@link Action#actionPerformed(ActionEvent)})
- * @return created Action
- * @throws NullPointerException in case <var>key</var> was <code>null</code>
- * @see #createAction(boolean,String)
- * @see #createToggle(boolean,String,Object)
- * @see #initAction(boolean,Action,String)
- */
- Action createAction(boolean store, String key, Object object) throws NullPointerException;
-
- /** Method for creating a Menu.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param menuKey action key for Menu
- * @param keys Action keys for menu items
- * @return menu created from the menu definition found
- * @throws Error in case action definitions for <var>keys</var> weren't found
- */
- JMenu createMenu(boolean store, String menuKey, String... keys) throws Error;
-
- /** Get an Action.
- * For an action to be retrieved with this method, it must have been initialized with {@link #initAction(boolean,Action,String)}, either directly by
- * invoking {@link #initAction(boolean,Action,String)} or indirectly by invoking one of this class' creation methods like {@link #createAction(boolean,String)},
- * {@link #createAction(boolean,String,Object)} or {@link #createToggle(boolean,String,Object)}.
- * @param key Key of action to get
- * @return Action for <var>key</var> or <code>null</code> if the action does not exist.
- * This method does the same as <code>getActionMap().get(key)</code>.
- */
- @Nullable Action getAction(@NotNull String key);
-
- /** Method for creating a menubar.
- * @param store whether to store the initialized Actions in the ActionMap of this ActionBuilder
- * @param barKey Action key of menu to create
- * @return JMenuBar created for <var>barKey</var>
- * @throws NullPointerException if no menubar definition was found
- * @todo make error handling consistent (see createMenu and others)
- */
- @NotNull JMenuBar createMenuBar(boolean store, String barKey) throws NullPointerException;
-
- /** Method for creating a popup menu.
- * @param store Whether to store the initialized Actions in the ActionMap of this ActionBuilder.
- * @param popupKey Action key of popup menu to create.
- * @return JPopupMenu created for <var>popupKey</var>
- * @throws MissingResourceException if no menubar definition was found.
- * @todo make error handling consistent (see createMenu and others)
- */
- @NotNull JPopupMenu createPopupMenu(boolean store, String popupKey) throws MissingResourceException;
-
- /** Method for creating a Menu.
- * This method assumes that the underlying properties contain an entry like <code>key + ".menu"</code> which lists the menu element's keys.
- * Submenus are build recursively.
- * @param store Whether to store the initialized Action in the ActionMap of this ActionBuilder.
- * @param menuKey Action key for menu.
- * @return menu created from the menu definition found.
- * @throws MissingResourceException In case a menu definition for <var>menuKey</var> wasn't found
- */
- JMenu createMenu(boolean store, String menuKey) throws MissingResourceException;
-
- /** Method for creating a menubar.
- * @param store whether to store the initialized Actions in the ActionMap of this ActionBuilder
- * @param barKey Action key of menu to create
- * @param target Target object
- * @return JMenuBar created for <var>barKey</var>
- * @throws MissingResourceException In case a menu or menubar definition was not found.
- */
- JMenuBar createMenuBar(boolean store, String barKey, Object target) throws MissingResourceException;
-
- /** Method for creating a popup menu.
- * @param store whether to store the initialized Actions in the ActionMap of this ActionBuilder
- * @param popupKey Action key of popup menu to create
- * @param target Target object
- * @return JPopupMenu created for <var>barKey</var>
- * @throws MissingResourceException In case a menu definition was not found.
- */
- JPopupMenu createPopupMenu(boolean store, String popupKey, Object target) throws MissingResourceException;
-
- /** Method for creating a Menu.
- * This method assumes that the underlying properties contain an entry like <code>key + ".menu"</code> which lists the menu element's keys.
- * Submenus are build recursively.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param menuKey action key for menu
- * @param target Target object
- * @return menu created from the menu definition found
- * @throws Error in case a menu definition for <var>menuKey</var> wasn't found
- */
- JMenu createMenu(boolean store, String menuKey, Object target) throws Error;
-
- /** Creates actions.
- * This is a loop variant of {@link #createToggle(boolean,String,Object)}.
- * The actions created can be retrieved using {@link #getAction(String)} or via the ActionMap returned by {@link #getActionMap()}.
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param target Target object
- * @param keys Keys of actions to create
- * @throws NullPointerException in case <var>keys</var> was or contained <code>null</code>
- */
- void createToggles(boolean store, Object target, String... keys) throws NullPointerException;
-
- /** Create an Action.
- * The created Action is automatically stored together with all other Actions created by this Builder instance in an ActionMap, which you can
- * retreive using {@link #getActionMap()}.
- * The supplied object needs to have a boolean return void argument getter method and a void return boolean argument setter method matching the
- * <var>key</var>.
- * You may pass <code>null</code> as object, which means that the object the getters and setters are invoked on is not defined yet.
- * You may safely use the Action, it will not throw any Exceptions upon {@link Action#actionPerformed(ActionEvent)} but simply silently do nothing.
- * The desired object can be set later using <code>action.putValue({@link ToggleAction#REFLECTION_TARGET}, <var>object</var>)</code>.
- * <p />
- * Users of this method can assume that the returned object behaves quite like {@link ToggleAction}.
- * Whether or not this method returns an instance of {@link ToggleAction} should not be relied on.
- * @see #createAction(boolean,String)
- * @see #createAction(boolean,String,Object)
- * @see #initAction(boolean,Action,String)
- * @param store whether to store the initialized Action in the ActionMap of this ActionBuilder
- * @param key Key for Action, which is used as basename for access to Preferences and ResourceBundles, as ActionMap key and as Property name within
- * the supplied object (may not be <code>null</code>)
- * @param object Instance to invoke method on if the Action was activated ({@link Action#actionPerformed(ActionEvent)})
- * @throws NullPointerException in case <var>key</var> was <code>null</code>
- * @return ToggleAction
- */
- Action createToggle(boolean store, String key, Object object) throws NullPointerException;
-
- /** Method for creating a toolbar.
- * @param barKey Action keys of toolbar to create
- * @return JToolBar created for <var>barKey</var>
- * @throws MissingResourceException In case there is no definition for the requested toolbar.
- */
- JToolBar createToolBar(String barKey) throws MissingResourceException;
-
- /** Method for creating a toolbar.
- * @param object Instance to invoke method on if the Action was activated ({@link Action#actionPerformed(ActionEvent)})
- * @param barKey Action keys of toolbar to create
- * @return JToolBar created for <var>barKey</var>
- * @throws MissingResourceException In case there is no definition for the requested toolbar.
- */
- JToolBar createToolBar(Object object, String barKey) throws MissingResourceException;
-
- /** Method to find the JMenuItem for a specific Action key.
- * @param menuBar JMenuBar to search
- * @param key Key to find JMenuItem for
- * @return JMenuItem for key or <code>null</code> if none found
- */
- @Nullable JMenuItem find(@NotNull JMenuBar menuBar, @NotNull String key);
-
- /** Get an icon.
- * @param key i18n key for icon
- * @return icon
- */
- Icon getIcon(String key);
-
- /** Show a localized message dialog.
- * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has
- * no <code>Frame</code>, a default <code>Frame</code> is used
- * @param messageType the type of message to be displayed
- * @param key localization key to use for the title, the message and eventually the icon
- * @param args formatting arguments for the message text
- * @deprecated use {@link #showMessageDialog(Component, String, Object...)} instead and put the messagetype in the action.properties file.
- */
- @Deprecated void showMessageDialog(Component parentComponent, int messageType, String key, Object... args);
-
- /** Show a localized message dialog.
- * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has
- * no <code>Frame</code>, a default <code>Frame</code> is used
- * @param key localization key to use for the title, the message and eventually the icon
- * @param args formatting arguments for the message text
- */
- void showMessageDialog(@Nullable Component parentComponent, @NotNull String key, Object... args);
-
- /** Get the message type for a dialog.
- * @param dialogKey dialog key
- * @return message type
- */
- int getMessageType(@NotNull String dialogKey);
-
- /** Formats a message with parameters.
- * It's a proxy method for using {@link MessageFormat}.
- * @param key message key
- * @param args parameters
- * @return formatted String
- * @see MessageFormat#format(String,Object...)
- */
- String format(@NotNull String key, Object... args);
-
- /** Show a localized confirmation dialog which the user can suppress in future (remembering his choice).
- * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has
- * no <code>Frame</code>, a default <code>Frame</code> is used
- * @param optionType the option type
- * @param messageType the type of message to be displayed
- * @param key localization key to use for the title, the message and eventually the icon
- * @param args formatting arguments for the message text
- * @return an integer indicating the option selected by the user now or eventually in a previous choice
- * @throws IllegalStateException if no preferences are associated
- */
- int showOnetimeConfirmDialog(@Nullable Component parentComponent, int optionType, int messageType, @NotNull String key, Object... args) throws IllegalStateException;
-
- /** Show a localized message dialog which the user can suppress in future.
- * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has
- * no <code>Frame</code>, a default <code>Frame</code> is used
- * @param messageType the type of message to be displayed
- * @param key localization key to use for the title, the message and eventually the icon
- * @param args formatting arguments for the message text
- * @throws IllegalStateException if no preferences are associated
- */
- void showOnetimeMessageDialog(@Nullable Component parentComponent, int messageType, @NotNull String key, Object... args) throws IllegalStateException;
-
- /** Show a localized question dialog.
- * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has
- * no <code>Frame</code>, a default <code>Frame</code> is used
- * @param key localization key to use for the title, the message and eventually the icon
- * @param args formatting arguments for the message text
- * @return <code>true</code> if user confirmed, otherwise <code>false</code>
- */
- boolean showQuestionDialog(Component parentComponent, String key, Object... args);
-
- /** Show a localized confirmation dialog.
- * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has
- * no <code>Frame</code>, a default <code>Frame</code> is used
- * @param optionType the option type
- * @param messageType the type of message to be displayed
- * @param key localization key to use for the title, the message and eventually the icon
- * @param args formatting arguments for the message text
- * @return an integer indicating the option selected by the user
- */
- int showConfirmDialog(Component parentComponent, int optionType, int messageType, String key, Object... args);
-
- /** Creates a label for a specified key.
- * @param key Key to create label for
- * @param args formatting arguments for the label text
- * @return JLabel for key Key
- * @note the label text will be the key if no String for the key was found
- */
- JLabel createLabel(String key, Object... args);
-
- /** Creates a label for a specified key and component.
- * @param component Component to associate label to (maybe <code>null</code>)
- * @param key Key to create label for
- * @param args formatting arguments for the label text
- * @return JLabel for key Key
- * @note the label text will be the key if no String for the key was found
- * @todo support icons
- * @todo support mnemonics
- * @todo alignments and textpositions
- */
- JLabel createLabel(Component component, String key, Object... args);
-
- /** Registers an ActionProvider with this ActionBuilder.
- * @param actionProvider ActionProvider to register
- */
- void addActionProvider(ActionProvider actionProvider);
-
- /** Sets the enabled state of an action.
- * @param key Key of the action to enable.
- * @param enabled New enabled state for that action, <code>true</code> to enable, <code>false</code> to disable.
- */
- void setActionEnabled(@NotNull String key, boolean enabled);
-}
Deleted: libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilderFactory.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilderFactory.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionBuilderFactory.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2009 Christian Hujer.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package net.sf.japi.swing;
-
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.WeakHashMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/** An ActionBuilderFactory provides implementations of {@link ActionBuilder}.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public abstract class ActionBuilderFactory {
-
- /** The ActionBuilders. */
- @NotNull private final Map<String, ActionBuilder> actionBuilders = new WeakHashMap<String, ActionBuilder>();
-
- /** The ActionBuilderFactory default instance. */
- private static final ActionBuilderFactory INSTANCE = new ActionBuilderFactory() {};
-
- /** Create an ActionBuilderFactory.
- * @return An ActionBuilderFactory.
- */
- public static ActionBuilderFactory getInstance() {
- return INSTANCE;
- }
-
- /** Returns an ActionBuilder for the package of the specified class.
- * @param clazz Class for which to return the action builder.
- * @return ActionBuilder for the given class. The builder is created in case it didn't already exist.
- */
- @NotNull public ActionBuilder getActionBuilder(@NotNull final Class<?> clazz) {
- return getActionBuilder(clazz.getPackage().getName());
- }
-
- /** Get an ActionBuilder.
- * If there is no ActionBuilder with name <var>key</var>, a new ActionBuilder is created and stored.
- * Future invocations of this method will constantly return that ActionBuilder unless the key is garbage collected.
- * If you must prevent the key from being garbage collected (and with it the ActionBuilder), you may internalize the key ({@link String#intern()}).
- * A good name for a key is the application or package name.
- * The <code><var>key</var></code> may be a package name, in which case it is tried to load a {@link ResourceBundle} named "action" from that
- * package and add it ({@link ActionBuilder#addBundle(ResourceBundle)}); nothing special happens if that fails.
- * @param baseName Name of ActionBuilder (which even may be <code>null</code> if you are too lazy to invent a key)
- * @return ActionBuilder for given key. The builder is created in case it didn't already exist.
- */
- @NotNull public ActionBuilder getActionBuilder(@Nullable final String baseName) {
- ActionBuilder builder = actionBuilders.get(baseName);
- if (builder == null) {
- builder = new DefaultActionBuilder(baseName);
- actionBuilders.put(baseName, builder);
- }
- return builder;
- }
-
- /** Stores an ActionBuilder.
- * In regular programs, an invocation of this operation should not be needed.
- * This operation is designed for tests that want to provide non-default ActionBuilders as Dummies, Stubs or Mocks.
- * @param baseName Basename to store an ActionBuilder for.
- * @param actionBuilder ActionBuilder to store.
- */
- public void putActionBuilder(@Nullable final String baseName, @NotNull final ActionBuilder actionBuilder) {
- actionBuilders.put(baseName, actionBuilder);
- }
-
-} // class ActionBuilderFactory
Deleted: libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionMethod.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionMethod.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionMethod.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Christian Hujer.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package net.sf.japi.swing;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import org.jetbrains.annotations.NotNull;
-
-/** Annotation for methods that are Actions.
- * {@link ActionBuilder} in future will automatically configure and store Actions with properties for methods that are annotated with this Annotation.
- * In future, this Annotation might get some attributes, but currently it hasn't got any.
- * There is no guarantee for future attributes to be optional.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-@Documented
-@Inherited
-@Retention(RUNTIME)
-@Target(METHOD)
-public @interface ActionMethod {
-
- /**
- * Determines the Action key.
- * Defaults to the method name.
- * @return The Action key for this ActionMethod or <code>""</code> if the method name should be used.
- */
- @NotNull String value() default "";
-
-} // @interface ActionMethod
Deleted: libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionProvider.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionProvider.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/ActionProvider.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2009 Christian Hujer.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package net.sf.japi.swing;
-
-import javax.swing.Action;
-import org.jetbrains.annotations.Nullable;
-
-/** Interface for classes that provide actions.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public interface ActionProvider {
-
- /** Get an action that matches a specific key or <code>null</code> if no such action was found.
- * @param key Key to find
- * @return Action for <var>key</var> or <code>null</code>
- */
- @Nullable Action getAction(final String key);
-
-} // interface ActionProvider
Deleted: libs/swing-action/trunk/src/prj/net/sf/japi/swing/ComponentFactory.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/ComponentFactory.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/ComponentFactory.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 Christian Hujer.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package net.sf.japi.swing;
-
-import javax.swing.Action;
-import javax.swing.JToolBar;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/** The ComponentFactory provides some convenience methods for creating Swing Components.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- * @todo Since this doesn't require an ActionBuilder, this should be in a different library / package.
- */
-public final class ComponentFactory {
-
- /** Utility class - do not instanciate. */
- private ComponentFactory() {
- }
-
- /** Creates a JToolBar from Actions.
- * @param name Name of the JToolBar, which is used as title for the undocked JToolBar.
- * @param actions Actions to create JToolBar for.
- * @return JToolBar with all supplied actions.
- */
- public static JToolBar createJToolBar(@Nullable final String name, @NotNull final Action... actions) {
- final JToolBar toolBar = name != null ? new JToolBar(name) : new JToolBar();
- for (final Action action : actions) {
- toolBar.add(action);
- }
- return toolBar;
- }
-
- /** Creates a JToolBar from Actions.
- * @param name Name of the JToolBar, which is used as title for the undocked JToolBar.
- * @param actions Actions to create JToolBar for.
- * @return JToolBar with all supplied actions.
- */
- public static JToolBar createJToolBar(@Nullable final String name, @NotNull final Iterable<Action> actions) {
- final JToolBar toolBar = name != null ? new JToolBar(name) : new JToolBar();
- for (final Action action : actions) {
- toolBar.add(action);
- }
- return toolBar;
- }
-
-} // class ComponentFactory
Deleted: libs/swing-action/trunk/src/prj/net/sf/japi/swing/DefaultActionBuilder.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/DefaultActionBuilder.java 2009-02-15 14:24:43 UTC (rev 898)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/DefaultActionBuilder.java 2009-02-15 15:41:47 UTC (rev 899)
@@ -1,1038 +0,0 @@
-/*
- * Copyright (C) 2009 Christian Hujer.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package net.sf.japi.swing;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.lang.reflect.Field;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import static java.util.ResourceBundle.getBundle;
-import java.util.prefs.Preferences;
-import static java.util.prefs.Preferences.userNodeForPackage;
-import javax.swing.Action;
-import static javax.swing.Action.ACCELERATOR_KEY;
-import static javax.swing.Action.LONG_DESCRIPTION;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
-import javax.swing.ActionMap;
-import javax.swing.Icon;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPopupMenu;
-import javax.swing.JToolBar;
-import javax.swing.KeyStroke;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.japi.swing.IconManager.getDefaultIconManager;
-import static net.sf.japi.swing.ReflectionAction.REFLECTION_MESSAGE_PROVIDER;
-import static net.sf.japi.swing.ReflectionAction.REFLECTION_TARGET;
-import static net.sf.japi.swing.ToggleAction.REFLECTION_PROPERTY_NAME;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/** Default implementation of {@link ActionBuilder}.
- * @todo Implement serialization.
- * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
- */
-public class DefaultActionBuilder implements ActionBuilder {
-
- /** The parent ActionBuilders. */
- @NotNull private final List<ActionBuilder> parents = new LinkedList<ActionBuilder>();
-
- /** The ResourceBundles to look for.
- * Type: ResourceBundle
- */
- @NotNull private final List<ResourceBundle> bundles = new LinkedList<ResourceBundle>();
-
- /** The Preferences to look for.
- * Type: Preferences
- */
- @NotNull private final List<Preferences> prefs = new LinkedList<Preferences>();
-
- /** The ActionMap to which created Actions are automatically added. */
- @NotNull private final ActionMap actionMap = new NamedActionMap();
-
- /** The action providers that were registered and will be queried when an action should be created / retrieved. */
- private final List<ActionProvider> actionProviders = new ArrayList<ActionProvider>();
-
- /** Add a ResourceBundle to the list of used bundles.
- * @param baseName the base name of the resource bundle, a fully qualified class name
- * @see ResourceBundle#getBundle(String)
- */
- public void addBundle(@NotNull final String baseName) {
- //noinspection Co...
[truncated message content] |