Author: ivaynberg
Date: Wed Oct 15 11:18:59 2008
New Revision: 704985
URL: http://svn.apache.org/viewvc?rev=704985&view=rev
Log:
WICKET-1055
Added:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.html
(with props)
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.java
(with props)
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.html
(with props)
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.java
(with props)
Modified:
wicket/trunk/wicket-examples/.amateras
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/Index.html
wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroupSelector.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
Modified: wicket/trunk/wicket-examples/.amateras
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/.amateras?rev=704985&r1=704984&r2=704985&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/.amateras (original)
+++ wicket/trunk/wicket-examples/.amateras Wed Oct 15 11:18:59 2008
@@ -1,11 +1,12 @@
#EclipseHTMLEditor configuration file
-#Tue Apr 10 14:11:00 CEST 2007
-validateDTD=true
-useDTD=true
-validateJSP=true
-validateXML=true
-validateJS=true
+#Wed Oct 15 10:10:26 PDT 2008
+validateDTD=false
+javaScriptCompleters=
+useDTD=false
+validateJSP=false
+validateXML=false
+validateJS=false
removeMarkers=true
root=/
-validateHTML=true
+validateHTML=false
javaScripts=
Added:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.html?rev=704985&view=auto
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.html
(added)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.html
Wed Oct 15 11:18:59 2008
@@ -0,0 +1,56 @@
+
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>Wicket Examples - component reference</title>
+ <link rel="stylesheet" type="text/css" href="style.css"/>
+</head>
+<body>
+ <span wicket:id="mainNavigation"/>
+
+ <h1>wicket.markup.html.form.CheckGroup</h1>
+ <wicket:link><a href="Index.html">[back to the
reference]</a></wicket:link>
+
+ <p>
+ A CheckBoxGroup and CheckBoxComponnet components let users select
multiple values from a group of checkboxes. These components are more flexible
then the CheckBoxMultipleChoice component in that individual checkboxes are
full components, unlike with CheckBoxMultipleChoice, and thus can be used
anywhere in the markup.
+ </p>
+ <p>
+ <form wicket:id="form">
+ <wicket:container wicket:id="group">
+ <wicket:container wicket:id="group2">
+ <table style="border: 2px dotted #fc0; width:
400px; padding: 5px;">
+ <tr>
+ <td valign="top">Select persons</td>
+ <td>
+ <input type="checkbox"
wicket:id="groupselector">check/uncheck all in selection 1</input><br/>
+ <input type="checkbox"
wicket:id="groupselector2">check/uncheck all in selection 2</input><br/>
+ <table cellspacing="0"
cellpadding="2">
+ <tr>
+ <td><b>Select1</b></td>
+ <td><b>Select2</b></td>
+ <td><b>First
Name</b></td>
+ <td><b>Last
Name</b></td>
+ </tr>
+ <tr wicket:id="persons">
+ <td><input
type="checkbox" wicket:id="checkbox"/></td>
+ <td><input
type="checkbox" wicket:id="checkbox2"/></td>
+ <td><span
wicket:id="name">[this is where name will be]</span></td>
+ <td><span
wicket:id="lastName">[this is where lastname will be]</span></td>
+ </tr>
+ </table>
+ <span valign="top">
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input type="submit" value="submit" />
+ </td>
+ </tr>
+ </table>
+ </wicket:container>
+ </wicket:container>
+ </form>
+ <span wicket:id="feedback">feedbackmessages will be put here</span>
+</body>
+</html>
Propchange:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.java?rev=704985&view=auto
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.java
(added)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.java
Wed Oct 15 11:18:59 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.examples.compref;
+
+import java.util.ArrayList;
+
+import org.apache.wicket.examples.WicketExamplePage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Check;
+import org.apache.wicket.markup.html.form.CheckGroup;
+import org.apache.wicket.markup.html.form.CheckGroupSelector;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.PropertyModel;
+
+
+/**
+ * CheckGroup and Check components example page
+ *
+ * @author ivaynberg
+ */
+public class CheckGroupPage2 extends WicketExamplePage
+{
+ /**
+ * Constructor
+ */
+ public CheckGroupPage2()
+ {
+ final CheckGroup<Person> group = new
CheckGroup<Person>("group", new ArrayList<Person>());
+ final CheckGroup<Person> group2 = new
CheckGroup<Person>("group2", new ArrayList<Person>());
+ Form<?> form = new Form<Void>("form")
+ {
+ @Override
+ protected void onSubmit()
+ {
+ info("selection 1 person(s): " +
group.getDefaultModelObjectAsString());
+ info("selection 2 person(s): " +
group2.getDefaultModelObjectAsString());
+ }
+ };
+
+ add(form);
+ form.add(group);
+ group.add(group2);
+
+ group2.add(new CheckGroupSelector("groupselector", group));
+ group2.add(new CheckGroupSelector("groupselector2", group2));
+ ListView<Person> persons = new ListView<Person>("persons",
+ ComponentReferenceApplication.getPersons())
+ {
+
+ @Override
+ protected void populateItem(ListItem<Person> item)
+ {
+ item.add(new Check<Person>("checkbox",
item.getModel(), group));
+ item.add(new Check<Person>("checkbox2",
item.getModel(), group2));
+ item.add(new Label("name",
+ new
PropertyModel<String>(item.getDefaultModel(), "name")));
+ item.add(new Label("lastName", new
PropertyModel<String>(item.getDefaultModel(),
+ "lastName")));
+ }
+
+ };
+
+ group2.add(persons);
+
+ add(new FeedbackPanel("feedback"));
+ }
+}
Propchange:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/Index.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/Index.html?rev=704985&r1=704984&r2=704985&view=diff
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/Index.html
(original)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/Index.html
Wed Oct 15 11:18:59 2008
@@ -63,12 +63,14 @@
<li><a
href="TextAreaPage.html">wicket.markup.html.form.TextArea</a></li>
<li><a
href="CheckBoxPage.html">wicket.markup.html.form.CheckBox</a></li>
<li><a
href="CheckGroupPage.html">wicket.markup.html.form.CheckGroup,
wicket.markup.html.form.Check, and
wicket.markup.html.form.CheckGroupSelector</a></li>
+ <li><a href="CheckGroupPage2.html">Embedded
wicket.markup.html.form.CheckGroup, wicket.markup.html.form.Check, and
wicket.markup.html.form.CheckGroupSelector</a></li>
<li><a
href="CheckBoxMultipleChoicePage.html">wicket.markup.html.form.CheckBoxMultipleChoice</a></li>
<li><a
href="PalettePage.html">wicket.markup.html.form.palette.Palette</a></li>
<li><a
href="DropDownChoicePage.html">wicket.markup.html.form.DropDownChoice</a></li>
<li><a
href="ListChoicePage.html">wicket.markup.html.form.ListChoice</a></li>
<li><a
href="RadioChoicePage.html">wicket.markup.html.form.RadioChoice</a></li>
<li><a
href="RadioGroupPage.html">wicket.markup.html.form.RadioGroup and
wicket.markup.html.form.Radio</a></li>
+ <li><a href="RadioGroupPage2.html">Embedded
wicket.markup.html.form.RadioGroup and wicket.markup.html.form.Radio</a></li>
<li><a
href="ListMultipleChoicePage.html">wicket.markup.html.form.ListMultipleChoice</a></li>
<li><a
href="SelectPage.html">wicket.extensions.markup.html.form.select.Select</a></li>
<li><a
href="PalettePage.html">wicket.extensions.markup.html.palette.Palette</a></li>
Added:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.html
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.html?rev=704985&view=auto
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.html
(added)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.html
Wed Oct 15 11:18:59 2008
@@ -0,0 +1,54 @@
+
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>Wicket Examples - component reference</title>
+ <link rel="stylesheet" type="text/css" href="style.css"/>
+</head>
+<body>
+ <span wicket:id="mainNavigation"/>
+
+ <h1>wicket.markup.html.form.RadioGroup and
wicket.markup.html.form.Radio</h1>
+ <wicket:link><a href="Index.html">[back to the
reference]</a></wicket:link>
+
+ <p>
+ A RadioGroup and Radio components let users select a single value from
a group of radio buttons. These components are more flexible then the
RadioChoice component in that individual radio choices are full components,
unlike with RadioChoice, and thus can be used anywhere in the markup.
+ </p>
+ <p>
+ <form wicket:id="form">
+ <wicket:container wicket:id="group">
+ <wicket:container wicket:id="group2">
+ <table style="border: 2px dotted #fc0; width:
400px; padding: 5px;">
+ <tr>
+ <td valign="top">Select a person</td>
+ <td>
+ <table cellspacing="0"
cellpadding="2">
+ <tr>
+ <td><b>Select1</b></td>
+ <td><b>Select2</b></td>
+ <td><b>First
Name</b></td>
+ <td><b>Last
Name</b></td>
+ </tr>
+ <tr wicket:id="persons">
+ <td><input type="radio"
wicket:id="radio"/></td>
+ <td><input type="radio"
wicket:id="radio2"/></td>
+ <td><span
wicket:id="name">[this is where name will be]</span></td>
+ <td><span
wicket:id="lastName">[this is where lastname will be]</span></td>
+ </tr>
+ </table>
+ <span valign="top">
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input type="submit" value="submit" />
+ </td>
+ </tr>
+ </table>
+ </wicket:container>
+ </wicket:container>
+ </form>
+ <span wicket:id="feedback">feedbackmessages will be put here</span>
+</body>
+</html>
Propchange:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.java?rev=704985&view=auto
==============================================================================
---
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.java
(added)
+++
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.java
Wed Oct 15 11:18:59 2008
@@ -0,0 +1,82 @@
+/*
+ * 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.examples.compref;
+
+import org.apache.wicket.examples.WicketExamplePage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.Radio;
+import org.apache.wicket.markup.html.form.RadioGroup;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+
+/**
+ * RadioGroup and Radio components example page
+ *
+ * @author ivaynberg
+ */
+public class RadioGroupPage2 extends WicketExamplePage
+{
+ /**
+ * Constructor
+ */
+ public RadioGroupPage2()
+ {
+
+ final RadioGroup<Person> group = new
RadioGroup<Person>("group", new Model<Person>());
+ final RadioGroup<Person> group2 = new
RadioGroup<Person>("group2", new Model<Person>());
+ Form<?> form = new Form<Void>("form")
+ {
+ @Override
+ protected void onSubmit()
+ {
+ info("selection group1: " +
group.getDefaultModelObjectAsString());
+ info("selection group2: " +
group2.getDefaultModelObjectAsString());
+ }
+ };
+
+ add(form);
+ form.add(group);
+ group.add(group2);
+
+ ListView<Person> persons = new ListView<Person>("persons",
+ ComponentReferenceApplication.getPersons())
+ {
+
+ @Override
+ protected void populateItem(ListItem<Person> item)
+ {
+ item.add(new Radio<Person>("radio",
item.getModel(), group));
+ item.add(new Radio<Person>("radio2",
item.getModel(), group2));
+ item.add(new Label("name",
+ new
PropertyModel<String>(item.getDefaultModel(), "name")));
+ item.add(new Label("lastName", new
PropertyModel<String>(item.getDefaultModel(),
+ "lastName")));
+ }
+
+ };
+
+ group2.add(persons);
+
+ add(new FeedbackPanel("feedback"));
+ }
+
+}
Propchange:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/RadioGroupPage2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=704985&r1=704984&r2=704985&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Wed Oct
15 11:18:59 2008
@@ -473,7 +473,8 @@
*
* <pre>
*
- * User u = (User)getModelObject(); u.setName("got you
there!");
+ * User u = (User)getModelObject();
+ * u.setName("got you there!");
*
* </pre>
*
@@ -495,11 +496,12 @@
* <li>The 'normal' use is for controlling whether a component is
rendered without having any
* effect on the rest of the processing. If a strategy lets this method
return 'false', then the
* target component and its children will not be rendered, in the same
fashion as if that
- * component had visibility property 'false'.</li> <li>The other use is
when a component should
- * block the rendering of the whole page. So instead of 'hiding' a
component, what we generally
- * want to achieve here is that we force the user to
logon/give-credentials for a higher level
- * of authorization. For this functionality, the strategy
implementation should throw a
- * [EMAIL PROTECTED] AuthorizationException}, which will then be
handled further by the framework.</li>
+ * component had visibility property 'false'.</li>
+ * <li>The other use is when a component should block the rendering of
the whole page. So
+ * instead of 'hiding' a component, what we generally want to achieve
here is that we force the
+ * user to logon/give-credentials for a higher level of authorization.
For this functionality,
+ * the strategy implementation should throw a [EMAIL PROTECTED]
AuthorizationException}, which will then be
+ * handled further by the framework.</li>
* </ul>
* </p>
*/
@@ -702,10 +704,10 @@
* What's stored here depends on what attributes are set on component.
Data can contains
* combination of following attributes:
* <ul>
- * <li>Model (indicated by [EMAIL PROTECTED] #FLAG_MODEL_SET})
<li>MetaDataEntry (optionally
- * [EMAIL PROTECTED] MetaDataEntry}[] if more metadata entries are
present) * <li>[EMAIL PROTECTED] IBehavior}(s)
- * added to component. The behaviors are not stored in separate array,
they are part of the
- * [EMAIL PROTECTED] #data} array
+ * <li>Model (indicated by [EMAIL PROTECTED] #FLAG_MODEL_SET})
+ * <li>MetaDataEntry (optionally [EMAIL PROTECTED] MetaDataEntry}[] if
more metadata entries are present) *
+ * <li>[EMAIL PROTECTED] IBehavior}(s) added to component. The
behaviors are not stored in separate array,
+ * they are part of the [EMAIL PROTECTED] #data} array
* </ul>
* If there is only one attribute set (i.e. model or MetaDataEntry([])
or one behavior), the
* #data object points directly to value of that attribute. Otherwise
the data is of type
@@ -2654,7 +2656,8 @@
/**
* Replaces this component with another. The replacing component must
have the same component id
* as this component. This method serves as a shortcut to <code>
- * this.getParent().replace(replacement)</code> and provides a better
context for errors.
+ * this.getParent().replace(replacement)</code>
+ * and provides a better context for errors.
*
* @since 1.2.1
*
@@ -3774,7 +3777,7 @@
/**
* Called just before a component is rendered.
* <p>
- * *NOTE* If you override this, you *must* call super.onBeforeRender()
within your
+ **NOTE* If you override this, you *must* call super.onBeforeRender()
within your
* implementation.
*
* Because this method is responsible for cascading [EMAIL PROTECTED]
#onBeforeRender()} call to its
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java?rev=704985&r1=704984&r2=704985&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
Wed Oct 15 11:18:59 2008
@@ -52,12 +52,14 @@
*/
private short uuid = -1;
+ private final CheckGroup<T> group;
+
/**
* @see WebMarkupContainer#WebMarkupContainer(String)
*/
public Check(String id)
{
- super(id);
+ this(id, null, null);
}
/**
@@ -67,7 +69,31 @@
*/
public Check(String id, IModel<T> model)
{
+ this(id, model, null);
+ }
+
+ /**
+ * @param id
+ * @param group
+ * parent [EMAIL PROTECTED] CheckGroup} of this check
+ * @see WebMarkupContainer#WebMarkupContainer(String)
+ */
+ public Check(String id, CheckGroup<T> group)
+ {
+ this(id, null, group);
+ }
+
+ /**
+ * @param id
+ * @param model
+ * @param group
+ * parent [EMAIL PROTECTED] CheckGroup} of this check
+ * @see WebMarkupContainer#WebMarkupContainer(String, IModel)
+ */
+ public Check(String id, IModel<T> model, CheckGroup<T> group)
+ {
super(id, model);
+ this.group = group;
}
@@ -102,12 +128,15 @@
checkComponentTag(tag, "input");
checkComponentTagAttribute(tag, "type", "checkbox");
- CheckGroup<?> group = findParent(CheckGroup.class);
-
+ CheckGroup<?> group = this.group;
if (group == null)
{
- throw new WicketRuntimeException("Check component [" +
getPath() +
- "] cannot find its parent CheckGroup");
+ group = findParent(CheckGroup.class);
+ if (group == null)
+ {
+ throw new WicketRuntimeException("Check
component [" + getPath() +
+ "] cannot find its parent CheckGroup");
+ }
}
final String uuid = getValue();
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroupSelector.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroupSelector.java?rev=704985&r1=704984&r2=704985&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroupSelector.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/CheckGroupSelector.java
Wed Oct 15 11:18:59 2008
@@ -35,13 +35,25 @@
/** */
private static final long serialVersionUID = 1L;
+ private final CheckGroup<?> group;
/**
* @see WebMarkupContainer#WebMarkupContainer(String)
*/
public CheckGroupSelector(String id)
{
+ this(id, null);
+ }
+
+ /**
+ * @param id
+ * @param group
+ * @see WebMarkupContainer#WebMarkupContainer(String)
+ */
+ public CheckGroupSelector(String id, CheckGroup<?> group)
+ {
super(id);
+ this.group = group;
}
/**
@@ -55,13 +67,17 @@
checkComponentTag(tag, "input");
checkComponentTagAttribute(tag, "type", "checkbox");
- CheckGroup<?> group = findParent(CheckGroup.class);
+ CheckGroup<?> group = this.group;
if (group == null)
{
- throw new WicketRuntimeException(
- "CheckGroupSelector component [" +
- getPath() +
- "] cannot find its parent CheckGroup.
All CheckGroupSelector components must be a child of or below in the hierarchy
of a CheckGroup component.");
+ group = findParent(CheckGroup.class);
+ if (group == null)
+ {
+ throw new WicketRuntimeException(
+ "CheckGroupSelector component [" +
+ getPath() +
+ "] cannot find its parent
CheckGroup. All CheckGroupSelector components must be a child of or below in
the hierarchy of a CheckGroup component.");
+ }
}
tag.put(
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java?rev=704985&r1=704984&r2=704985&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
Wed Oct 15 11:18:59 2008
@@ -49,12 +49,15 @@
*/
private short uuid = -1;
+ private final RadioGroup<T> group;
+
+
/**
* @see WebMarkupContainer#WebMarkupContainer(String)
*/
public Radio(String id)
{
- super(id);
+ this(id, null, null);
}
/**
@@ -64,7 +67,30 @@
*/
public Radio(String id, IModel<T> model)
{
+ this(id, model, null);
+ }
+
+ /**
+ * @param group
+ * parent [EMAIL PROTECTED] RadioGroup}
+ * @see WebMarkupContainer#WebMarkupContainer(String)
+ */
+ public Radio(String id, RadioGroup<T> group)
+ {
+ this(id, null, group);
+ }
+
+ /**
+ * @param id
+ * @param model
+ * @param group
+ * parent [EMAIL PROTECTED] RadioGroup}
+ * @see WebMarkupContainer#WebMarkupContainer(String, IModel)
+ */
+ public Radio(String id, IModel<T> model, RadioGroup<T> group)
+ {
super(id, model);
+ this.group = group;
}
@@ -101,13 +127,17 @@
final String value = getValue();
- RadioGroup<?> group = findParent(RadioGroup.class);
+ RadioGroup<?> group = this.group;
if (group == null)
{
- throw new WicketRuntimeException(
- "Radio component [" +
- getPath() +
- "] cannot find its parent RadioGroup.
All Radio components must be a child of or below in the hierarchy of a
RadioGroup component.");
+ group = findParent(RadioGroup.class);
+ if (group == null)
+ {
+ throw new WicketRuntimeException(
+ "Radio component [" +
+ getPath() +
+ "] cannot find its parent
RadioGroup. All Radio components must be a child of or below in the hierarchy
of a RadioGroup component.");
+ }
}