Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Bug with obtaining tabs of a componentXML TabSet

    I've created a componentXML like so:

    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>
    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:

    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);
    			}
    		}
    	});
    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
    Code:
      tabSet.getTabs();
    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)

    #2
    We have made a change to address the bug whereby getTab() could return null.
    Please try the next nightly build, either 9.0d or 8.3p branches

    Thanks
    Isomorphic Software

    Comment


      #3
      OK,

      getting a tab by name seems to work now, but

      Code:
      tabSet.getTabs()
      still returns an array filled with nulls.

      I need to iterate all tabs to do this
      Code:
      for (Tab tab : tabSet.getTabs()) {
      	tab.setCanClose(true/false);
      	tab.setCanEditTitle(true/false);
      }
      or, alternatively, do to
      Code:
      tabSet.setCanEditTabTitles(true/false);
      tabSet.setCanCloseTabs(true/false);
      which does not have any effect yet.

      SmartClient Version: v8.3p_2013-05-10/PowerEdition Deployment (built 2013-05-10)

      Thanks,
      fatzopilot

      Comment

      Working...
      X