Source Code Cross Referenced for SaveDataSetCSVDialog.java in  » Testing » jacareto » jacareto » cleverphl » gui » 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 » Testing » jacareto » jacareto.cleverphl.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Jacareto Copyright (c) 2002-2005
003:         * Applied Computer Science Research Group, Darmstadt University of
004:         * Technology, Institute of Mathematics & Computer Science,
005:         * Ludwigsburg University of Education, and Computer Based
006:         * Learning Research Group, Aachen University. All rights reserved.
007:         *
008:         * Jacareto is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2 of the License, or (at your option) any later version.
012:         *
013:         * Jacareto is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         * General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public
019:         * License along with Jacareto; if not, write to the Free
020:         * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         *
022:         */
023:
024:        package jacareto.cleverphl.gui;
025:
026:        import jacareto.cleverphl.CleverPHL;
027:        import jacareto.system.Customization;
028:        import jacareto.system.Language;
029:
030:        import java.awt.BorderLayout;
031:        import java.awt.FlowLayout;
032:        import java.awt.GridBagConstraints;
033:        import java.awt.GridBagLayout;
034:        import java.awt.Insets;
035:        import java.awt.Point;
036:        import java.awt.event.ActionEvent;
037:        import java.awt.event.ActionListener;
038:
039:        import javax.swing.ButtonGroup;
040:        import javax.swing.JButton;
041:        import javax.swing.JCheckBox;
042:        import javax.swing.JDialog;
043:        import javax.swing.JLabel;
044:        import javax.swing.JPanel;
045:        import javax.swing.JRadioButton;
046:        import javax.swing.JTextField;
047:        import javax.swing.border.EmptyBorder;
048:
049:        /**
050:         * Dialog for saving the data set in CSV format.
051:         *
052:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
053:         * @version 1.01
054:         */
055:        public class SaveDataSetCSVDialog extends JDialog implements 
056:                ActionListener {
057:            /** The selected separator. */
058:            private String separator;
059:
060:            /** The checkbox for the header line. */
061:            private JCheckBox headerCheckBox;
062:
063:            /** The checkbox for converting non-numeric values. */
064:            private JCheckBox convertCheckBox;
065:
066:            /** The button group for the separator radio buttons. */
067:            private ButtonGroup separatorGroup;
068:
069:            /** The button for the comma separator. */
070:            private JRadioButton commaButton;
071:
072:            /** The button for the semicolon separator. */
073:            private JRadioButton semicolonButton;
074:
075:            /** The button for the other separator. */
076:            private JRadioButton otherButton;
077:
078:            /** The textfield for specifiing another separator. */
079:            private JTextField otherField;
080:
081:            /** The ok button. */
082:            private JButton okButton;
083:
084:            /** The cancel button. */
085:            private JButton cancelButton;
086:
087:            /** Whether or not ok has been pressed. */
088:            private boolean okPressed;
089:
090:            /**
091:             * Creates a new dialog (visible).
092:             *
093:             * @param cleverPHL the CleverPHL instance
094:             */
095:            public SaveDataSetCSVDialog(CleverPHL cleverPHL) {
096:                super (cleverPHL.getDataSetFrame(), true);
097:                setName(cleverPHL.getCustomization().getString(
098:                        "Components.JacaretoComponent", "JACARETO_COMPONENT"));
099:
100:                Language language = cleverPHL.getLanguage();
101:                Customization customization = cleverPHL.getCustomization();
102:
103:                setTitle(language
104:                        .getString("CleverPHL.SaveDataSetCSVDialog.Title"));
105:
106:                // The file name text field
107:                /*filenameField = new JTextField(20);
108:                filenameField.setEditable (false);
109:
110:                try {
111:                   File[] containedFiles=files.getDir("CLEVERPHL_DATASETS_DIR").listFiles ();
112:                   Vector datasetFiles = new Vector (containedFiles.length);
113:                   for (int j=0;j<containedFiles.length;j++) {
114:                      datasetFiles.add (containedFiles[j].getName());
115:                   }
116:                   int i = 0;
117:                   String prefix = session.getName()+"_";
118:                   while (datasetFiles.contains (prefix+i+".csv")) {
119:                      i++;
120:                   }
121:                   filenameField.setText (files.getDir("CLEVERPHL_DATASETS_DIR").getCanonicalPath()+File.separator+prefix+i+".csv");
122:                } catch (IOException i) {
123:                }
124:
125:
126:                JLabel filenameLabel = new JLabel (language.getString ("General.Filename")+":");
127:                JButton chooseButton = new JButton (language.getString ("General.Choose") + "...");
128:                chooseButton.addActionListener (new ChooseButtonListener (cleverPHL));
129:
130:                JPanel filePanel = new JPanel();
131:                filePanel.setLayout (new FlowLayout (FlowLayout.LEFT));
132:                filePanel.add (filenameLabel);
133:                filePanel.add (filenameField);
134:                filePanel.add (chooseButton);    */
135:                // The checkbox for the header line
136:                headerCheckBox = new JCheckBox(language
137:                        .getString("CleverPHL.SaveDataSetCSVDialog.HeaderLine"));
138:                headerCheckBox.setSelected(customization.getBoolean(
139:                        "DataSet.CSV.StoreHeaderLine", false));
140:
141:                // The checkbox for converting non-numeric values
142:                convertCheckBox = new JCheckBox(
143:                        language
144:                                .getString("CleverPHL.SaveDataSetCSVDialog.ConvertNonNumeric"));
145:                convertCheckBox.setSelected(customization.getBoolean(
146:                        "DataSet.CSV.ConvertNonNumeric", false));
147:
148:                // The components for the separator
149:                commaButton = new JRadioButton(language
150:                        .getString("CleverPHL.SaveDataSetCSVDialog.Comma")
151:                        + " (,)");
152:                semicolonButton = new JRadioButton(language
153:                        .getString("CleverPHL.SaveDataSetCSVDialog.Semicolon")
154:                        + "(;)");
155:                otherButton = new JRadioButton(language
156:                        .getString("CleverPHL.SaveDataSetCSVDialog.Other")
157:                        + ": ");
158:                otherField = new JTextField(3);
159:                separatorGroup = new ButtonGroup();
160:                separatorGroup.add(commaButton);
161:                separatorGroup.add(semicolonButton);
162:                separatorGroup.add(otherButton);
163:
164:                JPanel separatorPanel = new JPanel();
165:                separatorPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
166:                separatorPanel.add(new JLabel(language
167:                        .getString("CleverPHL.SaveDataSetCSVDialog.Separator")
168:                        + ": "));
169:                separatorPanel.add(commaButton);
170:                separatorPanel.add(semicolonButton);
171:                separatorPanel.add(otherButton);
172:                separatorPanel.add(otherField);
173:
174:                commaButton.setSelected(true);
175:
176:                commaButton.addActionListener(new ActionListener() {
177:                    public void actionPerformed(ActionEvent e) {
178:                        otherField.setEnabled(false);
179:                    }
180:                });
181:                semicolonButton.addActionListener(new ActionListener() {
182:                    public void actionPerformed(ActionEvent e) {
183:                        otherField.setEnabled(false);
184:                    }
185:                });
186:                otherButton.addActionListener(new ActionListener() {
187:                    public void actionPerformed(ActionEvent e) {
188:                        otherField.setEnabled(true);
189:                    }
190:                });
191:                otherField.setEnabled(false);
192:
193:                // The panel with all components
194:                JPanel leftPanelWrapper = new JPanel();
195:                leftPanelWrapper.setLayout(new GridBagLayout());
196:
197:                GridBagConstraints c = new GridBagConstraints();
198:                c.gridx = 0;
199:                c.gridy = 0;
200:                c.weighty = 55;
201:                c.insets = new Insets(5, 5, 5, 5);
202:                c.anchor = GridBagConstraints.WEST;
203:
204:                //leftPanelWrapper. add (filePanel, c);
205:                c.gridy = 0;
206:                c.weighty = 15;
207:                leftPanelWrapper.add(separatorPanel, c);
208:                c.gridy = 1;
209:                c.weighty = 15;
210:                leftPanelWrapper.add(headerCheckBox, c);
211:                c.gridy = 2;
212:                c.weighty = 15;
213:                leftPanelWrapper.add(convertCheckBox, c);
214:
215:                // The panel with the two buttons
216:                JPanel buttonPanel = new JPanel();
217:                okButton = new JButton(language.getString("General.Ok"));
218:                okButton.addActionListener(this );
219:                cancelButton = new JButton(language.getString("General.Cancel"));
220:                cancelButton.addActionListener(this );
221:                buttonPanel.add(okButton);
222:                buttonPanel.add(cancelButton);
223:                buttonPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
224:
225:                // Add all to the content pane
226:                getContentPane().setLayout(new BorderLayout());
227:                getContentPane().add(leftPanelWrapper, BorderLayout.CENTER);
228:                getContentPane().add(buttonPanel, BorderLayout.SOUTH);
229:
230:                Point ownerLoc = cleverPHL.getDataSetFrame().getLocation();
231:                setLocation(((int) ownerLoc.getX()) + 30, ((int) ownerLoc
232:                        .getY()) + 30);
233:                pack();
234:                setResizable(false);
235:                setVisible(true);
236:            }
237:
238:            /**
239:             * Called when one of the two buttons has been pressed.
240:             *
241:             * @param e the action event
242:             */
243:            public void actionPerformed(ActionEvent e) {
244:                Object source = e.getSource();
245:
246:                if (source == okButton) {
247:                    if (commaButton.isSelected()) {
248:                        separator = ",";
249:                    } else if (semicolonButton.isSelected()) {
250:                        separator = ";";
251:                    } else {
252:                        separator = otherField.getText();
253:                    }
254:
255:                    okPressed = true;
256:                    dispose();
257:                } else {
258:                    separator = null;
259:                    okPressed = false;
260:                    dispose();
261:                }
262:            }
263:
264:            /**
265:             * Returns the separator
266:             *
267:             * @return DOCUMENT ME!
268:             */
269:            public String getSeparator() {
270:                return separator;
271:            }
272:
273:            /**
274:             * Returns whether or not ok has been pressed.
275:             *
276:             * @return DOCUMENT ME!
277:             */
278:            public boolean okPressed() {
279:                return okPressed;
280:            }
281:
282:            /**
283:             * Whether or not the header line should be stored.
284:             *
285:             * @return DOCUMENT ME!
286:             */
287:            public boolean hasHeaderLine() {
288:                return headerCheckBox.isSelected();
289:            }
290:
291:            /**
292:             * Whether or not the non-numeric values should be converted.
293:             *
294:             * @return DOCUMENT ME!
295:             */
296:            public boolean convertNonNumeric() {
297:                return convertCheckBox.isSelected();
298:            }
299:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.