Re: At new item to a list at each position
Ok, like I already said the project is about creating exams. The outer container are parts of the exams with a description what the part is about. The inner container are the exercise with a description what the students have to do. There are two more inner nested blocks but it works the same way. The user should be able to add inner form blocks at any position and should be able to remove the blocks, too. At the end the user shall submit the whole form together by clicking on one button. The forms (and inner nested forms) shall be evaluated by PHP because there already exists DataStructures for all different blocks to export it to an XML file. On Aug 24, 11:15 pm, Ian Bambury ianbamb...@gmail.com wrote: I'd say that the first step is to decide what you want the system to be able to do rather than get yourself up dead-ends by solving only part of a problem in a way that doesn't let you solve the rest of it. IMNSHO Ian http://examples.roughian.com 2009/8/24 Tobe tobias.jungnic...@googlemail.com Another problem is how to index the fields. I tried it with arrays: Outer forms 1 dimension, middle forms 2 dimension and inner forms 3 dimension and used the row IDs of the corresponding FlexTable as indices, but this doesn't work because the row IDs are always changing when I add new form blocks at any position. On Aug 22, 7:52 pm, Tobe tobias.jungnic...@googlemail.com wrote: The next problem is how to evaluate this nested form? Is there any good way to structure the fields and evaluate the complete form together with GWT? On Aug 18, 2:42 pm,Tobetobias.jungnic...@googlemail.com wrote: I had AbsolutePanels with other Widgets added to it, but now I just have one Widget in each. In other cases I used VerticalPanels instead of AbsolutePanels to get access to the different Widgets in the rows. Unfortunately I can't get the Widget of a Widget e. g. when I have a ListBox inside a VerticalPanel and the VerticalPanel inside a FlexTable by using flextable.getWidget(1,0).getWidget(0);, but it works when I get the Widgets step by step and cast it in each step. On Aug 17, 11:48 pm, Ian Bambury ianbamb...@gmail.com wrote: You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17Tobetobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
Given how deeply you intend to nest these things - 5 levels, Exam-Section-Exercise-OneMore-TwoMore - I think the nested tables idea is getting unmanageable for both the user and the design. I think I'd be going for a tree on the left and details on the right. Because it is basically a tree, people are used to trees, adding and deleting nodes is easy and doesn't require indices, and walking the tree to get the info back is easy as is setting up an existing exam in the display.. Ian http://examples.roughian.com 2009/8/25 Tobe tobias.jungnic...@googlemail.com Ok, like I already said the project is about creating exams. The outer container are parts of the exams with a description what the part is about. The inner container are the exercise with a description what the students have to do. There are two more inner nested blocks but it works the same way. The user should be able to add inner form blocks at any position and should be able to remove the blocks, too. At the end the user shall submit the whole form together by clicking on one button. The forms (and inner nested forms) shall be evaluated by PHP because there already exists DataStructures for all different blocks to export it to an XML file. On Aug 24, 11:15 pm, Ian Bambury ianbamb...@gmail.com wrote: I'd say that the first step is to decide what you want the system to be able to do rather than get yourself up dead-ends by solving only part of a problem in a way that doesn't let you solve the rest of it. IMNSHO Ian http://examples.roughian.com 2009/8/24 Tobe tobias.jungnic...@googlemail.com Another problem is how to index the fields. I tried it with arrays: Outer forms 1 dimension, middle forms 2 dimension and inner forms 3 dimension and used the row IDs of the corresponding FlexTable as indices, but this doesn't work because the row IDs are always changing when I add new form blocks at any position. On Aug 22, 7:52 pm, Tobe tobias.jungnic...@googlemail.com wrote: The next problem is how to evaluate this nested form? Is there any good way to structure the fields and evaluate the complete form together with GWT? On Aug 18, 2:42 pm,Tobetobias.jungnic...@googlemail.com wrote: I had AbsolutePanels with other Widgets added to it, but now I just have one Widget in each. In other cases I used VerticalPanels instead of AbsolutePanels to get access to the different Widgets in the rows. Unfortunately I can't get the Widget of a Widget e. g. when I have a ListBox inside a VerticalPanel and the VerticalPanel inside a FlexTable by using flextable.getWidget(1,0).getWidget(0);, but it works when I get the Widgets step by step and cast it in each step. On Aug 17, 11:48 pm, Ian Bambury ianbamb...@gmail.com wrote: You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17Tobetobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
Another problem is how to index the fields. I tried it with arrays: Outer forms 1 dimension, middle forms 2 dimension and inner forms 3 dimension and used the row IDs of the corresponding FlexTable as indices, but this doesn't work because the row IDs are always changing when I add new form blocks at any position. On Aug 22, 7:52 pm, Tobe tobias.jungnic...@googlemail.com wrote: The next problem is how to evaluate this nested form? Is there any good way to structure the fields and evaluate the complete form together with GWT? On Aug 18, 2:42 pm,Tobetobias.jungnic...@googlemail.com wrote: I had AbsolutePanels with other Widgets added to it, but now I just have one Widget in each. In other cases I used VerticalPanels instead of AbsolutePanels to get access to the different Widgets in the rows. Unfortunately I can't get the Widget of a Widget e. g. when I have a ListBox inside a VerticalPanel and the VerticalPanel inside a FlexTable by using flextable.getWidget(1,0).getWidget(0);, but it works when I get the Widgets step by step and cast it in each step. On Aug 17, 11:48 pm, Ian Bambury ianbamb...@gmail.com wrote: You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17Tobetobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
I'd say that the first step is to decide what you want the system to be able to do rather than get yourself up dead-ends by solving only part of a problem in a way that doesn't let you solve the rest of it. IMNSHO Ian http://examples.roughian.com 2009/8/24 Tobe tobias.jungnic...@googlemail.com Another problem is how to index the fields. I tried it with arrays: Outer forms 1 dimension, middle forms 2 dimension and inner forms 3 dimension and used the row IDs of the corresponding FlexTable as indices, but this doesn't work because the row IDs are always changing when I add new form blocks at any position. On Aug 22, 7:52 pm, Tobe tobias.jungnic...@googlemail.com wrote: The next problem is how to evaluate this nested form? Is there any good way to structure the fields and evaluate the complete form together with GWT? On Aug 18, 2:42 pm,Tobetobias.jungnic...@googlemail.com wrote: I had AbsolutePanels with other Widgets added to it, but now I just have one Widget in each. In other cases I used VerticalPanels instead of AbsolutePanels to get access to the different Widgets in the rows. Unfortunately I can't get the Widget of a Widget e. g. when I have a ListBox inside a VerticalPanel and the VerticalPanel inside a FlexTable by using flextable.getWidget(1,0).getWidget(0);, but it works when I get the Widgets step by step and cast it in each step. On Aug 17, 11:48 pm, Ian Bambury ianbamb...@gmail.com wrote: You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17Tobetobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
The next problem is how to evaluate this nested form? Is there any good way to structure the fields and evaluate the complete form together with GWT? On Aug 18, 2:42 pm, Tobe tobias.jungnic...@googlemail.com wrote: I had AbsolutePanels with other Widgets added to it, but now I just have one Widget in each. In other cases I used VerticalPanels instead of AbsolutePanels to get access to the different Widgets in the rows. Unfortunately I can't get the Widget of a Widget e. g. when I have a ListBox inside a VerticalPanel and the VerticalPanel inside a FlexTable by using flextable.getWidget(1,0).getWidget(0);, but it works when I get the Widgets step by step and cast it in each step. On Aug 17, 11:48 pm, Ian Bambury ianbamb...@gmail.com wrote: You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17Tobetobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
I had AbsolutePanels with other Widgets added to it, but now I just have one Widget in each. In other cases I used VerticalPanels instead of AbsolutePanels to get access to the different Widgets in the rows. Unfortunately I can't get the Widget of a Widget e. g. when I have a ListBox inside a VerticalPanel and the VerticalPanel inside a FlexTable by using flextable.getWidget(1,0).getWidget(0);, but it works when I get the Widgets step by step and cast it in each step. On Aug 17, 11:48 pm, Ian Bambury ianbamb...@gmail.com wrote: You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17 Tobe tobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
I notices, that there is still something going wrong. I colored the boxes to see if the inner boxes are really located in the outer ones, but it's not working. I think the problem is, that I get tableOuter and not tableInner by calling the following lines in addInner(): Cell cellForEvent = tableOuter.getCellForEvent(event); tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex (), 0).getParent(); On Aug 15, 11:42 am, Tobe tobias.jungnic...@googlemail.com wrote: Thanks Ian, now, it works I used this snippet of code in addInner() to get the corresponding inner FlexTable: Cell cellForEvent = tableOuter.getCellForEvent(event); tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex (), 0).getParent(); On Aug 14, 8:45 pm, Ian Bambury ianbamb...@gmail.com wrote: Presumably you know where they are, so you can do something like: FlexTable levelTwoFlexTable = (FlexTable) levelOneFlexTable.getWidget(row, column); BTW, though I'm not sure why you are getting your exceptions, here''s a way to add rows anywhere - you'd need two versions - one for adding a level-2 flextable to a level-1 flextable, and another to deal with adding rows to your level-2 flextable. And you'd probably be better off with labels styled as links rather than buttons... import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.Label; public class AddRowButton extends Button implements ClickHandler { private static int c = 0; public AddRowButton() { super(Add Row Here); addClickHandler(this); } @Override public void onClick(ClickEvent event) { Button b = (Button) event.getSource(); FlexTable f = (FlexTable) b.getParent(); int r = f.getCellForEvent(event).getRowIndex(); f.insertRow(r); f.setWidget(r, 0, new AddRowButton()); f.insertRow(r + 1); // Change the next line so it adds a level-2 flextable f.setWidget(r + 1, 0, new Label(Level 2 Flextable + ++c + here)); } } If you want to try it, then all you need is the following in your onModuleLoad() FlexTable f = new FlexTable(); f.setWidget(0, 0, new AddRowButton()); RootPanel.get().add(f); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
Ok, the .parent() is wrong because I have to access the tableInner inside tableOuter. The sourcecode of tableOuter is the following: table border=0 colgroup col /colgroup tbody tr td div style=position: relative; overflow-x: hidden; overflow-y: hidden; button tabindex=0 type=button class=gwt-Buttonadd outer/ button /div /td /tr tr td div style=position: relative; overflow-x: hidden; overflow-y: hidden; class=divOuter div class=gwt-HTML h2outer/h2 /div table border=0 class=divInner colgroup col /colgroup tbody tr td button tabindex=0 type=button class=gwt-Buttonadd inner/button /td /tr /tbody /table /div /td /tr tr td div style=position: relative; overflow-x: hidden; overflow-y: hidden; button tabindex=0 type=button class=gwt-Buttonadd outer/ button /div /td /tr /tbody /table , but how can I access the inner table in the first column of the second row which has the class=divInner attribute? On Aug 17, 5:12 pm, Tobe tobias.jungnic...@googlemail.com wrote: I notices, that there is still something going wrong. I colored the boxes to see if the inner boxes are really located in the outer ones, but it's not working. I think the problem is, that I get tableOuter and not tableInner by calling the following lines in addInner(): Cell cellForEvent = tableOuter.getCellForEvent(event); tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex (), 0).getParent(); On Aug 15, 11:42 am,Tobetobias.jungnic...@googlemail.com wrote: Thanks Ian, now, it works I used this snippet of code in addInner() to get the corresponding inner FlexTable: Cell cellForEvent = tableOuter.getCellForEvent(event); tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex (), 0).getParent(); On Aug 14, 8:45 pm, Ian Bambury ianbamb...@gmail.com wrote: Presumably you know where they are, so you can do something like: FlexTable levelTwoFlexTable = (FlexTable) levelOneFlexTable.getWidget(row, column); BTW, though I'm not sure why you are getting your exceptions, here''s a way to add rows anywhere - you'd need two versions - one for adding a level-2 flextable to a level-1 flextable, and another to deal with adding rows to your level-2 flextable. And you'd probably be better off with labels styled as links rather than buttons... import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.Label; public class AddRowButton extends Button implements ClickHandler { private static int c = 0; public AddRowButton() { super(Add Row Here); addClickHandler(this); } @Override public void onClick(ClickEvent event) { Button b = (Button) event.getSource(); FlexTable f = (FlexTable) b.getParent(); int r = f.getCellForEvent(event).getRowIndex(); f.insertRow(r); f.setWidget(r, 0, new AddRowButton()); f.insertRow(r + 1); // Change the next line so it adds a level-2 flextable f.setWidget(r + 1, 0, new Label(Level 2 Flextable + ++c + here)); } } If you want to try it, then all you need is the following in your onModuleLoad() FlexTable f = new FlexTable(); f.setWidget(0, 0, new AddRowButton()); RootPanel.get().add(f); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to
Re: At new item to a list at each position
Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
You should only ever have one widget in the cell. The method setWidget(int row, int column, Widget widget) removes any existing widget. I think you might need a design review ;-) Ian http://examples.roughian.com 2009/8/17 Tobe tobias.jungnic...@googlemail.com Ok, but in this case inside the (1,0) there can be some more Elements and always the last one is the nested FlexTable I need. I tried .getElement().getLastChild() but can't cast the received Node to a FlexTable. On Aug 17, 6:41 pm, Ian Bambury ianbamb...@gmail.com wrote: Can we try this in words, not html :-) You have an outer table with 'Insert' buttons in the even rows (0,2,4,...) and child tables in the first column of the odd rows (1,3,...) To access the first child table, you use FlexTable inner = (FlexTable)outer.getWidget(1, 0); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
Thanks Ian, now, it works I used this snippet of code in addInner() to get the corresponding inner FlexTable: Cell cellForEvent = tableOuter.getCellForEvent(event); tableInner = (FlexTable) tableOuter.getWidget(cellForEvent.getRowIndex (), 0).getParent(); On Aug 14, 8:45 pm, Ian Bambury ianbamb...@gmail.com wrote: Presumably you know where they are, so you can do something like: FlexTable levelTwoFlexTable = (FlexTable) levelOneFlexTable.getWidget(row, column); BTW, though I'm not sure why you are getting your exceptions, here''s a way to add rows anywhere - you'd need two versions - one for adding a level-2 flextable to a level-1 flextable, and another to deal with adding rows to your level-2 flextable. And you'd probably be better off with labels styled as links rather than buttons... import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.Label; public class AddRowButton extends Button implements ClickHandler { private static int c = 0; public AddRowButton() { super(Add Row Here); addClickHandler(this); } @Override public void onClick(ClickEvent event) { Button b = (Button) event.getSource(); FlexTable f = (FlexTable) b.getParent(); int r = f.getCellForEvent(event).getRowIndex(); f.insertRow(r); f.setWidget(r, 0, new AddRowButton()); f.insertRow(r + 1); // Change the next line so it adds a level-2 flextable f.setWidget(r + 1, 0, new Label(Level 2 Flextable + ++c + here)); } } If you want to try it, then all you need is the following in your onModuleLoad() FlexTable f = new FlexTable(); f.setWidget(0, 0, new AddRowButton()); RootPanel.get().add(f); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
I think my current version is (nearly) like your FlexTable version. The first layer is working, because it's just one FlexTable. In layer 2 there is one FlexTable for each different layer 1 FlexTable element. The problems are just the NullPointerExceptions in layer 2 when I want to access another FlexTable, than the last one, that is out of the scope. How can I access this old FlexTables? Do I have to save them in a vector or do I just have to define them in another scope? How does it works? On Aug 12, 8:38 pm, Ian Bambury ianbamb...@gmail.com wrote: OK, I understand the kind of problem now. You have an awful lot of possibilities to consider - you could have a tree-explorer setup for example. If you want the kind of look you have suggested, then I would probably (if it were me) consider the FlexTable approach you have suggested: - first line spans the whole width and contains details of the exam itself - after that, pairs of FlexTable lines - the first has cells with the various fields you want to display for the exam section header, the second spans the whole width and contains another widget with details of the exercises. This could be a flextable, or maybe a VP with each section displaying a class for the exercise. I would suggest (whatever my suggestion is worth) that you concentrate on the first level first. Basically you have the same design problem at each level - a list which requires the insertion of elements. You need to consider the abilities of your users - can they cope with left-click menus? Do they need blindingly obvious 'Insert A Line Here' buttons? The simplest answer all-round is to have 'Insert Here' buttons everywhere and insert two lines above- one is the new line, and one is a new 'Insert Here' button. A big concern is if you need to save this to a database (which you will unless this is just an academic exercise) and at what point do you do this. But the simple answer is a flextable InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Once you have that working, create a similar class that does the exercise details and insert that into the detail line Does that make sense? If not, feel free to say so :-) Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com What I forget to say is that the problems are the NullPointerExceptions when you add inner elements not at the last position. The project is about creating exams. The outer container are parts of the exams with a description what the part is about. The inner container are the exercise with a description what the students have to do. On Aug 12, 6:01 pm, Ian Bambury ianbamb...@gmail.com wrote: Hi Tobe, Sorry - what I meant was: can you give a use case example for what you are trying to do. I need more of an idea of how it will be used before I can get my head around this. For example, you might want to create a set of instructions (say a recipe) where everything is done in order so you need to be able to insert/append steps and move them up and down. I had a look at your example code and some of it works, but I'm getting NullPointerExceptions for addInner. I don't understand why you need addinner and addouter. A real-world example would help. Cheers, Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com @Ian: ok, I have an example what I created so far.I used FlexTables, because I think it's the right one for this problem. All starts with a FlexTable and a button inside for new outer elements. If the user clicks the button, there will be added one new row with a TextBox and a button inside a new inner FlexTable to add a new inner element and one row to add a new outer element at the end. The user can add new outer elements after the first outer button and at the end (after the second outer button) - so he can always add outer elements at any position. If the user adds the inner button there will be added, like the outer one, one new row to the inner FlexTable with a new TextBox and one new row with a button to add new inner elements. So shall be just this two layers and no third one, so there will be added just TextBoxes in the inner FlexTable and no new buttons to add inner-inner elements. Here is my code: package de.testgwt.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable;
Re: At new item to a list at each position
What do you mean by getting it as a widget from the cell in the main flextable. Sorry, I think I have a mental block. On Aug 14, 6:19 pm, Ian Bambury ianbamb...@gmail.com wrote: If I understand you correctly, you should be able to get the nested flextable by getting it as a widget from the cell in the main flextable and casting it. Ian http://examples.roughian.com 2009/8/14 Tobe tobias.jungnic...@googlemail.com I think my current version is (nearly) like your FlexTable version. The first layer is working, because it's just one FlexTable. In layer 2 there is one FlexTable for each different layer 1 FlexTable element. The problems are just the NullPointerExceptions in layer 2 when I want to access another FlexTable, than the last one, that is out of the scope. How can I access this old FlexTables? Do I have to save them in a vector or do I just have to define them in another scope? How does it works? On Aug 12, 8:38 pm, Ian Bambury ianbamb...@gmail.com wrote: OK, I understand the kind of problem now. You have an awful lot of possibilities to consider - you could have a tree-explorer setup for example. If you want the kind of look you have suggested, then I would probably (if it were me) consider the FlexTable approach you have suggested: - first line spans the whole width and contains details of the exam itself - after that, pairs of FlexTable lines - the first has cells with the various fields you want to display for the exam section header, the second spans the whole width and contains another widget with details of the exercises. This could be a flextable, or maybe a VP with each section displaying a class for the exercise. I would suggest (whatever my suggestion is worth) that you concentrate on the first level first. Basically you have the same design problem at each level - a list which requires the insertion of elements. You need to consider the abilities of your users - can they cope with left-click menus? Do they need blindingly obvious 'Insert A Line Here' buttons? The simplest answer all-round is to have 'Insert Here' buttons everywhere and insert two lines above- one is the new line, and one is a new 'Insert Here' button. A big concern is if you need to save this to a database (which you will unless this is just an academic exercise) and at what point do you do this. But the simple answer is a flextable InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Once you have that working, create a similar class that does the exercise details and insert that into the detail line Does that make sense? If not, feel free to say so :-) Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com What I forget to say is that the problems are the NullPointerExceptions when you add inner elements not at the last position. The project is about creating exams. The outer container are parts of the exams with a description what the part is about. The inner container are the exercise with a description what the students have to do. On Aug 12, 6:01 pm, Ian Bambury ianbamb...@gmail.com wrote: Hi Tobe, Sorry - what I meant was: can you give a use case example for what you are trying to do. I need more of an idea of how it will be used before I can get my head around this. For example, you might want to create a set of instructions (say a recipe) where everything is done in order so you need to be able to insert/append steps and move them up and down. I had a look at your example code and some of it works, but I'm getting NullPointerExceptions for addInner. I don't understand why you need addinner and addouter. A real-world example would help. Cheers, Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com @Ian: ok, I have an example what I created so far.I used FlexTables, because I think it's the right one for this problem. All starts with a FlexTable and a button inside for new outer elements. If the user clicks the button, there will be added one new row with a TextBox and a button inside a new inner FlexTable to add a new inner element and one row to add a new outer element at the end. The user can add new outer elements after the first outer button and at the end (after the second outer button) - so he can always add outer elements at any position. If the user adds the inner button there will be added, like the outer one, one new row to the inner FlexTable with a
Re: At new item to a list at each position
Presumably you know where they are, so you can do something like: FlexTable levelTwoFlexTable = (FlexTable) levelOneFlexTable.getWidget(row, column); BTW, though I'm not sure why you are getting your exceptions, here''s a way to add rows anywhere - you'd need two versions - one for adding a level-2 flextable to a level-1 flextable, and another to deal with adding rows to your level-2 flextable. And you'd probably be better off with labels styled as links rather than buttons... import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.Label; public class AddRowButton extends Button implements ClickHandler { private static int c = 0; public AddRowButton() { super(Add Row Here); addClickHandler(this); } @Override public void onClick(ClickEvent event) { Button b = (Button) event.getSource(); FlexTable f = (FlexTable) b.getParent(); int r = f.getCellForEvent(event).getRowIndex(); f.insertRow(r); f.setWidget(r, 0, new AddRowButton()); f.insertRow(r + 1); // Change the next line so it adds a level-2 flextable f.setWidget(r + 1, 0, new Label(Level 2 Flextable + ++c + here)); } } If you want to try it, then all you need is the following in your onModuleLoad() FlexTable f = new FlexTable(); f.setWidget(0, 0, new AddRowButton()); RootPanel.get().add(f); Ian http://examples.roughian.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
@Ian: ok, I have an example what I created so far.I used FlexTables, because I think it's the right one for this problem. All starts with a FlexTable and a button inside for new outer elements. If the user clicks the button, there will be added one new row with a TextBox and a button inside a new inner FlexTable to add a new inner element and one row to add a new outer element at the end. The user can add new outer elements after the first outer button and at the end (after the second outer button) - so he can always add outer elements at any position. If the user adds the inner button there will be added, like the outer one, one new row to the inner FlexTable with a new TextBox and one new row with a button to add new inner elements. So shall be just this two layers and no third one, so there will be added just TextBoxes in the inner FlexTable and no new buttons to add inner-inner elements. Here is my code: package de.testgwt.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.HTMLTable.Cell; public class TestGWT implements EntryPoint { FlexTable tableOuter; FlexTable tableInner; AbsolutePanel divOuter; AbsolutePanel divInner; public void onModuleLoad() { System.out.println(---); Button buttonAddOuter = new Button(add uter); buttonAddOuter.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ add(event); } }); divOuter = new AbsolutePanel(); divOuter.add(buttonAddOuter); tableOuter = new FlexTable(); tableOuter.setWidget(0, 0, divOuter); RootPanel.get().add(tableOuter); } public void add(ClickEvent event){ Cell cellForEvent = tableOuter.getCellForEvent(event); System.out.println(tableOuter: +tableOuter.hashCode()+ / row: +cellForEvent.getRowIndex()); divOuter = new AbsolutePanel(); divOuter.add(new TextBox()); tableInner = new FlexTable(); Button buttonAddInner = new Button(add Inner); buttonAddInner.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ addInner(event); } }); tableInner.setWidget(0, 0, buttonAddInner); divOuter.add(tableInner); tableOuter.insertRow(cellForEvent.getRowIndex()+1); tableOuter.setWidget(cellForEvent.getRowIndex()+1, 0, divOuter); Button buttonAddOuter = new Button(add outer); buttonAddOuter.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ add(event); } }); divOuter = new AbsolutePanel(); divOuter.add(buttonAddOuter); tableOuter.insertRow(cellForEvent.getRowIndex()+2); tableOuter.setWidget(cellForEvent.getRowIndex()+2, 0, divOuter); } public void addInner(ClickEvent event){ Cell cellForEvent = tableInner.getCellForEvent(event); System.out.println(tableInner: +tableInner.hashCode()+ / row: +cellForEvent.getRowIndex()); divInner = new AbsolutePanel(); divInner.add(new TextBox()); tableInner.insertRow(cellForEvent.getRowIndex()+1); tableInner.setWidget(cellForEvent.getRowIndex()+1, 0, divInner); Button buttonAddInner = new Button(add inner); buttonAddInner.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ addInner(event); } }); divInner = new AbsolutePanel(); divInner.add(buttonAddInner); tableInner.insertRow(cellForEvent.getRowIndex()+2); tableInner.setWidget(cellForEvent.getRowIndex()+2, 0, divInner); } } On Aug 10, 8:27 pm, Ian Bambury ianbamb...@gmail.com wrote: Hi Tobe, You seem to have changed from divs in the root panel to a widget, which is probably the right way to go - depends on what you are doing, and you don't say. It does rather depend on how you are displaying things, and
Re: At new item to a list at each position
Hi Tobe, Sorry - what I meant was: can you give a use case example for what you are trying to do. I need more of an idea of how it will be used before I can get my head around this. For example, you might want to create a set of instructions (say a recipe) where everything is done in order so you need to be able to insert/append steps and move them up and down. I had a look at your example code and some of it works, but I'm getting NullPointerExceptions for addInner. I don't understand why you need addinner and addouter. A real-world example would help. Cheers, Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com @Ian: ok, I have an example what I created so far.I used FlexTables, because I think it's the right one for this problem. All starts with a FlexTable and a button inside for new outer elements. If the user clicks the button, there will be added one new row with a TextBox and a button inside a new inner FlexTable to add a new inner element and one row to add a new outer element at the end. The user can add new outer elements after the first outer button and at the end (after the second outer button) - so he can always add outer elements at any position. If the user adds the inner button there will be added, like the outer one, one new row to the inner FlexTable with a new TextBox and one new row with a button to add new inner elements. So shall be just this two layers and no third one, so there will be added just TextBoxes in the inner FlexTable and no new buttons to add inner-inner elements. Here is my code: package de.testgwt.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.HTMLTable.Cell; public class TestGWT implements EntryPoint { FlexTable tableOuter; FlexTable tableInner; AbsolutePanel divOuter; AbsolutePanel divInner; public void onModuleLoad() { System.out.println(---); Button buttonAddOuter = new Button(add uter); buttonAddOuter.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ add(event); } }); divOuter = new AbsolutePanel(); divOuter.add(buttonAddOuter); tableOuter = new FlexTable(); tableOuter.setWidget(0, 0, divOuter); RootPanel.get().add(tableOuter); } public void add(ClickEvent event){ Cell cellForEvent = tableOuter.getCellForEvent(event); System.out.println(tableOuter: +tableOuter.hashCode()+ / row: +cellForEvent.getRowIndex()); divOuter = new AbsolutePanel(); divOuter.add(new TextBox()); tableInner = new FlexTable(); Button buttonAddInner = new Button(add Inner); buttonAddInner.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ addInner(event); } }); tableInner.setWidget(0, 0, buttonAddInner); divOuter.add(tableInner); tableOuter.insertRow(cellForEvent.getRowIndex()+1); tableOuter.setWidget(cellForEvent.getRowIndex()+1, 0, divOuter); Button buttonAddOuter = new Button(add outer); buttonAddOuter.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ add(event); } }); divOuter = new AbsolutePanel(); divOuter.add(buttonAddOuter); tableOuter.insertRow(cellForEvent.getRowIndex()+2); tableOuter.setWidget(cellForEvent.getRowIndex()+2, 0, divOuter); } public void addInner(ClickEvent event){ Cell cellForEvent = tableInner.getCellForEvent(event); System.out.println(tableInner: +tableInner.hashCode()+ / row: +cellForEvent.getRowIndex()); divInner = new AbsolutePanel(); divInner.add(new TextBox()); tableInner.insertRow(cellForEvent.getRowIndex()+1); tableInner.setWidget(cellForEvent.getRowIndex()+1, 0, divInner); Button buttonAddInner = new Button(add inner); buttonAddInner.addClickHandler(new ClickHandler(){
Re: At new item to a list at each position
What I forget to say is that the problems are the NullPointerExceptions when you add inner elements not at the last position. The project is about creating exams. The outer container are parts of the exams with a description what the part is about. The inner container are the exercise with a description what the students have to do. On Aug 12, 6:01 pm, Ian Bambury ianbamb...@gmail.com wrote: Hi Tobe, Sorry - what I meant was: can you give a use case example for what you are trying to do. I need more of an idea of how it will be used before I can get my head around this. For example, you might want to create a set of instructions (say a recipe) where everything is done in order so you need to be able to insert/append steps and move them up and down. I had a look at your example code and some of it works, but I'm getting NullPointerExceptions for addInner. I don't understand why you need addinner and addouter. A real-world example would help. Cheers, Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com @Ian: ok, I have an example what I created so far.I used FlexTables, because I think it's the right one for this problem. All starts with a FlexTable and a button inside for new outer elements. If the user clicks the button, there will be added one new row with a TextBox and a button inside a new inner FlexTable to add a new inner element and one row to add a new outer element at the end. The user can add new outer elements after the first outer button and at the end (after the second outer button) - so he can always add outer elements at any position. If the user adds the inner button there will be added, like the outer one, one new row to the inner FlexTable with a new TextBox and one new row with a button to add new inner elements. So shall be just this two layers and no third one, so there will be added just TextBoxes in the inner FlexTable and no new buttons to add inner-inner elements. Here is my code: package de.testgwt.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.HTMLTable.Cell; public class TestGWT implements EntryPoint { FlexTable tableOuter; FlexTable tableInner; AbsolutePanel divOuter; AbsolutePanel divInner; public void onModuleLoad() { System.out.println(---); Button buttonAddOuter = new Button(add uter); buttonAddOuter.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ add(event); } }); divOuter = new AbsolutePanel(); divOuter.add(buttonAddOuter); tableOuter = new FlexTable(); tableOuter.setWidget(0, 0, divOuter); RootPanel.get().add(tableOuter); } public void add(ClickEvent event){ Cell cellForEvent = tableOuter.getCellForEvent(event); System.out.println(tableOuter: +tableOuter.hashCode()+ / row: +cellForEvent.getRowIndex()); divOuter = new AbsolutePanel(); divOuter.add(new TextBox()); tableInner = new FlexTable(); Button buttonAddInner = new Button(add Inner); buttonAddInner.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ addInner(event); } }); tableInner.setWidget(0, 0, buttonAddInner); divOuter.add(tableInner); tableOuter.insertRow(cellForEvent.getRowIndex()+1); tableOuter.setWidget(cellForEvent.getRowIndex()+1, 0, divOuter); Button buttonAddOuter = new Button(add outer); buttonAddOuter.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ add(event); } }); divOuter = new AbsolutePanel(); divOuter.add(buttonAddOuter); tableOuter.insertRow(cellForEvent.getRowIndex()+2); tableOuter.setWidget(cellForEvent.getRowIndex()+2, 0, divOuter); } public void addInner(ClickEvent event){ Cell cellForEvent = tableInner.getCellForEvent(event);
Re: At new item to a list at each position
OK, I understand the kind of problem now. You have an awful lot of possibilities to consider - you could have a tree-explorer setup for example. If you want the kind of look you have suggested, then I would probably (if it were me) consider the FlexTable approach you have suggested: - first line spans the whole width and contains details of the exam itself - after that, pairs of FlexTable lines - the first has cells with the various fields you want to display for the exam section header, the second spans the whole width and contains another widget with details of the exercises. This could be a flextable, or maybe a VP with each section displaying a class for the exercise. I would suggest (whatever my suggestion is worth) that you concentrate on the first level first. Basically you have the same design problem at each level - a list which requires the insertion of elements. You need to consider the abilities of your users - can they cope with left-click menus? Do they need blindingly obvious 'Insert A Line Here' buttons? The simplest answer all-round is to have 'Insert Here' buttons everywhere and insert two lines above- one is the new line, and one is a new 'Insert Here' button. A big concern is if you need to save this to a database (which you will unless this is just an academic exercise) and at what point do you do this. But the simple answer is a flextable InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Detail Line InsertAbove Button Once you have that working, create a similar class that does the exercise details and insert that into the detail line Does that make sense? If not, feel free to say so :-) Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com What I forget to say is that the problems are the NullPointerExceptions when you add inner elements not at the last position. The project is about creating exams. The outer container are parts of the exams with a description what the part is about. The inner container are the exercise with a description what the students have to do. On Aug 12, 6:01 pm, Ian Bambury ianbamb...@gmail.com wrote: Hi Tobe, Sorry - what I meant was: can you give a use case example for what you are trying to do. I need more of an idea of how it will be used before I can get my head around this. For example, you might want to create a set of instructions (say a recipe) where everything is done in order so you need to be able to insert/append steps and move them up and down. I had a look at your example code and some of it works, but I'm getting NullPointerExceptions for addInner. I don't understand why you need addinner and addouter. A real-world example would help. Cheers, Ian http://examples.roughian.com 2009/8/12 Tobe tobias.jungnic...@googlemail.com @Ian: ok, I have an example what I created so far.I used FlexTables, because I think it's the right one for this problem. All starts with a FlexTable and a button inside for new outer elements. If the user clicks the button, there will be added one new row with a TextBox and a button inside a new inner FlexTable to add a new inner element and one row to add a new outer element at the end. The user can add new outer elements after the first outer button and at the end (after the second outer button) - so he can always add outer elements at any position. If the user adds the inner button there will be added, like the outer one, one new row to the inner FlexTable with a new TextBox and one new row with a button to add new inner elements. So shall be just this two layers and no third one, so there will be added just TextBoxes in the inner FlexTable and no new buttons to add inner-inner elements. Here is my code: package de.testgwt.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.HTMLTable.Cell; public class TestGWT implements EntryPoint { FlexTable tableOuter; FlexTable tableInner; AbsolutePanel divOuter; AbsolutePanel divInner; public void onModuleLoad() { System.out.println(---); Button buttonAddOuter = new Button(add uter); buttonAddOuter.addClickHandler(new ClickHandler(){
Re: At new item to a list at each position
I don't really need to know how to create the Array. I already created a Vector of button and adding the buttons to the Vector. But my problem is that I don't know how to handle with it. How can I add the new div at the position behind the corresponding button on the RootPanel? On Aug 7, 5:22 pm, Tobe tobias.jungnic...@googlemail.com wrote: Hi, I have a list, which items are divs, and want the user to add new items at any position. So if there are 2 item there have to be 3 button, one before the first, one between both and one after the last. Can somebody tell me how to create this array of buttons. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---
Re: At new item to a list at each position
Hi Tobe, You seem to have changed from divs in the root panel to a widget, which is probably the right way to go - depends on what you are doing, and you don't say. It does rather depend on how you are displaying things, and what you are displaying. If there are columns (apart from the buttons) then are they fixed-width or do they self-adjust? Are the items sorted in some way? If you could give (even a theoretical) example of what this list consists of, then it will be easier to answer. I suspect that the lack of response is because people have too many possibilities in mind to comment Ian http://examples.roughian.com 2009/8/10 Tobe tobias.jungnic...@googlemail.com I'm currently trying to do it with a FlexTable, but the problem is that I don't know how I can find out if the user really clicked the button or just somewhere inside the table. On Aug 10, 3:41 pm, Tobe tobias.jungnic...@googlemail.com wrote: I don't really need to know how to create the Array. I already created a Vector of button and adding the buttons to the Vector. But my problem is that I don't know how to handle with it. How can I add the new div at the position behind the corresponding button on the RootPanel? On Aug 7, 5:22 pm, Tobe tobias.jungnic...@googlemail.com wrote: Hi, I have a list, which items are divs, and want the user to add new items at any position. So if there are 2 item there have to be 3 button, one before the first, one between both and one after the last. Can somebody tell me how to create this array of buttons. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. 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 -~--~~~~--~~--~--~---