TheJavaBeast
TheJavaBeast

Reputation: 163

GWT resizable dialogbox options

I found the following question that i would like a better answer to. Any thoughts?

"As far as I understand DialogBox by default is not reizable (it is not even implemented) in GWT. By resizable I mean clicking on the edge of the DialogBox and dragging it bigger. I've seen some custom resizable panels on the web, but not the DialogBox. I've some ideas on how to make resizable DialogBox, just don't want to re-invent the weel. Maybe someone knows an implementation of resizable DialogBox and can link me to the source code?"

GWT resizable DialogBox

Upvotes: 3

Views: 3152

Answers (2)

mrechtien
mrechtien

Reputation: 35

A really simple way to achieve basic resizing of a dialog or any other GWT widget is achievable by using a combination of CSS and GWT/JavaScript:

Style the DOM element to be resizable and handle the mouse event caused by the resize itself... two steps follow.

1) Apply CSS to the dialog to make it resizable: div resizable like text-area or http://caniuse.com/#feat=css-resize

Don't forget to apply "overflow" other then "visible" (e.g. overflow: hidden) to make it work.

2) Overwrite onBrowserEvent(..) in your GWT widget (e.g. DialogBox) to handle the mouseup event after resize:

@Override
public void onBrowserEvent(Event pEvent) {
    if(pEvent.getTypeInt() == Event.ONMOUSEUP) {
        triggerYourLayoutOrResizeMethod();
    }
    super.onBrowserEvent(pEvent);
}

Upvotes: 1

appbootup
appbootup

Reputation: 9537

We looked around and finally gave up on modifying/enhancing GWT DialogBox. Instead we picked an open-sourced Windobox implementation that provides this out of the box. Code @ WindowBox

We have used it successfully in enterprise application with 200 screens across ie, firefox and chrome.

Upvotes: 5

Related Questions