It was changed because it didn't work. The way that code was set up had the effect of tons of (FeedbackPanel specific) calls from the outside. Bugs kept popping up, and the code was getting spaghetti like.
ah, well... there you go ;-)
It's hard to get the exact details back now - it was changed quite a while ago - but the main rationales behind the changes were: * get back to a point were feedback aware components are not so much dependent of other classes/ the request cycle processing; * it was too generic in the sense that it those components trapped either one message or all messages of the whole page; * it was too specific in the sense that it wasn't possible to e.g. have a group of related components (like a few radiofields and one textfield that work together), and trap messages for just that component.I introducted IFeedbackBoundary to have a 'stopper' in the hierarchy the *optionally* says (as you can decide yourself whether you actually *want* to use IFeedbackBoundary), here's where you stop.Not only makes that possible for creating feedback 'groups' specifically, but also works much better out of the box. Page and Form are the boundaries now, which means that if you want to have a seperate trap for non-form related messages, and one just for the form, you can do that now.The collecting component lets you override the normal feedback boundaries so that you can decide to use that component as the boundary, or to trap messages for just that component.
yeah, i get it now... but it's too complex now. it's a kind of wierd hybrid between the old push model and your new pull model. i think we need to refactor again and make it all a really simple, elegant pull model...
It should be our goal to let people easily create custom feedback components, not to just have the existing feedback panel and form component feedback border (which I allways found too specific btw) work in the way we think it is handy for people. I think we need the feedback boundary and collection component concepts to ensure flexibility. And I think such components should *not* be dependent of our request processing cycle so much.
this much we ALL agree on. have a look at the proposal i just sent out. i think we can make this whole thing a lot simpler somehow...
EelcoIgor Vaynberg wrote:I can kind of see what you are saying. The abstract validator would have to search the page and find the Ifeedback for the formcomponent in error. But what if you have two ifeedbacks for a component - the feedback panel and thelabel? The search is also inefficient for something simple like this, I don't think a link in a formcomponent to a labelcomponent is that big a deal. In abstract validator you would also have to cast Ifeedback to aComponent in order to get the model, this isnt very safe, it would be niceto have Icomponent and have Ifeedback extend Icomponent. Igor-----Original Message-----From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan LockeSent: Friday, July 29, 2005 10:03 PM To: [email protected] Subject: Re: [Wicket-user] FieldLabel componentwell, i don't know what's happened to the feedback interface stuff recently, but it was originally designed to be general enough to support what you're trying to do. seems like what you're writing is more or less a FormComponentFeedbackLabel. and the link is simply implementing IFeedback (or it used to be... i'm not sure what's changed... it looks unfamiliar now). the form code then finds the associated feedback elements for each form component.Igor Vaynberg wrote:I've seen the error border, it doesn't do what I want - in our app a red asterisk indicates a required field and field labelswith errors turn red.What I am looking for is a way to link the label to thecomponent notthe other way around. My primary interest was the validatorstuff, theOf Jonathandecoration of the label was a bonus. -Igor-----Original Message----- From: [EMAIL PROTECTED][mailto:[EMAIL PROTECTED] On Behalfasterisk, seeLocke Sent: Friday, July 29, 2005 8:14 PM To: [email protected] Subject: Re: [Wicket-user] FieldLabel componentif you just want to show an error indicator like a redcontents onFormComponentFeedbackBorder.i personally don't like the idea of changing field labelwicket.model.IModel; importusers. so instead, i've emphasized FeedbackPanel and IFeedback.however, you should be able to implement what you're talking about though by implementing IFeedback on a subclass of Label.Igor Vaynberg wrote:Hi Guys, Ive been working on forms a lot lately, and what ive beenmissing fromtapestry is a fieldlabel component. Basically a fieldlabelis a labelthat is linked to a form component. This allows to do cool things like: 1) FieldLabel can change its apperance based on the form componentTextField tf=new RequiredTextField(...) FieldLabel lb=new FieldLabel("label1","First Name", tf) {public void initialize() { add(new AttributeModifier("style", true, new Model("color:red;")) { public boolean isEnabled() { return !getFieldComponent().isValid(); } }); } }; This will create a field label that will turn red when thelinked formcomponent has an error. Another good use is to prepand an asterisk to thefieldlabel's label ifthe linked form component has a requiredvalidator added. 2) FieldLabel's label can participate in validator messages With this patch it is possible to create generic errormessages of form :"'${label}' is required" or "'${label}' contains an invalidemail address"I am looking for feedback and ideas on how to make thisbetter before Isubmit this as a patch. Thank you! Igor ------------------------------------------------------------------------ Index: wicket/markup/html/form/FormComponent.java ===================================================================RCS file: /cvsroot/wicket/wicket/src/java/wicket/markup/html/form/FormComponent.java,v retrieving revision 1.43 diff -u -r1.43 FormComponent.java--- wicket/markup/html/form/FormComponent.java 28 Jul2005 11:56:51 -0000 1.43+++ wicket/markup/html/form/FormComponent.java 30 Jul2005 02:32:19 -0000@@ -30,6 +30,7 @@ import wicket.model.IModel; import wicket.util.lang.Classes; import wicket.util.string.StringList; +import wicket.version.undo.Change; /*** An html form component knows how to validate itself. Validators that @@ -71,6 +72,9 @@/** The validator or validator list for this component. */ private IValidator validator = IValidator.NULL; + /** The field label for this component */ + private FieldLabel fieldLabel; + /** * Typesafe interface to code that is called whenvisiting a form component* @@ -575,4 +579,24 @@ { validator.validate(this); } + + protected FormComponent setFieldLabel(FieldLabel label) { + if (fieldLabel!=null) { + + addStateChange(new Change() { + private final FieldLabel +oldFieldLabel=FormComponent.this.fieldLabel; + + public void undo() + {+FormComponent.this.fieldLabel=oldFieldLabel;+ } + }); + } + this.fieldLabel=label; + return this; + } + + public FieldLabel getFieldLabel() { + return fieldLabel; + } } \ No newline at end of file Index: wicket/markup/html/form/validation/AbstractValidator.java ===================================================================RCS file: /cvsroot/wicket/wicket/src/java/wicket/markup/html/form/validation/AbstractValidator.java,v retrieving revision 1.31 diff -u -r1.31 AbstractValidator.java ---wicket/markup/html/form/validation/AbstractValidator.java 21 Jul 2005 10:46:36 -0000 1.31+++wicket/markup/html/form/validation/AbstractValidator.java 30 Jul 2005 02:32:19 -0000@@ -21,6 +21,7 @@ import java.util.Map; import wicket.Localizer; +import wicket.markup.html.form.FieldLabel; import wicket.markup.html.form.FormComponent; import wicket.model.IModel; import wicket.model.Model; @@ -139,6 +140,21 @@ final Map resourceModel = new HashMap(4); resourceModel.put("input", formComponent.getInput()); resourceModel.put("name", formComponent.getId()); + + // try to retrieve the label from field label,default to empty string+ String labelValue = ""; + FieldLabel label = formComponent.getFieldLabel(); + if (label != null) + { + Object modelObject = label.getModelObject(); + if (modelObject != null) + { + labelValue = modelObject.toString(); + } + } + resourceModel.put("label", labelValue); + + return resourceModel; } } Index: wicket/markup/html/form/FieldLabel.java =================================================================== RCS file: wicket/markup/html/form/FieldLabel.java diff -N wicket/markup/html/form/FieldLabel.java --- /dev/null 1 Jan 1970 00:00:00 -0000+++ wicket/markup/html/form/FieldLabel.java 1 Jan 197000:00:00 -0000@@ -0,0 +1,55 @@ +package wicket.markup.html.form; + +import wicket.AttributeModifier; +import wicket.Component; +import wicket.markup.html.WebMarkupContainer;+import wicket.markup.html.basic.Label; import +wicket.markup.html.panel.Panel; importStrategies+wicket.model.Model; import wicket.model.PropertyModel; + +public class FieldLabel extends Label { + protected FormComponent fc; + + public FieldLabel(String id, FormComponent formComponent) + { + super(id); + internalInitialize(formComponent); + } + + public FieldLabel(String id, String string,FormComponent formComponent)+ { + super(id, string); + internalInitialize(formComponent); + } + + public FieldLabel(String id, IModel model,FormComponent formComponent)+ { + super(id, model); + internalInitialize(formComponent); + } + + private void internalInitialize(FormComponent formComponent) + { + if (fc==null) throw newIllegalArgumentException("formComponent cannot be null");+ this.fc=fc; + + fc.setFieldLabel(this); + setRenderBodyOnly(true); + + initialize(); + } + + public final FormComponent getFormComponent() { + return fc; + } + + public void initialize() { + + } + + + +}-------------------------------------------------------SF.Net email is sponsored by: Discover Easy Linux Migrationfrom IBM. Find simple to follow Roadmaps, straightforward articles,informative Webcasts and more! Get everything you need to get up to speed, fast.http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user-------------------------------------------------------SF.Net email is sponsored by: Discover Easy Linux MigrationStrategiesfrom IBM. Find simple to follow Roadmaps, straightforward articles,informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user-------------------------------------------------------SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
