简体   繁体   English

GWT可调整大小的对话框选项

[英]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?" “据我所知,默认情况下DialogBox在GWT中无法调整大小(甚至没有实现)。可调整大小是指单击DialogBox的边缘并将其拖动到更大位置。我在网络上看到了一些自定义可调整大小的面板,但不是DialogBox。我对如何制作可调整大小的DialogBox有一些想法,只是不想重新发明。也许有人知道可调整大小的DialogBox的实现,可以将我链接到源代码吗?”

GWT resizable DialogBox GWT可调整大小的对话框

We looked around and finally gave up on modifying/enhancing GWT DialogBox. 我们环顾四周,最后放弃了修改/增强GWT DialogBox。 Instead we picked an open-sourced Windobox implementation that provides this out of the box. 相反,我们选择了一个开源的Windobox实现,可以立即提供。 Code @ WindowBox 代码@ WindowBox

We have used it successfully in enterprise application with 200 screens across ie, firefox and chrome. 我们已经成功地在企业应用程序中使用了它,该应用程序具有200个屏幕,即Firefox和chrome。

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: 通过结合使用CSS和GWT / JavaScript,可以实现一种非常简单的方法来实现对话框或其他GWT小部件的基本大小调整:

Style the DOM element to be resizable and handle the mouse event caused by the resize itself... two steps follow. 设置DOM元素的大小,使其可调整大小,并处理由调整大小本身引起的鼠标事件。执行以下两个步骤。

1) Apply CSS to the dialog to make it resizable: div resizable like text-area or http://caniuse.com/#feat=css-resize 1)将CSS应用于对话框以使其可调整大小: div可调整大小,例如文本区域http://caniuse.com/#feat=css-resize

Don't forget to apply "overflow" other then "visible" (eg overflow: hidden) to make it work. 不要忘记应用“溢出”,然后再应用“可见”(例如,溢出:隐藏)以使其起作用。

2) Overwrite onBrowserEvent(..) in your GWT widget (eg DialogBox) to handle the mouseup event after resize: 2)在GWT小部件(例如DialogBox)中覆盖onBrowserEvent(..),以在调整大小后处理mouseup事件:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM