thanks, now my implementation is 

> public class HATestPanel extends FlowPanel{
>  
>  Button btnAdd = new Button("Add");
>  Button btnListWidget = new Button("submit");
>  
>  public void onLoad(){
>   
>   this.add(btnAdd);
>   this.add(btnListWidget);
>   btnAdd.addClickHandler(new ClickHandler(){
>
>    @Override
>    public void onClick(ClickEvent event) {
>     // TODO Auto-generated method stub
>     CompositePanel compositePanel = new CompositePanel();
>     HATestPanel.this.add(compositePanel);    
>    }
>    
>   });
>   
>   
>   btnListWidget.addClickHandler(new ClickHandler(){
>
>    @Override
>    public void onClick(ClickEvent event) {
>     // TODO Auto-generated method stub    
>     for (int i=0; i<HATestPanel.this.getWidgetCount();i++){
>      if (HATestPanel.this.getWidget(i) instanceof CompositePanel){
>       ListBox lb =((CompositePanel)HATestPanel.this.getWidget(i)).getLb();
>       TextBox txt = 
> ((CompositePanel)HATestPanel.this.getWidget(i)).getTxt2();
>       if 
> (lb.getItemText(lb.getSelectedIndex()).equalsIgnoreCase("field1")){
>        System.out.println(txt.getText());
>        // validation txt
>       }else if 
> (lb.getItemText(lb.getSelectedIndex()).equalsIgnoreCase("field2")){
>        System.out.println(txt.getText());
>        // validation txt
>       }
>      }
>     }
>    }
>    
>   });
>   
>  }
>
> }
>
But there is still some problem, if I want to add a delete button after 
each row, is it very difficult? Or the easier method is add a checkbox 
before the listbox in class CompositePanel and then add a "delete" button 
(one and only one for the HATestPanel, not per row) to the HATestPanel?
 
I see this forum attachment page, it has a delete link after the browse 
button of each attachment row, but I have no idea how could this be 
implemented in my case?
 
 

Jens於 2012年4月14日星期六UTC+8下午11時13分39秒寫道:

> Store them in a separate list or iterate through all child widgets of your 
> HATestPanel using FlowPanel.getWidgetCount() and FlowPanel.getWidget(int 
> index). For each widget check if its a CompositePanel, cast it and call its 
> getter to get the value. 
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/r8DOFF8Fy8gJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to