as shown in the attached image, if I want to access the value of the textbox with value "value2" (the textbox in the second row after the "add" button"), how to do it as seem there is no a specific name to access it.
maybe my design is poor, any better method suggested? in reality, the listbox is used for user select "searc field", and the textbox is for user enter search value for that search field.
On Sat, Apr 14, 2012 at 10:17 AM, tong123123 <tong123...@gmail.com> wrote: > as shown in the attached image, if I want to access the value of the > textbox with value "value2" (the textbox in the second row after the "add" > button"), how to do it as seem there is no a specific name to access it.
> maybe my design is poor, any better method suggested? > in reality, the listbox is used for user select "searc field", and the > textbox is for user enter search value for that search field.
> -- > 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/-/Rc2QBu_9m6MJ. > To post to this group, send email to google-web-toolkit@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en.
> as shown in the attached image, if I want to access the value of the > textbox with value "value2" (the textbox in the second row after the "add" > button"), how to do it as seem there is no a specific name to access it.
> maybe my design is poor, any better method suggested? > in reality, the listbox is used for user select "searc field", and the > textbox is for user enter search value for that search field.
I think you mean add a getter and setter in CompositePanel, but the problem is how to access it in HATestPanel?
as I don't know the variable name of each CompositePanel.
just like I click the button three times, then what is the variaible name of these 3 compositePanel? although in each click handler its name is compositePanel.
> add(compositePanel) or HATextPanel.this.add(compositePanel) if you like.
> -- J.
> Am Samstag, 14. April 2012 16:17:36 UTC+2 schrieb tong123123:
>> as shown in the attached image, if I want to access the value of the >> textbox with value "value2" (the textbox in the second row after the "add" >> button"), how to do it as seem there is no a specific name to access it.
>> maybe my design is poor, any better method suggested?
>> in reality, the listbox is used for user select "searc field", and the >> textbox is for user enter search value for that search field.
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.
Am Samstag, 14. April 2012 17:06:08 UTC+2 schrieb tong123123:
> I think you mean add a getter and setter in CompositePanel, but the > problem is how to access it in HATestPanel?
> as I don't know the variable name of each CompositePanel.
> just like I click the button three times, then what is the variaible name > of these 3 compositePanel? although in each click handler its name is > compositePanel.
> Jens於 2012年4月14日星期六UTC+8下午10時36分21秒寫道:
>> Store your widgets in fields and add getter/setter methods so you can >> access their data.
>> add(compositePanel) or HATextPanel.this.add(compositePanel) if you like.
>> -- J.
>> Am Samstag, 14. April 2012 16:17:36 UTC+2 schrieb tong123123:
>>> as shown in the attached image, if I want to access the value of the >>> textbox with value "value2" (the textbox in the second row after the "add" >>> button"), how to do it as seem there is no a specific name to access it.
>>> maybe my design is poor, any better method suggested?
>>> in reality, the listbox is used for user select "searc field", and the >>> textbox is for user enter search value for that search field.
On Saturday, April 14, 2012 5:13:39 PM UTC+2, Jens wrote:
> 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.
In other words: variables are a mean to give name to things; fields are just variables with a distinct scope (object instance instead of local to a block or method). If you need/want names for things, it's up to you to give them such a name.
Sorry, I cannot catch your idea, in my clickhandler, the variable name is compositePanel for each click, and then add to the flowpanel, but if I press the add button three time and then outside the add button, how to refer the name of these three compositePanel?
> In other words: variables are a mean to give name to things; fields are > just variables with a distinct scope (object instance instead of local to a > block or method). If you need/want names for things, it's up to you to give > them such a name.
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?
> 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.
> 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?
If you add a Button to each composite panel you can call CompositePanel.removeFromParent() to delete itself from the view. If you add a CheckBox in each composite panel and a single delete Button in HATestPanel you first have to find all composite panels (same loop as for your submit button) which are checked for deletion (implement a isChecked() method in CompositePanel) before calling removeFromParent() on them.