Results 1 to 6 of 6

Thread: [FIXED] Problem in BorderLayout Collapsible Region

  1. #1
    Ext User pedrosousa's Avatar
    Join Date
    Oct 2008
    Location
    Portugal [Aveiro]
    Posts
    17

    Default [FIXED] Problem in BorderLayout Collapsible Region

    Hi everyone,

    I'm trying to build a Border Layout with two regions: north and south. The south region is collapsible and the ContentPanel in south region is collapsible too and it has a tabpanel inside. In the north region I have a ContentPanel with a toolbar as Bottom Component with one button to simulate the collapsible tool of south region.


    Problems:
    1. When I press the collapsible tool, the first time, it hides the south region. Then press again the tool and shows the region but with content panel hidden. Then press more two time and the regions is shown with contentPanel visible.
    2. When I press the button collapse in the bottom toolBar, that simulates the collapsible tool, it collapse the contentPanel only. The south region don't collapse.
    Is this the right behavior?


    Code:
    package demo.layout.client;
    
    import com.extjs.gxt.ui.client.Style.LayoutRegion;
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.TabItem;
    import com.extjs.gxt.ui.client.widget.TabPanel;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
    import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
    import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.Element;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class Layout extends Viewport implements EntryPoint {
        
        private ContentPanel center;
        private ContentPanel south;
        
        
        public Layout() {
            setLayout(new BorderLayout());
        }
    
        public void onModuleLoad() {
            RootPanel.get().add(this);
        }
    
        @Override
        protected void onRender(Element parent, int pos) {
            super.onRender(parent, pos);
            
            center = new ContentPanel();
            ToolBar toolBar = new ToolBar();
            
            TextToolItem collapse = new TextToolItem("Colapse");
            collapse.addSelectionListener(new SelectionListener<ComponentEvent>() {
                public void componentSelected(ComponentEvent ce) {
                    if(south.isExpanded()) {
                        south.collapse();
                    } else {
                        south.expand();
                    }
                }
            });
            
            toolBar.add(collapse);
            
            center.setBottomComponent(toolBar);
            
            south = new ContentPanel();
            south.setCollapsible(true);
            
            TabPanel tabPanel = new TabPanel();
            tabPanel.add(new TabItem("Tab1"));
            tabPanel.add(new TabItem("Tab2"));
            tabPanel.add(new TabItem("Tab3"));
            south.add(tabPanel);
            
            BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
            
            BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH);
            southData.setCollapsible(true);
            
            add(center, centerData);
            add(south, southData);
        }
    }
    Thanks

    System information:

    - GXT 1.1
    - GWT 1.5.2
    - Host mode and web mode
    - FF 3.0.1
    - Windows XP SP3


    Regards,
    Attached Images Attached Images

  2. #2
    Sencha User darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242

    Default

    BorderLayout was not listening for the expand and collapse on it's panels. So calling expand() and collapse() would not result in the regions state changing correctly. This is fixed in SVN.

  3. #3
    Ext User pedrosousa's Avatar
    Join Date
    Oct 2008
    Location
    Portugal [Aveiro]
    Posts
    17

    Default Problem in BorderLayout Collapsible

    Quote Originally Posted by darrellmeyer View Post
    BorderLayout was not listening for the expand and collapse on it's panels. So calling expand() and collapse() would not result in the regions state changing correctly. This is fixed in SVN.
    I've downloaded the last version of GXT and run the example posted. The button collapse simulating the collapse tool doesn't work for expand.

    There is something i'm doing wrong?

    Thanks.

    Regards,
    --
    Pedro Sousa

  4. #4
    Sencha User darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242

    Default

    Your code works with 1.1.1. Are you sure you are using the latest code for both your project and launch classpath?

  5. #5
    Ext User pedrosousa's Avatar
    Join Date
    Oct 2008
    Location
    Portugal [Aveiro]
    Posts
    17

    Smile

    Quote Originally Posted by darrellmeyer View Post
    Your code works with 1.1.1. Are you sure you are using the latest code for both your project and launch classpath?
    The GXT i'm using is GXT 1.1.1 with JDK 1.6.0_05. I noticed that the function isExpanded() from south panel return always true even when the panel is collapsed. In the button colapse I have the folowing code:
    Code:
    if(south.isExpanded()) {
           south.collapse();
    } else {
           south.expand();
    }
    When the panel is expanded I click the button and the panel collapse. When I click again in the button with the panel collapsed, don't expand.

    Regards,
    --
    Pedro Sousa

  6. #6
    Sencha User darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242

    Default

    Sorry, I did know the collapse button was also suppose to expand. This now works in SVN.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •