Source Code Cross Referenced for MessageViewDialog.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:        package com.bostechcorp.cbesb.console.client.dialogs;
002:
003:        import com.bostechcorp.cbesb.console.client.ConsoleImageBundle;
004:        import com.bostechcorp.cbesb.console.client.StyleConstants;
005:        import com.bostechcorp.cbesb.console.i18n.ConsoleMessages;
006:        import com.google.gwt.core.client.GWT;
007:        import com.google.gwt.user.client.ui.Button;
008:        import com.google.gwt.user.client.ui.ClickListener;
009:        import com.google.gwt.user.client.ui.DialogBox;
010:        import com.google.gwt.user.client.ui.DisclosureEvent;
011:        import com.google.gwt.user.client.ui.DisclosureHandler;
012:        import com.google.gwt.user.client.ui.DisclosurePanel;
013:        import com.google.gwt.user.client.ui.HasHorizontalAlignment;
014:        import com.google.gwt.user.client.ui.HasVerticalAlignment;
015:        import com.google.gwt.user.client.ui.HorizontalPanel;
016:        import com.google.gwt.user.client.ui.Image;
017:        import com.google.gwt.user.client.ui.Label;
018:        import com.google.gwt.user.client.ui.PushButton;
019:        import com.google.gwt.user.client.ui.TextArea;
020:        import com.google.gwt.user.client.ui.VerticalPanel;
021:        import com.google.gwt.user.client.ui.Widget;
022:
023:        public class MessageViewDialog extends DialogBox {
024:            private VerticalPanel messagePanel = new VerticalPanel();
025:
026:            private HorizontalPanel messageTextPanel = new HorizontalPanel();
027:
028:            private VerticalPanel widgetPanel = new VerticalPanel();
029:
030:            private Label messageTextLabel = new Label("", true);
031:
032:            String messageTextContent;
033:            // Image icon;
034:
035:            ConsoleImageBundle images = (ConsoleImageBundle) GWT
036:                    .create(ConsoleImageBundle.class);
037:
038:            Image messageImage;
039:
040:            private PushButton okButton;
041:
042:            public MessageViewDialog(String messageText,
043:                    Widget additionalWidget, int iconStyle) {
044:                super (false, true);
045:                initContent(iconStyle);
046:                setMessage(messageText);
047:                setStyle();
048:                setWidget(messagePanel);
049:                if (additionalWidget == null)
050:                    messagePanel.setWidth("300px");
051:                else
052:                    messagePanel.setWidth("500px");
053:                initContent(additionalWidget);
054:                show();
055:                center();
056:            }
057:
058:            public MessageViewDialog(String messageText,
059:                    Widget additionalWidget, int iconStyle,
060:                    ClickListener listener) {
061:                super (false, true);
062:                initContent(iconStyle);
063:                setMessage(messageText);
064:                setStyle();
065:                setWidget(messagePanel);
066:                if (additionalWidget == null)
067:                    messagePanel.setWidth("300px");
068:                else
069:                    messagePanel.setWidth("500px");
070:                initContent(additionalWidget);
071:                okButton.addClickListener(listener);
072:                show();
073:                center();
074:            }
075:
076:            private void setMessage(String messageTextContent) {
077:                this .messageTextContent = messageTextContent;
078:            }
079:
080:            private void setStyle() {
081:                // TODO Auto-generated method stub
082:            }
083:
084:            private void initContent(Widget additionalWidget) {
085:
086:                messageTextLabel.setText(messageTextContent);
087:                //		messageTextLabel.setHeight("10px");
088:                messageTextLabel.setWidth("100%");
089:
090:                messageTextPanel.setHeight("50px");
091:                messageTextPanel.add(messageImage);
092:                messageTextPanel.add(messageTextLabel);
093:                messageTextPanel.setCellWidth(messageTextLabel, "100%");
094:                messageTextPanel.setCellHorizontalAlignment(messageImage,
095:                        HasHorizontalAlignment.ALIGN_LEFT);
096:                messageTextPanel.setCellHorizontalAlignment(messageTextLabel,
097:                        HasHorizontalAlignment.ALIGN_LEFT);
098:
099:                messageTextPanel.setCellVerticalAlignment(messageImage,
100:                        HasVerticalAlignment.ALIGN_MIDDLE);
101:                messageTextPanel.setCellVerticalAlignment(messageTextLabel,
102:                        HasVerticalAlignment.ALIGN_MIDDLE);
103:
104:                messagePanel.add(messageTextPanel);
105:                messagePanel.setCellVerticalAlignment(messageTextPanel,
106:                        HasVerticalAlignment.ALIGN_MIDDLE);
107:                initWidgetPanel(additionalWidget);
108:                okButton = new PushButton(" "
109:                        + ((ConsoleMessages) GWT.create(ConsoleMessages.class))
110:                                .OK() + " ");
111:                okButton.setWidth("100%");
112:                okButton.addClickListener(new ClickListener() {
113:                    public void onClick(Widget w) {
114:                        close();
115:                    }
116:                });
117:                messagePanel.add(okButton);
118:                messagePanel.setCellWidth(okButton, "100%");
119:                messagePanel.setCellHorizontalAlignment(okButton,
120:                        HasHorizontalAlignment.ALIGN_CENTER);
121:
122:            }
123:
124:            /**
125:             * initialize additional widget panel
126:             * @param addWidget
127:             */
128:            private void initWidgetPanel(Widget addWidget) {
129:                if (addWidget != null) {
130:                    //			addWidget.setWidth("100%");
131:                    widgetPanel.add(addWidget);
132:                    widgetPanel.setCellWidth(addWidget, "100%");
133:                    messagePanel.add(widgetPanel);
134:                    messagePanel.setCellWidth(widgetPanel, "100%");
135:                } else {
136:                    // don't add the panel
137:                }
138:
139:            }
140:
141:            private void initContent(int iconStyle) {
142:                if (iconStyle == 0) {
143:                    // get info icon
144:                    setText(((ConsoleMessages) GWT
145:                            .create(ConsoleMessages.class)).Information());
146:                    messageImage = images.informationImage().createImage();
147:                } else if (iconStyle == 1) {
148:                    // get warning icon
149:                    setText(((ConsoleMessages) GWT
150:                            .create(ConsoleMessages.class)).Warning());
151:                    messageImage = images.warningImage().createImage();
152:                } else if (iconStyle == 2) {
153:                    setText(((ConsoleMessages) GWT
154:                            .create(ConsoleMessages.class)).Error());
155:                    messageImage = images.errorImage().createImage();
156:                }
157:            }
158:
159:            private void close() {
160:                hide();
161:                messagePanel.removeFromParent();
162:                this .removeFromParent();
163:            }
164:
165:            // /
166:            public static void showInfo(String informationMessage) {
167:                new MessageViewDialog(informationMessage, null, 0);
168:            }
169:
170:            public static void showInfo(String informationmessage,
171:                    Widget additionalWidget) {
172:                new MessageViewDialog(informationmessage, additionalWidget, 0);
173:            }
174:
175:            public static void showWarning(String warningMessage) {
176:                new MessageViewDialog(warningMessage, null, 1);
177:            }
178:
179:            public static void showError(String errorText, String errorTrace) {
180:
181:                new MessageViewDialog(errorText,
182:                        initErrorContainer(errorTrace), 2);
183:            }
184:
185:            public static void showError(String errorText,
186:                    StackTraceElement[] stTr) {
187:
188:                new MessageViewDialog(errorText,
189:                        initErrorContainer(stackTraceToString(stTr)), 2);
190:                // mvd.show(parentWidget);
191:            }
192:
193:            private static String stackTraceToString(StackTraceElement[] stTr) {
194:                String result = "";
195:                for (int i = 0; i < stTr.length; i++) {
196:                    result += "\t" + stTr[i].getClassName() + "-"
197:                            + stTr[i].getMethodName() + "("
198:                            + stTr[i].getFileName() + ":"
199:                            + stTr[i].getLineNumber() + ")\n";
200:                }
201:                return result;
202:            }
203:
204:            public static void showTimeoutDialog(String text,
205:                    ClickListener listener) {
206:                new MessageViewDialog(text, null, 1, listener);
207:            }
208:
209:            /**
210:             * auxiliar method to create and display the errorPanel
211:             * @param errorText
212:             * @return
213:             */
214:            public static Widget initErrorContainer(String errorText) {
215:                // Error Area
216:                final Button headerButton = new Button(((ConsoleMessages) GWT
217:                        .create(ConsoleMessages.class)).ShowDetails());
218:                //		headerLabel.setWidth("100%");
219:                headerButton
220:                        .addStyleName(StyleConstants.POPUP_DIALOG_SHOW_DETAILS);
221:                DisclosurePanel errorContainer = new DisclosurePanel();
222:                errorContainer.setHeader(headerButton);
223:                //		errorContainer.addStyleName("headerX");
224:                errorContainer.addEventHandler(new DisclosureHandler() {
225:                    public void onClose(DisclosureEvent event) {
226:                        headerButton.setText(((ConsoleMessages) GWT
227:                                .create(ConsoleMessages.class)).ShowDetails());
228:                    }
229:
230:                    public void onOpen(DisclosureEvent event) {
231:                        headerButton.setText(((ConsoleMessages) GWT
232:                                .create(ConsoleMessages.class)).CloseDetails());
233:                    }
234:                });
235:                final TextArea errorTraceArea = new TextArea();
236:                errorTraceArea.setWidth("500px");
237:                errorContainer.setWidth("500px");
238:                // Fixed textarea size
239:                //		errorTraceArea.setCharacterWidth(80);
240:                errorTraceArea.setVisibleLines(9);
241:                errorTraceArea.setText(errorText);
242:                errorContainer.add(errorTraceArea);
243:                //		errorContainer.setContent(errorContainer);
244:                return errorContainer;
245:            }
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.