From 3b5793fd5540f8eee3c9a0ef49e2688c9505920c Mon Sep 17 00:00:00 2001 From: Jani Laakso Date: Tue, 4 Dec 2007 19:51:22 +0000 Subject: License header parametrized Cleanup performed Organized imports Format svn changeset:3162/svn branch:trunk --- src/com/itmill/toolkit/event/Action.java | 30 ++---------- src/com/itmill/toolkit/event/EventRouter.java | 52 ++++++--------------- src/com/itmill/toolkit/event/ListenerMethod.java | 54 ++++++---------------- .../itmill/toolkit/event/MethodEventSource.java | 30 ++---------- src/com/itmill/toolkit/event/ShortcutAction.java | 8 +++- 5 files changed, 41 insertions(+), 133 deletions(-) (limited to 'src/com/itmill/toolkit/event') diff --git a/src/com/itmill/toolkit/event/Action.java b/src/com/itmill/toolkit/event/Action.java index f2551f2b7b..6e80e504b6 100644 --- a/src/com/itmill/toolkit/event/Action.java +++ b/src/com/itmill/toolkit/event/Action.java @@ -1,30 +1,6 @@ -/* ************************************************************************* - - IT Mill Toolkit - - Development of Browser User Interfaces Made Easy - - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* - - This product is distributed under commercial license that can be found - from the product package on license.pdf. Use of this product might - require purchasing a commercial license from IT Mill Ltd. For guidelines - on usage, see licensing-guidelines.html - - ************************************************************************* - - For more information, contact: - - IT Mill Ltd phone: +358 2 4802 7180 - Ruukinkatu 2-4 fax: +358 2 4802 7181 - 20540, Turku email: info@itmill.com - Finland company www: www.itmill.com - - Primary source for information and releases: www.itmill.com - - ********************************************************************** */ +/* +@ITMillApache2LicenseForJavaFiles@ + */ package com.itmill.toolkit.event; diff --git a/src/com/itmill/toolkit/event/EventRouter.java b/src/com/itmill/toolkit/event/EventRouter.java index a71a3e1874..c6f04c51ad 100644 --- a/src/com/itmill/toolkit/event/EventRouter.java +++ b/src/com/itmill/toolkit/event/EventRouter.java @@ -1,30 +1,6 @@ -/* ************************************************************************* - - IT Mill Toolkit - - Development of Browser User Interfaces Made Easy - - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* - - This product is distributed under commercial license that can be found - from the product package on license.pdf. Use of this product might - require purchasing a commercial license from IT Mill Ltd. For guidelines - on usage, see licensing-guidelines.html - - ************************************************************************* - - For more information, contact: - - IT Mill Ltd phone: +358 2 4802 7180 - Ruukinkatu 2-4 fax: +358 2 4802 7181 - 20540, Turku email: info@itmill.com - Finland company www: www.itmill.com - - Primary source for information and releases: www.itmill.com - - ********************************************************************** */ +/* +@ITMillApache2LicenseForJavaFiles@ + */ package com.itmill.toolkit.event; @@ -86,14 +62,14 @@ public class EventRouter implements MethodEventSource { public void removeListener(Class eventType, Object target) { if (listenerList != null) { - Iterator i = listenerList.iterator(); + final Iterator i = listenerList.iterator(); while (i.hasNext()) { try { - ListenerMethod lm = (ListenerMethod) i.next(); + final ListenerMethod lm = (ListenerMethod) i.next(); if (lm.matches(eventType, target)) { i.remove(); } - } catch (java.lang.ClassCastException e) { + } catch (final java.lang.ClassCastException e) { // Class cast exceptions are ignored } } @@ -108,14 +84,14 @@ public class EventRouter implements MethodEventSource { public void removeListener(Class eventType, Object target, Method method) { if (listenerList != null) { - Iterator i = listenerList.iterator(); + final Iterator i = listenerList.iterator(); while (i.hasNext()) { try { - ListenerMethod lm = (ListenerMethod) i.next(); + final ListenerMethod lm = (ListenerMethod) i.next(); if (lm.matches(eventType, target, method)) { i.remove(); } - } catch (java.lang.ClassCastException e) { + } catch (final java.lang.ClassCastException e) { // Class cast exceptions are ignored } } @@ -130,7 +106,7 @@ public class EventRouter implements MethodEventSource { public void removeListener(Class eventType, Object target, String methodName) { // Find the correct method - Method[] methods = target.getClass().getMethods(); + final Method[] methods = target.getClass().getMethods(); Method method = null; for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { @@ -143,14 +119,14 @@ public class EventRouter implements MethodEventSource { // Remove the listeners if (listenerList != null) { - Iterator i = listenerList.iterator(); + final Iterator i = listenerList.iterator(); while (i.hasNext()) { try { - ListenerMethod lm = (ListenerMethod) i.next(); + final ListenerMethod lm = (ListenerMethod) i.next(); if (lm.matches(eventType, target, method)) { i.remove(); } - } catch (java.lang.ClassCastException e) { + } catch (final java.lang.ClassCastException e) { // Class cast exceptions are ignored } } @@ -178,7 +154,7 @@ public class EventRouter implements MethodEventSource { // Send the event to all listeners. The listeners themselves // will filter out unwanted events. - Iterator i = new LinkedList(listenerList).iterator(); + final Iterator i = new LinkedList(listenerList).iterator(); while (i.hasNext()) { ((ListenerMethod) i.next()).receiveEvent(event); } diff --git a/src/com/itmill/toolkit/event/ListenerMethod.java b/src/com/itmill/toolkit/event/ListenerMethod.java index 07c9866e37..0b0d51cf58 100644 --- a/src/com/itmill/toolkit/event/ListenerMethod.java +++ b/src/com/itmill/toolkit/event/ListenerMethod.java @@ -1,30 +1,6 @@ -/* ************************************************************************* - - IT Mill Toolkit - - Development of Browser User Interfaces Made Easy - - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* - - This product is distributed under commercial license that can be found - from the product package on license.pdf. Use of this product might - require purchasing a commercial license from IT Mill Ltd. For guidelines - on usage, see licensing-guidelines.html - - ************************************************************************* - - For more information, contact: - - IT Mill Ltd phone: +358 2 4802 7180 - Ruukinkatu 2-4 fax: +358 2 4802 7181 - 20540, Turku email: info@itmill.com - Finland company www: www.itmill.com - - Primary source for information and releases: www.itmill.com - - ********************************************************************** */ +/* +@ITMillApache2LicenseForJavaFiles@ + */ package com.itmill.toolkit.event; @@ -64,18 +40,18 @@ public class ListenerMethod implements EventListener { * Type of the event that should trigger this listener. Also the subclasses * of this class are accepted to trigger the listener. */ - private Class eventType; + private final Class eventType; /** * The object containing the trigger method. */ - private Object object; + private final Object object; /** * The trigger method to call when an event passing the given criteria * fires. */ - private Method method; + private final Method method; /** * Optional argument set to pass to the trigger method. @@ -189,7 +165,7 @@ public class ListenerMethod implements EventListener { throws java.lang.IllegalArgumentException { // Finds the correct method - Method[] methods = object.getClass().getMethods(); + final Method[] methods = object.getClass().getMethods(); Method method = null; for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { @@ -296,7 +272,7 @@ public class ListenerMethod implements EventListener { Object[] arguments) throws java.lang.IllegalArgumentException { // Find the correct method - Method[] methods = object.getClass().getMethods(); + final Method[] methods = object.getClass().getMethods(); Method method = null; for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { @@ -351,7 +327,7 @@ public class ListenerMethod implements EventListener { this.method = method; eventArgumentIndex = -1; - Class[] params = method.getParameterTypes(); + final Class[] params = method.getParameterTypes(); if (params.length == 0) { arguments = new Object[0]; @@ -395,7 +371,7 @@ public class ListenerMethod implements EventListener { throws java.lang.IllegalArgumentException { // Finds the correct method - Method[] methods = object.getClass().getMethods(); + final Method[] methods = object.getClass().getMethods(); Method method = null; for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { @@ -411,7 +387,7 @@ public class ListenerMethod implements EventListener { this.method = method; eventArgumentIndex = -1; - Class[] params = method.getParameterTypes(); + final Class[] params = method.getParameterTypes(); if (params.length == 0) { arguments = new Object[0]; @@ -443,7 +419,7 @@ public class ListenerMethod implements EventListener { if (eventArgumentIndex == 0 && arguments.length == 1) { method.invoke(object, new Object[] { event }); } else { - Object[] arg = new Object[arguments.length]; + final Object[] arg = new Object[arguments.length]; for (int i = 0; i < arg.length; i++) { arg[i] = arguments[i]; } @@ -454,11 +430,11 @@ public class ListenerMethod implements EventListener { method.invoke(object, arguments); } - } catch (java.lang.IllegalAccessException e) { + } catch (final java.lang.IllegalAccessException e) { // This should never happen throw new java.lang.RuntimeException( "Internal error - please report: " + e.toString()); - } catch (java.lang.reflect.InvocationTargetException e) { + } catch (final java.lang.reflect.InvocationTargetException e) { // This should never happen throw new MethodException("Invocation if method " + method + " failed.", e.getTargetException()); @@ -526,7 +502,7 @@ public class ListenerMethod implements EventListener { */ private static final long serialVersionUID = 3257005445242894135L; - private Throwable cause; + private final Throwable cause; private String message; diff --git a/src/com/itmill/toolkit/event/MethodEventSource.java b/src/com/itmill/toolkit/event/MethodEventSource.java index 8e80ea604e..9718bfcd68 100644 --- a/src/com/itmill/toolkit/event/MethodEventSource.java +++ b/src/com/itmill/toolkit/event/MethodEventSource.java @@ -1,30 +1,6 @@ -/* ************************************************************************* - - IT Mill Toolkit - - Development of Browser User Interfaces Made Easy - - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* - - This product is distributed under commercial license that can be found - from the product package on license.pdf. Use of this product might - require purchasing a commercial license from IT Mill Ltd. For guidelines - on usage, see licensing-guidelines.html - - ************************************************************************* - - For more information, contact: - - IT Mill Ltd phone: +358 2 4802 7180 - Ruukinkatu 2-4 fax: +358 2 4802 7181 - 20540, Turku email: info@itmill.com - Finland company www: www.itmill.com - - Primary source for information and releases: www.itmill.com - - ********************************************************************** */ +/* +@ITMillApache2LicenseForJavaFiles@ + */ package com.itmill.toolkit.event; diff --git a/src/com/itmill/toolkit/event/ShortcutAction.java b/src/com/itmill/toolkit/event/ShortcutAction.java index da03d86764..4b4cca83b5 100644 --- a/src/com/itmill/toolkit/event/ShortcutAction.java +++ b/src/com/itmill/toolkit/event/ShortcutAction.java @@ -1,3 +1,7 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + package com.itmill.toolkit.event; import com.itmill.toolkit.terminal.Resource; @@ -11,9 +15,9 @@ import com.itmill.toolkit.terminal.Resource; */ public class ShortcutAction extends Action { - private int keyCode; + private final int keyCode; - private int[] modifiers; + private final int[] modifiers; public ShortcutAction(String caption, int kc, int[] m) { super(caption); -- cgit v1.2.3