Ok I understand that it is not the 'wicket-way'.

But to subclass the FormComponents I think I have to replace the onComponentTag and this is final like on CheckBox, ListChoice, PasswordTextField, etc.

Anyway I currently do the Panel aproach - will see how I come along.

What I curently wirte is a FromTable which has methods like addTextField(String label,TextField tf), addCheckBox(String label,Checkbox box) etc. The FormTable than renders them using a ListView.This is maybe also not the wicket-way but convinient for prototyping etc.

Another thing I came along when I did this is that I always have to make sure that the user sets the right id on the provided FormComponent. ie:

addTextField("Name: ", new TextField(FormTable.COMP_ID, Model()))
or worse
addLink(new Link(FormTable.COMP_ID),new Label(FormTable.COMP_ID2,"Click me");

Maybe it could be possible to have an setId() method on Component, which can be called until the component is added to the parent and afterwards throws an exception?

Thanks,
Christian

On Thu, 15 Dec 2005 10:30:00 +0100, Johan Compagner <[EMAIL PROTECTED]> wrote:

As martijn is saying it is not the wicket way to do it but ofcourse you can
do it if you want.
Just overwrite FormComponent or something and then implement
onComponentTagBody()
and there you can output anything you want.


On 12/14/05, Christian Essl <[EMAIL PROTECTED]> wrote:

I think I described the problem rather stupid.

The problem is that you have to make panels if you want to show varying
FromComponents at the same template-place. Ie if you have a ListView which
either displays a CheckBox or TextField depending on the row you can not
just write:
<tr wicket:id="list"><span wicket:id="formComp"/></wicket:id>
and add the right FormComponent to the ListItem. But you need a panel to
wrap the FormComponent.

This is no herculaen task, but it bothered me to write these panels again, when they are already used in different places. And than they also clutter
the respective apis.

So I just thought it would be good to have ie a TextField which can be
used directly in the ListView template like this:
<tr wicket:id="list">
<span wicket:id="comp">xxx</span>
</tr>
and than replaces it's tag body with <input type="textfield" name="xx">.

Html attributes like size would have to be set in Java code. To me this
does not make too much difference because otherwise to customize the
template you would have to subclass the Panel and provide a custom
template. And than you also have to somehow provide this new Panel to the
using component.

Mabe this all is against the wicket-way. Just a thought.

Christian

On Wed, 14 Dec 2005 21:00:37 +0100, Juergen Donnerstag
<[EMAIL PROTECTED]> wrote:

> On 12/14/05, Christian Essl <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Im just trying to make a special FromPanel where you just add
>> FormComponents and their labels and it will render those in a two
column
>> table (similar to the Click Form).
>>
>> Anyway as discussed before the problem is that you can not just set a
>> FromComponent on a div or span tag. The usual way around this is to
make
>> specific Panels for each FormComponent which than has the
FormComponents
>> specific html tag (ie <input type="text"> for a TextField).
>>
>
> Sorry, but I don't remember the problem. Could you please repeat it
> for me. Tx. I know that FormComponent check the tag name they are
> associated with and hence they can not be attached to <span> and
> <div>. What is the problem with that?
>
>> This seems to be quite a bit of redundant work, because different parts
>> of
>> wicket (extensions.beanedit, extensions.data.table.filter,
>> wicket-contrib-data) have already their custom implementation of that
>> and
>> I think it is also quite useful in custom code if you go beyond 'basic' >> forms where the exact set of FormComponents and layout is not known in
>> advance.
>>
>
> ?!? It is probably because I don't know enough about the problem.
> - redundant work because one panel per FormComponent => ok, understood
> and what is useful?
>
>> With the current Panel aproach I also think that customizing the
>> html-tag-attributes for the FormComponent is a bit inconvinient
>> especially
>> if you need to do it from code and further different in each of the
>> use-cases.
>>
>> Maybe for the FormComponents which have no children (TextField,
>> TextArea,CheckBox, DropDownChoice,ListChoice and ListMultipleChoice)
>> there
>> could be an overrideable property isRenderFullTag(). On true they would >> than not check for the right tag, but render their full html replacing
>> what is in the template-html.
>
> ?!? "but render their full html replacing what is in the
> template-html" What template html? you are not talking about the
> markup, right?
>
>> Mabe they could also have a convinience
>> method like addAttribute(String name,String value), addAttribute(String
>> name,IModel model).
>>
>
> you don't like AttributeModifiers?
> addAttribute => add(new AttributeModifier()
>
> Sorry if these are stupid questions. I didn't follow all the
> discussion about Forms.
>
> Juergen
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user



--
Christian Essl





___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




--
Christian Essl
        

        
                
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to