[GWT Ext] ToastWindow 지원??
Google/GWT / 2008. 11. 26. 11:41
GWT-Ext User Extensions 의 최신버전을 받아서 보면 ToastWindow 가 없습니다.
데모페이지에는 떡하니 나와있는데 말입니다.
데모의 소스를 실제 프로젝트에 적용하면... 아무것도 나오지 않습니다.
그래서 js 를 찾기위에 구글을 뒤적뒤적....
Ext JS 포럼에서 찾은 소중한 글...
다음 script 를 추가하면 될 것 같았습니다.
01 | Ext.ux.ToastWindowMgr = { |
02 | positions: [] |
03 | }; |
04 |
05 | Ext.ux.ToastWindow = Ext.extend(Ext.Window, { |
06 | initComponent: function (){ |
07 | Ext.apply( this , { |
08 | iconCls: this .iconCls || 'information' , |
09 | width: 200, |
10 | height: 100, |
11 | autoScroll: true , |
12 | autoDestroy: true , |
13 | plain: false |
14 | }); |
15 | this .task = new Ext.util.DelayedTask( this .hide, this ); |
16 | Ext.ux.ToastWindow.superclass.initComponent.call( this ); |
17 | }, |
18 | setMessage: function (msg){ |
19 | this .body.update(msg); |
20 | }, |
21 | setTitle: function (title, iconCls){ |
22 | Ext.ux.ToastWindow.superclass.setTitle.call( this , title, iconCls|| this .iconCls); |
23 | }, |
24 | onRender: function (ct, position) { |
25 | Ext.ux.ToastWindow.superclass.onRender.call( this , ct, position); |
26 | }, |
27 | afterShow: function (){ |
28 | Ext.ux.ToastWindow.superclass.afterShow.call( this ); |
29 | this .on( 'move' , function (){ |
30 | Ext.ux.ToastWindowMgr.positions.remove( this .pos); |
31 | this .task.cancel();} |
32 | , this ); |
33 | this .task.delay(2000); |
34 | }, |
35 | animShow: function (){ |
36 | this .pos = 0; |
37 | while (Ext.ux.ToastWindowMgr.positions.indexOf( this .pos)>-1) |
38 | this .pos++; |
39 | Ext.ux.ToastWindowMgr.positions.push( this .pos); |
40 | this .setSize(200,100); |
41 | this .el.alignTo(document, "br-br" , [ -20, -20-(( this .getSize().height+10)* this .pos) ]); |
42 | this .el.slideIn( 'b' , { |
43 | duration: 1, |
44 | callback: this .afterShow, |
45 | scope: this |
46 | }); |
47 | }, |
48 | animHide: function (){ |
49 | Ext.ux.ToastWindowMgr.positions.remove( this .pos); |
50 | this .el.ghost( "b" , { |
51 | duration: 1, |
52 | remove: true |
53 | }); |
54 | } |
55 | }); |
테스트 코드를 실행시키면!!!
1 | ToastWindow tw = new ToastWindow( "토스트 윈도우" , "문서가 임시저장되었습니다." ); |
2 | tw.setIconCls( "icon-exclamation-header" ); |
3 | tw.show(); |
잘 나옵니다....
GWT Ext ux 에서 왜 빠졌는지는 모르겠지만.. (라이센스 때문인가???)
메신저에 익숙해진 사람들에게는 저런 메세지가 강력할 듯 하네요~~