You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/09/04 12:01:56 UTC
git commit: WICKET-4730 Filter component does not clear filter fields
Updated Branches:
refs/heads/master 2d52dd825 -> c0c9635d9
WICKET-4730 Filter component does not clear filter fields
Add an additional constructor which accepts a custom original state. This way it wont depend on the current form's model object
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c0c9635d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c0c9635d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c0c9635d
Branch: refs/heads/master
Commit: c0c9635d93ced3bc97cac65df9ceec760088952d
Parents: 2d52dd8
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Sep 4 12:00:59 2012 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Sep 4 12:00:59 2012 +0200
----------------------------------------------------------------------
.../data/table/filter/GoAndClearFilter.java | 26 +++++++++++++--
1 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/c0c9635d/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
index 8cf5990..d6d60b8 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
@@ -42,7 +42,8 @@ public class GoAndClearFilter extends GoFilter
/**
* Constructor
*
- * This constructor will use default models for the 'clear' and 'go' button labels
+ * This constructor will use default models for the 'clear' and 'go' button labels.
+ * Uses the form's model object as an original state
*
* @param id
* component id
@@ -55,7 +56,8 @@ public class GoAndClearFilter extends GoFilter
}
/**
- * Constructor
+ * Constructor.
+ * Uses the form's model object as an original state
*
* @param id
* component id
@@ -69,9 +71,27 @@ public class GoAndClearFilter extends GoFilter
public GoAndClearFilter(final String id, final FilterForm<?> form,
final IModel<String> goModel, final IModel<String> clearModel)
{
+ this(id, goModel, clearModel, WicketObjects.cloneModel(form.getDefaultModelObject()));
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * component id
+ * @param goModel
+ * model for the label of the 'go' button
+ * @param clearModel
+ * model for the label of the 'clear' button
+ * @param originalState
+ * the object to use as original state
+ */
+ public GoAndClearFilter(final String id, final IModel<String> goModel,
+ final IModel<String> clearModel, Object originalState)
+ {
super(id, goModel);
- originalState = WicketObjects.cloneModel(form.getDefaultModelObject());
+ this.originalState = originalState;
clear = new Button("clear", clearModel)
{