Announcement

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

    First Tab Pane drawn on other Tabs

    SmartGWT Power 3.0
    Firefox 10.0.4

    I have TabSet B nested in TabSet A

    TabSet A has Tab 1 and Tab 2.
    TabSet B has Tab 3 and Tab 4.

    On startup Tab 1 is displayed.

    When I programatically select Tab 4 (without ever selecting Tab 3), the content from Tab 3 is display on Tab 4.

    If I then manually select Tab 3, and back to Tab 4, then everything is drawn fine.

    Any ideas on this?

    #2
    This sounds like a possible bug in your scheme for assigning names/IDs to your tabs, your calls to selectTab(), or your TabSelectedHandler if you've created one. Let us know if you see something that suggests it's a framework problem.

    Comment


      #3
      I verified that the Tab and TabSet IDs are unique.

      I don't use any TabSelectedHandlers.

      I programmatically do a Tab 2.selectTab
      I programmatically do a Tab 4.selectTab

      Tab 4 still shows Tab 3 contents.

      Manually selecting Tab 3 fixes the problem.

      Comment


        #4
        TabSet/Tab combo is working fine for me with SmartGWT 3.0 and 3.0p-2012-04-26. Post a stand-alone test case when you can.

        Comment


          #5
          Originally posted by shortpasta
          TabSet/Tab combo is working fine for me with SmartGWT 3.0 and 3.0p-2012-04-26. Post a stand-alone test case when you can.
          I dare say I hit the same bug (if it is a bug) using smartgwt 3.0 LGPL from sc maven repo (SmartClient Version: SC_SNAPSHOT-2011-12-05/LGPL Development Only (built 2011-12-05)) using the following test case.
          Code:
          public class Main implements EntryPoint {
          
          
          	public void onModuleLoad () {
          		
          		
          		final TabSet tabSet = new TabSet ();
          		
          		final Tab tab1 = new Tab ("tab 1");
          		tabSet.addTab (tab1);
          		
          		final Tab tab2 = new Tab ("tab 2");
          		tabSet.addTab (tab2);
          		
          		final HLayout tabsPane = new HLayout ();
          		tabsPane.setWidth100 ();
          		tabsPane.setHeight100 ();
          		tabsPane.addMember (tabSet);
          		tabsPane.setVisible (false);
          		
          		final HLayout mainPane = new HLayout ();
          		mainPane.setWidth100 ();
          		mainPane.setHeight100 ();
          
          		final Button homeButton = new Button ("Show home");
          
          		tabsPane.addMember (homeButton);
          		
          
          		final Label contents1 = new Label ("tab 1 contents");
          		tab1.setPane (contents1);
          		final Label contents2 = new Label ("tab 2 contents");
          		tab2.setPane (contents2);
          		
          		final Button tab1Button = new Button ("Show tab 1");
          		tab1Button.addClickHandler (new ClickHandler() {
          			
          			@Override
          			public void onClick (ClickEvent event) {
          				
          				mainPane.setVisibleMember (tabsPane);
          				tabSet.selectTab (tab1);
          			}
          		});
          		final Button tab2Button = new Button ("Show tab 2");
          		tab2Button.addClickHandler (new ClickHandler() {
          			
          			@Override
          			public void onClick (ClickEvent event) {
          				
          				mainPane.setVisibleMember (tabsPane);
          				tabSet.selectTab (tab2);
          			}
          		});
          		final HLayout homePane = new HLayout ();
          		homePane.setWidth100 ();
          		homePane.setHeight100 ();
          		homePane.addMember (tab1Button);
          		homePane.addMember (tab2Button);
          		
          		homeButton.addClickHandler (new ClickHandler() {
          			
          			@Override
          			public void onClick (ClickEvent event) {
          				
          				mainPane.setVisibleMember (homePane);
          			}
          		});
          
          		
          		mainPane.addMember (homePane);
          		mainPane.addMember (tabsPane);
          		
          		mainPane.show ();
          	}
          
          }
          The sample ui produces an initial pane with two buttons. Each button triggers the visualization of an initially hidden tabset.
          If you click "show tab 2" before clicking "show tab 1" then tab1 contents are shown within tab2.

          Is there something wrong in the test case? If not, is there any known workaround? (since in the meantime there's no way to programmatically show a tabset for the first time with an arbitrary selected tab).

          UPDATE: The test case works properly on smartgwt 2.4 (SmartClient Version: SC_SNAPSHOT-2010-12-31/LGPL Development Only (built 2010-12-31)). In fact I originally developed some code with smartgwt 2.4 with no problems. I hit this issue after I updated to smartgwt 3.0. The issue seems reproducible even on smartgwt 2.5 (SmartClient Version: SC_SNAPSHOT-2011-08-02/LGPL Development Only (built 2011-08-02)).

          PS: I wrote on this thread to avoid cross-posting. Please let me know if I should instead have started a new one.
          Last edited by d.cavestro; 18 Jun 2012, 00:26.

          Comment


            #6
            I've found a quick (and diiiirty) workaround. It does the trick at least for smartgwt 3.0 (at least when not using IE or the tab contents aren't set at runtime using tabSet.updateTab ()).

            Code:
            final Set<Object> tabInitialized = new HashSet<Object> ();// initialization status holder
            tabsPane.addDrawHandler (new DrawHandler() {
            			
            	@Override
            	public void onDraw (final DrawEvent event) {
            		if (tabInitialized.isEmpty ()) {//if the tabset has never been initialized
            			tabInitialized.add (null);
            			final Tab selectedTab = tabSet.getSelectedTab ();
            			tabSet.selectTab (0);//force the selection of the first tab
            			tabSet.markForRedraw ("tabset issue hack");//and redraw
            			tabSet.selectTab (selectedTab);
            		}
            	}
            });
            In my real world scenario I have to set tab contents using tabSet.updateTab () and support ie8, so I had to force drawing the first tab (at first access) and only after I programmatically select the desired tab. That's ugly.
            Last edited by d.cavestro; 18 Jun 2012, 03:31.

            Comment

            Working...
            X