1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    78
    Answers
    1
    Vote Rating
    0
    sarsipius is on a distinguished road

      0  

    Default Answered: How to fit a TabPanel in a Viewport

    Answered: How to fit a TabPanel in a Viewport


    Hi,

    I try to code a module in which a TabPanel need to be rendered

    I don't find which layout I need to apply to the viewport in order to use the whole space for the TabPanel

    Here is the code:

    Code:
    public class Module implements EntryPoint {
      
      public void onModuleLoad() {
        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
          public void onUncaughtException(Throwable e) {
            MessageBox.alert("Error", e.getMessage(), null);
          }
        });
        
        Viewport viewport = new Viewport();
        viewport.setLayout(new BorderLayout());
        
        ContentPanel cp = new ContentPanel();
        cp.setHeading("Panel");
        cp.setLayout(new FitLayout());
        
        TabPanel tabPanel = new TabPanel();
        tabPanel.setBodyBorder(false);
        tabPanel.setBorderStyle(false);
        tabPanel.setResizeTabs(false);
        tabPanel.setAnimScroll(true);
        tabPanel.setTabScroll(true);
        tabPanel.setCloseContextMenu(true);
        
        TabItem tabItem = new TabItem("Item");
        tabItem.setLayout(new FitLayout());
        tabItem.setClosable(false);
        tabItem.add(cp);
        
        viewport.add(tabPanel, new BorderLayoutData(LayoutRegion.CENTER));
        
        RootPanel.get().add(viewport);
      }
      
    }
    Could someone try it and help me?
    Thanks

  2. It looks like it is not a layout problem.

    I miss the statement where you add your tabItem to your tabPanel.

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    You are setting the layout of the viewport to be borderlayout, but dont seem to be using it:

    Code:
    viewport.setLayout(new BorderLayout());
    Instead, set the layout to be FitLayout, and the child of the viewport (the tab panel) will be always sized to use all space.

    Code:
    viewport.setLayout(new FitLayout());

  4. #3
    Sencha User
    Join Date
    Oct 2008
    Posts
    78
    Answers
    1
    Vote Rating
    0
    sarsipius is on a distinguished road

      0  

    Default


    no you're wrong

    Code:
    viewport.add(tabPanel, new BorderLayoutData(LayoutRegion.CENTER));
    
    and I tried FitLayout, RowLayout, CenterLayout, etc. but the TabPanel didn't fit

  5. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Sorry, which part am I wrong about? That you are using the BorderLayout, or that the FitLayout doesn't work?

    From the code you are quoting, it looks like you might be focusing on the when you add the tab panel to the viewport - I am talking about configuring the viewport.

    Looking again at your original sample, I would modify it like this:

    Code:
    public class Module implements EntryPoint {
      
      public void onModuleLoad() {
        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
          public void onUncaughtException(Throwable e) {
            MessageBox.alert("Error", e.getMessage(), null);
          }
        });
        
        Viewport viewport = new Viewport();
        viewport.setLayout(new FitLayout());
        
        ContentPanel cp = new ContentPanel();
        cp.setHeading("Panel");
        cp.setLayout(new FitLayout());
        
        TabPanel tabPanel = new TabPanel();
        tabPanel.setBodyBorder(false);
        tabPanel.setBorderStyle(false);
        tabPanel.setResizeTabs(false);
        tabPanel.setAnimScroll(true);
        tabPanel.setTabScroll(true);
        tabPanel.setCloseContextMenu(true);
        
        TabItem tabItem = new TabItem("Item");
        tabItem.setLayout(new FitLayout());
        tabItem.setClosable(false);
        tabItem.add(cp);
        
        viewport.add(tabPanel);
        
        RootPanel.get().add(viewport);
      }
    }

  6. #5
    Sencha User
    Join Date
    Oct 2008
    Posts
    78
    Answers
    1
    Vote Rating
    0
    sarsipius is on a distinguished road

      0  

    Default


    both

    I know how to use layouts and I assure you that the FitLayout doesn't work

    if you have 10 seconds to try my code, you'll see it

    you can even replace

    Code:
    viewport.add(tabPanel);
    by

    [code]viewport.add(cp);[/code]

    and it works fine

    so I tell you this is probably an issue with the TabPanel object but I don't know how to fix it

  7. #6
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Answers
    4
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    It looks like it is not a layout problem.

    I miss the statement where you add your tabItem to your tabPanel.

  8. #7
    Sencha User
    Join Date
    Oct 2008
    Posts
    78
    Answers
    1
    Vote Rating
    0
    sarsipius is on a distinguished road

      0  

    Default


    you're right and I'm really ashamed!
    thank you

  9. #8
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Nothing to be ashamed about – I should have caught that too. Thanks gishmo.

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi