Source Code Cross Referenced for ConfirmationViewDialog.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » console » client » dialogs » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.console.client.dialogs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         *
005:         * Copyright (C) 2006 Bostech Corporation
006:         *
007:         * This program is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License as published by the
009:         * Free Software Foundation; either version 2 of the License, or (at your option)
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015:         * for more details.
016:         *
017:         * You should have received a copy of the GNU General Public License along with
018:         * this program; if not, write to the Free Software Foundation, Inc.,
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id$
023:         */
024:        package com.bostechcorp.cbesb.console.client.dialogs;
025:
026:        import com.bostechcorp.cbesb.console.client.ConsoleImageBundle;
027:        import com.bostechcorp.cbesb.console.client.ClientUtils;
028:        import com.bostechcorp.cbesb.console.i18n.ConsoleMessages;
029:        import com.google.gwt.core.client.GWT;
030:        import com.google.gwt.user.client.ui.Button;
031:        import com.google.gwt.user.client.ui.ClickListener;
032:        import com.google.gwt.user.client.ui.DialogBox;
033:        import com.google.gwt.user.client.ui.HasHorizontalAlignment;
034:        import com.google.gwt.user.client.ui.HasVerticalAlignment;
035:        import com.google.gwt.user.client.ui.HorizontalPanel;
036:        import com.google.gwt.user.client.ui.Image;
037:        import com.google.gwt.user.client.ui.Label;
038:        import com.google.gwt.user.client.ui.PushButton;
039:        import com.google.gwt.user.client.ui.VerticalPanel;
040:        import com.google.gwt.user.client.ui.Widget;
041:
042:        public class ConfirmationViewDialog extends DialogBox {
043:
044:            private static final String YES_BUTTON = ((ConsoleMessages) GWT
045:                    .create(ConsoleMessages.class)).yes();
046:
047:            private static final String CANCEL_BUTTON = ((ConsoleMessages) GWT
048:                    .create(ConsoleMessages.class)).Cancel();
049:
050:            private static final String NO_BUTTON = ((ConsoleMessages) GWT
051:                    .create(ConsoleMessages.class)).no();
052:
053:            private static final String OK_BUTTON = ((ConsoleMessages) GWT
054:                    .create(ConsoleMessages.class)).OK();
055:
056:            private int result;
057:
058:            private VerticalPanel confirmPanel = new VerticalPanel();
059:
060:            // private DisclosurePanel errorContainer = new DisclosurePanel();
061:            private HorizontalPanel messageTextPanel = new HorizontalPanel();
062:
063:            private HorizontalPanel widgetPanel = new HorizontalPanel();
064:
065:            private HorizontalPanel ButtonsPanel = new HorizontalPanel();
066:
067:            private Label messageTextLabel = new Label();
068:
069:            String messageTextContent;
070:
071:            ConsoleImageBundle images = (ConsoleImageBundle) GWT
072:                    .create(ConsoleImageBundle.class);
073:
074:            Image messageImage;
075:
076:            public ConfirmationViewDialog(String messageText,
077:                    Widget additionalWidget, String button1, String button2,
078:                    String button3, String button4, String button5) {
079:                super (false, true);
080:                initContent();
081:                setMessage(messageText);
082:                setStyle();
083:                setWidget(confirmPanel);
084:                initContent(additionalWidget);
085:
086:                initButtonsPanels(button1, button2, button3, button4, button5);
087:            }
088:
089:            private void initButtonsPanels(String button1, String button2,
090:                    String button3, String button4, String button5) {
091:
092:                if (button1 != null) {
093:                    PushButton button = new PushButton(button1);
094:                    button.addClickListener(new ButtonCLickListener());
095:                    ButtonsPanel.add(button);
096:                }
097:
098:                if (button2 != null) {
099:                    PushButton button = new PushButton(button2);
100:                    ButtonsPanel.add(button);
101:                }
102:
103:                if (button3 != null) {
104:                    PushButton button = new PushButton(button3);
105:                    ButtonsPanel.add(button);
106:                }
107:
108:                if (button4 != null) {
109:                    PushButton button = new PushButton(button4);
110:                    ButtonsPanel.add(button);
111:                }
112:
113:                if (button5 != null) {
114:                    PushButton button = new PushButton(button5);
115:                    ButtonsPanel.add(button);
116:                }
117:                confirmPanel.add(ButtonsPanel);
118:            }
119:
120:            private void setMessage(String messageTextContent) {
121:                this .messageTextContent = messageTextContent;
122:            }
123:
124:            private void setStyle() {
125:                // TODO Auto-generated method stub
126:
127:            }
128:
129:            private void initContent(Widget additionalWidget) {
130:
131:                messageTextLabel.setText(messageTextContent);
132:                messageTextLabel.setWordWrap(true);
133:                messageTextLabel.setWidth("100%");
134:                messageTextPanel.add(messageImage);
135:                messageTextPanel.add(messageTextLabel);
136:                messageTextPanel.setCellHorizontalAlignment(messageImage,
137:                        HasHorizontalAlignment.ALIGN_LEFT);
138:                messageTextPanel.setCellHorizontalAlignment(messageTextLabel,
139:                        HasHorizontalAlignment.ALIGN_RIGHT);
140:
141:                messageTextPanel.setCellVerticalAlignment(messageImage,
142:                        HasVerticalAlignment.ALIGN_MIDDLE);
143:                messageTextPanel.setCellVerticalAlignment(messageTextLabel,
144:                        HasVerticalAlignment.ALIGN_MIDDLE);
145:
146:                confirmPanel.add(messageTextPanel);
147:                initWidgetPanel(additionalWidget);
148:                // final PushButton okButton = new PushButton(" "
149:                // + ((ConsoleMessages) GWT.create(ConsoleMessages.class)).OK()
150:                // + " ");
151:                // okButton.setWidth("100px");
152:                // okButton.addClickListener(new ClickListener() {
153:                // public void onClick(Widget w) {
154:                // close();
155:                // }
156:                // });
157:                // confirmPanel.add(okButton);
158:                // confirmPanel.setCellHorizontalAlignment(okButton,
159:                // HasHorizontalAlignment.ALIGN_CENTER);
160:
161:            }
162:
163:            private void initWidgetPanel(Widget addWidget) {
164:                if (addWidget != null) {
165:                    widgetPanel.add(addWidget);
166:                    confirmPanel.add(widgetPanel);
167:                } else {
168:                    // don't add the panel
169:                }
170:
171:            }
172:
173:            //
174:            private void initContent() {
175:                // if (iconStyle == 0) {
176:                // get info icon
177:                setText(((ConsoleMessages) GWT.create(ConsoleMessages.class))
178:                        .confirmation());
179:                messageImage = images.informationImage().createImage();
180:            }
181:
182:            public static int showOkCancel(String question, Widget parentWidget) {
183:
184:                return showCustomButtons(question, null, OK_BUTTON,
185:                        CANCEL_BUTTON, null, null, null, parentWidget);
186:            }
187:
188:            public static int showYesNo(String question, Widget parentWidget) {
189:                return showCustomButtons(question, null, YES_BUTTON, NO_BUTTON,
190:                        null, null, null, parentWidget);
191:            }
192:
193:            public static int showYesNoCancel(String question,
194:                    Widget parentWidget) {
195:                return showCustomButtons(question, null, YES_BUTTON, NO_BUTTON,
196:                        CANCEL_BUTTON, null, null, parentWidget);
197:            }
198:
199:            public static int showCustomButtons(String question,
200:                    Widget additionalWidget, String button1, String button2,
201:                    String button3, String button4, String button5,
202:                    Widget parentWidget) {
203:
204:                ConfirmationViewDialog dialog = new ConfirmationViewDialog(
205:                        question, additionalWidget, button1, button2, button3,
206:                        button4, button5);
207:                dialog.show(parentWidget);
208:                return dialog.getResult();
209:            }
210:
211:            public void show(Widget w) {
212:                setPopupPosition(w.getAbsoluteLeft() + w.getOffsetWidth() / 4,
213:                        w.getAbsoluteTop() + w.getOffsetHeight() / 4);
214:                show();
215:            }
216:
217:            class ButtonCLickListener implements  ClickListener {
218:                public void onClick(Widget sender) {
219:                    if (((ConsoleMessages) GWT.create(ConsoleMessages.class))
220:                            .yes().equals(((Button) sender).getText()))
221:                        ConfirmationViewDialog.this .result = 1;
222:                    else if (((ConsoleMessages) GWT
223:                            .create(ConsoleMessages.class)).no().equals(
224:                            ((Button) sender).getText()))
225:                        ConfirmationViewDialog.this .result = 2;
226:                    else if (((ConsoleMessages) GWT
227:                            .create(ConsoleMessages.class)).OK().equals(
228:                            ((Button) sender).getText()))
229:                        ConfirmationViewDialog.this .result = 3;
230:                    else if (((ConsoleMessages) GWT
231:                            .create(ConsoleMessages.class)).Cancel().equals(
232:                            ((Button) sender).getText()))
233:                        ConfirmationViewDialog.this .result = 4;
234:                    //				Integer
235:                    //					.parseInt(((PushButton) sender).getTitle());
236:                    ConfirmationViewDialog.this .hide();
237:                }
238:            }
239:
240:            public int getResult() {
241:                return result;
242:            }
243:
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.