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 = 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 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...
> >
> > 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