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


001:        package com.bostechcorp.cbesb.console.client;
002:
003:        import com.bostechcorp.cbesb.console.client.dialogs.FileUploadDialog;
004:        import com.bostechcorp.cbesb.console.client.dialogs.MessageViewDialog;
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.Composite;
010:        import com.google.gwt.user.client.ui.DialogBox;
011:        import com.google.gwt.user.client.ui.FileUpload;
012:        import com.google.gwt.user.client.ui.FormHandler;
013:        import com.google.gwt.user.client.ui.FormPanel;
014:        import com.google.gwt.user.client.ui.FormSubmitCompleteEvent;
015:        import com.google.gwt.user.client.ui.FormSubmitEvent;
016:        import com.google.gwt.user.client.ui.TextBox;
017:        import com.google.gwt.user.client.ui.VerticalPanel;
018:        import com.google.gwt.user.client.ui.Widget;
019:
020:        public class FileUploadPanel extends Composite {
021:            public static String ACTION_COMPONENT = "uploadComponent";
022:
023:            public static String ACTION_ASSEMBLY = "uploadAssembly";
024:
025:            public static String LICENSE_IMPORT = "uploadLicense";
026:            final TextBox pathText = new TextBox();
027:
028:            final FormPanel form = new FormPanel();
029:
030:            Admin admin = null;
031:
032:            DialogBox parent = null;
033:            FileUpload upload;
034:            final VerticalPanel panel = new VerticalPanel();
035:
036:            public FileUploadPanel(final Admin admin, String actionType) {
037:                this (admin, actionType, null);
038:            }
039:
040:            public FileUploadPanel(final Admin admin, String actionType,
041:                    DialogBox parentDialog) {
042:
043:                // Create a FormPanel and point it at a service.
044:                this .admin = admin;
045:                this .parent = parentDialog;
046:
047:                if (actionType.equals(ACTION_COMPONENT))
048:                    form.setAction(GWT.getModuleBaseURL() + "/uploadComponent");
049:                else if (actionType.equals(ACTION_ASSEMBLY))
050:                    form.setAction(GWT.getModuleBaseURL() + "/uploadAssembly");
051:                else if (actionType.equals(LICENSE_IMPORT))
052:                    form.setAction(GWT.getModuleBaseURL() + "/uploadLicense");
053:                // Because we're going to add a FileUpload widget, we'll need to set the
054:                // form to use the POST method, and multipart MIME encoding.
055:                form.setEncoding(FormPanel.ENCODING_MULTIPART);
056:                form.setMethod(FormPanel.METHOD_POST);
057:
058:                // Create a panel to hold all of the form widgets.
059:
060:                form.setWidget(panel);
061:                panel.setWidth("300");
062:                // panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
063:                // Create a FileUpload widget.
064:                reloadWidgets();
065:
066:                // Add an event handler to the form.
067:                form.addFormHandler(new FormHandler() {
068:                    public void onSubmitComplete(FormSubmitCompleteEvent event) {
069:                        // When the form submission is successfully completed, this
070:                        // event is
071:                        // fired. Assuming the service returned a response of type
072:                        // text/plain,
073:                        // we can get the result text here (see the FormPanel
074:                        // documentation for
075:                        // further explanation).
076:                        String result = event.getResults();
077:                        if (result != null) {
078:                            /*if(result.startsWith(((ConsoleMessages)GWT.create(ConsoleMessages.class)).Submit()))
079:                            	Window.alert(result);*/
080:                            if (!result.startsWith(((ConsoleMessages) GWT
081:                                    .create(ConsoleMessages.class)).Error())) {
082:                                if (form.getAction().equalsIgnoreCase(
083:                                        GWT.getModuleBaseURL()
084:                                                + "/uploadLicense")) {
085:
086:                                    admin.refreshImport();
087:                                } else {
088:                                    if (!result.trim().equalsIgnoreCase(""))
089:                                        MessageViewDialog.showInfo(result);
090:                                    //Window.alert(result);
091:                                    admin.refresh();
092:                                }
093:                            }
094:                        }
095:                        if (parent != null) {
096:                            parent.hide();
097:                        }
098:
099:                        panel.clear();
100:                        reloadWidgets();
101:
102:                        pathText.setText("");
103:
104:                    }
105:
106:                    public void onSubmit(FormSubmitEvent event) {
107:                        // This event is fired just before the form is submitted. We can
108:                        // take
109:                        // this opportunity to perform validation.
110:                        // if (tb.getText().length() == 0) {
111:                        // Window.alert("The text box must not be empty");
112:                        // event.setCancelled(true);
113:                        // }
114:                    }
115:                });
116:                initWidget(form);
117:            }
118:
119:            private void reloadWidgets() {
120:                upload = new FileUpload();
121:                upload.setName(((ConsoleMessages) GWT
122:                        .create(ConsoleMessages.class)).uploadFormElement());
123:                panel.add(upload);
124:                upload.setWidth("100%");
125:                // Add a 'submit' button.
126:                panel.add(new Button(((ConsoleMessages) GWT
127:                        .create(ConsoleMessages.class)).Submit(),
128:                        new ClickListener() {
129:                            public void onClick(Widget sender) {
130:                                //				if(pathText.getText().equals("")){
131:                                //					return;
132:                                //					//form.getTitle()
133:                                //				}
134:                                form.submit();
135:                                recordFileName();
136:                            }
137:                        }));
138:            }
139:
140:            public void recordFileName() {
141:
142:                if (parent != null)
143:                    ((FileUploadDialog) parent).setFileName(upload
144:                            .getFilename());
145:            }
146:
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.