can DialogBox has a "x" close button in the upper right hand corner like most window have?

258 views
Skip to first unread message

tong123123

unread,
May 31, 2012, 4:54:44 AM5/31/12
to google-we...@googlegroups.com
I think it is very difficult if not impossible, just requested by my company and try to ask here.

Andrea Boscolo

unread,
May 31, 2012, 8:12:28 AM5/31/12
to google-we...@googlegroups.com
DialogBox uses a Caption element for the header. By default the caption is simply text.
Extend it to provide all the buttons you need.
Search in the groups to find out some samples.

jhulford

unread,
May 31, 2012, 11:22:21 AM5/31/12
to google-we...@googlegroups.com
Where it was a pain in the past to do this, it's actually pretty straightforward now.  Just extend DialogBox and provide your own Caption implementation in your constructor's super call.  Our Caption is just a simple 2 column Grid extension with an "X" Image in the right column.

tong123123

unread,
Jun 1, 2012, 5:05:40 AM6/1/12
to google-we...@googlegroups.com
from http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/DialogBox.html
I think I need create a class that implements DialogBox.Caption and then use the constructor
DialogBox(DialogBox.Caption captionWidget)
?
but the difficulty is how to implement all the method in the interface DialogBox.Caption?

let said I name the class customCaption and implements all the interface method in DialogBox.Caption and then inside the customCaption class I use flextable to add a "x" image in a column of flextable?


On Thursday, May 31, 2012 4:54:44 PM UTC+8, tong123123 wrote:
I think it is very difficult if not impossible, just requested by my company and try to ask here.

jhulford

unread,
Jun 1, 2012, 9:27:11 AM6/1/12
to google-we...@googlegroups.com
Yes, that would be exactly how you'd do it.  There's really not much to actually implement. All of the handler methods are just simple variants of "addHandler", so you really end up with having to actually write are the get/set HTML/Text methods.

tong123123

unread,
Jun 2, 2012, 11:32:50 AM6/2/12
to google-we...@googlegroups.com
if the source checked out is not wrong, I see the following
public static class CaptionImpl extends HTML implements Caption {

    public CaptionImpl() {
      super();
      setStyleName("Caption");
    }
  }

in class DialogBox source file,
but

com.google.gwt.user.client.ui.DialogBox.Caption has the following interface

addMouseDownHandler,addMouseUpHandler,addMouseOutHandler,addMouseOverHandler
addMouseMoveHandler,fireEvent, getHTML, setHTML, getText, setText,
setHTML, asWidget
so how could the com.google.gwt.user.client.ui.DialogBox.CaptionImpl implement Caption Inteface???


jhulford於 2012年6月1日星期五UTC+8下午9時27分11秒寫道:

Thomas Broyer

unread,
Jun 2, 2012, 1:15:24 PM6/2/12
to google-we...@googlegroups.com


On Saturday, June 2, 2012 5:32:50 PM UTC+2, tong123123 wrote:
if the source checked out is not wrong, I see the following
public static class CaptionImpl extends HTML implements Caption {

    public CaptionImpl() {
      super();
      setStyleName("Caption");
    }
  }

in class DialogBox source file,
but

com.google.gwt.user.client.ui.DialogBox.Caption has the following interface

addMouseDownHandler,addMouseUpHandler,addMouseOutHandler,addMouseOverHandler
addMouseMoveHandler,fireEvent, getHTML, setHTML, getText, setText,
setHTML, asWidget
so how could the com.google.gwt.user.client.ui.DialogBox.CaptionImpl implement Caption Inteface???

All those methods are inherited from the com.google.gwt.user.client.ui.HTML super-class.
Reply all
Reply to author
Forward
0 new messages