I've created a componentXML like so:
Now, I'd like to access these Tabs in java code. Since it is not possible to do it via Canvas.getById() (as Tab is not an instance of Canvas), I tried like this:
This always gives "Tab0 is null" (dev and prod). The DeferredCommand is there to give all components time to initialize themselves (if at all that is needed here).
In dev mode, I can see that
returns an array exactly sized to hold all tabs defined within the <tabs> element, but each entry is null.
FF 20.0.1 & Version 26.0.1410.64 m
v8.3p_2013-04-28/PowerEdition Deployment (built 2013-04-28)
Code:
<TabSet ID="PortalTabSet" autoDraw="true" width="100%" height="100%" tabBarAlign="left"> <tabs> <Tab title="Tab0" canClose="true"> <pane> <Canvas ref="PortalLayout0" /> </pane> <ID>Tab0</ID> <name>Tab0</name> </Tab> <Tab title="Tab1" canClose="true"> <pane> <Canvas ref="PortalLayout0" /> </pane> <ID>Tab1</ID> <name>Tab1</name> </Tab> </tabs>
Code:
final TabSet tabSet = (TabSet) Canvas.getById("PortalTabSet"); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Tab tab = tabSet.getTab("Tab0"); if(tab == null){ SC.say("Tab0 is null"); } else { String name = tab.getName(); SC.say("Tab name is "+name); } } });
In dev mode, I can see that
Code:
tabSet.getTabs();
FF 20.0.1 & Version 26.0.1410.64 m
v8.3p_2013-04-28/PowerEdition Deployment (built 2013-04-28)
Comment