Results 1 to 2 of 2

Thread: Problem with Set Banner in Layout : GXT 3

  1. #1
    Sencha User
    Join Date
    May 2011
    Dhaka, Bangladesh
    Vote Rating

    Default Problem with Set Banner in Layout : GXT 3

    Now I face a great problem with GXT 3. In GXT 2 I have used "setTopComponent (getBanner());" where getBanner() is a method to load a banner. But when I use GXT 3 I do not know how I use this functionality in my current application where I use GXT 3. here I place my code. Please help me to provide me a solution.
    HTML Code:
    /* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.test.client;
    import;import;import;import com.sencha.gxt.core.client.util.Margins;import com.sencha.gxt.widget.core.client.ContentPanel;import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;import com.sencha.gxt.widget.core.client.container.MarginData;import com.sencha.gxt.widget.core.client.container.SimpleContainer;import com.sencha.gxt.widget.core.client.container.Viewport;
    /** * * @author tanvir.rahman */public class Layout implements IsWidget {
        @Override    public Widget asWidget() {
            final BorderLayoutContainer container = new BorderLayoutContainer();        container.setBorders(false);
            Viewport viewport = new Viewport();        viewport.add(container);
            ContentPanel banerPanel = new ContentPanel();        banerPanel.setHeadingText("LOGO");        ContentPanel menuPanel = new ContentPanel();        menuPanel.setHeadingText("Application Menu");        ContentPanel centerPanel = new ContentPanel();        centerPanel.setHeadingText("Work Space");
            //DockLayoutPanel dockPanel = new DockLayoutPanel(Style.Unit.PX);        //dockPanel.addNorth(new HTML("HEADER"), 2);
            BorderLayoutData menuData = new BorderLayoutData(220);        menuData.setCollapsible(true);        menuData.setSplit(true);        menuData.setCollapseMini(true);
            MarginData centerData = new MarginData();                BorderLayoutData bannerData = new BorderLayoutData();        //bannerData.setHidden(true);        bannerData.setMargins(new Margins(0));                container.setNorthWidget(banerPanel, bannerData);        container.setWestWidget(menuPanel, menuData);        container.setCenterWidget(centerPanel, centerData);
            SimpleContainer simpleContainer = new SimpleContainer();        simpleContainer.add(viewport);
            return simpleContainer;    }        public ContentPanel getBanner(){        ContentPanel bannerPanel = new ContentPanel();        bannerPanel.setHeaderVisible(false);        bannerPanel.add(new Image("resource/img/UCL.png"));        return bannerPanel;    }}

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Vote Rating


    Moved to GXT 3 forums, as this is not a GXT 2 question.

    Can you try formatting the code? Something seems to have happened when you pasted it in, and it is very hard to read.

    At a guess, the image hasn't loaded when the page comes up, so the layout only allocates a small amount of space for it. Then, the image loads, but the layout doesn't run again.

    One option: instead of using an external file like that, use ClientBundle and ImageResource so that the app knows how big the image will be. Another option would be to set a height on the Image object so it knows how much room it needs to take up.

    Without being able to properly read this, I can't be sure, but it looks like you are making a ContentPanel as the bannerPanel and hiding the header - why bother having the panel then? You could just add the image directly into the border LC.

Posting Permissions

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