Search code examples
cssgwtuibinder

How to position the GWT dialog to the bottom right corner of the browser?


    int browserHeight=Window.getClientHeight();
    int browserWidth=Window.getClientWidth();
    dialog.setPopupPosition(browserWidth-dialog.getElement().getClientWidth(), browserHeight-dialog.getElement().getClientHeight());

    dialog.show();

The above code will make the position starts from the very last pixel of the browser (ie bottom=0), which is not what i expect. I don't like css cos browser incompatible problem. Also there a footer in my website (height=50px) if u can make the dialog to not to lay on the footer like the following pic enter image description here

so, How to position the GWT dialog to the bottom right corner of the browser?


Solution

  • This is the right way

    dialogBox.setPopupPositionAndShow(new PositionCallback(){
    
        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
                            // TODO Auto-generated method stub
            dialogBox.setPopupPosition(parentDockLayoutPanel().getOffsetWidth()-         dialogBox.getOffsetWidth(), 
    parentDockLayoutPanel().getOffsetHeight() - dialogBox.getOffsetHeight()-50);
        }
    
    });