Source Code Cross Referenced for MessageboxDlg.java in  » Ajax » zk » org » zkoss » zul » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » zk » org.zkoss.zul.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* MessageboxDlg.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Wed Aug 17 16:42:20     2005, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2005 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.zul.impl;
020:
021:        import org.zkoss.mesg.Messages;
022:        import org.zkoss.zul.mesg.MZul;
023:
024:        import org.zkoss.zk.ui.UiException;
025:
026:        import org.zkoss.zul.Window;
027:        import org.zkoss.zul.Messagebox;
028:
029:        /**
030:         * Used with {@link Messagebox} to implement a message box.
031:         *
032:         * @author tomyeh
033:         */
034:        public class MessageboxDlg extends Window {
035:            /** A OK button. */
036:            public static final int OK = Messagebox.OK;
037:            /** A Cancel button. */
038:            public static final int CANCEL = Messagebox.CANCEL;
039:            /** A Yes button. */
040:            public static final int YES = Messagebox.YES;
041:            /** A No button. */
042:            public static final int NO = Messagebox.NO;
043:            /** A Abort button. */
044:            public static final int ABORT = Messagebox.ABORT;
045:            /** A Retry button. */
046:            public static final int RETRY = Messagebox.RETRY;
047:            /** A IGNORE button. */
048:            public static final int IGNORE = Messagebox.IGNORE;
049:
050:            /** What buttons are allowed. */
051:            private int _buttons;
052:            /** Which button is pressed. */
053:            private int _result;
054:
055:            public void onOK() {
056:                if ((_buttons & OK) != 0)
057:                    endModal(OK);
058:                else if ((_buttons & YES) != 0)
059:                    endModal(YES);
060:                else if ((_buttons & RETRY) != 0)
061:                    endModal(RETRY);
062:            }
063:
064:            public void onCancel() {
065:                if (_buttons == OK)
066:                    endModal(OK);
067:                else if ((_buttons & CANCEL) != 0)
068:                    endModal(CANCEL);
069:                else if ((_buttons & NO) != 0)
070:                    endModal(NO);
071:                else if ((_buttons & ABORT) != 0)
072:                    endModal(ABORT);
073:            }
074:
075:            /** Sets what buttons are allowed. */
076:            public void setButtons(int buttons) {
077:                _buttons = buttons;
078:            }
079:
080:            /** Sets the focus.
081:             * @param button the button to gain the focus. If 0, the default one
082:             * (i.e., the first one) is assumed.
083:             * @since 3.0.0
084:             */
085:            public void setFocus(int button) {
086:                if (button > 0) {
087:                    final Button btn = (Button) getFellowIfAny("btn" + button);
088:                    if (btn != null)
089:                        btn.focus();
090:                }
091:            }
092:
093:            /** Called only internally.
094:             */
095:            public void endModal(int button) {
096:                _result = button;
097:                detach();
098:            }
099:
100:            /** Returns the result which is the button being pressed.
101:             */
102:            public int getResult() {
103:                return _result;
104:            }
105:
106:            /**
107:             * Represents a button on the message box.
108:             * @since 3.0.0
109:             */
110:            public static class Button extends org.zkoss.zul.Button {
111:                private int _button;
112:
113:                /** Sets the identity.
114:                 */
115:                public void setIdentity(int button) {
116:                    _button = button;
117:
118:                    final int label;
119:                    switch (button) {
120:                    case YES:
121:                        label = MZul.YES;
122:                        break;
123:                    case NO:
124:                        label = MZul.NO;
125:                        break;
126:                    case RETRY:
127:                        label = MZul.RETRY;
128:                        break;
129:                    case ABORT:
130:                        label = MZul.ABORT;
131:                        break;
132:                    case IGNORE:
133:                        label = MZul.IGNORE;
134:                        break;
135:                    case CANCEL:
136:                        label = MZul.CANCEL;
137:                        break;
138:                    default:
139:                        label = MZul.OK;
140:                    }
141:                    setLabel(Messages.get(label));
142:                    setId("btn" + _button);
143:                }
144:
145:                public void onClick() {
146:                    ((MessageboxDlg) getSpaceOwner()).endModal(_button);
147:                }
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.