[Jguiraffe-developers] SF.net SVN: jguiraffe:[196] trunk
Brought to you by:
oheger
|
From: <oh...@us...> - 2010-09-03 17:28:48
|
Revision: 196
http://jguiraffe.svn.sourceforge.net/jguiraffe/?rev=196&view=rev
Author: oheger
Date: 2010-09-03 17:28:38 +0000 (Fri, 03 Sep 2010)
Log Message:
-----------
Fixed findbugs errors. Further wrapper implementations. Site improvements and release preparations.
Modified Paths:
--------------
trunk/core/pom.xml
trunk/core/src/main/java/net/sf/jguiraffe/di/BeanCreationEvent.java
trunk/core/src/main/java/net/sf/jguiraffe/di/impl/Invocation.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManager.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/WidgetHandler.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/model/TreeExpansionEvent.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ListModelUtils.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ProgressBarTag.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormEvent.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormListenerType.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManager.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/ctrl/FormControllerValidationEvent.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/cmd/CommandQueueEvent.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/NumberWithUnit.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/PercentLayoutBase.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/action/SwingActionManager.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingProgressBarHandler.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingTabbedPaneHandler.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/table/SwingTableModel.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/layout/SwingSizeHandler.java
trunk/core/src/main/java/net/sf/jguiraffe/locators/URLLocator.java
trunk/core/src/main/java/net/sf/jguiraffe/transform/ValidationMessageConstants.java
trunk/core/src/site/site.xml
trunk/core/src/test/java/net/sf/jguiraffe/di/impl/AbstractInvocationTest.java
trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/components/TestComponentManagerWrapper.java
trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/impl/TestJellyBeanBuilder.java
trunk/core/src/test/java/net/sf/jguiraffe/gui/layout/TestPercentLayout.java
trunk/core/src/test/java/net/sf/jguiraffe/locators/TestURLLocator.java
trunk/examples/pom.xml
trunk/examples/src/site/site.xml
trunk/pom.xml
trunk/src/site/site.xml
trunk/src/site/xdoc/index.xml
Added Paths:
-----------
trunk/RELEASE-NOTES.txt
trunk/conf/KEYS
trunk/conf/findbugs-exclude.xml
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManagerWrapper.java
trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManagerWrapper.java
trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/action/TestActionManagerWrapper.java
trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/window/TestWindowManagerWrapper.java
trunk/src/assembly/
trunk/src/assembly/bin.xml
trunk/src/assembly/src.xml
Added: trunk/RELEASE-NOTES.txt
===================================================================
--- trunk/RELEASE-NOTES.txt (rev 0)
+++ trunk/RELEASE-NOTES.txt 2010-09-03 17:28:38 UTC (rev 196)
@@ -0,0 +1,23 @@
+$Id$
+
+ JGUIraffe Library
+ Version 1.0
+ Release Notes
+
+
+INTRODUCTION
+============
+
+This document contains the release notes for this version of the JGUIraffe
+library. JGUIraffe is a framework supporting the implementation of Java
+desktop applications using concepts like declarative UI definition, action and
+command objects, and dependency injection.
+
+This is the first release of JGUIraffe.
+
+Comprehensive documentation about the JGUIraffe library is available on
+the project's web site
+ http://jguiraffe.sourceforge.net/
+
+A user's guide can be fount at
+ http://jguiraffe.sourceforge.net/jguiraffe/userguide/user_guide.html
Property changes on: trunk/RELEASE-NOTES.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/conf/KEYS
===================================================================
--- trunk/conf/KEYS (rev 0)
+++ trunk/conf/KEYS 2010-09-03 17:28:38 UTC (rev 196)
@@ -0,0 +1,42 @@
+This file contains the keys used for signing JGUIraffe artifacts.
+Import the keys using one of the following commands:
+ pgp < KEYS
+ gpg --import KEYS
+
+After that pgp or gpg can be used to verify the signatures of downloaded
+JGUIraffe artifacts.
+
+pub 1024D/D75CF3DC 2005-02-09
+uid Oliver Heger (CODE SIGNING KEY) <oh...@ap...>
+sig 3 D75CF3DC 2005-02-09 Oliver Heger (CODE SIGNING KEY) <oh...@ap...>
+sig 3 D75CF3DC 2005-02-09 Oliver Heger (CODE SIGNING KEY) <oh...@ap...>
+sub 1024g/E5A7764F 2005-02-09
+sig D75CF3DC 2005-02-09 Oliver Heger (CODE SIGNING KEY) <oh...@ap...>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.10 (MingW32)
+
+mQGiBEIKY9oRBACP354Cc/RrUGb19JCaNTpnJi/QlOVGg9VMcumnVf+/NPKEwm8x
+rAGFkL/OpDXYbMPP0yEZ9W1ABaor5azA0U3C6QhQrf4wHcGAUmfytcu5AcdJQEAB
+iIn+R9hlsWm4X7yOokHiEF0x35YZW1dFJA14RERalrdMd0ynkfSX3uT+swCgsfKb
+4pena5krbWZQE+cVMkQC7T0D/RThlQHlePkpmV/GBi7wahJBUOTRj4oRPkcJJq0N
+Ov3RrG70gJXsaZOTFgSZNrXY2y/1imn/ijnMtZx/fC/+ILol5FnkvIqWjLD6wg7k
+Q5c5JysTjlBLNf29/uzoHDMHGzFTU6xrB/hdVXG6vjUtd5bZ6NNVMbepNocWo19s
+LEjAA/4nOTD5BOto6CYbvQqvYkxdTGUw520sx101bDnITA5Wuooa4yoi5VtWxD4B
+b9lZWtA43WPS/cmTYq2PVlMK1ckAMc+5CvI4EKuRQbK3V6PvDMSHqCG/QCtJ5SQr
+dTh3o9eIP0AcTdy63Bui6/omQ+JIYhs7M+BH/D2XVorHqmfU4LQzT2xpdmVyIEhl
+Z2VyIChDT0RFIFNJR05JTkcgS0VZKSA8b2hlZ2VyQGFwYWNoZS5vcmc+iF4EExEC
+AB4FAkIKY9oCGwMGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQfEUEpNdc89yaEQCc
+CK8LVZ6Thm4ovu7klWWDTSEQElsAoKCL8z3AHK/gSfRypEPum4z3LfnFiF4EExEC
+AB4FAkIKY9oCGwMGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQfEUEpNdc89yaEQCb
+BlRHNMtpv4SoV3ZE4Lk4QVqECqYAoJxZ7kNpGRXpHNmgRLqAWYXRbbQHuQENBEIK
+Y98QBADvq3R8EJ7idASVqvvQaxbD13WAGdGV+eAQA8Y0jJy2b1jIvNNk1AT6wcDh
+CQcByLpVlfK+4lJ3HY8jr481qYhzRzq+yVRXy3asd5lgCEWpEf/4eQDsYkAyU0/q
+hu3ZoyihzaRdREzVMh8miXdVs09iPo5uBvmk5dpAIlLHiZHf4wADBgQA4Umfa+Ao
+Xjqtsmeao67GIZIDtaBCFztaIHPSrqASLgdWMjIRJ/92xEXRyqeiAy/oxUado1No
+S+kJ9qY+21O0FXPkIt8CvH4Mh0HZDMyS6W3O4w/9hDSploj9wmHNMkEON4uYMgMn
+8+I4wCrPkEJMyaWuV1iTB+SxkdOI0UbKGpmISAQYEQIACQUCQgpj3wIbDAAKCRB8
+RQSk11zz3LAMAJICwier2ykv/kNdQLFoEjhZS/vdAJ9zWXBgSKARkMcT3OdjwoOv
+1sGStw==
+=xKwh
+-----END PGP PUBLIC KEY BLOCK-----
Added: trunk/conf/findbugs-exclude.xml
===================================================================
--- trunk/conf/findbugs-exclude.xml (rev 0)
+++ trunk/conf/findbugs-exclude.xml 2010-09-03 17:28:38 UTC (rev 196)
@@ -0,0 +1,30 @@
+<!--
+ Copyright 2006-2010 The GUIraffe Team.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- ===================================================================== -->
+<!-- $Id$ -->
+<!-- ===================================================================== -->
+<FindBugsFilter>
+ <Match>
+ <Class name="net.sf.jguiraffe.di.impl.DefaultBeanContext"/>
+ <Bug code="Wa"/>
+ </Match>
+
+ <Match>
+ <Class name="net.sf.jguiraffe.gui.builder.event.filter.TypeEventFilter"/>
+ <Bug code="REC"/>
+ </Match>
+</FindBugsFilter>
\ No newline at end of file
Property changes on: trunk/conf/findbugs-exclude.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/core/pom.xml
===================================================================
--- trunk/core/pom.xml 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/pom.xml 2010-09-03 17:28:38 UTC (rev 196)
@@ -24,7 +24,7 @@
<parent>
<groupId>net.sf.jguiraffe</groupId>
<artifactId>jguiraffe-parent</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
</parent>
<groupId>net.sf.jguiraffe</groupId>
@@ -117,20 +117,20 @@
<webAccessUrl>http://jguiraffe.svn.sourceforge.net/viewvc/jguiraffe/trunk</webAccessUrl>
<anonymousConnection>scm:svn:https://jguiraffe.svn.sourceforge.net/svnroot/jguiraffe/trunk</anonymousConnection>
<developerConnection>scm:svn:https://jguiraffe.svn.sourceforge.net/svnroot/jguiraffe/trunk</developerConnection>
- <reportSets>
- <reportSet>
- <reports>
- <report>index</report>
- <report>dependencies</report>
- <report>project-team</report>
- <report>mailing-list</report>
- <report>issue-tracking</report>
- <report>license</report>
- <report>scm</report>
- </reports>
- </reportSet>
- </reportSets>
</configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ <report>dependencies</report>
+ <report>project-team</report>
+ <report>mailing-list</report>
+ <report>issue-tracking</report>
+ <report>license</report>
+ <report>scm</report>
+ </reports>
+ </reportSet>
+ </reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -151,14 +151,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.3</version>
<configuration>
- <configLocation>${basedir}/../conf/checkstyle.xml</configLocation>
+ <configLocation>../conf/checkstyle.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.1</version>
+ <configuration>
+ <excludeFilterFile>../conf/findbugs-exclude.xml</excludeFilterFile>
+ </configuration>
</plugin>
</plugins>
</reporting>
@@ -178,6 +182,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
</plugins>
</build>
</profile>
Modified: trunk/core/src/main/java/net/sf/jguiraffe/di/BeanCreationEvent.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/di/BeanCreationEvent.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/di/BeanCreationEvent.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -42,13 +42,13 @@
private static final long serialVersionUID = 3858761676828030611L;
/** Stores the bean provider responsible for the creation. */
- private final BeanProvider beanProvider;
+ private final transient BeanProvider beanProvider;
/** The bean that was newly created. */
private final Object bean;
/** The dependency provider involved in the creation process. */
- private final DependencyProvider dependencyProvider;
+ private final transient DependencyProvider dependencyProvider;
/**
* Creates a new instance of {@code BeanCreationEvent} and initializes it.
Modified: trunk/core/src/main/java/net/sf/jguiraffe/di/impl/Invocation.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/di/impl/Invocation.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/di/impl/Invocation.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -116,7 +116,7 @@
*/
public ClassDescription[] getParameterTypes()
{
- return parameterTypes;
+ return parameterTypes.clone();
}
/**
@@ -199,7 +199,7 @@
*/
public Class<?>[] getParameterClasses(DependencyProvider depProvider)
{
- ClassDescription[] descs = getParameterTypes();
+ ClassDescription[] descs = parameterTypes;
Class<?>[] result = new Class<?>[descs.length];
for (int i = 0; i < descs.length; i++)
{
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManager.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManager.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManager.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -27,7 +27,7 @@
* </p>
* <p>
* This interface plays a similar role for the action builder as the
- * <code>{@link net.sf.jguiraffe.gui.forms.components.ComponentManager ComponentManager}</code>
+ * {@link net.sf.jguiraffe.gui.forms.components.ComponentManager ComponentManager}
* interface for the form builder: It hides the details of creating GUI library
* specific objects. Instead of form elements this interface deals with objects
* like actions, menus, and toolbar buttons.
@@ -39,6 +39,14 @@
* the objects they represent. With the objects created by this implementation
* the action related components of an application can be constructed.
* </p>
+ * <p>
+ * <strong>Note:</strong> This interface is not intended to be directly
+ * implemented by client code. It is subject to change even in minor releases as
+ * new features are made available. Therefore if an application needs to provide
+ * a custom implementation of this interface, it should extend an existing
+ * implementation. For instance, the {@link ActionManagerWrapper} class is a
+ * good candidate if only a subset of methods is to be modified.
+ * </p>
*
* @author Oliver Heger
* @version $Id$
Added: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManagerWrapper.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManagerWrapper.java (rev 0)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManagerWrapper.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2006-2010 The JGUIraffe Team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.jguiraffe.gui.builder.action;
+
+import net.sf.jguiraffe.gui.builder.components.ComponentBuilderData;
+import net.sf.jguiraffe.gui.builder.components.tags.TextIconData;
+import net.sf.jguiraffe.gui.forms.ComponentHandler;
+
+/**
+ * <p>
+ * A base class for wrapper implementations of the {@link ActionManager}
+ * interface.
+ * </p>
+ * <p>
+ * An instance of this class is initialized with a reference to an
+ * {@link ActionManager} object. All methods simply delegate to this object.
+ * </p>
+ * <p>
+ * This class is especially useful if a custom implementation of
+ * {@link ActionManager} is to be created based on an existing implementation.
+ * Then only the methods to be customized have to be implemented. All other
+ * methods can still delegate to the existing implementation.
+ * </p>
+ *
+ * @author Oliver Heger
+ * @version $Id$
+ */
+public abstract class ActionManagerWrapper implements ActionManager
+{
+ /** Stores the wrapped action manager. */
+ private final ActionManager wrappedManager;
+
+ /**
+ * Creates a new instance of {@code ActionManagerWrapper} and initializes it
+ * with the wrapped {@code ActionManager}. Note: This method does not check
+ * whether the passed in {@code ActionManager} object is <b>null</b> because
+ * we do not want to enforce this restriction on all subclasses. The passed
+ * in wrapped action manager is stored in an internal field and can be
+ * accessed using the {@link #getWrappedActionManager()} method. If a
+ * subclass needs another mechanism to access the wrapped manager, it has to
+ * override the {@link #getWrappedActionManager()} method.
+ *
+ * @param wrapped the wrapped {@code ActionManager}
+ */
+ protected ActionManagerWrapper(ActionManager wrapped)
+ {
+ wrappedManager = wrapped;
+ }
+
+ /**
+ * Returns a reference to the wrapped {@code ActionManager} object.
+ *
+ * @return the wrapped {@code ActionManager}
+ */
+ public ActionManager getWrappedActionManager()
+ {
+ return wrappedManager;
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public FormAction createAction(ActionBuilder actionBuilder,
+ ActionData actionData) throws FormActionException
+ {
+ return getWrappedActionManager()
+ .createAction(actionBuilder, actionData);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public Object createMenuItem(ActionBuilder actionBuilder,
+ FormAction action, boolean checked, Object parent)
+ throws FormActionException
+ {
+ return getWrappedActionManager().createMenuItem(actionBuilder, action,
+ checked, parent);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public ComponentHandler<?> createMenuItem(ActionBuilder actionBuilder,
+ ActionData actionData, boolean checked, Object parent)
+ throws FormActionException
+ {
+ return getWrappedActionManager().createMenuItem(actionBuilder,
+ actionData, checked, parent);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public Object createMenuBar(ActionBuilder actionBuilder)
+ throws FormActionException
+ {
+ return getWrappedActionManager().createMenuBar(actionBuilder);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public Object createMenu(ActionBuilder actionBuilder, Object menu,
+ TextIconData data, Object parent) throws FormActionException
+ {
+ return getWrappedActionManager().createMenu(actionBuilder, menu, data,
+ parent);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public Object createToolbar(ActionBuilder actionBuilder)
+ throws FormActionException
+ {
+ return getWrappedActionManager().createToolbar(actionBuilder);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public Object createToolbarButton(ActionBuilder actionBuilder,
+ FormAction action, boolean checked, Object parent)
+ throws FormActionException
+ {
+ return getWrappedActionManager().createToolbarButton(actionBuilder,
+ action, checked, parent);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public ComponentHandler<?> createToolbarButton(ActionBuilder actionBuilder,
+ ActionData data, boolean checked, Object parent)
+ throws FormActionException
+ {
+ return getWrappedActionManager().createToolbarButton(actionBuilder,
+ data, checked, parent);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public void addMenuSeparator(ActionBuilder actionBuilder, Object menu)
+ throws FormActionException
+ {
+ getWrappedActionManager().addMenuSeparator(actionBuilder, menu);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public void addToolBarSeparator(ActionBuilder actionBuilder, Object toolBar)
+ throws FormActionException
+ {
+ getWrappedActionManager().addToolBarSeparator(actionBuilder, toolBar);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code ActionManager} object.
+ */
+ public void registerPopupMenuHandler(Object component,
+ PopupMenuHandler handler, ComponentBuilderData compData)
+ throws FormActionException
+ {
+ getWrappedActionManager().registerPopupMenuHandler(component, handler,
+ compData);
+ }
+}
Property changes on: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/action/ActionManagerWrapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/WidgetHandler.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/WidgetHandler.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/WidgetHandler.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -28,11 +28,16 @@
* colors can be changed. This way it is possible to change the GUI dynamically.
* </p>
* <p>
- * <code>{@link ComponentBuilderData}</code> provides methods for obtaining
+ * {@link ComponentBuilderData} provides methods for obtaining
* the widgets created during the latest builder operation by name. After a
* <code>WidgetHandler</code> has been obtained this way, it can be used for
* doing something with the corresponding widget.
* </p>
+ * <p>
+ * <strong>Note:</strong> This interface is not intended to be directly
+ * implemented by client code. It is subject to change even in minor releases as
+ * new features are made available.
+ * </p>
*
* @author Oliver Heger
* @version $Id$
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/model/TreeExpansionEvent.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/model/TreeExpansionEvent.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/model/TreeExpansionEvent.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1078903161051276615L;
/** Stores the path to the modified node. */
- private final TreeNodePath path;
+ private final transient TreeNodePath path;
/** The type of this event. */
private final Type type;
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ListModelUtils.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ListModelUtils.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ListModelUtils.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -70,7 +70,7 @@
Object result = listModel.getValueObject(index);
if (result == null)
{
- result = new Integer(index);
+ result = Integer.valueOf(index);
}
return result;
}
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ProgressBarTag.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ProgressBarTag.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/components/tags/ProgressBarTag.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -110,10 +110,10 @@
public class ProgressBarTag extends InputComponentTag
{
/** Constant for the default minimum value. */
- private static final Integer DEF_MINIMUM = new Integer(0);
+ private static final Integer DEF_MINIMUM = 0;
/** Constant for the default maximum value. */
- private static final Integer DEF_MAXIMUM = new Integer(100);
+ private static final Integer DEF_MAXIMUM = 100;
/** A helper object for defining the progress text. */
private TextData textData;
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormEvent.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormEvent.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormEvent.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -24,12 +24,11 @@
* information related to form elements (controls or input components).
* </p>
* <p>
- * All input components in a
- * <code>{@link net.sf.jguiraffe.gui.forms.Form Form}</code> object (i.e. form
- * elements with an associated
- * <code>{@link net.sf.jguiraffe.gui.forms.ComponentHandler ComponentHandler}</code>
- * can act as event sources. Therefore all event objects contain a reference to
- * the component handler of the event source and the name under which the
+ * All input components in a {@link net.sf.jguiraffe.gui.forms.Form Form} object
+ * (i.e. form elements with an associated
+ * {@link net.sf.jguiraffe.gui.forms.ComponentHandler ComponentHandler} can act
+ * as event sources. Therefore all event objects contain a reference to the
+ * component handler of the event source and the name under which the
* corresponding component was registered at the form. These properties can be
* used by custom event listener implementations to find out, which component
* has caused the event and to access the component's current input data.
@@ -49,7 +48,7 @@
* Stores a reference to the component handler of the component that caused
* this event.
*/
- private final ComponentHandler<?> handler;
+ private final transient ComponentHandler<?> handler;
/** Stores the name of the component that caused this event. */
private final String name;
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormListenerType.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormListenerType.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/event/FormListenerType.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -224,6 +224,8 @@
*
* @param l the event listener
* @param event the event
+ * @throws ClassCastException if the listener object or the event are
+ * incompatible with the listener type
*/
public abstract void callListener(FormEventListener l, FormEvent event);
}
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManager.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManager.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManager.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -35,6 +35,14 @@
* their arguments to determine whether they are in the creation or the
* initialization phase.
* </p>
+ * <p>
+ * <strong>Note:</strong> This interface is not intended to be directly
+ * implemented by client code. It is subject to change even in minor releases as
+ * new features are made available. Therefore if an application needs to provide
+ * a custom implementation of this interface, it should extend an existing
+ * implementation. For instance, the {@link WindowManagerWrapper} class is a
+ * good candidate if only a subset of methods is to be modified.
+ * </p>
*
* @author Oliver Heger
* @version $Id$
Added: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManagerWrapper.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManagerWrapper.java (rev 0)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManagerWrapper.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006-2010 The JGUIraffe Team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.jguiraffe.gui.builder.window;
+
+/**
+ * <p>
+ * A base class for wrapper implementations of the {@link WindowManager}
+ * interface.
+ * </p>
+ * <p>
+ * An instance of this class is initialized with a reference to a
+ * {@link WindowManager} object. All methods simply delegate to this object.
+ * </p>
+ * <p>
+ * This class is especially useful if a custom implementation of
+ * {@link WindowManager} is to be created based on an existing implementation.
+ * Then only the methods to be customized have to be implemented. All other
+ * methods can still delegate to the existing implementation.
+ * </p>
+ *
+ * @author Oliver Heger
+ * @version $Id$
+ */
+public abstract class WindowManagerWrapper implements WindowManager
+{
+ /** The wrapped window manager. */
+ private final WindowManager wrappedManager;
+
+ /**
+ * Creates a new instance of {@code WindowManagerWrapper} and initializes it
+ * with the wrapped {@code WindowManager}. Note: This method does not check
+ * whether the passed in {@code WindowManager} object is <b>null</b> because
+ * we do not want to enforce this restriction on all subclasses. The passed
+ * in wrapped window manager is stored in an internal field and can be
+ * accessed using the {@link #getWrappedWindowManager()} method. If a
+ * subclass needs another mechanism to access the wrapped manager, it has to
+ * override the {@link #getWrappedWindowManager()} method.
+ *
+ * @param wrapped the wrapped {@code WindowManager}
+ */
+ protected WindowManagerWrapper(WindowManager wrapped)
+ {
+ wrappedManager = wrapped;
+ }
+
+ /**
+ * Returns a reference to the wrapped {@code WindowManager}.
+ *
+ * @return the wrapped {@code WindowManager}
+ */
+ public WindowManager getWrappedWindowManager()
+ {
+ return wrappedManager;
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code WindowManager} object.
+ */
+ public Window createFrame(WindowBuilderData builderData, WindowData data,
+ Window wnd) throws WindowBuilderException
+ {
+ return getWrappedWindowManager().createFrame(builderData, data, wnd);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code WindowManager} object.
+ */
+ public Window createInternalFrame(WindowBuilderData builderData,
+ WindowData data, Window wnd) throws WindowBuilderException
+ {
+ return getWrappedWindowManager().createInternalFrame(builderData, data,
+ wnd);
+ }
+
+ /**
+ * {@inheritDoc} Just delegates to the wrapped {@code WindowManager} object.
+ */
+ public Window createDialog(WindowBuilderData builderData, WindowData data,
+ boolean modal, Window wnd) throws WindowBuilderException
+ {
+ return getWrappedWindowManager().createDialog(builderData, data, modal,
+ wnd);
+ }
+}
Property changes on: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/WindowManagerWrapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/ctrl/FormControllerValidationEvent.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/ctrl/FormControllerValidationEvent.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/builder/window/ctrl/FormControllerValidationEvent.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -40,7 +40,7 @@
private static final long serialVersionUID = 20091209L;
/** The validation results. */
- private final FormValidatorResults validationResults;
+ private final transient FormValidatorResults validationResults;
/**
* Creates a new instance of {@code FormControllerValidationEvent} and
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/cmd/CommandQueueEvent.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/cmd/CommandQueueEvent.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/cmd/CommandQueueEvent.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -41,7 +41,7 @@
private static final long serialVersionUID = 7434520871707897320L;
/** Stores the <code>Command</code> object affected by this event. */
- private final Command command;
+ private final transient Command command;
/** Stores the event's type. */
private final Type type;
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/NumberWithUnit.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/NumberWithUnit.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/NumberWithUnit.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -43,7 +43,7 @@
public class NumberWithUnit implements Serializable
{
/** Constant for the special value zero. */
- public static final NumberWithUnit ZERO = new NumberWithUnit();
+ public static final NumberWithUnit ZERO;
/**
* The serial version UID.
@@ -297,4 +297,9 @@
{
return (n != null) ? n : ZERO;
}
+
+ static
+ {
+ ZERO = new NumberWithUnit();
+ }
}
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/PercentLayoutBase.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/PercentLayoutBase.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/layout/PercentLayoutBase.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -264,7 +264,7 @@
*/
public CellConstraints getColumnConstraints(int idx)
{
- return getAllColumnConstraints()[idx];
+ return getInternalAllColumnConstraints()[idx];
}
/**
@@ -286,8 +286,7 @@
*/
public CellConstraints[] getAllColumnConstraints()
{
- ensureInit();
- return columnConstraints;
+ return getInternalAllColumnConstraints().clone();
}
/**
@@ -298,7 +297,7 @@
*/
public CellConstraints getRowConstraints(int idx)
{
- return getAllRowConstraints()[idx];
+ return getInternalAllRowConstraints()[idx];
}
/**
@@ -320,8 +319,7 @@
*/
public CellConstraints[] getAllRowConstraints()
{
- ensureInit();
- return rowConstraints;
+ return getInternalAllRowConstraints().clone();
}
/**
@@ -492,6 +490,38 @@
}
/**
+ * Returns the internal array of all cell constraints objects for the
+ * layout's column. This method can be used by subclasses for direct
+ * read-only access to the layout's column constraints. The public
+ * {@link #getAllColumnConstraints()} method returns a defensive copy of
+ * this array. So for performance reasons this method should be used by
+ * subclasses.
+ *
+ * @return the array with the layout's column constraints objects
+ */
+ protected final CellConstraints[] getInternalAllColumnConstraints()
+ {
+ ensureInit();
+ return columnConstraints;
+ }
+
+ /**
+ * Returns the internal array of all cell constraints objects for the
+ * layout's rows. This method can be used by subclasses for direct read-only
+ * access to the layout's row constraints. The public
+ * {@link #getAllRowConstraints()} method returns a defensive copy of this
+ * array. So for performance reasons this method should be used by
+ * subclasses.
+ *
+ * @return the array with the layout's row constraints objects
+ */
+ protected final CellConstraints[] getInternalAllRowConstraints()
+ {
+ ensureInit();
+ return rowConstraints;
+ }
+
+ /**
* Returns the component at the specified position of this layout.
*
* @param col the column
@@ -723,9 +753,9 @@
*/
private Dimension calcLayoutSize(Object container, boolean minimum)
{
- int[] colSizes = calcCellSizesWithGroups(getAllColumnConstraints(),
+ int[] colSizes = calcCellSizesWithGroups(getInternalAllColumnConstraints(),
getRowCount(), getColumnGroups(), container, minimum, false);
- int[] rowSizes = calcCellSizesWithGroups(getAllRowConstraints(),
+ int[] rowSizes = calcCellSizesWithGroups(getInternalAllRowConstraints(),
getColumnCount(), getRowGroups(), container, minimum, true);
return new Dimension(sumUpSizes(colSizes), sumUpSizes(rowSizes));
}
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/action/SwingActionManager.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/action/SwingActionManager.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/action/SwingActionManager.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -80,7 +80,7 @@
initActionProperty(action, Action.SMALL_ICON, actionData.getIcon());
if (actionData.getMnemonicKey() > 0)
{
- initActionProperty(action, Action.MNEMONIC_KEY, new Integer(
+ initActionProperty(action, Action.MNEMONIC_KEY, Integer.valueOf(
actionData.getMnemonicKey()));
}
initActionProperty(action, Action.ACCELERATOR_KEY,
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingProgressBarHandler.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingProgressBarHandler.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingProgressBarHandler.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -112,7 +112,7 @@
*/
public Integer getData()
{
- return new Integer(getValue());
+ return Integer.valueOf(getValue());
}
/**
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingTabbedPaneHandler.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingTabbedPaneHandler.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/SwingTabbedPaneHandler.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -78,7 +78,7 @@
*/
public Integer getData()
{
- return new Integer(getTabbedPane().getSelectedIndex());
+ return Integer.valueOf(getTabbedPane().getSelectedIndex());
}
/**
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/table/SwingTableModel.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/table/SwingTableModel.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/builder/components/table/SwingTableModel.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -85,10 +85,10 @@
private final JTable table;
/** Holds a reference to the associated custom renderer implementation. */
- private TableCellRenderer customRenderer;
+ private transient TableCellRenderer customRenderer;
/** Holds a reference to the associated custom editor implementation. */
- private TableCellEditor customEditor;
+ private transient TableCellEditor customEditor;
/** Stores the index of the currently rendered row. */
private int renderedRowIndex;
Modified: trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/layout/SwingSizeHandler.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/layout/SwingSizeHandler.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/gui/platform/swing/layout/SwingSizeHandler.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -127,7 +127,8 @@
{
double[] result = new double[2];
FontMetrics fm = comp.getFontMetrics(font);
- result[IDX_FONTX] = fm.stringWidth(WIDTH_STRING) / WIDTH_STRING_LEN;
+ result[IDX_FONTX] =
+ (double) fm.stringWidth(WIDTH_STRING) / WIDTH_STRING_LEN;
result[IDX_FONTY] = fm.getHeight();
return result;
}
Modified: trunk/core/src/main/java/net/sf/jguiraffe/locators/URLLocator.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/locators/URLLocator.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/locators/URLLocator.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -131,7 +131,7 @@
}
URLLocator c = (URLLocator) obj;
- return getURL().equals(c.getURL());
+ return getURL().toExternalForm().equals(c.getURL().toExternalForm());
}
/**
@@ -142,7 +142,7 @@
@Override
public int hashCode()
{
- return getURL().hashCode();
+ return getURL().toExternalForm().hashCode();
}
/**
Modified: trunk/core/src/main/java/net/sf/jguiraffe/transform/ValidationMessageConstants.java
===================================================================
--- trunk/core/src/main/java/net/sf/jguiraffe/transform/ValidationMessageConstants.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/main/java/net/sf/jguiraffe/transform/ValidationMessageConstants.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -28,7 +28,7 @@
* @author Oliver Heger
* @version $Id$
*/
-public class ValidationMessageConstants
+public final class ValidationMessageConstants
{
/**
* The default caption of a message box for displaying validation messages.
@@ -122,4 +122,11 @@
* The input does not match the specified pattern.
*/
public static final String ERR_PATTERN = "ERR_PATTERN";
+
+ /**
+ * Private constructor so that no instances can be created.
+ */
+ private ValidationMessageConstants()
+ {
+ }
}
Modified: trunk/core/src/site/site.xml
===================================================================
--- trunk/core/src/site/site.xml 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/site/site.xml 2010-09-03 17:28:38 UTC (rev 196)
@@ -33,7 +33,7 @@
<body>
<links>
<item name="Top" href="../index.html"/>
- <item name="SourceForge" href="http://www.sourceforge.org/"/>
+ <item name="SourceForge" href="http://sourceforge.net/projects/jguiraffe/"/>
</links>
<menu name="JGuiraffe">
Modified: trunk/core/src/test/java/net/sf/jguiraffe/di/impl/AbstractInvocationTest.java
===================================================================
--- trunk/core/src/test/java/net/sf/jguiraffe/di/impl/AbstractInvocationTest.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/test/java/net/sf/jguiraffe/di/impl/AbstractInvocationTest.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -183,6 +183,20 @@
}
/**
+ * Tests that the parameter types cannot be manipulated.
+ */
+ @Test
+ public void testGetParameterTypesModify()
+ {
+ Invocation inv = createInvocation(TARGET_CLASS, PARAM_TYPES, paramDeps);
+ ClassDescription[] types = inv.getParameterTypes();
+ ClassDescription cd = types[0];
+ types[0] = null;
+ ClassDescription[] types2 = inv.getParameterTypes();
+ assertEquals("Description was changed", cd, types2[0]);
+ }
+
+ /**
* Tests the constructor when an invalid number of parameter types is
* passed. This should cause an exception.
*/
@@ -240,6 +254,18 @@
}
/**
+ * Tests that the list of parameter dependencies cannot be modified.
+ */
+ @Test(expected = UnsupportedOperationException.class)
+ public void testGetParameterDependenciesModify()
+ {
+ Invocation inv = createInvocation(TARGET_CLASS, PARAM_TYPES, paramDeps);
+ Iterator<Dependency> it = inv.getParameterDependencies().iterator();
+ it.next();
+ it.remove();
+ }
+
+ /**
* Tests the isTypeInfoComplete() method if the type info is complete.
*/
@Test
Added: trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/action/TestActionManagerWrapper.java
===================================================================
--- trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/action/TestActionManagerWrapper.java (rev 0)
+++ trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/action/TestActionManagerWrapper.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2006-2010 The JGUIraffe Team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.jguiraffe.gui.builder.action;
+
+import static org.junit.Assert.assertSame;
+import net.sf.jguiraffe.gui.builder.components.ComponentBuilderData;
+import net.sf.jguiraffe.gui.builder.components.tags.LabelTag;
+import net.sf.jguiraffe.gui.builder.components.tags.TextIconData;
+import net.sf.jguiraffe.gui.forms.ComponentHandler;
+
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test class for {@code ActionManagerWrapper}.
+ *
+ * @author Oliver Heger
+ * @version $Id$
+ */
+public class TestActionManagerWrapper
+{
+ /** The mock for the wrapped action manager. */
+ private ActionManager wrappedManager;
+
+ /** The wrapper to be tested. */
+ private ActionManagerWrapper wrapper;
+
+ @Before
+ public void setUp() throws Exception
+ {
+ wrappedManager = EasyMock.createMock(ActionManager.class);
+ wrapper = new ActionManagerWrapper(wrappedManager)
+ {
+ };
+ }
+
+ /**
+ * Replays the specified mock objects including the mock for the wrapped
+ * manager.
+ *
+ * @param mocks the mocks to be replayed
+ */
+ private void replay(Object... mocks)
+ {
+ EasyMock.replay(mocks);
+ EasyMock.replay(wrappedManager);
+ }
+
+ /**
+ * Verifies the specified mock objects including the mock for the wrapped
+ * manager.
+ *
+ * @param mocks the mocks to be verified
+ */
+ private void verify(Object... mocks)
+ {
+ EasyMock.verify(mocks);
+ EasyMock.verify(wrappedManager);
+ }
+
+ /**
+ * Tests whether the correct manager is returned.
+ */
+ @Test
+ public void testGetWrappedActionManager()
+ {
+ assertSame("Wrong wrapped manager", wrappedManager,
+ wrapper.getWrappedActionManager());
+ }
+
+ /**
+ * Tests the createAction() implementation.
+ */
+ @Test
+ public void testCreateAction() throws FormActionException
+ {
+ FormAction action = EasyMock.createMock(FormAction.class);
+ ActionData data = EasyMock.createMock(ActionData.class);
+ ActionBuilder builder = new ActionBuilder();
+ EasyMock.expect(wrappedManager.createAction(builder, data)).andReturn(
+ action);
+ replay(action, data);
+ assertSame("Wrong action", action, wrapper.createAction(builder, data));
+ verify(action, data);
+ }
+
+ /**
+ * Tests the createMenuItem() implementation which expects an action.
+ */
+ @Test
+ public void testCreateMenuItemFromAction() throws FormActionException
+ {
+ FormAction action = EasyMock.createMock(FormAction.class);
+ final Object parent = new Object();
+ final Object item = new Object();
+ ActionBuilder builder = new ActionBuilder();
+ EasyMock.expect(
+ wrappedManager.createMenuItem(builder, action, true, parent))
+ .andReturn(item);
+ replay(action);
+ assertSame("Wrong item", item,
+ wrapper.createMenuItem(builder, action, true, parent));
+ verify(action);
+ }
+
+ /**
+ * Tests the createMenuItem() implementation which expects a data object.
+ */
+ @Test
+ public void testCreateMenuItemFromData() throws FormActionException
+ {
+ ActionData data = EasyMock.createMock(ActionData.class);
+ ComponentHandler<?> ch = EasyMock.createMock(ComponentHandler.class);
+ ActionBuilder builder = new ActionBuilder();
+ final Object parent = new Object();
+ wrappedManager.createMenuItem(builder, data, false, parent);
+ EasyMock.expectLastCall().andReturn(ch);
+ replay(data, ch);
+ assertSame("Wrong component handler", ch,
+ wrapper.createMenuItem(builder, data, false, parent));
+ verify(data, ch);
+ }
+
+ /**
+ * Tests the createMenuBar() implementation.
+ */
+ @Test
+ public void testCreateMenuBar() throws FormActionException
+ {
+ ActionBuilder builder = new ActionBuilder();
+ final Object bar = new Object();
+ EasyMock.expect(wrappedManager.createMenuBar(builder)).andReturn(bar);
+ replay();
+ assertSame("Wrong menu bar", bar, wrapper.createMenuBar(builder));
+ verify();
+ }
+
+ /**
+ * Tests the createMenu() implementation.
+ */
+ @Test
+ public void testCreateMenu() throws FormActionException
+ {
+ ActionBuilder builder = new ActionBuilder();
+ final Object menu = new Object();
+ final Object newMenu = new Object();
+ final Object parent = new Object();
+ final TextIconData tiData = new TextIconData(new LabelTag());
+ EasyMock.expect(
+ wrappedManager.createMenu(builder, menu, tiData, parent))
+ .andReturn(newMenu);
+ replay();
+ assertSame("Wrong menu", newMenu,
+ wrapper.createMenu(builder, menu, tiData, parent));
+ verify();
+ }
+
+ /**
+ * Tests the createToolbar() implementation.
+ */
+ @Test
+ public void testCreateToolbar() throws FormActionException
+ {
+ ActionBuilder builder = new ActionBuilder();
+ final Object toolbar = new Object();
+ EasyMock.expect(wrappedManager.createToolbar(builder)).andReturn(
+ toolbar);
+ replay();
+ assertSame("Wrong tool bar", toolbar, wrapper.createToolbar(builder));
+ verify();
+ }
+
+ /**
+ * Tests the createToolbarButton() implementation which expects an action.
+ */
+ @Test
+ public void testCreateToolbarButtonFromAction() throws FormActionException
+ {
+ FormAction action = EasyMock.createMock(FormAction.class);
+ ActionBuilder builder = new ActionBuilder();
+ final Object parent = new Object();
+ final Object button = new Object();
+ EasyMock.expect(
+ wrappedManager.createToolbarButton(builder, action, true,
+ parent)).andReturn(button);
+ replay(action);
+ assertSame("Wrong button", button,
+ wrapper.createToolbarButton(builder, action, true, parent));
+ verify(action);
+ }
+
+ /**
+ * Tests the createToolbarButton() implementation which expects a data
+ * object.
+ */
+ @Test
+ public void testCreateToolbarButtonFromData() throws FormActionException
+ {
+ ActionData data = EasyMock.createMock(ActionData.class);
+ ComponentHandler<?> ch = EasyMock.createMock(ComponentHandler.class);
+ ActionBuilder builder = new ActionBuilder();
+ final Object parent = new Object();
+ wrappedManager.createToolbarButton(builder, data, false, parent);
+ EasyMock.expectLastCall().andReturn(ch);
+ replay(data, ch);
+ assertSame("Wrong component handler", ch,
+ wrapper.createToolbarButton(builder, data, false, parent));
+ verify(data, ch);
+ }
+
+ /**
+ * Tests the addMenuSeparator() implementation.
+ */
+ @Test
+ public void testAddMenuSeparator() throws FormActionException
+ {
+ ActionBuilder builder = new ActionBuilder();
+ final Object menu = new Object();
+ wrappedManager.addMenuSeparator(builder, menu);
+ replay();
+ wrapper.addMenuSeparator(builder, menu);
+ verify();
+ }
+
+ /**
+ * Tests the addToolbarSeparator() implementation.
+ */
+ @Test
+ public void testAddToolbarSeparator() throws FormActionException
+ {
+ ActionBuilder builder = new ActionBuilder();
+ final Object toolbar = new Object();
+ wrappedManager.addToolBarSeparator(builder, toolbar);
+ replay();
+ wrapper.addToolBarSeparator(builder, toolbar);
+ verify();
+ }
+
+ /**
+ * Tests the registerPopupMenuHandler() implementation.
+ */
+ @Test
+ public void testRegisterPopupMenuHandler() throws FormActionException
+ {
+ PopupMenuHandler ph = EasyMock.createMock(PopupMenuHandler.class);
+ ComponentBuilderData compData = new ComponentBuilderData();
+ final Object comp = new Object();
+ wrappedManager.registerPopupMenuHandler(comp, ph, compData);
+ replay(ph);
+ wrapper.registerPopupMenuHandler(comp, ph, compData);
+ verify(ph);
+ }
+}
Property changes on: trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/action/TestActionManagerWrapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/components/TestComponentManagerWrapper.java
===================================================================
--- trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/components/TestComponentManagerWrapper.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/components/TestComponentManagerWrapper.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -61,7 +61,7 @@
public class TestComponentManagerWrapper
{
/** The mock object for the wrapped manager. */
- ComponentManager wrappedManager;
+ private ComponentManager wrappedManager;
/** The wrapper to be tested. */
private ComponentManagerWrapper wrapper;
Modified: trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/impl/TestJellyBeanBuilder.java
===================================================================
--- trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/impl/TestJellyBeanBuilder.java 2010-08-30 19:54:41 UTC (rev 195)
+++ trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/impl/TestJellyBeanBuilder.java 2010-09-03 17:28:38 UTC (rev 196)
@@ -79,8 +79,9 @@
public class TestJellyBeanBuilder
{
/** An array with the names of the stores defined by the test script. */
- private static final String[] STORE_NAMES =
- { "beans", "const", "special" };
+ private static final String[] STORE_NAMES = {
+ "beans", "const", "special"
+ };
/** An array with the elements produced by collection tags. */
private static final Object[] COL_ELEMENTS = {
@@ -104,6 +105,15 @@
/** Constant for the the value of the string property. */
private static final String STR_PROP = "Test";
+ /** Constant for the windows-style line endings. */
+ private static final String WND_LF = "\r\n";
+
+ /** Constant for the CR character. */
+ private static final char CR = '\r';
+
+ /** Constant for the LF character. */
+ private static final char LF = '\n';
+
/** Constant for the value of the int property. */
private static final int INT_PROP = 42;
@@ -1008,16 +1018,30 @@
@Test
public void testBuildValueTag() throws BuilderException
{
- final String newLine = System.getProperty("line.separator");
final String beanName = "valueTest";
BeanContext context = setUpContext();
- ReflectionTestClass bean = (ReflectionTestClass) context
- .getBean(beanName);
- assertEquals("Wrong value", "Line 1" + newLine + "Line 2" + newLine
- + "Line 3", bean.getStringProp());
+ ReflectionTestClass bean =
+ (ReflectionTestClass) context.getBean(beanName);
+ assertEquals("Wrong value", "Line 1" + LF + "Line 2" + LF + "Line 3",
+ fixCR(bean.getStringProp()));
}
/**
+ * Normalizes the line endings in the specified string. This is needed on
+ * operating systems with different conventions for line endings. The
+ * resulting string contains only the LF character for line endings.
+ *
+ * @param s the string to be processed
+ * @return the string with normalized line endings
+ */
+ private static String fixCR(String s)
+ {
+ String result = s.replace(WND_LF, String.valueOf(LF));
+ result = result.replace(CR, LF);
+ return result;
+ }
+
+ /**
* Tests whether the value tag does not escape its body.
*/
@Test
Added: trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/window/TestWindowManagerWrapper.java
===================================================================
--- trunk/core/src/test/java/net/sf/jguiraffe/gui/builder/window/TestWindowManagerWrapp...
[truncated message content] |