Don't forget the power of panels. It might be more verbose, but the
advantage, besides keeping things clean, is that you have full blown
components instead of just text.
Eelco
On 8/30/05, Gwyn Evans <[EMAIL PROTECTED]> wrote:
> Mainly, because this isn't just a matter of modifying a particular tag
> on a one-to-one basis, but because you need to get a new control per
> element in your (dynamic) list?
>
> I'm wondering what Phil will be able to come up with to push more of
> the html into the template, but I've got the use case I mention as
> something I want to be able to do, as a test case.
>
> /Gwyn
>
> On 30/08/05, Gili <[EMAIL PROTECTED]> wrote:
> >
> > Sorry to be jumping into the middle of this conversation (it only
> > now
> > caught my attention). Why are we generating so much HTML from the Java
> > end of things? Isn't this one of the things we wanted to avoid in Wicket
> > (Intermixing Java and HTML code)?
> >
> > Isn't there a way to dump all the HTML code into the markup file and
> > inject data into it from the Java end like other Wicket components do?
> >
> > Gili
> >
> > Gwyn Evans wrote:
> > > Actually, (and I'm not trying to be awkward!) I have a use case that
> > > might involve an algorithm...
> > >
> > > I came across the lack of multiple check boxes when seeing how I'd
> > > duplicate the result of this JSP method in Wicket...
> > >
> > > String generateServiceTable(List services, int colSize, String listName) {
> > > int cols = (services.size() / colSize) + 1;
> > > StringBuffer sb = new StringBuffer();
> > > sb.append("<table >\n");
> > > sb.append("<tr>\n");
> > > for (int i = 0, rows = 0; i < services.size(); i++) {
> > > Service service = (Service) services.get(i);
> > > if (rows == 0) {
> > > sb.append("<td valign=top width=\"" + 100 / cols + "%\">\n");
> > > }
> > > rows++;
> > > sb.append(
> > > "<input type=\"checkbox\" name=\"" + listName + "\" value=\"");
> > > sb.append(service.getName());
> > > sb.append("\"");
> > > if (service.isFree()) {
> > > sb.append(" checked");
> > > }
> > > sb.append(">");
> > > sb.append(service.getName());
> > > sb.append("<br>\n");
> > > if (rows == colSize) {
> > > sb.append("</td>\n");
> > > rows = 0;
> > > }
> > > }
> > > sb.append("</tr>\n");
> > > sb.append("</table>\n");
> > > return sb.toString();
> > > }
> > >
> > > It basically blocks the generated controls into columns, e.g. 10 per
> > > column, with each column surrounded by a <td></td> pair. The approach
> > > that comes to mind is to override getPrefix/getSuffix, but does a
> > > better approach come to mind?
> > >
> > > /Gwyn
> > >
> > > On 30/08/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > >
> > >>+1 for it anyway, and getting making the getter final. It's unlikely
> > >>users want to determine the character based on an algoritm, and by
> > >>supporting only a getter, we can apply versioning to it.
> > >>
> > >>Eelco
> > >>
> > >>
> > >>On 8/30/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
> > >>
> > >>>if you type the code that way then i know that everybody will be +1 for
> > >>><a> :)
> > >>>
> > >>>It has its drawback that then every radiochoice and checkboxchoice (is
> > >>>checkbox choice not automatically multiply ?? )
> > >>>has 2 extra references in them. But if it is pretty common to use them
> > >>>then and everybody has to make there own
> > >>>classes then maybe it is ok in this situation.
> > >>>
> > >>>I was thinking about making it ever better.
> > >>>Can't we make it a listview/loop also or something like that? So that
> > >>>you have full control over how everything is rendered..
> > >>>but maybe this makes it to difficult again..
> > >>>
> > >>>johan
> > >>>
> > >>>
> > >>>Gwyn Evans wrote:
> > >>>
> > >>>>Hi,
> > >>>> As part of adding a CheckBoxMultipleChoice element, something come
> > >>>>up that I'd like to get opinions on...
> > >>>>
> > >>>>Basically, both the above generate a series of controls. As coded,
> > >>>>the RadioChoice defaults to adding a prefix of "" & a suffix of
> > >>>>"<br/>/n" to each control, so you get a vertical set of buttons. If
> > >>>>you want to change that, you need to extend the core class and
> > >>>>override the getSuffix() method.
> > >>>>
> > >>>>So, the choice is, do we stick with that, or add access to the
> > >>>>suffix/prefix via the core classes, i.e. get/set methods.
> > >>>>
> > >>>>Thus, for a horizontal list, do we go for
> > >>>>
> > >>>> a) add(new RadioChoice("choices", myList).setSuffix(""));
> > >>>>
> > >>>>or
> > >>>>
> > >>>> b) add(new RadioChoice("choices", myList) {
> > >>>> public String getSuffix() { return ""; }
> > >>>> });
> > >>>>
> > >>>>/Gwyn
> > >>>>
>
>
> -------------------------------------------------------
> 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-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
>
-------------------------------------------------------
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-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop