diff options
Diffstat (limited to 'server/src/main/java/com/vaadin/event')
15 files changed, 104 insertions, 100 deletions
diff --git a/server/src/main/java/com/vaadin/event/ActionManager.java b/server/src/main/java/com/vaadin/event/ActionManager.java index 6eb698d08a..e4b0b98a4a 100644 --- a/server/src/main/java/com/vaadin/event/ActionManager.java +++ b/server/src/main/java/com/vaadin/event/ActionManager.java @@ -39,8 +39,8 @@ import com.vaadin.ui.Component; * * */ -public class ActionManager implements Action.Container, Action.Handler, - Action.Notifier { +public class ActionManager + implements Action.Container, Action.Handler, Action.Notifier { private static final long serialVersionUID = 1641868163608066491L; @@ -227,8 +227,8 @@ public class ActionManager implements Action.Container, Action.Handler, @Override public void handleAction(Action action, Object sender, Object target) { if (actionHandlers != null) { - Handler[] array = actionHandlers.toArray(new Handler[actionHandlers - .size()]); + Handler[] array = actionHandlers + .toArray(new Handler[actionHandlers.size()]); for (Handler handler : array) { handler.handleAction(action, sender, target); } diff --git a/server/src/main/java/com/vaadin/event/ConnectorActionManager.java b/server/src/main/java/com/vaadin/event/ConnectorActionManager.java index 0816ba48df..15fa0e8132 100644 --- a/server/src/main/java/com/vaadin/event/ConnectorActionManager.java +++ b/server/src/main/java/com/vaadin/event/ConnectorActionManager.java @@ -72,9 +72,8 @@ public class ConnectorActionManager extends ActionManager { @Override public void handleAction(Action action, Object sender, Object target) { if (!connector.isConnectorEnabled()) { - getLogger().warning( - ServerRpcHandler.getIgnoredDisabledError("action", - connector)); + getLogger().warning(ServerRpcHandler + .getIgnoredDisabledError("action", connector)); return; } diff --git a/server/src/main/java/com/vaadin/event/ContextClickEvent.java b/server/src/main/java/com/vaadin/event/ContextClickEvent.java index 5b15634105..56a9be1c7b 100644 --- a/server/src/main/java/com/vaadin/event/ContextClickEvent.java +++ b/server/src/main/java/com/vaadin/event/ContextClickEvent.java @@ -32,9 +32,9 @@ import com.vaadin.util.ReflectTools; */ public class ContextClickEvent extends ClickEvent { - public static final Method CONTEXT_CLICK_METHOD = ReflectTools - .findMethod(ContextClickListener.class, "contextClick", - ContextClickEvent.class); + public static final Method CONTEXT_CLICK_METHOD = ReflectTools.findMethod( + ContextClickListener.class, "contextClick", + ContextClickEvent.class); public ContextClickEvent(Component source, MouseEventDetails mouseEventDetails) { diff --git a/server/src/main/java/com/vaadin/event/EventRouter.java b/server/src/main/java/com/vaadin/event/EventRouter.java index b662dfcb36..7d83574bbe 100644 --- a/server/src/main/java/com/vaadin/event/EventRouter.java +++ b/server/src/main/java/com/vaadin/event/EventRouter.java @@ -63,7 +63,8 @@ public class EventRouter implements MethodEventSource { * here, we use the default documentation from implemented interface. */ @Override - public void addListener(Class<?> eventType, Object object, String methodName) { + public void addListener(Class<?> eventType, Object object, + String methodName) { if (listenerList == null) { listenerList = new LinkedHashSet<ListenerMethod>(); } @@ -95,7 +96,8 @@ public class EventRouter implements MethodEventSource { * implemented interface. */ @Override - public void removeListener(Class<?> eventType, Object target, Method method) { + public void removeListener(Class<?> eventType, Object target, + Method method) { if (listenerList != null) { final Iterator<ListenerMethod> i = listenerList.iterator(); while (i.hasNext()) { diff --git a/server/src/main/java/com/vaadin/event/LayoutEvents.java b/server/src/main/java/com/vaadin/event/LayoutEvents.java index e4432b7c7a..5b7cb4372d 100644 --- a/server/src/main/java/com/vaadin/event/LayoutEvents.java +++ b/server/src/main/java/com/vaadin/event/LayoutEvents.java @@ -114,8 +114,8 @@ public interface LayoutEvents { private final Component childComponent; public LayoutClickEvent(Component source, - MouseEventDetails mouseEventDetails, - Component clickedComponent, Component childComponent) { + MouseEventDetails mouseEventDetails, Component clickedComponent, + Component childComponent) { super(source, mouseEventDetails); this.clickedComponent = clickedComponent; this.childComponent = childComponent; diff --git a/server/src/main/java/com/vaadin/event/ListenerMethod.java b/server/src/main/java/com/vaadin/event/ListenerMethod.java index 3311ed705e..979da5a06b 100644 --- a/server/src/main/java/com/vaadin/event/ListenerMethod.java +++ b/server/src/main/java/com/vaadin/event/ListenerMethod.java @@ -83,7 +83,8 @@ public class ListenerMethod implements EventListener, Serializable { private int eventArgumentIndex; /* Special serialization to handle method references */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { try { out.defaultWriteObject(); String name = method.getName(); @@ -91,18 +92,17 @@ public class ListenerMethod implements EventListener, Serializable { out.writeObject(name); out.writeObject(paramTypes); } catch (NotSerializableException e) { - getLogger() - .log(Level.WARNING, - "Error in serialization of the application: Class {0} must implement serialization.", - target.getClass().getName()); + getLogger().log(Level.WARNING, + "Error in serialization of the application: Class {0} must implement serialization.", + target.getClass().getName()); throw e; } } /* Special serialization to handle method references */ - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); try { String name = (String) in.readObject(); @@ -126,8 +126,8 @@ public class ListenerMethod implements EventListener, Serializable { } } if (cls.getSuperclass() != null) { - Method parentMethod = findHighestMethod(cls.getSuperclass(), - method, paramTypes); + Method parentMethod = findHighestMethod(cls.getSuperclass(), method, + paramTypes); if (parentMethod != null) { return parentMethod; } @@ -180,26 +180,26 @@ public class ListenerMethod implements EventListener, Serializable { // Checks that the object is of correct type if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " cannot be used for the given target: " - + target.getClass().getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " cannot be used for the given target: " + + target.getClass().getName()); } // Checks that the event argument is null if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { - throw new java.lang.IllegalArgumentException("argument[" - + eventArgumentIndex + "] must be null"); + throw new java.lang.IllegalArgumentException( + "argument[" + eventArgumentIndex + "] must be null"); } // Checks the event type is supported by the method if (eventArgumentIndex >= 0 && !method.getParameterTypes()[eventArgumentIndex] .isAssignableFrom(eventType)) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " does not accept the given eventType: " - + eventType.getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " does not accept the given eventType: " + + eventType.getName()); } this.eventType = eventType; @@ -259,18 +259,18 @@ public class ListenerMethod implements EventListener, Serializable { // Checks that the event argument is null if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { - throw new java.lang.IllegalArgumentException("argument[" - + eventArgumentIndex + "] must be null"); + throw new java.lang.IllegalArgumentException( + "argument[" + eventArgumentIndex + "] must be null"); } // Checks the event type is supported by the method if (eventArgumentIndex >= 0 && !method.getParameterTypes()[eventArgumentIndex] .isAssignableFrom(eventType)) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " does not accept the given eventType: " - + eventType.getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " does not accept the given eventType: " + + eventType.getName()); } this.eventType = eventType; @@ -311,10 +311,10 @@ public class ListenerMethod implements EventListener, Serializable { // Check that the object is of correct type if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " cannot be used for the given target: " - + target.getClass().getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " cannot be used for the given target: " + + target.getClass().getName()); } this.eventType = eventType; @@ -404,10 +404,10 @@ public class ListenerMethod implements EventListener, Serializable { // Checks that the object is of correct type if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " cannot be used for the given target: " - + target.getClass().getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " cannot be used for the given target: " + + target.getClass().getName()); } this.eventType = eventType; @@ -419,7 +419,8 @@ public class ListenerMethod implements EventListener, Serializable { if (params.length == 0) { arguments = new Object[0]; - } else if (params.length == 1 && params[0].isAssignableFrom(eventType)) { + } else if (params.length == 1 + && params[0].isAssignableFrom(eventType)) { arguments = new Object[] { null }; eventArgumentIndex = 0; } else { @@ -479,7 +480,8 @@ public class ListenerMethod implements EventListener, Serializable { if (params.length == 0) { arguments = new Object[0]; - } else if (params.length == 1 && params[0].isAssignableFrom(eventType)) { + } else if (params.length == 1 + && params[0].isAssignableFrom(eventType)) { arguments = new Object[] { null }; eventArgumentIndex = 0; } else { @@ -525,9 +527,9 @@ public class ListenerMethod implements EventListener, Serializable { } catch (final java.lang.reflect.InvocationTargetException e) { // An exception was thrown by the invocation target. Throw it // forwards. - throw new MethodException("Invocation of method " - + method.getName() + " in " - + target.getClass().getName() + " failed.", + throw new MethodException( + "Invocation of method " + method.getName() + " in " + + target.getClass().getName() + " failed.", e.getTargetException()); } } @@ -570,9 +572,8 @@ public class ListenerMethod implements EventListener, Serializable { * equals with the method stored in this object */ public boolean matches(Class<?> eventType, Object target, Method method) { - return (this.target == target) - && (eventType.equals(this.eventType) && method - .equals(this.method)); + return (this.target == target) && (eventType.equals(this.eventType) + && method.equals(this.method)); } @Override @@ -603,14 +604,14 @@ public class ListenerMethod implements EventListener, Serializable { ListenerMethod t = (ListenerMethod) obj; return eventArgumentIndex == t.eventArgumentIndex - && (eventType == t.eventType || (eventType != null && eventType - .equals(t.eventType))) - && (target == t.target || (target != null && target - .equals(t.target))) - && (method == t.method || (method != null && method - .equals(t.method))) - && (arguments == t.arguments || (Arrays.equals(arguments, - t.arguments))); + && (eventType == t.eventType + || (eventType != null && eventType.equals(t.eventType))) + && (target == t.target + || (target != null && target.equals(t.target))) + && (method == t.method + || (method != null && method.equals(t.method))) + && (arguments == t.arguments + || (Arrays.equals(arguments, t.arguments))); } /** @@ -622,8 +623,8 @@ public class ListenerMethod implements EventListener, Serializable { * @author Vaadin Ltd. * @since 3.0 */ - public class MethodException extends RuntimeException implements - Serializable { + public class MethodException extends RuntimeException + implements Serializable { private MethodException(String message, Throwable cause) { super(message, cause); diff --git a/server/src/main/java/com/vaadin/event/MethodEventSource.java b/server/src/main/java/com/vaadin/event/MethodEventSource.java index ddfc87ca8c..43fcb901e1 100644 --- a/server/src/main/java/com/vaadin/event/MethodEventSource.java +++ b/server/src/main/java/com/vaadin/event/MethodEventSource.java @@ -91,7 +91,8 @@ public interface MethodEventSource extends Serializable { * unless <code>method</code> has exactly one match in * <code>object</code> */ - public void addListener(Class<?> eventType, Object object, String methodName); + public void addListener(Class<?> eventType, Object object, + String methodName); /** * Removes all registered listeners matching the given parameters. Since @@ -132,7 +133,8 @@ public interface MethodEventSource extends Serializable { * the method owned by the target that's registered to listen to * events of type eventType. */ - public void removeListener(Class<?> eventType, Object target, Method method); + public void removeListener(Class<?> eventType, Object target, + Method method); /** * <p> diff --git a/server/src/main/java/com/vaadin/event/MouseEvents.java b/server/src/main/java/com/vaadin/event/MouseEvents.java index b32ce06587..855c073125 100644 --- a/server/src/main/java/com/vaadin/event/MouseEvents.java +++ b/server/src/main/java/com/vaadin/event/MouseEvents.java @@ -62,7 +62,8 @@ public interface MouseEvents { public static final MouseButton BUTTON_RIGHT = MouseButton.RIGHT; private MouseEventDetails details; - public ClickEvent(Component source, MouseEventDetails mouseEventDetails) { + public ClickEvent(Component source, + MouseEventDetails mouseEventDetails) { super(source); details = mouseEventDetails; } @@ -193,8 +194,8 @@ public interface MouseEvents { */ public interface ClickListener extends ConnectorEventListener { - public static final Method clickMethod = ReflectTools.findMethod( - ClickListener.class, "click", ClickEvent.class); + public static final Method clickMethod = ReflectTools + .findMethod(ClickListener.class, "click", ClickEvent.class); /** * Called when a {@link Component} has been clicked. A reference to the diff --git a/server/src/main/java/com/vaadin/event/SelectionEvent.java b/server/src/main/java/com/vaadin/event/SelectionEvent.java index 09cf57167f..5f11818af9 100644 --- a/server/src/main/java/com/vaadin/event/SelectionEvent.java +++ b/server/src/main/java/com/vaadin/event/SelectionEvent.java @@ -109,8 +109,8 @@ public class SelectionEvent extends EventObject { } /** - * The interface for adding and removing listeners for - * {@link SelectionEvent SelectionEvents}. + * The interface for adding and removing listeners for {@link SelectionEvent + * SelectionEvents}. */ public interface SelectionNotifier extends Serializable { /** diff --git a/server/src/main/java/com/vaadin/event/ShortcutAction.java b/server/src/main/java/com/vaadin/event/ShortcutAction.java index dd511c23c0..2d719cd8e1 100644 --- a/server/src/main/java/com/vaadin/event/ShortcutAction.java +++ b/server/src/main/java/com/vaadin/event/ShortcutAction.java @@ -112,21 +112,21 @@ public class ShortcutAction extends Action { public static final char SHORTHAND_CHAR_CTRL = '^'; // regex-quote (escape) the characters - private static final String SHORTHAND_ALT = Pattern.quote(Character - .toString(SHORTHAND_CHAR_ALT)); - private static final String SHORTHAND_SHIFT = Pattern.quote(Character - .toString(SHORTHAND_CHAR_SHIFT)); - private static final String SHORTHAND_CTRL = Pattern.quote(Character - .toString(SHORTHAND_CHAR_CTRL)); + private static final String SHORTHAND_ALT = Pattern + .quote(Character.toString(SHORTHAND_CHAR_ALT)); + private static final String SHORTHAND_SHIFT = Pattern + .quote(Character.toString(SHORTHAND_CHAR_SHIFT)); + private static final String SHORTHAND_CTRL = Pattern + .quote(Character.toString(SHORTHAND_CHAR_CTRL)); // Used for replacing escaped chars, e.g && with & - private static final Pattern SHORTHAND_ESCAPE = Pattern.compile("(" - + SHORTHAND_ALT + "?)" + SHORTHAND_ALT + "|(" + SHORTHAND_SHIFT - + "?)" + SHORTHAND_SHIFT + "|(" + SHORTHAND_CTRL + "?)" - + SHORTHAND_CTRL); + private static final Pattern SHORTHAND_ESCAPE = Pattern + .compile("(" + SHORTHAND_ALT + "?)" + SHORTHAND_ALT + "|(" + + SHORTHAND_SHIFT + "?)" + SHORTHAND_SHIFT + "|(" + + SHORTHAND_CTRL + "?)" + SHORTHAND_CTRL); // Used for removing escaped chars, only leaving real shorthands - private static final Pattern SHORTHAND_REMOVE = Pattern.compile("([" - + SHORTHAND_ALT + "|" + SHORTHAND_SHIFT + "|" + SHORTHAND_CTRL - + "])\\1"); + private static final Pattern SHORTHAND_REMOVE = Pattern + .compile("([" + SHORTHAND_ALT + "|" + SHORTHAND_SHIFT + "|" + + SHORTHAND_CTRL + "])\\1"); // Mnemonic char, optionally followed by another, and optionally a third private static final Pattern SHORTHANDS = Pattern.compile("(" + SHORTHAND_ALT + "|" + SHORTHAND_SHIFT + "|" + SHORTHAND_CTRL @@ -186,8 +186,8 @@ public class ShortcutAction extends Action { String match = matcher.group(); // KeyCode from last char in match, uppercase - keyCode = Character.toUpperCase(matcher.group().charAt( - match.length() - 1)); + keyCode = Character + .toUpperCase(matcher.group().charAt(match.length() - 1)); // Given modifiers override this indicated in the caption if (modifierKeys != null) { diff --git a/server/src/main/java/com/vaadin/event/ShortcutListener.java b/server/src/main/java/com/vaadin/event/ShortcutListener.java index ccfe68d6fb..850791f176 100644 --- a/server/src/main/java/com/vaadin/event/ShortcutListener.java +++ b/server/src/main/java/com/vaadin/event/ShortcutListener.java @@ -18,8 +18,8 @@ package com.vaadin.event; import com.vaadin.event.Action.Listener; import com.vaadin.server.Resource; -public abstract class ShortcutListener extends ShortcutAction implements - Listener { +public abstract class ShortcutListener extends ShortcutAction + implements Listener { private static final long serialVersionUID = 1L; diff --git a/server/src/main/java/com/vaadin/event/UIEvents.java b/server/src/main/java/com/vaadin/event/UIEvents.java index e986386da8..9e051e6682 100644 --- a/server/src/main/java/com/vaadin/event/UIEvents.java +++ b/server/src/main/java/com/vaadin/event/UIEvents.java @@ -39,8 +39,8 @@ public interface UIEvents { * @author Vaadin Ltd */ public interface PollListener extends Serializable { - public static final Method POLL_METHOD = ReflectTools.findMethod( - PollListener.class, "poll", PollEvent.class); + public static final Method POLL_METHOD = ReflectTools + .findMethod(PollListener.class, "poll", PollEvent.class); /** * A poll request has been received by the server. diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java index 6bb227a95e..7fae2ee87b 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java @@ -32,8 +32,8 @@ import com.vaadin.server.PaintTarget; * * @since 6.3 */ -public abstract class ClientSideCriterion implements Serializable, - AcceptCriterion { +public abstract class ClientSideCriterion + implements Serializable, AcceptCriterion { /* * All criteria that extend this must be completely validatable on client diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java index 8b769ee031..4449ec22c4 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java @@ -38,8 +38,8 @@ import com.vaadin.server.PaintTarget; * * @since 6.3 */ -public abstract class ServerSideCriterion implements Serializable, - AcceptCriterion { +public abstract class ServerSideCriterion + implements Serializable, AcceptCriterion { private static final long serialVersionUID = 2128510128911628902L; diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java index 8e9fdecdae..2b2be484b3 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java @@ -51,11 +51,10 @@ public class SourceIs extends ClientSideCriterion { if (c.isAttached()) { target.addAttribute("component" + paintedComponents++, c); } else { - Logger.getLogger(SourceIs.class.getName()) - .log(Level.WARNING, - "SourceIs component {0} at index {1} is not attached to the component hierachy and will thus be ignored", - new Object[] { c.getClass().getName(), - Integer.valueOf(i) }); + Logger.getLogger(SourceIs.class.getName()).log(Level.WARNING, + "SourceIs component {0} at index {1} is not attached to the component hierachy and will thus be ignored", + new Object[] { c.getClass().getName(), + Integer.valueOf(i) }); } } target.addAttribute("c", paintedComponents); |