Source Code Cross Referenced for MessageBoxSample.java in  » Ajax » gwtext-2.01 » com » gwtext » sample » showcase2 » client » window » 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 » gwtext 2.01 » com.gwtext.sample.showcase2.client.window 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GWT-Ext Widget Library
003:         * Copyright(c) 2007-2008, GWT-Ext.
004:         * licensing@gwt-ext.com
005:         * 
006:         * http://www.gwt-ext.com/license
007:         */
008:        package com.gwtext.sample.showcase2.client.window;
009:
010:        import com.google.gwt.user.client.Timer;
011:        import com.gwtext.client.core.EventObject;
012:        import com.gwtext.client.util.Format;
013:        import com.gwtext.client.widgets.*;
014:        import com.gwtext.client.widgets.event.ButtonListenerAdapter;
015:        import com.gwtext.client.widgets.layout.TableLayout;
016:        import com.gwtext.sample.showcase2.client.Showcase2;
017:        import com.gwtext.sample.showcase2.client.ShowcasePanel;
018:
019:        public class MessageBoxSample extends ShowcasePanel {
020:
021:            public String getSourceUrl() {
022:                return "source/window/MessageBoxSample.java.html";
023:            }
024:
025:            public Panel getViewPanel() {
026:                if (panel == null) {
027:                    panel = new Panel();
028:                    panel.setLayout(new TableLayout(2));
029:
030:                    Panel panel1 = new Panel();
031:                    panel1.setTitle("Confirm");
032:                    panel1.setFrame(true);
033:                    panel1.setWidth(250);
034:                    panel1.setHeight(150);
035:                    panel1.setPaddings(20);
036:
037:                    Button button1 = new Button("Show Me",
038:                            new ButtonListenerAdapter() {
039:                                public void onClick(Button button, EventObject e) {
040:                                    MessageBox
041:                                            .confirm(
042:                                                    "Confirm",
043:                                                    "Are you sure you want to do that?",
044:                                                    new MessageBox.ConfirmCallback() {
045:                                                        public void execute(
046:                                                                String btnID) {
047:                                                            Showcase2
048:                                                                    .showMessage(
049:                                                                            "Button Click",
050:                                                                            Format
051:                                                                                    .format(
052:                                                                                            "You clicked the {0} button",
053:                                                                                            btnID));
054:                                                        }
055:                                                    });
056:                                }
057:                            });
058:
059:                    panel1.add(new HTMLPanel(
060:                            "A Standard Yes/No Confirm Dialog.", 0, 0, 0, 10));
061:
062:                    panel1.addButton(button1);
063:                    panel.add(new PaddedPanel(panel1, 0, 0, 10, 10));
064:
065:                    Panel panel2 = new Panel();
066:                    panel2.setTitle("Prompt");
067:                    panel2.setFrame(true);
068:                    panel2.setWidth(250);
069:                    panel2.setHeight(150);
070:                    panel2.setPaddings(20);
071:
072:                    Button button2 = new Button("Show Me",
073:                            new ButtonListenerAdapter() {
074:                                public void onClick(Button button, EventObject e) {
075:                                    MessageBox.prompt("Name",
076:                                            "Please enter your name:",
077:                                            new MessageBox.PromptCallback() {
078:                                                public void execute(
079:                                                        String btnID,
080:                                                        String text) {
081:                                                    Showcase2
082:                                                            .showMessage(
083:                                                                    "Button Click",
084:                                                                    Format
085:                                                                            .format(
086:                                                                                    "You clicked the {0} button and entered the text \"{1}\"",
087:                                                                                    btnID,
088:                                                                                    text));
089:                                                }
090:                                            });
091:                                }
092:                            });
093:                    panel2.add(new HTMLPanel("A Standard prompt dialog.", 0, 0,
094:                            0, 10));
095:                    panel2.addButton(button2);
096:                    panel.add(new PaddedPanel(panel2, 0, 0, 10, 10));
097:
098:                    Panel panel3 = new Panel();
099:                    panel3.setTitle("Multi-line Prompt");
100:                    panel3.setFrame(true);
101:                    panel3.setWidth(250);
102:                    panel3.setHeight(150);
103:                    panel3.setPaddings(20);
104:
105:                    Button button3 = new Button("Show Me",
106:                            new ButtonListenerAdapter() {
107:                                public void onClick(final Button button,
108:                                        EventObject e) {
109:                                    MessageBox.show(new MessageBoxConfig() {
110:                                        {
111:                                            setTitle("Address");
112:                                            setMsg("Please enter your address:");
113:                                            setWidth(300);
114:                                            setButtons(MessageBox.OKCANCEL);
115:                                            setMultiline(true);
116:                                            setCallback(new MessageBox.PromptCallback() {
117:                                                public void execute(
118:                                                        String btnID,
119:                                                        String text) {
120:                                                    Showcase2
121:                                                            .showMessage(
122:                                                                    "Button Click",
123:                                                                    Format
124:                                                                            .format(
125:                                                                                    "You clicked the {0} button and entered the text \"{1}\"",
126:                                                                                    btnID,
127:                                                                                    text));
128:                                                }
129:                                            });
130:                                            setAnimEl(button.getId());
131:                                        }
132:                                    });
133:                                }
134:                            });
135:                    panel3.add(new HTMLPanel("A multi-line prompt dialog.", 0,
136:                            0, 0, 10));
137:                    panel3.addButton(button3);
138:                    panel.add(new PaddedPanel(panel3, 0, 0, 10, 10));
139:
140:                    Panel panel4 = new Panel();
141:                    panel4.setTitle("Yes/No/Cancel");
142:                    panel4.setFrame(true);
143:                    panel4.setWidth(250);
144:                    panel4.setHeight(150);
145:                    panel4.setPaddings(20);
146:
147:                    Button button4 = new Button("Show Me",
148:                            new ButtonListenerAdapter() {
149:                                public void onClick(final Button button,
150:                                        EventObject e) {
151:                                    MessageBox.show(new MessageBoxConfig() {
152:                                        {
153:                                            setTitle("Save Changes?");
154:                                            setMsg("Your are closing a tab that has unsaved changes. Would you like to save your changes?");
155:                                            setButtons(MessageBox.YESNOCANCEL);
156:                                            setCallback(new MessageBox.PromptCallback() {
157:                                                public void execute(
158:                                                        String btnID,
159:                                                        String text) {
160:                                                    Showcase2
161:                                                            .showMessage(
162:                                                                    "Button Click",
163:                                                                    Format
164:                                                                            .format(
165:                                                                                    "You clicked the {0} button",
166:                                                                                    btnID));
167:                                                }
168:                                            });
169:                                            setAnimEl(button.getId());
170:                                        }
171:                                    });
172:                                }
173:                            });
174:                    panel4.add(new HTMLPanel("Standard Yes/No/Cancel dialog.",
175:                            0, 0, 0, 10));
176:
177:                    panel4.addButton(button4);
178:                    panel.add(new PaddedPanel(panel4, 0, 0, 10, 10));
179:
180:                    Panel panel5 = new Panel();
181:                    panel5.setTitle("Progress Dialog");
182:                    panel5.setFrame(true);
183:                    panel5.setWidth(250);
184:                    panel5.setHeight(150);
185:                    panel5.setPaddings(20);
186:
187:                    Button button5 = new Button("Show Me",
188:                            new ButtonListenerAdapter() {
189:                                public void onClick(final Button button,
190:                                        EventObject e) {
191:                                    MessageBox.show(new MessageBoxConfig() {
192:                                        {
193:                                            setTitle("Please wait...");
194:                                            setMsg("Initializing...");
195:                                            setWidth(240);
196:                                            setProgress(true);
197:                                            setClosable(false);
198:                                            setCallback(new MessageBox.PromptCallback() {
199:                                                public void execute(
200:                                                        String btnID,
201:                                                        String text) {
202:                                                    Showcase2
203:                                                            .showMessage(
204:                                                                    "Button Click",
205:                                                                    Format
206:                                                                            .format(
207:                                                                                    "You clicked the {0} button and entered the text {1}",
208:                                                                                    btnID,
209:                                                                                    text));
210:                                                }
211:                                            });
212:                                            setAnimEl(button.getId());
213:                                        }
214:                                    });
215:
216:                                    //create bogus progress
217:                                    for (int i = 1; i < 12; i++) {
218:                                        final int j = i;
219:                                        Timer timer = new Timer() {
220:                                            public void run() {
221:                                                if (j == 11) {
222:                                                    MessageBox.hide();
223:                                                } else {
224:                                                    MessageBox
225:                                                            .updateProgress(
226:                                                                    j * 10,
227:                                                                    "Loading item "
228:                                                                            + j
229:                                                                            + " of 10... ");
230:                                                }
231:                                            }
232:                                        };
233:                                        timer.schedule(i * 1000);
234:                                    }
235:                                }
236:                            });
237:                    panel5
238:                            .add(new HTMLPanel(
239:                                    "You can set a progress on a progress MessageBox..",
240:                                    0, 0, 0, 10));
241:
242:                    panel5.addButton(button5);
243:                    panel.add(new PaddedPanel(panel5, 0, 0, 10, 10));
244:
245:                    Panel panel6 = new Panel();
246:                    panel6.setTitle("Wait Dialog");
247:                    panel6.setFrame(true);
248:                    panel6.setWidth(250);
249:                    panel6.setHeight(150);
250:                    panel6.setPaddings(20);
251:
252:                    Button button6 = new Button("Show Me",
253:                            new ButtonListenerAdapter() {
254:                                public void onClick(final Button button,
255:                                        EventObject e) {
256:                                    MessageBox.show(new MessageBoxConfig() {
257:                                        {
258:                                            setMsg("Saving your data, please wait...");
259:                                            setProgressText("Saving...");
260:                                            setWidth(300);
261:                                            setWait(true);
262:                                            setWaitConfig(new WaitConfig() {
263:                                                {
264:                                                    setInterval(200);
265:                                                }
266:                                            });
267:                                            setAnimEl(button.getId());
268:                                        }
269:                                    });
270:
271:                                    Timer timer = new Timer() {
272:                                        public void run() {
273:                                            MessageBox.hide();
274:                                            Showcase2
275:                                                    .showMessage("Done",
276:                                                            "Your fake data was saved!");
277:                                        }
278:                                    };
279:                                    timer.schedule(8000);
280:                                }
281:                            });
282:                    panel6
283:                            .add(new HTMLPanel(
284:                                    "Dialog with indefinite progress bar (will close after 8 sec).",
285:                                    0, 0, 0, 10));
286:
287:                    panel6.addButton(button6);
288:                    panel.add(new PaddedPanel(panel6, 0, 0, 10, 10));
289:
290:                    Panel panel7 = new Panel();
291:                    panel7.setTitle("Alert");
292:                    panel7.setFrame(true);
293:                    panel7.setWidth(250);
294:                    panel7.setHeight(150);
295:                    panel7.setPaddings(20);
296:
297:                    Button button7 = new Button("Show Me",
298:                            new ButtonListenerAdapter() {
299:                                public void onClick(Button button, EventObject e) {
300:                                    MessageBox
301:                                            .alert("Changes saved successfully");
302:                                }
303:                            });
304:                    panel7.add(new HTMLPanel("Standard Alert dialog.", 0, 0, 0,
305:                            10));
306:
307:                    panel7.addButton(button7);
308:                    panel.add(new PaddedPanel(panel7, 0, 0, 10, 10));
309:
310:                }
311:                return panel;
312:            }
313:
314:            public String getIntro() {
315:                return "<p><h1>MessageBox Dialogs</h1><p>The example shows how to use the MessageBox class. Some of the buttons have animations, some are normal.</p></p>";
316:            }
317:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.