Search code examples
gwttabssmartgwt

(Auto) Resize SmartGWT Vertical Tabs to accommodate the text


I'd like the UI tabs to show the complete text. I tried manually resizing the tabs but that didn't work. I checked via FireBug, which shows that the tabs are actually being re-sized but not in the correct way. See this image.

enter image description here

Here is the relevant code:

// Left  tab starts here
    final TabSet companyDetailsLeftTabSet = new TabSet();  
    //companyDetailsLeftTabSet.setAutoWidth();
    //companyDetailsLeftTabSet.setOverflow(Overflow.VISIBLE);
    companyDetailsLeftTabSet.setMargin(20);
    companyDetailsLeftTabSet.setTabBarPosition(Side.TOP);  
    //companyDetailsLeftTabSet.setTabBarThickness(25);
    companyDetailsLeftTabSet.setWidth(940);  
    companyDetailsLeftTabSet.setHeight(550);  

    companyDetailsLeftTabSet.setStyleName("text");
    Tab companyInformationsTab = new Tab(AnisConstants.COMPANYINFO);
    Tab relationTab = new Tab(AnisConstants.RELATIONS); 
    Tab legalInformationsTab = new Tab(AnisConstants.LEGALINFORMATIONS); 
    Tab loanTab = new Tab(AnisConstants.LOANS); 
    Tab assetTab = new Tab(AnisConstants.ASSETS); 
    Tab scoringTab = new Tab(AnisConstants.SCORING); 
    companyInformationsTab.setWidth(150);
    relationTab.setWidth(150);
    legalInformationsTab.setWidth(150);
    loanTab.setWidth(150);
    assetTab.setWidth(150);
    scoringTab.setWidth(150);


    companyDetailsLeftTabSet.addTab(companyInformationsTab);  
    companyDetailsLeftTabSet.addTab(relationTab); 
    companyDetailsLeftTabSet.addTab(legalInformationsTab); 
    companyDetailsLeftTabSet.addTab(loanTab);
    companyDetailsLeftTabSet.addTab(assetTab);
    companyDetailsLeftTabSet.addTab(scoringTab);
    VLayout vpnlCompany = new VLayout();
    vpnlCompany.addMember(btnSave);
    vpnlCompany.addMember(companyDetailsLeftTabSet);

Here is one more image, the problem tabs are highlighted with red.

enter image description here

Please comment if you need some more info.


Solution

  • As mentioned in the comment. It could be accomplished by adding:

    tabset.setTabBarThickness(int tabBarThickness);
    

    For more details and options, that link is helpful. It solved my problem.