Reputation: 2481
I initialize UI, adding all the elements to a VerticalPanel and at the end of initialization I check whether user password is expiring or not. If it is expiring I show a DialogBox with warning.
One of the element of this page is a TabPanel with a DataGrid and all the data is taken from server asynchronously. So the problem is that when Password Expiration dialog box appears it is behind DataGrid rows. When I inspect elements in Chrome I see that there're PopupGlassPanel -> DialogBox -> Table (with content). But the picture should be: Table (with content) -> PopupGlassPanel -> DialogBox.
But I cannot do anything with async calls to the server for retrieving data. Is it possible to control such things in order all data is retrieved from server and only after it my Dialo Box is shown?
Initialization method looks like:
public void initUI() {
final VerticalPanel mainPanel = new VerticalPanel();
Panel outer = new VerticalPanel();
DataHolder dataHolder = new DataHolder(); //this class contains DataGrid and makes async calls to server for data
outer.add(dataHolder.getContent());
tabPanel.add(outer, "Important Data", true);
mainPanel.add(tabPanel);
checkPasswordExpiration(getPwdExpiring());
RootPanel.get().add(mainPanel);
}
//...........
private void checkPasswordExpiration(int days) {
//...
//Show dialog box
//...
}
Upvotes: 0
Views: 412
Reputation: 1785
You need to call checkPasswordExpiration()
after the async call returns. To do this you should get the async callback (onSuccess()
) to fire an event for which you have a handler that will call checkPasswordExpiration(getPwdExpiring());
You can use EventBus
to fire the event in and to add a handler.
Upvotes: 1