Source Code Cross Referenced for JFormDialog.java in  » Web-Services » soapui-1.7.5 » com » eviware » x » impl » swing » 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 » Web Services » soapui 1.7.5 » com.eviware.x.impl.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  soapUI, copyright (C) 2004-2007 eviware.com 
003:         *
004:         *  soapUI is free software; you can redistribute it and/or modify it under the 
005:         *  terms of version 2.1 of the GNU Lesser General Public License as published by 
006:         *  the Free Software Foundation.
007:         *
008:         *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
009:         *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
010:         *  See the GNU Lesser General Public License for more details at gnu.org.
011:         */
012:
013:        package com.eviware.x.impl.swing;
014:
015:        import java.awt.BorderLayout;
016:        import java.awt.Color;
017:        import java.awt.Dimension;
018:        import java.util.Arrays;
019:
020:        import javax.swing.BorderFactory;
021:        import javax.swing.ImageIcon;
022:        import javax.swing.JDialog;
023:        import javax.swing.JPanel;
024:
025:        import com.eviware.soapui.support.UISupport;
026:        import com.eviware.soapui.support.action.swing.ActionList;
027:        import com.eviware.soapui.support.components.JButtonBar;
028:        import com.eviware.soapui.support.types.StringToStringMap;
029:        import com.eviware.x.form.ValidationMessage;
030:        import com.eviware.x.form.XForm;
031:        import com.eviware.x.form.XFormDialog;
032:        import com.eviware.x.form.XFormField;
033:
034:        public class JFormDialog extends SwingXFormDialog {
035:            private JDialog dialog;
036:            private SwingXFormImpl form;
037:
038:            public JFormDialog(String name, XForm form, ActionList actions,
039:                    String description, ImageIcon icon) {
040:                dialog = new JDialog(UISupport.getMainFrame(), name, true);
041:
042:                JButtonBar buttons = UISupport.initDialogActions(actions,
043:                        dialog);
044:                buttons.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
045:
046:                JPanel panel = new JPanel(new BorderLayout());
047:                this .form = (SwingXFormImpl) form;
048:                panel.add((this .form.getPanel()), BorderLayout.CENTER);
049:                panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
050:
051:                if (description != null || icon != null)
052:                    dialog.getContentPane()
053:                            .add(
054:                                    UISupport.buildDescription(name,
055:                                            description, icon),
056:                                    BorderLayout.NORTH);
057:
058:                dialog.getContentPane().add(panel, BorderLayout.CENTER);
059:
060:                buttons.setBorder(BorderFactory.createCompoundBorder(
061:                        BorderFactory.createCompoundBorder(BorderFactory
062:                                .createMatteBorder(1, 0, 0, 0, Color.GRAY),
063:                                BorderFactory.createMatteBorder(1, 0, 0, 0,
064:                                        Color.WHITE)), BorderFactory
065:                                .createEmptyBorder(3, 5, 3, 5)));
066:
067:                dialog.getContentPane().add(buttons, BorderLayout.SOUTH);
068:            }
069:
070:            public void setValues(StringToStringMap values) {
071:                form.setValues(values);
072:            }
073:
074:            public StringToStringMap getValues() {
075:                StringToStringMap result = new StringToStringMap();
076:                result.putAll(form.getValues());
077:
078:                return result;
079:            }
080:
081:            public void setOptions(String field, Object[] options) {
082:                form.setOptions(field, options);
083:            }
084:
085:            public void setVisible(boolean visible) {
086:                dialog.pack();
087:                if (dialog.getHeight() < 270) {
088:                    dialog.setSize(new Dimension(dialog.getWidth(), 270));
089:                }
090:
091:                if (dialog.getWidth() < 450) {
092:                    dialog.setSize(new Dimension(450, dialog.getHeight()));
093:                }
094:
095:                UISupport.centerDialog(dialog);
096:                dialog.setVisible(visible);
097:            }
098:
099:            public boolean validate() {
100:                XFormField[] formFields = form.getFormFields();
101:                for (int c = 0; c < formFields.length; c++) {
102:                    ValidationMessage[] messages = formFields[c].validate();
103:                    if (messages != null && messages.length > 0) {
104:                        ((AbstractSwingXFormField) messages[0].getFormField())
105:                                .getComponent().requestFocus();
106:                        UISupport.showErrorMessage(messages[0].getMessage());
107:                        return false;
108:                    }
109:                }
110:
111:                return true;
112:            }
113:
114:            public void setFormFieldProperty(String name, Object value) {
115:                form.setFormFieldProperty(name, value);
116:            }
117:
118:            public String getValue(String field) {
119:                return form.getComponentValue(field);
120:            }
121:
122:            public void setValue(String field, String value) {
123:                form.setComponentValue(field, value);
124:            }
125:
126:            public int getValueIndex(String name) {
127:                String[] options = form.getOptions(name);
128:                if (options == null)
129:                    return -1;
130:
131:                return Arrays.asList(options).indexOf(
132:                        form.getComponentValue(name));
133:            }
134:
135:            public boolean show() {
136:                setReturnValue(XFormDialog.CANCEL_OPTION);
137:                show(new StringToStringMap());
138:                return getReturnValue() == XFormDialog.OK_OPTION;
139:            }
140:
141:            public XFormField getFormField(String name) {
142:                return form.getFormField(name);
143:            }
144:
145:            public void setWidth(int i) {
146:                dialog.setPreferredSize(new Dimension(i, (int) dialog
147:                        .getPreferredSize().getHeight()));
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.