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 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 =...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to