You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by aa...@apache.org on 2010/06/17 23:52:32 UTC
svn commit: r955757 - in /click/trunk/click: build/
framework/src/org/apache/click/ framework/src/org/apache/click/ajax/
framework/src/org/apache/click/control/
Author: aadrian
Date: Thu Jun 17 21:52:31 2010
New Revision: 955757
URL: http://svn.apache.org/viewvc?rev=955757&view=rev
Log:
few more checkstyle fixes
Modified:
click/trunk/click/build/checkstyle-suppressions.xml
click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
click/trunk/click/framework/src/org/apache/click/Behavior.java
click/trunk/click/framework/src/org/apache/click/Callback.java
click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java
click/trunk/click/framework/src/org/apache/click/Partial.java
click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java
click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java
Modified: click/trunk/click/build/checkstyle-suppressions.xml
URL: http://svn.apache.org/viewvc/click/trunk/click/build/checkstyle-suppressions.xml?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/build/checkstyle-suppressions.xml (original)
+++ click/trunk/click/build/checkstyle-suppressions.xml Thu Jun 17 21:52:31 2010
@@ -24,6 +24,7 @@
<suppressions>
<!-- File Length -->
<suppress checks="FileLength" files="ClickUtils.java"/>
+ <suppress checks="FileLength" files="ClickServlet.java"/>
<suppress checks="FileLength" files="Form.java"/>
<suppress checks="FileLength" files="Tree.java"/>
<suppress checks="FileLength" files="Table.java"/>
Modified: click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java Thu Jun 17 21:52:31 2010
@@ -198,7 +198,6 @@ public class ActionEventDispatcher {
* @param context the request context
* @param eventSourceList the list of source controls
* @param eventListenerList the list of listeners to fire
- * @param event the specific event which events to fire
*
* @return true if the page should continue processing or false otherwise
*/
@@ -259,7 +258,7 @@ public class ActionEventDispatcher {
boolean continueProcessing = true;
- for (Iterator<Control> it = behaviorSourceSet.iterator(); it.hasNext(); ) {
+ for (Iterator<Control> it = behaviorSourceSet.iterator(); it.hasNext();) {
Control source = it.next();
// Pop the first entry in the set
Modified: click/trunk/click/framework/src/org/apache/click/Behavior.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Behavior.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Behavior.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Behavior.java Thu Jun 17 21:52:31 2010
@@ -84,4 +84,4 @@ public interface Behavior extends Callba
*/
// TODO move this method to another interface/class?
public boolean isRequestTarget(Context context);
-}
+}
Modified: click/trunk/click/framework/src/org/apache/click/Callback.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Callback.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Callback.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Callback.java Thu Jun 17 21:52:31 2010
@@ -53,4 +53,4 @@ public interface Callback {
* @param source the callback's control
*/
public void preDestroy(Control source);
-}
+}
Modified: click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java Thu Jun 17 21:52:31 2010
@@ -1,336 +1,336 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.click;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.click.service.ConfigService;
-import org.apache.click.service.LogService;
-import org.apache.commons.lang.Validate;
-
-/**
- * Provides a Control event callback dispatcher.
- *
- * TODO: javadoc
- */
-public class CallbackDispatcher {
-
- // -------------------------------------------------------------- Constants
-
- /** The thread local dispatcher holder. */
- private static final ThreadLocal THREAD_LOCAL_DISPATCHER = new ThreadLocal();
-
- // -------------------------------------------------------------- Variables
-
- /** The set of registered behavior enabled controls. */
- Set<Control> behaviorEnabledControls;
-
- /** The list of registered callbacks. */
- List<CallbackHolder> callbacks;
-
- /** The application log service. */
- LogService logger;
-
- // Constructors -----------------------------------------------------------
-
- public CallbackDispatcher(ConfigService configService) {
- this.logger = configService.getLogService();
- }
-
- // --------------------------------------------------------- Public Methods
-
- public static void registerBehavior(Control control) {
- CallbackDispatcher instance = getThreadLocalDispatcher();
- instance.internalRegisterBehavior(control);
- }
-
- public static void registerCallback(Control control, Callback callback) {
- CallbackDispatcher instance = getThreadLocalDispatcher();
- instance.internalRegisterCallback(control, callback);
- }
-
- // protected methods ------------------------------------------------------
-
- /**
- * Allow the dispatcher to handle the error that occurred.
- *
- * @param throwable the error which occurred during processing
- */
- protected void errorOccurred(Throwable throwable) {
- getBehaviorEnabledControls().clear();
- getCallbacks().clear();
- }
-
- // ------------------------------------------------ package private methods
-
- /**
- * Register the behavior source control.
- *
- * @param source the behavior source control
- */
- void internalRegisterBehavior(Control source) {
- Validate.notNull(source, "Null source parameter");
- getBehaviorEnabledControls().add(source);
- }
-
- /**
- * Register the behavior source control.
- *
- * @param source the behavior source control
- */
- void internalRegisterCallback(Control source, Callback callback) {
- Validate.notNull(source, "Null source parameter");
- Validate.notNull(callback, "Null callback parameter");
-
- CallbackHolder callbackHolder = new CallbackHolder(source, callback);
- getCallbacks().add(callbackHolder);
- }
-
- void processBeforeResponse(Context context) {
- if (hasBehaviorEnabledControls()) {
- for(Control control : getBehaviorEnabledControls()) {
- List<Behavior> behaviors = control.getBehaviors();
- for (Behavior behavior : behaviors) {
- behavior.preResponse(control);
- }
- }
- }
-
- if (hasCallbacks()) {
- for (CallbackHolder callbackHolder : getCallbacks()) {
- Callback callback = callbackHolder.getCallback();
- Control control = callbackHolder.getControl();
- callback.preResponse(control);
- }
- }
- }
-
- void processBeforeGetHeadElements(Context context) {
- if (hasBehaviorEnabledControls()) {
- for(Control control : getBehaviorEnabledControls()) {
- List<Behavior> behaviors = control.getBehaviors();
- for (Behavior behavior : behaviors) {
- behavior.preGetHeadElements(control);
- }
- }
- }
-
- if (hasCallbacks()) {
- for (CallbackHolder callbackHolder : getCallbacks()) {
- Callback callback = callbackHolder.getCallback();
- Control control = callbackHolder.getControl();
- callback.preGetHeadElements(control);
- }
- }
- }
-
- void processPreDestroy(Context context) {
- if (hasBehaviorEnabledControls()) {
- for(Control control : getBehaviorEnabledControls()) {
- List<Behavior> behaviors = control.getBehaviors();
- for (Behavior behavior : behaviors) {
- behavior.preDestroy(control);
- }
- }
- }
-
- if (hasCallbacks()) {
- for (CallbackHolder callbackHolder : getCallbacks()) {
- Callback callback = callbackHolder.getCallback();
- Control control = callbackHolder.getControl();
- callback.preDestroy(control);
- }
- }
- }
-
- /**
- * Checks if any control callbacks have been registered.
- */
- boolean hasBehaviorEnabledControls() {
- if (behaviorEnabledControls == null || behaviorEnabledControls.isEmpty()) {
- return false;
- }
- return true;
- }
-
- /**
- * Return the set of behavior enabled controls.
- *
- * @return the set of behavior enabled controls.
- */
- Set<Control> getBehaviorEnabledControls() {
- if (behaviorEnabledControls == null) {
- behaviorEnabledControls = new LinkedHashSet<Control>();
- }
- return behaviorEnabledControls;
- }
-
- /**
- * Checks if any control callbacks have been registered.
- */
- boolean hasCallbacks() {
- if (callbacks == null || callbacks.isEmpty()) {
- return false;
- }
- return true;
- }
-
- /**
- * Return the set of registered callbacks.
- *
- * @return set of registered callbacks
- */
- List<CallbackHolder> getCallbacks() {
- if (callbacks == null) {
- callbacks = new ArrayList<CallbackHolder>();
- }
- return callbacks;
- }
-
- static CallbackDispatcher getThreadLocalDispatcher() {
- return getDispatcherStack().peek();
- }
-
- /**
- * Adds the specified CallbackDispatcher on top of the dispatcher stack.
- *
- * @param callbackDispatcher the CallbackDispatcher to add
- */
- static void pushThreadLocalDispatcher(CallbackDispatcher callbackDispatcher) {
- getDispatcherStack().push(callbackDispatcher);
- }
-
- /**
- * Remove and return the callbackDispatcher instance on top of the
- * dispatcher stack.
- *
- * @return the callbackDispatcher instance on top of the dispatcher stack
- */
- static CallbackDispatcher popThreadLocalDispatcher() {
- DispatcherStack dispatcherStack = getDispatcherStack();
- CallbackDispatcher callbackDispatcher = dispatcherStack.pop();
-
- if (dispatcherStack.isEmpty()) {
- THREAD_LOCAL_DISPATCHER.set(null);
- }
-
- return callbackDispatcher;
- }
-
- static DispatcherStack getDispatcherStack() {
- DispatcherStack dispatcherStack = (DispatcherStack) THREAD_LOCAL_DISPATCHER.get();
-
- if (dispatcherStack == null) {
- dispatcherStack = new DispatcherStack(2);
- THREAD_LOCAL_DISPATCHER.set(dispatcherStack);
- }
-
- return dispatcherStack;
- }
-
- /**
- * Provides an unsynchronized Stack.
- */
- static class DispatcherStack extends ArrayList {
-
- /** Serialization version indicator. */
- private static final long serialVersionUID = 1L;
-
- /**
- * Create a new DispatcherStack with the given initial capacity.
- *
- * @param initialCapacity specify initial capacity of this stack
- */
- private DispatcherStack(int initialCapacity) {
- super(initialCapacity);
- }
-
- /**
- * Pushes the CallbackDispatcher onto the top of this stack.
- *
- * @param callbackDispatcher the CallbackDispatcher to push onto this stack
- * @return the CallbackDispatcher pushed on this stack
- */
- private CallbackDispatcher push(CallbackDispatcher callbackDispatcher) {
- add(callbackDispatcher);
-
- return callbackDispatcher;
- }
-
- /**
- * Removes and return the CallbackDispatcher at the top of this stack.
- *
- * @return the CallbackDispatcher at the top of this stack
- */
- private CallbackDispatcher pop() {
- CallbackDispatcher callbackDispatcher = peek();
-
- remove(size() - 1);
-
- return callbackDispatcher;
- }
-
- /**
- * Looks at the CallbackDispatcher at the top of this stack without
- * removing it.
- *
- * @return the CallbackDispatcher at the top of this stack
- */
- private CallbackDispatcher peek() {
- int length = size();
-
- if (length == 0) {
- String msg = "No CallbackDispatcher available on ThreadLocal Dispatcher Stack";
- throw new RuntimeException(msg);
- }
-
- return (CallbackDispatcher) get(length - 1);
- }
- }
-
- static class CallbackHolder {
-
- private Callback callback;
-
- private Control control;
-
- public CallbackHolder(Control control, Callback callback) {
- this.control = control;
- this.callback = callback;
- }
-
- public Callback getCallback() {
- return callback;
- }
-
- public void setCallback(Callback callback) {
- this.callback = callback;
- }
-
- public Control getControl() {
- return control;
- }
-
- public void setControl(Control control) {
- this.control = control;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.click;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.click.service.ConfigService;
+import org.apache.click.service.LogService;
+import org.apache.commons.lang.Validate;
+
+/**
+ * Provides a Control event callback dispatcher.
+ *
+ * TODO: javadoc
+ */
+public class CallbackDispatcher {
+
+ // -------------------------------------------------------------- Constants
+
+ /** The thread local dispatcher holder. */
+ private static final ThreadLocal THREAD_LOCAL_DISPATCHER = new ThreadLocal();
+
+ // -------------------------------------------------------------- Variables
+
+ /** The set of registered behavior enabled controls. */
+ Set<Control> behaviorEnabledControls;
+
+ /** The list of registered callbacks. */
+ List<CallbackHolder> callbacks;
+
+ /** The application log service. */
+ LogService logger;
+
+ // Constructors -----------------------------------------------------------
+
+ public CallbackDispatcher(ConfigService configService) {
+ this.logger = configService.getLogService();
+ }
+
+ // --------------------------------------------------------- Public Methods
+
+ public static void registerBehavior(Control control) {
+ CallbackDispatcher instance = getThreadLocalDispatcher();
+ instance.internalRegisterBehavior(control);
+ }
+
+ public static void registerCallback(Control control, Callback callback) {
+ CallbackDispatcher instance = getThreadLocalDispatcher();
+ instance.internalRegisterCallback(control, callback);
+ }
+
+ // protected methods ------------------------------------------------------
+
+ /**
+ * Allow the dispatcher to handle the error that occurred.
+ *
+ * @param throwable the error which occurred during processing
+ */
+ protected void errorOccurred(Throwable throwable) {
+ getBehaviorEnabledControls().clear();
+ getCallbacks().clear();
+ }
+
+ // ------------------------------------------------ package private methods
+
+ /**
+ * Register the behavior source control.
+ *
+ * @param source the behavior source control
+ */
+ void internalRegisterBehavior(Control source) {
+ Validate.notNull(source, "Null source parameter");
+ getBehaviorEnabledControls().add(source);
+ }
+
+ /**
+ * Register the behavior source control.
+ *
+ * @param source the behavior source control
+ */
+ void internalRegisterCallback(Control source, Callback callback) {
+ Validate.notNull(source, "Null source parameter");
+ Validate.notNull(callback, "Null callback parameter");
+
+ CallbackHolder callbackHolder = new CallbackHolder(source, callback);
+ getCallbacks().add(callbackHolder);
+ }
+
+ void processBeforeResponse(Context context) {
+ if (hasBehaviorEnabledControls()) {
+ for (Control control : getBehaviorEnabledControls()) {
+ List<Behavior> behaviors = control.getBehaviors();
+ for (Behavior behavior : behaviors) {
+ behavior.preResponse(control);
+ }
+ }
+ }
+
+ if (hasCallbacks()) {
+ for (CallbackHolder callbackHolder : getCallbacks()) {
+ Callback callback = callbackHolder.getCallback();
+ Control control = callbackHolder.getControl();
+ callback.preResponse(control);
+ }
+ }
+ }
+
+ void processBeforeGetHeadElements(Context context) {
+ if (hasBehaviorEnabledControls()) {
+ for (Control control : getBehaviorEnabledControls()) {
+ List<Behavior> behaviors = control.getBehaviors();
+ for (Behavior behavior : behaviors) {
+ behavior.preGetHeadElements(control);
+ }
+ }
+ }
+
+ if (hasCallbacks()) {
+ for (CallbackHolder callbackHolder : getCallbacks()) {
+ Callback callback = callbackHolder.getCallback();
+ Control control = callbackHolder.getControl();
+ callback.preGetHeadElements(control);
+ }
+ }
+ }
+
+ void processPreDestroy(Context context) {
+ if (hasBehaviorEnabledControls()) {
+ for (Control control : getBehaviorEnabledControls()) {
+ List<Behavior> behaviors = control.getBehaviors();
+ for (Behavior behavior : behaviors) {
+ behavior.preDestroy(control);
+ }
+ }
+ }
+
+ if (hasCallbacks()) {
+ for (CallbackHolder callbackHolder : getCallbacks()) {
+ Callback callback = callbackHolder.getCallback();
+ Control control = callbackHolder.getControl();
+ callback.preDestroy(control);
+ }
+ }
+ }
+
+ /**
+ * Checks if any control callbacks have been registered.
+ */
+ boolean hasBehaviorEnabledControls() {
+ if (behaviorEnabledControls == null || behaviorEnabledControls.isEmpty()) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Return the set of behavior enabled controls.
+ *
+ * @return the set of behavior enabled controls.
+ */
+ Set<Control> getBehaviorEnabledControls() {
+ if (behaviorEnabledControls == null) {
+ behaviorEnabledControls = new LinkedHashSet<Control>();
+ }
+ return behaviorEnabledControls;
+ }
+
+ /**
+ * Checks if any control callbacks have been registered.
+ */
+ boolean hasCallbacks() {
+ if (callbacks == null || callbacks.isEmpty()) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Return the set of registered callbacks.
+ *
+ * @return set of registered callbacks
+ */
+ List<CallbackHolder> getCallbacks() {
+ if (callbacks == null) {
+ callbacks = new ArrayList<CallbackHolder>();
+ }
+ return callbacks;
+ }
+
+ static CallbackDispatcher getThreadLocalDispatcher() {
+ return getDispatcherStack().peek();
+ }
+
+ /**
+ * Adds the specified CallbackDispatcher on top of the dispatcher stack.
+ *
+ * @param callbackDispatcher the CallbackDispatcher to add
+ */
+ static void pushThreadLocalDispatcher(CallbackDispatcher callbackDispatcher) {
+ getDispatcherStack().push(callbackDispatcher);
+ }
+
+ /**
+ * Remove and return the callbackDispatcher instance on top of the
+ * dispatcher stack.
+ *
+ * @return the callbackDispatcher instance on top of the dispatcher stack
+ */
+ static CallbackDispatcher popThreadLocalDispatcher() {
+ DispatcherStack dispatcherStack = getDispatcherStack();
+ CallbackDispatcher callbackDispatcher = dispatcherStack.pop();
+
+ if (dispatcherStack.isEmpty()) {
+ THREAD_LOCAL_DISPATCHER.set(null);
+ }
+
+ return callbackDispatcher;
+ }
+
+ static DispatcherStack getDispatcherStack() {
+ DispatcherStack dispatcherStack = (DispatcherStack) THREAD_LOCAL_DISPATCHER.get();
+
+ if (dispatcherStack == null) {
+ dispatcherStack = new DispatcherStack(2);
+ THREAD_LOCAL_DISPATCHER.set(dispatcherStack);
+ }
+
+ return dispatcherStack;
+ }
+
+ /**
+ * Provides an unsynchronized Stack.
+ */
+ static class DispatcherStack extends ArrayList {
+
+ /** Serialization version indicator. */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create a new DispatcherStack with the given initial capacity.
+ *
+ * @param initialCapacity specify initial capacity of this stack
+ */
+ private DispatcherStack(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Pushes the CallbackDispatcher onto the top of this stack.
+ *
+ * @param callbackDispatcher the CallbackDispatcher to push onto this stack
+ * @return the CallbackDispatcher pushed on this stack
+ */
+ private CallbackDispatcher push(CallbackDispatcher callbackDispatcher) {
+ add(callbackDispatcher);
+
+ return callbackDispatcher;
+ }
+
+ /**
+ * Removes and return the CallbackDispatcher at the top of this stack.
+ *
+ * @return the CallbackDispatcher at the top of this stack
+ */
+ private CallbackDispatcher pop() {
+ CallbackDispatcher callbackDispatcher = peek();
+
+ remove(size() - 1);
+
+ return callbackDispatcher;
+ }
+
+ /**
+ * Looks at the CallbackDispatcher at the top of this stack without
+ * removing it.
+ *
+ * @return the CallbackDispatcher at the top of this stack
+ */
+ private CallbackDispatcher peek() {
+ int length = size();
+
+ if (length == 0) {
+ String msg = "No CallbackDispatcher available on ThreadLocal Dispatcher Stack";
+ throw new RuntimeException(msg);
+ }
+
+ return (CallbackDispatcher) get(length - 1);
+ }
+ }
+
+ static class CallbackHolder {
+
+ private Callback callback;
+
+ private Control control;
+
+ public CallbackHolder(Control control, Callback callback) {
+ this.control = control;
+ this.callback = callback;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+ public Control getControl() {
+ return control;
+ }
+
+ public void setControl(Control control) {
+ this.control = control;
+ }
+ }
+}
Modified: click/trunk/click/framework/src/org/apache/click/Partial.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Partial.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Partial.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Partial.java Thu Jun 17 21:52:31 2010
@@ -554,4 +554,4 @@ public class Partial {
response.setContentType(getContentType() + "; charset=" + getCharacterEncoding());
}
}
-}
+}
Modified: click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java Thu Jun 17 21:52:31 2010
@@ -90,4 +90,4 @@ public abstract class AjaxBehavior imple
// NOTE: if this method is ever made public the headElementsProcessed
// check should be done here
}
-}
+}
Modified: click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java?rev=955757&r1=955756&r2=955757&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java Thu Jun 17 21:52:31 2010
@@ -235,10 +235,22 @@ public abstract class AbstractControl im
this.actionListener = listener;
}
+ /**
+ * Returns <tt>true</tt> if this control has any
+ * <tt>Behavior</tt>s registered.
+ *
+ * @return <tt>true</tt> if this control has any
+ * <tt>Behavior</tt>s registered, <tt>false</tt> otherwise.
+ */
public boolean hasBehaviors() {
return (behaviors != null && behaviors.size() > 0);
}
+ /**
+ * Adds an AJAX Behavior.
+ *
+ * @param behavior the AJAX behavior
+ */
public void addBehavior(Behavior behavior) {
if (getBehaviors().contains(behavior)) {
return;
@@ -252,10 +264,20 @@ public abstract class AbstractControl im
CallbackDispatcher.registerBehavior(this);
}
+ /**
+ * Removes form this Control a <tt>behavior</tt>.
+ *
+ * @param behavior the <tt>behavior</tt> to remove.
+ */
public void removeBehavior(Behavior behavior) {
getBehaviors().remove(behavior);
}
+ /**
+ * Returns the list with all available behaviors for this control.
+ *
+ * @return the list with this control's behaviors.
+ */
public List<Behavior> getBehaviors() {
if (behaviors == null) {
behaviors = new ArrayList<Behavior>();
@@ -263,6 +285,13 @@ public abstract class AbstractControl im
return behaviors;
}
+ /**
+ * Returns this Control's CSS selector or <tt>null</tt>null if no selector
+ * can be found.
+ *
+ * @return this Control's CSS selector or <tt>null</tt> if no selector
+ * can be found.
+ */
public String getCssSelector() {
// TODO each control could have an optimized version of cssSelector
// targeting specifically that control. For now we just use a generic
@@ -270,6 +299,15 @@ public abstract class AbstractControl im
return ClickUtils.getCssSelector(this);
}
+
+ /**
+ * Returns <tt>true</tt> if this is an AJAX control,
+ * <tt>false</tt> otherwise.
+ *
+ * @param context the Click context.
+ * @return <tt>true</tt> if this is an AJAX control,
+ * <tt>false</tt> otherwise.
+ */
public boolean isAjaxTarget(Context context) {
// TODO each control could have an optimized version of isAjaxTarget
// targeting specifically that control. For now we just check that the