You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by edward durai <ed...@yahoo.com> on 2006/12/14 07:14:22 UTC

Dynamic field drawing using Wicket?

Hello Experts,

I am concentrating to do Wicket sample application. 
I have xml like

<DYNAMIC>
<FIELDS LABELNAME="USERNAME" FIELDTYPE="TEXT"/>
<FIELDS LABELNAME="PASSWORD" FIELDTYPE="TEXT"/>
<FIELDS LABELNAME="COUNTRY" FIELDTYPE="COMBO"/>
</DYNAMIC>

Using the above xml, I want to draw

lable name and texboxes/combo(given above) display.

Is it possible in Wicket?
Kindly send me your suggestion.

Thanks for resposing.

Edward


-- 
View this message in context: http://www.nabble.com/Dynamic-field-drawing-using-Wicket--tf2818746.html#a7867403
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: [Vote] Dynamic field drawing using Wicket?

Posted by edward durai <ed...@yahoo.com>.
Hello Sir,

Thank you for reply. Please explain me briefly. It's very much helpful for
me to create dynamic fields creation.

Thanks

Regards,
Edward



Eelco Hillenius wrote:
> 
> Taken that you want them to turn up as real components, being able to
> receive their own inputs and stuff, you'd need an interpretation.
> 
> Roughly
> 
> public class MyDynamicPanel extends Panel {
> 
>   public MyDynamicPanel(URL xmlDefinition, IModel model) {
>     // read and interpret definition
>     // create a ListView or Repeater or something similar and
>     // for each element you find, you add a panel with the actual
> component in it
> 
>   }
> 
>   protected Panel newTextComponent(String id, ...) { ...
> 
>   protected Panel newComboBoxComponent(String id, ... { ...
> }
> 
> etc.
> 
> MyDynamicPanel.html
> ...
>   <ul>
>     <li wicket:id="components"> <!-- generated for every component,
> e.g. backed by a ListView -->
>       <span wicket:id="component">[actual component will be placed
> here]</span>
>     </li>
>   </ul>
> 
> Then e.g. a text component could be as simple as:
> 
> public class TextFieldPanel extends Panel {
> 
>   public TextFieldPanel(String id, IModel model) {
>     add(new TextField("field", model);
>   }
> }
> 
> TextFieldPanel.html
> <wicket:panel>
>   <input type="text" wicket:id="field" />
> </wicket:panel>
> 
> That may seem like more work than needed, but it is very flexible to
> work with panels like that.
> 
> Hope that helps,
> 
> Eelco
> 
> On 12/13/06, edward durai <ed...@yahoo.com> wrote:
>>
>> Hello Experts,
>>
>> I am concentrating to do Wicket sample application.
>> I have xml like
>>
>> <DYNAMIC>
>> <FIELDS LABELNAME="USERNAME" FIELDTYPE="TEXT"/>
>> <FIELDS LABELNAME="PASSWORD" FIELDTYPE="TEXT"/>
>> <FIELDS LABELNAME="COUNTRY" FIELDTYPE="COMBO"/>
>> </DYNAMIC>
>>
>> Using the above xml, I want to draw
>>
>> lable name and texboxes/combo(given above) display.
>>
>> Is it possible in Wicket?
>> Kindly send me your suggestion.
>>
>> Thanks for resposing.
>>
>> Edward
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Dynamic-field-drawing-using-Wicket--tf2818746.html#a7867403
>> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamic-field-drawing-using-Wicket--tf2818746.html#a9177807
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Dynamic field drawing using Wicket?

Posted by Eelco Hillenius <ee...@gmail.com>.
Taken that you want them to turn up as real components, being able to
receive their own inputs and stuff, you'd need an interpretation.

Roughly

public class MyDynamicPanel extends Panel {

  public MyDynamicPanel(URL xmlDefinition, IModel model) {
    // read and interpret definition
    // create a ListView or Repeater or something similar and
    // for each element you find, you add a panel with the actual
component in it

  }

  protected Panel newTextComponent(String id, ...) { ...

  protected Panel newComboBoxComponent(String id, ... { ...
}

etc.

MyDynamicPanel.html
...
  <ul>
    <li wicket:id="components"> <!-- generated for every component,
e.g. backed by a ListView -->
      <span wicket:id="component">[actual component will be placed here]</span>
    </li>
  </ul>

Then e.g. a text component could be as simple as:

public class TextFieldPanel extends Panel {

  public TextFieldPanel(String id, IModel model) {
    add(new TextField("field", model);
  }
}

TextFieldPanel.html
<wicket:panel>
  <input type="text" wicket:id="field" />
</wicket:panel>

That may seem like more work than needed, but it is very flexible to
work with panels like that.

Hope that helps,

Eelco

On 12/13/06, edward durai <ed...@yahoo.com> wrote:
>
> Hello Experts,
>
> I am concentrating to do Wicket sample application.
> I have xml like
>
> <DYNAMIC>
> <FIELDS LABELNAME="USERNAME" FIELDTYPE="TEXT"/>
> <FIELDS LABELNAME="PASSWORD" FIELDTYPE="TEXT"/>
> <FIELDS LABELNAME="COUNTRY" FIELDTYPE="COMBO"/>
> </DYNAMIC>
>
> Using the above xml, I want to draw
>
> lable name and texboxes/combo(given above) display.
>
> Is it possible in Wicket?
> Kindly send me your suggestion.
>
> Thanks for resposing.
>
> Edward
>
>
> --
> View this message in context: http://www.nabble.com/Dynamic-field-drawing-using-Wicket--tf2818746.html#a7867403
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>