Source Code Cross Referenced for SwingDialogs.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.Component;
017:        import java.awt.Dimension;
018:        import java.awt.event.ActionEvent;
019:
020:        import javax.swing.AbstractAction;
021:        import javax.swing.BorderFactory;
022:        import javax.swing.JButton;
023:        import javax.swing.JDialog;
024:        import javax.swing.JEditorPane;
025:        import javax.swing.JOptionPane;
026:        import javax.swing.JPanel;
027:        import javax.swing.JScrollPane;
028:
029:        import com.eviware.soapui.support.DefaultHyperlinkListener;
030:        import com.eviware.soapui.support.UISupport;
031:        import com.eviware.soapui.support.components.ProgressDialog;
032:        import com.eviware.x.dialogs.XDialogs;
033:        import com.eviware.x.dialogs.XProgressDialog;
034:        import com.jgoodies.forms.factories.ButtonBarFactory;
035:
036:        /**
037:         * 
038:         * @author Lars
039:         */
040:        public class SwingDialogs implements  XDialogs {
041:            private Component parent;
042:            private JDialog extendedInfoDialog;
043:            private Boolean extendedInfoResult;
044:
045:            public SwingDialogs(Component parent) {
046:                this .parent = parent;
047:            }
048:
049:            public void showErrorMessage(String message) {
050:                if (parent == null)
051:                    return;
052:
053:                JOptionPane.showMessageDialog(parent, message, "Error",
054:                        JOptionPane.ERROR_MESSAGE);
055:            }
056:
057:            public boolean confirm(String question, String title) {
058:                return JOptionPane.showConfirmDialog(parent, question, title,
059:                        JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION;
060:            }
061:
062:            public String prompt(String question, String title, String value) {
063:                return (String) JOptionPane.showInputDialog(parent, question,
064:                        title, JOptionPane.QUESTION_MESSAGE, null, null, value);
065:            }
066:
067:            public String prompt(String question, String title) {
068:                return JOptionPane.showInputDialog(parent, question, title,
069:                        JOptionPane.QUESTION_MESSAGE);
070:            }
071:
072:            public void showInfoMessage(String message) {
073:                showInfoMessage(message, "Information");
074:            }
075:
076:            public void showInfoMessage(String message, String title) {
077:                JOptionPane.showMessageDialog(parent, message, title,
078:                        JOptionPane.INFORMATION_MESSAGE);
079:            }
080:
081:            public Object prompt(String question, String title, Object[] objects) {
082:                Object result = JOptionPane.showInputDialog(parent, question,
083:                        title, JOptionPane.OK_CANCEL_OPTION, null, objects,
084:                        null);
085:                return result;
086:            }
087:
088:            public Object prompt(String question, String title,
089:                    Object[] objects, String value) {
090:                Object result = JOptionPane.showInputDialog(parent, question,
091:                        title, JOptionPane.OK_CANCEL_OPTION, null, objects,
092:                        value);
093:                return result;
094:            }
095:
096:            public Boolean confirmOrCancel(String question, String title) {
097:                int result = JOptionPane.showConfirmDialog(parent, question,
098:                        title, JOptionPane.YES_NO_CANCEL_OPTION);
099:
100:                if (result == JOptionPane.CANCEL_OPTION)
101:                    return null;
102:
103:                return Boolean.valueOf(result == JOptionPane.YES_OPTION);
104:            }
105:
106:            public XProgressDialog createProgressDialog(String label,
107:                    int length, String initialValue, boolean canCancel) {
108:                return new ProgressDialog("Progress", label, length,
109:                        initialValue, canCancel);
110:            }
111:
112:            public void showExtendedInfo(String title, String description,
113:                    String content, Dimension size) {
114:                JPanel buttonBar = ButtonBarFactory
115:                        .buildRightAlignedBar(new JButton(new OkAction("OK")));
116:
117:                showExtendedInfo(title, description, content, buttonBar, size);
118:            }
119:
120:            private void showExtendedInfo(String title, String description,
121:                    String content, JPanel buttonBar, Dimension size) {
122:                extendedInfoDialog = new JDialog(UISupport.getMainFrame(),
123:                        title);
124:                extendedInfoDialog.setModal(true);
125:                JPanel panel = new JPanel(new BorderLayout());
126:
127:                if (description != null) {
128:                    panel.add(UISupport.buildDescription(title, description,
129:                            null), BorderLayout.NORTH);
130:                }
131:
132:                JEditorPane editorPane = new JEditorPane("text/html", content);
133:                editorPane.setCaretPosition(0);
134:                editorPane.setEditable(false);
135:                editorPane.addHyperlinkListener(new DefaultHyperlinkListener(
136:                        editorPane));
137:
138:                JScrollPane scrollPane = new JScrollPane(editorPane);
139:                scrollPane.setBorder(BorderFactory.createCompoundBorder(
140:                        BorderFactory.createEmptyBorder(5, 5, 5, 5), scrollPane
141:                                .getBorder()));
142:
143:                panel.add(scrollPane);
144:                buttonBar
145:                        .setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
146:                panel.add(buttonBar, BorderLayout.SOUTH);
147:
148:                extendedInfoDialog.getRootPane().setContentPane(panel);
149:                if (size == null)
150:                    extendedInfoDialog.setSize(400, 300);
151:                else
152:                    extendedInfoDialog.setSize(size);
153:
154:                UISupport.showDialog(extendedInfoDialog);
155:            }
156:
157:            public boolean confirmExtendedInfo(String title,
158:                    String description, String content, Dimension size) {
159:                JPanel buttonBar = ButtonBarFactory.buildRightAlignedBar(
160:                        new JButton(new OkAction("OK")), new JButton(
161:                                new CancelAction("Cancel")));
162:
163:                showExtendedInfo(title, description, content, buttonBar, size);
164:
165:                return extendedInfoResult == null ? false : extendedInfoResult;
166:            }
167:
168:            public Boolean confirmOrCancleExtendedInfo(String title,
169:                    String description, String content, Dimension size) {
170:                JPanel buttonBar = ButtonBarFactory.buildRightAlignedBar(
171:                        new JButton(new OkAction("Yes")), new JButton(
172:                                new NoAction("No")), new JButton(
173:                                new CancelAction("Cancel")));
174:
175:                showExtendedInfo(title, description, content, buttonBar, size);
176:
177:                return extendedInfoResult;
178:            }
179:
180:            private final class OkAction extends AbstractAction {
181:                public OkAction(String name) {
182:                    super (name);
183:                }
184:
185:                public void actionPerformed(ActionEvent e) {
186:                    extendedInfoResult = true;
187:                    extendedInfoDialog.setVisible(false);
188:                }
189:            }
190:
191:            private final class NoAction extends AbstractAction {
192:                public NoAction(String name) {
193:                    super (name);
194:                }
195:
196:                public void actionPerformed(ActionEvent e) {
197:                    extendedInfoResult = false;
198:                    extendedInfoDialog.setVisible(false);
199:                }
200:            }
201:
202:            private final class CancelAction extends AbstractAction {
203:                public CancelAction(String name) {
204:                    super (name);
205:                }
206:
207:                public void actionPerformed(ActionEvent e) {
208:                    extendedInfoResult = null;
209:                    extendedInfoDialog.setVisible(false);
210:                }
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.