Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6654555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:24:14+00:00 2026-05-26T01:24:14+00:00

From an EntryPoint class I load a custom build westPanel. From this WestPanel I

  • 0

From an EntryPoint class I load a custom build westPanel. From this WestPanel I would like to replace the center of the DockLayoutPanel present on my EntryPoint class.

Here is my EntryPoint class:

public class MainEntryPoint implements EntryPoint {
    private VerticalPanel mainPanel = new VerticalPanel();
    private DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.EM);
    private NorthMenu northMenu = new NorthMenu();
    private VerticalPanel mainPanel = new VerticalPanel();
    //other panels

    @Override
    public void onModuleLoad() {
        dockLayoutPanel.addNorth(northMenu, 40);
        dockLayoutPanel.add(mainPanel);
        //add other panels
        RootLayoutPanel panel = RootLayoutPanel.get();
        panel.add(dockLayoutPanel);     
    }
}

WestPanel should replace DockLayout’s mainPanel with a MyOtherPanel:

public class WestMenu extends Composite {
    private StackLayoutPanel stackLayoutPanel = new StackLayoutPanel(Unit.EM);  
    public WestMenu(){  
        Tree configuration = new Tree();
        configuration.addSelectionHandler( new SelectionHandler(){
            @Override
            public void onSelection(SelectionEvent event) {
                MyOtherPanel builderPanel = new MyOtherPanel();
                RootLayoutPanel panel = RootLayoutPanel.get();
                DockLayoutPanel dlp = (DockLayoutPanel)panel.getWidget(0);
                dlp.add(builderPanel);
            }           
        });
        //other init configurations
        initWidget(stackLayoutPanel);
    }   
} 

I keep on getting an Exception saying that I can not replace it. What is the best way to replace/change the center panel of a DockLayoutPanel?

thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:24:15+00:00Added an answer on May 26, 2026 at 1:24 am

    You need to explicitly remove the center (see javadoc of the protected insert method in DockLayoutPanel):

    dlp.remove(currentCenterPanel);
    

    But that’s not very developer friendly, as you need to keep track of the center widget and always make sure you call remove before adding. I don’t know why they did it like this.

    Another solution could be to simple put a SimpleLayoutPanel as center widget and set your own center widget on this panel, via setWidget. That way you don’t have to do the remove.

    The latter technique also makes it possible to combine the implementation with the ActivityManager by setting the SimpleLayoutPanel as the display in ActivityManager.setDiplay(...). As your implementation looks like the main content of your application, the ActiviyManager might be useful here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load an assembly, instantiate a class from that assembly, and then
I have a C# program that uses a class from another assembly, and this
I would like to return a string variable from my Main() method. I've returned
I want to call my .NET code from unmanaged C++. My process entrypoint is
I am getting time out from using JsonpRequestBuilder. The entry point code goes like
From time to time I see an enum like the following: [Flags] public enum
I am trying to organize my JavaScript. What I would like to do is
Is it possible to add/create new history token from every class? I have the
I'm using OpenNetCF's IoC framework and the code in my Program class looks like:
I'd like to create a Hyperlink from one GWT module to another. Instead of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.