You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "ray bon (JIRA)" <ji...@apache.org> on 2009/02/13 17:30:59 UTC
[jira] Created: (WICKET-2104) FormTester does not toggle selected
values when using selectMultiple
FormTester does not toggle selected values when using selectMultiple
--------------------------------------------------------------------
Key: WICKET-2104
URL: https://issues.apache.org/jira/browse/WICKET-2104
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.5
Environment: Ubuntu 8.04, Java 1.6
Reporter: ray bon
FormTester.selectMultiple only appends values, there is no way to replace or 'uncheck' items in a multiple select. This is contrary to the documentation in the source which does mention a toggle.
This is different from issue WICKET-1893. The solution there affects the model prior to submit().
Following are three methods that could be added to implement the toggle capability:
add to inner class
protected abstract class ChoiceSelector :
/**
* Implements removal of current selection(s) to allow toggle behaviour of assignValueToFormComponent.
*
* @param formComponent
* a <code>FormComponent</code>
*/
protected void doUnSelect() // should this be final?
{
// multiple selectable should remove unselected option(s)
removeFormComponentValues(formComponent);
}
add to FormTester
/**
* Simulates selecting multiple options for the <code>FormComponent</code>. The
* method only support multiple selectable <code>FormComponent</code>s.
*
* @see #select(String, int)
*
* @param formComponentId
* relative path (from <code>Form</code>) to the selectable
* <code>FormComponent</code>
* @param indexes
* index of the selectable option, starting from 0
* @param toggle
* set to <code>true</code> to clear existing selected option(s)
* set to <code>false</code> to append to existing selected option(s)
*/
public void selectMultiple(String formComponentId, int[] indexes, boolean toggle)
{
checkClosed();
ChoiceSelector choiceSelector = choiceSelectorFactory.createForMultiple((FormComponent)workingForm.get(formComponentId));
if (toggle)
{
choiceSelector.doUnSelect();
}
selectMultiple(formComponentId, indexes);
}
add to FormTester
/**
* Removes <code>FormComponent</code>'s values from request parameter.
*
* @param formComponent
* a <code>FormComponent</code>
*/
private void removeFormComponentValues(FormComponent formComponent)
{
if (parameterExist(formComponent))
{
Map newParameters = new HashMap(); // could also get parameters from request and clear()
newParameters.put(formComponent.getInputName(), new String[0]);
baseWicketTester.getServletRequest().setParameters(newParameters);
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WICKET-2104) FormTester does not toggle selected
values when using selectMultiple
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Juergen Donnerstag resolved WICKET-2104.
----------------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.5-M1)
1.4-RC3
Assignee: Juergen Donnerstag (was: Timo Rantalaiho)
added FormTester:selectMultiple(String formComponentId, int[] indexes, final boolean replace). The "replace" parameter allows to reset any existing selection first.
> FormTester does not toggle selected values when using selectMultiple
> --------------------------------------------------------------------
>
> Key: WICKET-2104
> URL: https://issues.apache.org/jira/browse/WICKET-2104
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5
> Environment: Ubuntu 8.04, Java 1.6
> Reporter: ray bon
> Assignee: Juergen Donnerstag
> Fix For: 1.4-RC3
>
>
> FormTester.selectMultiple only appends values, there is no way to replace or 'uncheck' items in a multiple select. This is contrary to the documentation in the source which does mention a toggle.
> This is different from issue WICKET-1893. The solution there affects the model prior to submit().
> Following are three methods that could be added to implement the toggle capability:
> add to inner class
> protected abstract class ChoiceSelector :
> /**
> * Implements removal of current selection(s) to allow toggle behaviour of assignValueToFormComponent.
> *
> * @param formComponent
> * a <code>FormComponent</code>
> */
> protected void doUnSelect() // should this be final?
> {
> // multiple selectable should remove unselected option(s)
> removeFormComponentValues(formComponent);
> }
> add to FormTester
> /**
> * Simulates selecting multiple options for the <code>FormComponent</code>. The
> * method only support multiple selectable <code>FormComponent</code>s.
> *
> * @see #select(String, int)
> *
> * @param formComponentId
> * relative path (from <code>Form</code>) to the selectable
> * <code>FormComponent</code>
> * @param indexes
> * index of the selectable option, starting from 0
> * @param toggle
> * set to <code>true</code> to clear existing selected option(s)
> * set to <code>false</code> to append to existing selected option(s)
> */
> public void selectMultiple(String formComponentId, int[] indexes, boolean toggle)
> {
> checkClosed();
> ChoiceSelector choiceSelector = choiceSelectorFactory.createForMultiple((FormComponent)workingForm.get(formComponentId));
>
> if (toggle)
> {
> choiceSelector.doUnSelect();
> }
> selectMultiple(formComponentId, indexes);
> }
> add to FormTester
> /**
> * Removes <code>FormComponent</code>'s values from request parameter.
> *
> * @param formComponent
> * a <code>FormComponent</code>
> */
> private void removeFormComponentValues(FormComponent formComponent)
> {
> if (parameterExist(formComponent))
> {
> Map newParameters = new HashMap(); // could also get parameters from request and clear()
> newParameters.put(formComponent.getInputName(), new String[0]);
> baseWicketTester.getServletRequest().setParameters(newParameters);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WICKET-2104) FormTester does not toggle selected
values when using selectMultiple
Posted by "Timo Rantalaiho (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Rantalaiho updated WICKET-2104:
------------------------------------
Fix Version/s: 1.5-M1
See the original mailing list discussion
http://www.nabble.com/FormTester-selectMultiple-CheckBoxMultipleChoice-help-td21971209.html#a22004300
for a potential workaround.
If working workarounds can be found, we'll only tackle this in Wicket 1.5.
> FormTester does not toggle selected values when using selectMultiple
> --------------------------------------------------------------------
>
> Key: WICKET-2104
> URL: https://issues.apache.org/jira/browse/WICKET-2104
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5
> Environment: Ubuntu 8.04, Java 1.6
> Reporter: ray bon
> Assignee: Timo Rantalaiho
> Fix For: 1.5-M1
>
>
> FormTester.selectMultiple only appends values, there is no way to replace or 'uncheck' items in a multiple select. This is contrary to the documentation in the source which does mention a toggle.
> This is different from issue WICKET-1893. The solution there affects the model prior to submit().
> Following are three methods that could be added to implement the toggle capability:
> add to inner class
> protected abstract class ChoiceSelector :
> /**
> * Implements removal of current selection(s) to allow toggle behaviour of assignValueToFormComponent.
> *
> * @param formComponent
> * a <code>FormComponent</code>
> */
> protected void doUnSelect() // should this be final?
> {
> // multiple selectable should remove unselected option(s)
> removeFormComponentValues(formComponent);
> }
> add to FormTester
> /**
> * Simulates selecting multiple options for the <code>FormComponent</code>. The
> * method only support multiple selectable <code>FormComponent</code>s.
> *
> * @see #select(String, int)
> *
> * @param formComponentId
> * relative path (from <code>Form</code>) to the selectable
> * <code>FormComponent</code>
> * @param indexes
> * index of the selectable option, starting from 0
> * @param toggle
> * set to <code>true</code> to clear existing selected option(s)
> * set to <code>false</code> to append to existing selected option(s)
> */
> public void selectMultiple(String formComponentId, int[] indexes, boolean toggle)
> {
> checkClosed();
> ChoiceSelector choiceSelector = choiceSelectorFactory.createForMultiple((FormComponent)workingForm.get(formComponentId));
>
> if (toggle)
> {
> choiceSelector.doUnSelect();
> }
> selectMultiple(formComponentId, indexes);
> }
> add to FormTester
> /**
> * Removes <code>FormComponent</code>'s values from request parameter.
> *
> * @param formComponent
> * a <code>FormComponent</code>
> */
> private void removeFormComponentValues(FormComponent formComponent)
> {
> if (parameterExist(formComponent))
> {
> Map newParameters = new HashMap(); // could also get parameters from request and clear()
> newParameters.put(formComponent.getInputName(), new String[0]);
> baseWicketTester.getServletRequest().setParameters(newParameters);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WICKET-2104) FormTester does not toggle selected
values when using selectMultiple
Posted by "Timo Rantalaiho (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timo Rantalaiho reassigned WICKET-2104:
---------------------------------------
Assignee: Timo Rantalaiho
> FormTester does not toggle selected values when using selectMultiple
> --------------------------------------------------------------------
>
> Key: WICKET-2104
> URL: https://issues.apache.org/jira/browse/WICKET-2104
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5
> Environment: Ubuntu 8.04, Java 1.6
> Reporter: ray bon
> Assignee: Timo Rantalaiho
>
> FormTester.selectMultiple only appends values, there is no way to replace or 'uncheck' items in a multiple select. This is contrary to the documentation in the source which does mention a toggle.
> This is different from issue WICKET-1893. The solution there affects the model prior to submit().
> Following are three methods that could be added to implement the toggle capability:
> add to inner class
> protected abstract class ChoiceSelector :
> /**
> * Implements removal of current selection(s) to allow toggle behaviour of assignValueToFormComponent.
> *
> * @param formComponent
> * a <code>FormComponent</code>
> */
> protected void doUnSelect() // should this be final?
> {
> // multiple selectable should remove unselected option(s)
> removeFormComponentValues(formComponent);
> }
> add to FormTester
> /**
> * Simulates selecting multiple options for the <code>FormComponent</code>. The
> * method only support multiple selectable <code>FormComponent</code>s.
> *
> * @see #select(String, int)
> *
> * @param formComponentId
> * relative path (from <code>Form</code>) to the selectable
> * <code>FormComponent</code>
> * @param indexes
> * index of the selectable option, starting from 0
> * @param toggle
> * set to <code>true</code> to clear existing selected option(s)
> * set to <code>false</code> to append to existing selected option(s)
> */
> public void selectMultiple(String formComponentId, int[] indexes, boolean toggle)
> {
> checkClosed();
> ChoiceSelector choiceSelector = choiceSelectorFactory.createForMultiple((FormComponent)workingForm.get(formComponentId));
>
> if (toggle)
> {
> choiceSelector.doUnSelect();
> }
> selectMultiple(formComponentId, indexes);
> }
> add to FormTester
> /**
> * Removes <code>FormComponent</code>'s values from request parameter.
> *
> * @param formComponent
> * a <code>FormComponent</code>
> */
> private void removeFormComponentValues(FormComponent formComponent)
> {
> if (parameterExist(formComponent))
> {
> Map newParameters = new HashMap(); // could also get parameters from request and clear()
> newParameters.put(formComponent.getInputName(), new String[0]);
> baseWicketTester.getServletRequest().setParameters(newParameters);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.