RE: Boolean DropDownChoice
Even better, why are you using a drop down at all? Check boxes are normally used for true-false choices. From: Paul Bors p...@bors.ws To: users@wicket.apache.org Date: 08/01/2012 07:51 PM Subject:RE: Boolean DropDownChoice Instead of going to the extent of overriding a class because your model value is not updated, why not fix the problem? Take a look at the component reference wicket-example project: http://www.wicket-library.com/wicket-examples/compref/ More precisely at the DropDownChoice: http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/or g.apache.wicket.examples.compref.DropDownChoicePage?0 -Original Message- From: Lawrence, Sean [mailto:sean.lawre...@mantech.com] Sent: Wednesday, August 01, 2012 7:19 PM To: users@wicket.apache.org Subject: Boolean DropDownChoice Hi, I'm trying to create a custom form component that extends a DropDownChoiceBoolean. The reason I'm doing this is because I need a form component that forces a user to select a choice. However, I'm unable to get the model to update. What am I not overriding properly? I'm all ears for suggestions if there is a better way to do this as well. /** * A Boolean form component that uses a drop down choice so that * a user is forced to choose between Yes or No. * */ public class YesNoDropDownChoice extends DropDownChoiceBoolean { private static final long serialVersionUID = 1L; public YesNoDropDownChoice(String id, IModelBoolean model) { super(id, model, Arrays.asList( Choice.YES.getBoolean(), Choice.NO.getBoolean())); onModelChanged(); } @Override protected void onModelChanged() { super.onModelChanged(); setModelObject(getModelObject()); } /** * {@inheritDoc} */ @Override protected void convertInput() { Boolean b = getModelObject(); setConvertedInput(b); } } Thanks in advance, Sean Lawrence This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org ** This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies. **
RE: Boolean DropDownChoice
Hi Paul, The reason for the dropdown over the checkbox is I'm attempting to enforce a selection. I.e. make required or @NotNull I think I got a bit carried away by attempting to extend DropDownChoice. Thanks for the link. The following is what I'm going forward with: new DropDownChoiceBoolean(active, new PropertyModelBoolean(getModel(), active), Arrays.asList(null, new Boolean(true), new Boolean(false))); I'll will likely add a IRenderer as well so the choices render as Yes, No, or ---. Thanks again, Sean Lawrence -Original Message- From: Richard W. Adams [mailto:rwada...@up.com] Sent: Thursday, August 02, 2012 7:53 AM To: users@wicket.apache.org Subject: RE: Boolean DropDownChoice Even better, why are you using a drop down at all? Check boxes are normally used for true-false choices. From: Paul Bors p...@bors.ws To: users@wicket.apache.org Date: 08/01/2012 07:51 PM Subject:RE: Boolean DropDownChoice Instead of going to the extent of overriding a class because your model value is not updated, why not fix the problem? Take a look at the component reference wicket-example project: http://www.wicket-library.com/wicket-examples/compref/ More precisely at the DropDownChoice: http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/or g.apache.wicket.examples.compref.DropDownChoicePage?0 -Original Message- From: Lawrence, Sean [mailto:sean.lawre...@mantech.com] Sent: Wednesday, August 01, 2012 7:19 PM To: users@wicket.apache.org Subject: Boolean DropDownChoice Hi, I'm trying to create a custom form component that extends a DropDownChoiceBoolean. The reason I'm doing this is because I need a form component that forces a user to select a choice. However, I'm unable to get the model to update. What am I not overriding properly? I'm all ears for suggestions if there is a better way to do this as well. /** * A Boolean form component that uses a drop down choice so that * a user is forced to choose between Yes or No. * */ public class YesNoDropDownChoice extends DropDownChoiceBoolean { private static final long serialVersionUID = 1L; public YesNoDropDownChoice(String id, IModelBoolean model) { super(id, model, Arrays.asList( Choice.YES.getBoolean(), Choice.NO.getBoolean())); onModelChanged(); } @Override protected void onModelChanged() { super.onModelChanged(); setModelObject(getModelObject()); } /** * {@inheritDoc} */ @Override protected void convertInput() { Boolean b = getModelObject(); setConvertedInput(b); } } Thanks in advance, Sean Lawrence This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org ** This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies. ** This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Boolean DropDownChoice
Instead of going to the extent of overriding a class because your model value is not updated, why not fix the problem? Take a look at the component reference wicket-example project: http://www.wicket-library.com/wicket-examples/compref/ More precisely at the DropDownChoice: http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/or g.apache.wicket.examples.compref.DropDownChoicePage?0 -Original Message- From: Lawrence, Sean [mailto:sean.lawre...@mantech.com] Sent: Wednesday, August 01, 2012 7:19 PM To: users@wicket.apache.org Subject: Boolean DropDownChoice Hi, I'm trying to create a custom form component that extends a DropDownChoiceBoolean. The reason I'm doing this is because I need a form component that forces a user to select a choice. However, I'm unable to get the model to update. What am I not overriding properly? I'm all ears for suggestions if there is a better way to do this as well. /** * A Boolean form component that uses a drop down choice so that * a user is forced to choose between Yes or No. * */ public class YesNoDropDownChoice extends DropDownChoiceBoolean { private static final long serialVersionUID = 1L; public YesNoDropDownChoice(String id, IModelBoolean model) { super(id, model, Arrays.asList( Choice.YES.getBoolean(), Choice.NO.getBoolean())); onModelChanged(); } @Override protected void onModelChanged() { super.onModelChanged(); setModelObject(getModelObject()); } /** * {@inheritDoc} */ @Override protected void convertInput() { Boolean b = getModelObject(); setConvertedInput(b); } } Thanks in advance, Sean Lawrence This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org