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 6891971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:28:36+00:00 2026-05-27T06:28:36+00:00

My aim is to use GWT.runSync to load the popup contents only when required.

  • 0

My aim is to use GWT.runSync to load the popup contents only when required.

If I construct my widget as:

public class CreateButton extends Button {

public CreateButton() {
    super("Create");
    buildUI();
}

private void buildUI() {

    final CreateWidget createWidget = new CreateWidget();

    final PopupPanel popupPanel = new PopupPanel(false);
    popupPanel.setWidget(createWidget);
    popupPanel.setGlassEnabled(true);
    popupPanel.setAnimationEnabled(true);
    addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            popupPanel.center();

        }
    });
}
}

Then the popup will be centered correctly.

If I build the popup within the clickHandler:

public class CreateButton extends Button {

public CreateButton() {
    super("Create");
    buildUI();
}

private void buildUI() {

        @Override
        public void onClick(ClickEvent event) {
            final CreateWidget createWidget = new CreateWidget();

            final PopupPanel popupPanel = new PopupPanel(false);
            popupPanel.setWidget(createWidget);
            popupPanel.setGlassEnabled(true);
            popupPanel.setAnimationEnabled(true);
            addClickHandler(new ClickHandler() {

            popupPanel.center();

        }
    });

}
}

The popup will not center correctly. I have tried using setPositionAndShow, however the supplied offsets are 12, even though the CreateWidget is actually about 200px for both width and height.

I want to use the second method so I can eventually use GWT.runAsync within the onClick as CreateWidget is very complex.

I am using GWT-2.1.1

  • 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-27T06:28:36+00:00Added an answer on May 27, 2026 at 6:28 am

    Seems to work by delaying the call to center. Perhaps a once off Timer would work as well. Delaying the call also works when wrapping buildUI within GWT.runAsync

    public class CreateButton extends Button {
    
        public CreateButton() {
            super("Create");
            buildUI();
        }
    
        private void buildUI() {
    
            @Override
            public void onClick(ClickEvent event) {
                final CreateWidget createWidget = new CreateWidget();
    
                final PopupPanel popupPanel = new PopupPanel(false);
                popupPanel.setWidget(createWidget);
                popupPanel.setGlassEnabled(true);
                popupPanel.setAnimationEnabled(true);
                addClickHandler(new ClickHandler() {
    
                    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
    
                        @Override
                        public boolean execute() {
    
                            popupPanel.center();
                            return false;
    
                        }
                    }, 50); //a value greater than 50 maybe needed here.
                });    
            }
        }
    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My project is to implement minimum spanning tree using java. I aim to use
basically my aim is to use JQuery to post back an x & y
AIM: To output the contents of a log file line by line newest at
which column i need to use to join V$session and V$sqlarea? My main aim
I am a very, very mediocre programmer, but I still aim to use the
My aim is to use a member function in a for_each call. So I
MY AIM Use jQuery UI Autocomplete to search for a book and when a
My aim is to Sanitize a string. The class should do: trim an input
Hey, friend. as show in title: My aim is use ajax to connect with
I am trying to use multimaps in C++. The main aim is that there

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.