开发者

GWT resizable DialogBox

As far as I understand DialogBox by default is not reizable (it is n开发者_开发百科ot 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?


I did something like this, it just adds a red box to the bottom right corner, you can then add mouse handlers to that red box for resizing.

public class ThumbnailDialog extends DialogBox {

  private FocusPanel tab = new FocusPanel();

  public ThumbnailDialog() {
    super(false, false);    
    tab.setPixelSize(4, 4);
    tab.getElement().getStyle().setBackgroundColor("red");
    tab.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    tab.getElement().getStyle().setRight(0, Style.Unit.PX);
    tab.getElement().getStyle().setBottom(0, Style.Unit.PX);

    Element tabElement = getCellElement(2, 2);
    tabElement.getStyle().setOverflow(Style.Overflow.VISIBLE);
    tabElement.appendChild(tab.getElement());
  }
}


OK after some research I've come to a conclusion that due to construction of DialogBox it can not be done. At-least it can not be done without loosing DialogBox default behavior. All the mouse events has to be overridden. If I override all the events, I can loose default behavior in case Google changes something in the future. DialogBox caption is not made seperate from DialogBox it self. On all the mouse events DialogBox checks if sender is Caption, if it is not, it swallows the mouse event. That way DialogBox is moved around the screen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜