If no-one else does it before then, I'll try to take a look at it
tonight (if I'm finally able to get CVS access working from my hotel).
Eelco
On 8/30/05, Johannes Fahrenkrug <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm sorry that I have to nag again, but this issue is pretty important
> to our project and it would be great if someone could take a look at
> this issue (look at the message history below). Thank you very much in
> advance, guys!
>
> - Johannes
>
> Johannes Fahrenkrug wrote:
>
> > Sure, here we go:
> >
> > This is the important part of the html file:
> >
> > <!-- Daten der Reiseteilnehmer -->
> > <tr>
> > <td colspan="5">
> > <table border="0" cellpadding="0" cellspacing="0" width="100%">
> > <tr>
> > <th colspan="4" align="left">Mitreisende:</th>
> > </tr>
> > <tr>
> > <td> </td>
> > </tr>
> > <tr>
> > <th align="left">Person</th>
> > <th align="left">Geschlecht</th>
> > <th align="left">Vorname</th>
> > <th align="left">Name</th>
> > <th align="left">Geburtsdatum</th>
> > </tr>
> > <tr wicket:id="paxRow">
> > <td align="left"><span wicket:id="name">Helge</span></td>
> > <td align="left">
> > <select wicket:id="geschlecht">
> > <option value="Herr">Herr</option>
> > <option value="Frau">Frau</option>
> > </select> </td>
> > <td align="left">
> > <input wicket:id="vorname" size="20" type="text">
> > </td>
> > <td align="left">
> > <input wicket:id="nachname" size="20" type="text">
> > </td>
> > <td align="left">
> > <input wicket:id="geburt" size="8" type="text">
> > </td>
> > </tr>
> >
> > </table>
> > </td>
> > </tr>
> > </table>
> > <!-- ende mitreisende-tabelle -->
> >
> >
> ***************************************************************************
>
> >
> > This is the important part of the wicket java page:
> >
> > public PaxAdressPage(Buchung buchung) {
> > TabControlBorder tabControlBorder = new TabControlBorder("border",
> > PAGE_NR);
> > this.buchung = buchung;
> > add(tabControlBorder);
> >
> > add(new Uebersicht("uebersicht", PAGE_NR, buchung));
> > FeedbackPanel feedback = new FeedbackPanel("feedback");
> > tabControlBorder.add(feedback);
> > tabControlBorder.add(new InputForm(buchung, feedback));
> > }
> >
> > static class InputForm extends Form {
> > private static final long serialVersionUID = -276716485494111968L;
> >
> > private Buchung buchung;
> >
> > public InputForm(Buchung buchung, FeedbackPanel feedback) {
> > super("adress_form");
> > this.buchung = buchung;
> > add(new HiddenField("nextPageName", new
> > PropertyModel(buchung, "nextPageName")));
> > add(new ListView("paxRow", buchung.getPersonen()) {
> > protected void populateItem(ListItem item) {
> > Person person = (Person) item.getModelObject();
> > List<String> geschlechter = new ArrayList<String>();
> > geschlechter.add("m");
> > geschlechter.add("w");
> > item.add(new Label("name", person.getName()));
> > item.add(new DropDownChoice("geschlecht", new
> > PropertyModel(person, "geschlecht"),
> > geschlechter,
> > new ChoiceRenderer(){
> > public String getDisplayValue(Object object) {
> > if (((String) object).equals("m")) {
> > return "männlich";
> > } else {
> > return "weiblich";
> > }
> > };
> > }));
> > item.add(new TextFieldWithErrorIndicator("vorname",
> > new PropertyModel(person, "vorname")).required());
> > item.add(new TextFieldWithErrorIndicator("nachname", new
> > PropertyModel(person, "nachname")).required());
> > getSession().setLocale(new Locale("de", "DE"));
> > item.add(new TextFieldWithErrorIndicator("geburt", new
> > PropertyModel(person, "geburt"), Date.class).add(new
> > TypeValidator(Date.class, new Locale("de", "DE"))));
> > }
> > });
> > }
> >
> ***************************************************************************
>
> >
> >
> > and I attached the TextFieldWithErrorIndicator class.
> > When I don't put the TextFields into a ListView, they get surrounded
> > with a red border if they have an error (class "error" is being set).
> > If you put them into a ListView (like in the code above), that doesn't
> > happen. "hasErrorMessage" in the onRender method in
> > TextFieldWithErrorIndicator is "false" when the field is in a ListView
> > and "true" when it isn't (provided the validator returns an error, of
> > course).
> > But the error messages get displayed in the feedbackPanel in both
> > cases. I guess it might be a timing problem or something... maybe
> > "hasErrorMessage" gets reset to false when the field is in a listView
> > before the onRender method is called...
> >
> > - Johannes
> >
> > Eelco Hillenius wrote:
> >
> >> No, user list is fine too. I haven't found the time to look at it yet.
> >> Could you give us a bit more code?
> >>
> >> Eelco
> >>
> >> On 8/26/05, Johannes Fahrenkrug <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>> Should I maybe post this again on the developers list?
> >>>
> >>> - Johannes
> >>>
> >>> Johannes Fahrenkrug wrote:
> >>>
> >>>
> >>>
> >>>> Hi,
> >>>>
> >>>> this is my problem:
> >>>>
> >>>> I subclassed the TextField and created a
> >>>> TextFieldWithErrorIndicator class. I overrode the "onRender" method
> >>>> like so:
> >>>>
> >>>> @Override
> >>>> protected void onRender() { String clazz =
> >>>> this.hasErrorMessage() ? "error" : "no-error";
> >>>> getResponse().write("<span class=\"" + clazz + "\">");
> >>>> super.onRender();
> >>>> getResponse().write("</span>");
> >>>> }
> >>>>
> >>>> I did that in order to be able to highlight the input fields which
> >>>> contain errors. It works fine with text fields that are added
> >>>> directly to the form. When I add them to a listView, however, it
> >>>> doesn't work anymore. I debugged the onRender method and found out
> >>>> that "hasErrorMessages" returns false when the field is within a
> >>>> listrow.
> >>>>
> >>>> The feedbackPanel on the page displays the correct error messages,
> >>>> though.
> >>>>
> >>>> Is that a bug or am I doing something wrong?
> >>>>
> >>>> - Johannes
> >>>>
> >>>>
> >>>> -------------------------------------------------------
> >>>> SF.Net email is Sponsored by the Better Software Conference & EXPO
> >>>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> >>>> Practices
> >>>> Agile & Plan-Driven Development * Managing Projects & Teams *
> >>>> Testing & QA
> >>>> Security * Process Improvement & Measurement *
> >>>> http://www.sqe.com/bsce5sf
> >>>> _______________________________________________
> >>>> Wicket-user mailing list
> >>>> [email protected]
> >>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>>
> >>>
> >>>
> >>>
> >>> -------------------------------------------------------
> >>> SF.Net email is Sponsored by the Better Software Conference & EXPO
> >>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> >>> Practices
> >>> Agile & Plan-Driven Development * Managing Projects & Teams *
> >>> Testing & QA
> >>> Security * Process Improvement & Measurement *
> >>> http://www.sqe.com/bsce5sf
> >>> _______________________________________________
> >>> Wicket-user mailing list
> >>> [email protected]
> >>> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>
> >>>
> >>
> >>
> >>
> >> -------------------------------------------------------
> >> SF.Net email is Sponsored by the Better Software Conference & EXPO
> >> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> >> Practices
> >> Agile & Plan-Driven Development * Managing Projects & Teams * Testing
> >> & QA
> >> Security * Process Improvement & Measurement *
> >> http://www.sqe.com/bsce5sf
> >> _______________________________________________
> >> Wicket-user mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >>
> >
> >------------------------------------------------------------------------
> >
> >package de.gebeco.inetbuch.web;
> >
> >import wicket.markup.html.form.TextField;
> >import wicket.markup.html.form.validation.RequiredValidator;
> >import wicket.model.IModel;
> >
> >public class TextFieldWithErrorIndicator extends TextField {
> >
> > public TextFieldWithErrorIndicator(String id, Class type) {
> > super(id, type);
> > }
> >
> > public TextFieldWithErrorIndicator(String id, IModel model, Class type)
> {
> > super(id, model, type);
> > }
> >
> > public TextFieldWithErrorIndicator(String id, IModel object) {
> > super(id, object);
> > }
> >
> > public TextFieldWithErrorIndicator(String id) {
> > super(id);
> > }
> >
> > TextFieldWithErrorIndicator required() {
> > add(RequiredValidator.getInstance());
> > return this;
> > }
> >
> > @Override
> > protected void onRender() {
> > String clazz = this.hasErrorMessage() ? "error" : "no-error";
> > getResponse().write("<span class=\"" + clazz + "\">");
> > super.onRender();
> > getResponse().write("</span>");
> > }
> >
> >}
> >
> >
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user