Search code examples
gwtgwt2gwt-editors

Adding list sub-editors to tab panel


I use ListEditor to allow editing list of chilren and I do everything just like I saw in some examples.The only difference from examples is that I want widgets editing children to be added as a tabs to some TabLayoutPanel.

The problem is that I want to give a header to this new tab and this header is not constant but depends on object being edited by newly created sub-editor (so let the header be child.getName()) which I don't know inside EditorSource#create() method.

ListEditor<ChildProxy, ChildPanel> children = ListEditor
        .of(new EditorSource<ChildPanel>() {

            @Override
            public ChildPanel create(int index) {
                ChildPanel tab = new ChildPanel();
                //here's a problem, how I can get tabHeader here?
                tabPanel.add(tab,tabHeader);
            }

        });

How can I set value-dependent headers to tabs created by create()? Any help/workaround would be greatly appreciated.


Solution

  • What worked for me was passing tabPanel and index to newly created ChildPanel() and make it ValueAwareEditor. Then on setValue() I was setting header on tabPanel reference at given index.