1. #1
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    arosequi is on a distinguished road

      0  

    Default [solved] Replicating the BorderLayout Example

    [solved] Replicating the BorderLayout Example


    I'm starting a fairly simple GXT project, and I'm using the BorderLayout for my page. I copied the source code for the BorderLayout example in the Ext GWT Explorer demo, but it doesn't work. Am I missing something obvious here?

    - My class is called MainWindow, and it extends LayoutContainer.
    - My onModuleLoad() method is simply:

    Code:
    RootPanel.get().add(new MainWindow());
    - I did some debug printing, and the code definitely gets to the MainWindow class and executes it properly.
    - However, nothing appears on the screen. I closed/restarted the Hosted Mode browser, and it still doesn't work.
    - It gives me no errors. It gives me nothing at all.
    - I've added the proper entries to my HTML and XML files. I changed my MainWindow to an Ext-GWT Button, and it works just fine. So, I think I did all of the Ext-GWT things alright.

    I think I'm missing something small, but I can't tell what it is. Any ideas?
    Last edited by arosequi; 17 Dec 2008 at 9:03 PM. Reason: Solved

  2. #2
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    arosequi is on a distinguished road

      0  

    Default


    I think I got it fixed. At the end of the code for my MainWindow, I had to add a call to the show() method.

    I'm assuming the Explorer demo does this one level above the source that it shows us, so I never saw it.

  3. #3
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    Yes, Window/Dialog needs to have show() called - all other widgets are added to a container or rootpanel

  4. #4
    Ext User
    Join Date
    Feb 2008
    Posts
    1
    Vote Rating
    0
    jrhaggard is on a distinguished road

      0  

    Default


    Hello,

    I'm having a similar issue but the remedy suggested so far, doesn't seem to make the example appear for me. Am I calling show() in the wrong place? Any help would be much appreciated.

    Code:
    public void onModuleLoad() 
    {
    	  RootPanel.get().add(new StageView());
    }
    Code:
    package com.abc.client.view;
    
    import com.extjs.gxt.ui.client.Style.LayoutRegion;
    import com.extjs.gxt.ui.client.util.Margins;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.LayoutContainer;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
    
    public class StageView extends LayoutContainer
    {
    	public StageView()
    	{
    		  setLayout(new BorderLayout());
    
    		  ContentPanel north = new ContentPanel();
    		  ContentPanel west = new ContentPanel();
    		  ContentPanel center = new ContentPanel();
    		  ContentPanel east = new ContentPanel();
    		  ContentPanel south = new ContentPanel();
    
    		  BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 100);  
    		  northData.setCollapsible(true);  
    		  northData.setFloatable(true);  
    		  northData.setSplit(true);  
    		  northData.setMargins(new Margins(5, 5, 0, 5));  
    
    		  BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 200);  
    		  westData.setSplit(true);  
    		  westData.setCollapsible(true);  
    		  westData.setMargins(new Margins(5));  
    
    		  BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);  
    		  centerData.setMargins(new Margins(5, 0, 5, 0));  
    
    		  BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 200);  
    		  eastData.setSplit(true);  
    		  eastData.setCollapsible(true);  
    		  eastData.setMargins(new Margins(5));  
    
    		  BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 100);  
    		  southData.setSplit(true);  
    		  southData.setCollapsible(true);  
    		  southData.setFloatable(true);  
    		  southData.setMargins(new Margins(0, 5, 5, 5));  
    
    		  add(north, northData);  
    		  add(west, westData);  
    		  add(center, centerData);  
    		  add(east, eastData);  
    		  add(south, southData);
    		  
    		  show();
    	}
    }

  5. #5
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    Quote Originally Posted by jrhaggard View Post
    Hello,

    I'm having a similar issue but the remedy suggested so far, doesn't seem to make the example appear for me. Am I calling show() in the wrong place? Any help would be much appreciated.
    Yes. You don't call show on a container like LayoutContainter, only Windows (and widgets that extend it - like Dialog) need show().

    LayoutContainer will render when its added to the RootPanel like you've done.

Thread Participants: 2