hello, any help?!
2009/10/20 Cage Yim <[email protected]>
> Actually, I'd create a dynamic flex table+formPanel reference from the
> showcase of GWT, and want to put all dynamic created textBox values into an
> arraylist, however, it seens not able to add arraylist instead of widget,
> does anyone know how to solve it? Thank you very much.
> Here are part of the code with my program~
>
> public class setFramework implements EntryPoint {
> private myServiceAsync serviceProxy;
> private ArrayList itemsIncludeArray = new ArrayList();
> final FlexTable flexTable = new FlexTable();
>
> public void onModuleLoad() {
> serviceProxy = GWT.create(myService.class);
> Button submitBtnButton = new Button(" OK");
> // Create a Flex Table
>
> FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
> flexTable.addStyleName("cw-FlexTable");
> flexTable.setWidth("32em");
> flexTable.setCellSpacing(5);
> flexTable.setCellPadding(3);
>
> cellFormatter.setHorizontalAlignment(0, 1,
> HasHorizontalAlignment.ALIGN_LEFT);
> flexTable.setHTML(0, 0, "Please define no of textbox");
> cellFormatter.setColSpan(0, 0, 2);
>
>
> Button addRowButton = new Button("add new textbox",
> new ClickHandler() {
> public void onClick(ClickEvent event) {
> addRow(flexTable);
> }
> });
>
> Button removeRowButton = new Button("remove textbox",
> new ClickHandler() {
> public void onClick(ClickEvent event) {
> removeRow(flexTable);
> }
> });
>
> VerticalPanel buttonPanel = new VerticalPanel();
> buttonPanel.setStyleName("cw-FlexTable-buttonPanel");
> buttonPanel.add(addRowButton);
> buttonPanel.add(removeRowButton);
> buttonPanel.add(submitBtnButton);
> flexTable.setWidget(0, 1, buttonPanel);
> cellFormatter.setVerticalAlignment(0, 1,
> HasVerticalAlignment.ALIGN_TOP);
> addRow(flexTable);
> addRow(flexTable);
>
> flexTable.ensureDebugId("cwFlexTable");
> fPanel.add(flexTable);
>
> RootPanel.get("setTypeTable").add(fPanel);
>
> submitBtnButton.addClickHandler(new ClickHandler(){
> public void onClick(ClickEvent arg0) {
> // TODO Auto-generated method stub
> fPanel.submit();
> }
> });
>
> fPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
> public void onSubmit(SubmitEvent event) {
> // This event is fired just before the form is submitted. We can
> // take this opportunity to perform validation.
> if (itemsIncludeArray.isEmpty() == true) {
> Window.alert("you've enter nothing");
> event.cancel();
> }
> }
> });
> }
> protected void addRow(FlexTable flexTable) {
> // TODO Auto-generated method stub
> int numRows = flexTable.getRowCount();
> TextBox itemsInclude = new TextBox();
> flexTable.setWidget(numRows, 0, itemsInclude);
> itemsIncludeArray.add(itemsInclude);
> //flexTable.setWidget(numRows, 1, new TextBox());
> flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1);
> }
> protected void removeRow(FlexTable flexTable) {
> // TODO Auto-generated method stub
> int numRows = flexTable.getRowCount();
> if (numRows > 1) {
> flexTable.removeRow(numRows - 1);
> flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows - 1);
> }
> }
> }
>
> Thanks again
>
>
> 2009/10/19 Cage <[email protected]>
>
>
>> I've no idea how to use formpanel.add() method to add arraylist then
>> submit, please help, thank you very much.
>>
>> >>
>>
>
>
> --
> Cage
> There can be miracles, when you believe.... I believe I can ly
>
--
Cage
There can be miracles, when you believe.... I believe I can ly
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---