1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    5
    Vote Rating
    0
    Stefan.Baehring is on a distinguished road

      0  

    Default Replace a ContentPanel in a BorderLayout

    Replace a ContentPanel in a BorderLayout


    Hello,

    I'm trying to replace a ContentPanel within a Border Layout. I'm using this example:

    Viewport viewport = new Viewport();
    BorderLayout bl = new BorderLayout();
    viewport.setLayout(bl);
    LayoutContainer north = new LayoutContainer();
    north.addText("North: Application Title");
    ContentPanel west = new ContentPanel();
    west.setHeading("West: Navigation");
    ContentPanel center = new ContentPanel();
    BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 20);
    northData.setMargins(new Margins(5, 5, 0, 5));
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setCollapsible(true);
    westData.setFloatable(true);
    westData.setSplit(true);
    westData.setMargins(new Margins(5, 0, 5, 5));

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5));
    viewport.add(north, northData);
    viewport.add(west, westData);
    viewport.add(center, centerData);
    RootPanel.get().add(viewport);

    I'm trying to replace the ContentPanel "center" with a complete new one when a button is pressed,
    but nothing happens (the event handling works fine). I tried something like this:

    viewport.remove(center); ---> this works!
    ContentPanel newCP = new ContentPanel();
    newCP.setHeading("New ContentPanel");
    viewport.add(newCP, centerData); ---> nothing happens!

    also tried:
    viewport.layout();
    viewport.repaint();
    ...

    Any suggestions?

    Many thanks for your help.

    Best Regards,

    Stefan Baehring

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Posts
    107
    Vote Rating
    0
    marman is on a distinguished road

      0  

    Default


    can you give a full code example so we can paste it into our code and see what is going on?

  3. #3
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I did a small testcase:
    Code:
    class Test implements EntryPoint {
    
      public void onModuleLoad() {
    
        final Viewport viewport = new Viewport();
        BorderLayout bl = new BorderLayout();
        viewport.setLayout(bl);
        LayoutContainer north = new LayoutContainer();
        north.addText("North: Application Title");
        ContentPanel west = new ContentPanel();
        west.setHeading("West: Navigation");
        final ContentPanel center = new ContentPanel();
        BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 20);
        northData.setMargins(new Margins(5, 5, 0, 5));
        BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
        westData.setCollapsible(true);
        westData.setFloatable(true);
        westData.setSplit(true);
        westData.setMargins(new Margins(5, 0, 5, 5));
    
        final BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
        centerData.setMargins(new Margins(5));
        viewport.add(north, northData);
        viewport.add(west, westData);
        viewport.add(center, centerData);
        RootPanel.get().add(viewport);
    
        new Timer() {
    
          @Override
          public void run() {
            viewport.remove(center);
            ContentPanel newCP = new ContentPanel();
            newCP.setHeading("New ContentPanel");
            viewport.add(newCP, centerData);
            viewport.layout();
          }
    
        }.schedule(1000);
    
      }
    
    }
    After one second the center contentpanel switches to the new one. You need to call layout.

  4. #4
    Ext User
    Join Date
    Sep 2010
    Posts
    5
    Vote Rating
    0
    Stefan.Baehring is on a distinguished road

      0  

    Default


    Hello sven,

    now it works.

    I'm quite sure that I have tried calling the layout() method.
    Anyway, I have implemented my source code from scratch again and now it works.
    Maybe I have tried to many things and something got mixed up.

    Many thanks for the help,

    Stefan

Similar Threads

  1. Replace ContentPanel
    By niemayd in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 16 Jan 2009, 2:15 AM
  2. moving contentPanel from center borderlayout region to west borderlayout region
    By qwerty_qwerty in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 29 May 2008, 10:27 AM
  3. "Replace" a ContentPanel in a BorderLayout?
    By temporary in forum Ext 1.x: Help & Discussion
    Replies: 15
    Last Post: 6 Jun 2007, 10:59 AM
  4. how to dynamically replace ContentPanel with new created BorderLayout?
    By slacker in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 20 Apr 2007, 12:48 AM
  5. BorderLayout Contentpanel
    By pomata in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 6 Dec 2006, 7:29 PM

Thread Participants: 2

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