You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/06/21 02:31:03 UTC

svn commit: r549305 - in /incubator/wicket/trunk: jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/ jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/ jdk-1.5/wicket-examples/src/main/java/org/apa...

Author: almaw
Date: Wed Jun 20 17:31:02 2007
New Revision: 549305

URL: http://svn.apache.org/viewvc?view=rev&rev=549305
Log:
AjaxSubmitButton -> AjaxButton
IndicatingAjaxSubmitButton -> IndicatingAjaxButton

Added:
    incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java   (with props)
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java   (with props)
Modified:
    incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitButton.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FormPage.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java

Added: incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java?view=auto&rev=549305
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java Wed Jun 20 17:31:02 2007
@@ -0,0 +1,59 @@
+/*
+ * 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.wicket.extensions.ajax.markup.html;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.IAjaxIndicatorAware;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.markup.html.form.Form;
+
+/**
+ * A variant of the {@link AjaxButton} that displays a busy indicator while the
+ * ajax request is in progress.
+ *
+ * @author evan
+ *
+ */
+public abstract class IndicatingAjaxButton
+       extends AjaxButton implements IAjaxIndicatorAware {
+
+       private final WicketAjaxIndicatorAppender indicatorAppender = new WicketAjaxIndicatorAppender();
+
+       /**
+        *
+        * @param id
+        * @param form
+        */
+       public IndicatingAjaxButton(String id, Form form)
+       {
+               super(id, form);
+               add(indicatorAppender);
+       }
+
+       protected abstract void onSubmit(AjaxRequestTarget target, Form form);
+
+       /**
+        * @see IAjaxIndicatorAware#getAjaxIndicatorMarkupId()
+        * @return the markup id of the ajax indicator
+        *
+        */
+       public String getAjaxIndicatorMarkupId()
+       {
+               return indicatorAppender.getMarkupId();
+       }
+
+}
\ No newline at end of file

Propchange: incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java?view=diff&rev=549305&r1=549304&r2=549305
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxSubmitButton.java Wed Jun 20 17:31:02 2007
@@ -16,44 +16,26 @@
  */
 package org.apache.wicket.extensions.ajax.markup.html;
 
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.IAjaxIndicatorAware;
 import org.apache.wicket.ajax.markup.html.form.AjaxSubmitButton;
 import org.apache.wicket.markup.html.form.Form;
 
 /**
- * A variant of the {@link AjaxSubmitButton} that displays a busy indicator while the
- * ajax request is in progress.
- *
+ * A variant of the {@link AjaxSubmitButton} that displays a busy indicator
+ * while the ajax request is in progress.
+ * 
  * @author evan
- *
+ * @deprecated Use {@link IndicatingAjaxButton} instead.
  */
-public abstract class IndicatingAjaxSubmitButton
-       extends AjaxSubmitButton implements IAjaxIndicatorAware {
-
-       private final WicketAjaxIndicatorAppender indicatorAppender = new WicketAjaxIndicatorAppender();
-
-       /**
-        *
-        * @param id
-        * @param form
-        */
-       public IndicatingAjaxSubmitButton(String id, Form form)
-       {
-               super(id, form);
-               add(indicatorAppender);
-       }
-
-       protected abstract void onSubmit(AjaxRequestTarget target, Form form);
-
-       /**
-        * @see IAjaxIndicatorAware#getAjaxIndicatorMarkupId()
-        * @return the markup id of the ajax indicator
-        *
-        */
-       public String getAjaxIndicatorMarkupId()
-       {
-               return indicatorAppender.getMarkupId();
-       }
+public abstract class IndicatingAjaxSubmitButton extends IndicatingAjaxButton
+{
 
+	/**
+	 * 
+	 * @param id
+	 * @param form
+	 */
+	public IndicatingAjaxSubmitButton(String id, Form form)
+	{
+		super(id, form);
+	}
 }

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java?view=auto&rev=549305
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java Wed Jun 20 17:31:02 2007
@@ -0,0 +1,138 @@
+/*
+ * 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.wicket.ajax.markup.html.form;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.IAjaxCallDecorator;
+import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.util.string.AppendingStringBuffer;
+
+/**
+ * A button that submits the form via ajax. Since this button takes the form as
+ * a constructor argument it does not need to be added to it unlike the
+ * {@link Button} component.
+ * 
+ * @since 1.3
+ * 
+ * @author Igor Vaynberg (ivaynberg)
+ */
+public abstract class AjaxButton extends Button
+{
+	private static final long serialVersionUID = 1L;
+
+	private Form form;
+	
+	/**
+	 * Construct.
+	 * 
+	 * @param id
+	 */
+	public AjaxButton(String id)
+	{
+		this(id, null);
+	}
+	
+	/**
+	 * Returns the form if it was set in constructor, otherwise returns the 
+	 * form nearest in parent hierarchy.
+	 * @see org.apache.wicket.markup.html.form.FormComponent#getForm()
+	 */
+	public Form getForm()
+	{
+		if (form != null)
+			return form;
+		else
+			return super.getForm();
+	}
+
+	/**
+	 * Construct.
+	 * 
+	 * @param id
+	 * @param form
+	 */
+	public AjaxButton(String id, final Form form)
+	{
+		super(id);
+		this.form = form;
+
+		add(new AjaxFormSubmitBehavior(form, "onclick")
+		{
+
+			private static final long serialVersionUID = 1L;
+
+			protected void onSubmit(AjaxRequestTarget target)
+			{
+				AjaxButton.this.onSubmit(target, form);
+			}
+
+			protected void onError(AjaxRequestTarget target)
+			{
+				AjaxButton.this.onError(target, form);
+			}
+
+			protected CharSequence getEventHandler()
+			{
+				return new AppendingStringBuffer(super.getEventHandler()).append("; return false;");
+			}
+
+			protected IAjaxCallDecorator getAjaxCallDecorator()
+			{
+				return AjaxButton.this.getAjaxCallDecorator();
+			}
+
+		});
+
+	}
+
+	/**
+	 * Returns the {@link IAjaxCallDecorator} that will be used to modify the
+	 * generated javascript. This is the preferred way of changing the
+	 * javascript in the onclick handler
+	 * 
+	 * @return call decorator used to modify the generated javascript or null
+	 *         for none
+	 */
+	protected IAjaxCallDecorator getAjaxCallDecorator()
+	{
+		return null;
+	}
+
+	/**
+	 * Listener method invoked on form submit with no errors
+	 * 
+	 * @param target
+	 * @param form
+	 */
+	protected abstract void onSubmit(AjaxRequestTarget target, Form form);
+
+	/**
+	 * Listener method invoked on form submit with errors
+	 * 
+	 * @param target
+	 * @param form
+	 * 
+	 * TODO 1.3: Make abstract to be consistent with onSubmit()
+	 */
+	protected void onError(AjaxRequestTarget target, Form form)
+	{
+
+	}
+
+}

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitButton.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitButton.java?view=diff&rev=549305&r1=549304&r2=549305
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitButton.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitButton.java Wed Jun 20 17:31:02 2007
@@ -16,12 +16,8 @@
  */
 package org.apache.wicket.ajax.markup.html.form;
 
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.IAjaxCallDecorator;
-import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
 import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.util.string.AppendingStringBuffer;
 
 /**
  * A button that submits the form via ajax. Since this button takes the form as
@@ -31,8 +27,9 @@
  * @since 1.2
  * 
  * @author Igor Vaynberg (ivaynberg)
+ * @deprecated Use {@link AjaxButton} instead.
  */
-public abstract class AjaxSubmitButton extends Button
+public abstract class AjaxSubmitButton extends AjaxButton
 {
 	private static final long serialVersionUID = 1L;
 
@@ -45,20 +42,7 @@
 	 */
 	public AjaxSubmitButton(String id)
 	{
-		this(id, null);
-	}
-	
-	/**
-	 * Returns the form if it was set in constructor, otherwise returns the 
-	 * form nearest in parent hierarchy.
-	 * @see org.apache.wicket.markup.html.form.FormComponent#getForm()
-	 */
-	public Form getForm()
-	{
-		if (form != null)
-			return form;
-		else
-			return super.getForm();
+		super(id);
 	}
 
 	/**
@@ -69,70 +53,6 @@
 	 */
 	public AjaxSubmitButton(String id, final Form form)
 	{
-		super(id);
-		this.form = form;
-
-		add(new AjaxFormSubmitBehavior(form, "onclick")
-		{
-
-			private static final long serialVersionUID = 1L;
-
-			protected void onSubmit(AjaxRequestTarget target)
-			{
-				AjaxSubmitButton.this.onSubmit(target, form);
-			}
-
-			protected void onError(AjaxRequestTarget target)
-			{
-				AjaxSubmitButton.this.onError(target, form);
-			}
-
-			protected CharSequence getEventHandler()
-			{
-				return new AppendingStringBuffer(super.getEventHandler()).append("; return false;");
-			}
-
-			protected IAjaxCallDecorator getAjaxCallDecorator()
-			{
-				return AjaxSubmitButton.this.getAjaxCallDecorator();
-			}
-
-		});
-
-	}
-
-	/**
-	 * Returns the {@link IAjaxCallDecorator} that will be used to modify the
-	 * generated javascript. This is the preferred way of changing the
-	 * javascript in the onclick handler
-	 * 
-	 * @return call decorator used to modify the generated javascript or null
-	 *         for none
-	 */
-	protected IAjaxCallDecorator getAjaxCallDecorator()
-	{
-		return null;
-	}
-
-	/**
-	 * Listener method invoked on form submit with no errors
-	 * 
-	 * @param target
-	 * @param form
-	 */
-	protected abstract void onSubmit(AjaxRequestTarget target, Form form);
-
-	/**
-	 * Listener method invoked on form submit with errors
-	 * 
-	 * @param target
-	 * @param form
-	 * 
-	 * TODO 1.3: Make abstract to be consistent with onsubmit()
-	 */
-	protected void onError(AjaxRequestTarget target, Form form)
-	{
-
+		super(id, form);
 	}
-
 }

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FormPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FormPage.java?view=diff&rev=549305&r1=549304&r2=549305
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FormPage.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FormPage.java Wed Jun 20 17:31:02 2007
@@ -19,7 +19,7 @@
 import org.apache.wicket.IClusterable;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior;
-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitButton;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.markup.html.form.RequiredTextField;
@@ -80,7 +80,7 @@
 				Duration.ONE_SECOND);
 
 		// add a button that can be used to submit the form via ajax
-		form.add(new AjaxSubmitButton("ajax-submit-button", form) {
+		form.add(new AjaxButton("ajax-button", form) {
 			protected void onSubmit(AjaxRequestTarget target, Form form) {
 				// repaint the feedback panel so that it is hidden
 				target.addComponent(feedback);

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java?view=diff&rev=549305&r1=549304&r2=549305
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java Wed Jun 20 17:31:02 2007
@@ -23,8 +23,8 @@
 import org.apache.wicket.IClusterable;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitButton;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
@@ -34,7 +34,6 @@
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.PropertyModel;
 
-
 /**
  * Ajax todo list without having to write any JavaScript yourself.
  * 
@@ -249,7 +248,7 @@
 				super(id, new CompoundPropertyModel(new TodoItem()));
 				setOutputMarkupId(true);
 				add(new TextField("text"));
-				add(new AjaxSubmitButton("add", this)
+				add(new AjaxButton("add", this)
 				{
 					protected void onSubmit(AjaxRequestTarget target, Form form)
 					{
@@ -261,7 +260,7 @@
 					}
 				});
 
-				add(new AjaxSubmitButton("cancel", this)
+				add(new AjaxButton("cancel", this)
 				{
 					public void onSubmit(AjaxRequestTarget target, Form form)
 					{