Source Code Cross Referenced for TextOptionsPanel.java in  » Database-Client » SQL-Workbench » workbench » gui » dialogs » export » 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 » Database Client » SQL Workbench » workbench.gui.dialogs.export 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * TextOptionsPanel.java
003:         *
004:         * This file is part of SQL Workbench/J, http://www.sql-workbench.net
005:         *
006:         * Copyright 2002-2008, Thomas Kellerer
007:         * No part of this code maybe reused without the permission of the author
008:         *
009:         * To contact the author please send an email to: support@sql-workbench.net
010:         *
011:         */
012:        package workbench.gui.dialogs.export;
013:
014:        import javax.swing.JPanel;
015:        import workbench.resource.ResourceMgr;
016:        import workbench.resource.Settings;
017:        import workbench.util.CharacterRange;
018:        import workbench.util.StringUtil;
019:        import workbench.gui.dialogs.export.TextOptions;
020:
021:        /**
022:         *
023:         * @author  support@sql-workbench.net
024:         */
025:        public class TextOptionsPanel extends JPanel implements  TextOptions {
026:
027:            /** Creates new form TextoptionsPanel */
028:            public TextOptionsPanel() {
029:                initComponents();
030:                CharacterRange[] ranges = CharacterRange.getRanges();
031:                for (int i = 0; i < ranges.length; i++) {
032:                    escapeRange.addItem(ranges[i]);
033:                }
034:            }
035:
036:            public void saveSettings() {
037:                Settings s = Settings.getInstance();
038:                //s.setProperty("workbench.export.text.cleanup", this.getCleanupCarriageReturns());
039:                s.setProperty("workbench.export.text.includeheader", this 
040:                        .getExportHeaders());
041:                s.setProperty("workbench.export.text.quotealways", this 
042:                        .getQuoteAlways());
043:                s.setProperty("workbench.export.text.escaperange", this 
044:                        .getEscapeRange().getId());
045:                s.setProperty("workbench.export.text.lineending",
046:                        (String) this .lineEnding.getSelectedItem());
047:                s.setProperty("workbench.export.text.decimal",
048:                        getDecimalSymbol());
049:                s.setDefaultTextDelimiter(this .getTextDelimiter());
050:                s.setQuoteChar(this .getTextQuoteChar());
051:            }
052:
053:            public void restoreSettings() {
054:                Settings s = Settings.getInstance();
055:                //this.setCleanupCarriageReturns(s.getBoolProperty("workbench.export.text.cleanup"));
056:                this 
057:                        .setExportHeaders(s
058:                                .getBoolProperty("workbench.export.text.includeheader"));
059:                this .setQuoteAlways(s
060:                        .getBoolProperty("workbench.export.text.quotealways"));
061:                int id = s.getIntProperty("workbench.export.text.escaperange",
062:                        0);
063:                CharacterRange range = CharacterRange.getRangeById(id);
064:                this .setEscapeRange(range);
065:                this .setLineEnding(s.getProperty(
066:                        "workbench.export.text.lineending", "LF"));
067:                this .setTextQuoteChar(s.getQuoteChar());
068:                this .setTextDelimiter(s.getDefaultTextDelimiter(true));
069:                setDecimalSymbol(s.getProperty("workbench.export.text.decimal",
070:                        s.getDecimalSymbol()));
071:            }
072:
073:            public void setDecimalSymbol(String symbol) {
074:                this .decimalChar.setText(symbol);
075:            }
076:
077:            public String getDecimalSymbol() {
078:                return decimalChar.getText();
079:            }
080:
081:            public boolean getExportHeaders() {
082:                return this .exportHeaders.isSelected();
083:            }
084:
085:            public String getTextDelimiter() {
086:                return this .delimiter.getText();
087:            }
088:
089:            public String getTextQuoteChar() {
090:                return this .quoteChar.getText();
091:            }
092:
093:            public void setExportHeaders(boolean flag) {
094:                this .exportHeaders.setSelected(flag);
095:            }
096:
097:            public void setTextDelimiter(String delim) {
098:                this .delimiter.setText(delim);
099:            }
100:
101:            public void setTextQuoteChar(String quote) {
102:                this .quoteChar.setText(quote);
103:            }
104:
105:            public boolean getQuoteAlways() {
106:                return this .quoteAlways.isSelected();
107:            }
108:
109:            public void setQuoteAlways(boolean flag) {
110:                this .quoteAlways.setSelected(flag);
111:            }
112:
113:            public void setEscapeRange(CharacterRange range) {
114:                this .escapeRange.setSelectedItem(range);
115:            }
116:
117:            public CharacterRange getEscapeRange() {
118:                return (CharacterRange) this .escapeRange.getSelectedItem();
119:            }
120:
121:            public String getLineEnding() {
122:                String s = (String) lineEnding.getSelectedItem();
123:                ;
124:                if ("LF".equals(s))
125:                    return "\n";
126:                else if ("CRLF".equals(s))
127:                    return "\r\n";
128:                else
129:                    return StringUtil.LINE_TERMINATOR;
130:            }
131:
132:            public void setLineEnding(String ending) {
133:                if (ending == null)
134:                    return;
135:                if ("\n".equals(ending)) {
136:                    lineEnding.setSelectedItem("LF");
137:                } else if ("\r\n".equals(ending)) {
138:                    lineEnding.setSelectedItem("CRLF");
139:                } else {
140:                    lineEnding.setSelectedItem(ending.toUpperCase());
141:                }
142:            }
143:
144:            /** This method is called from within the constructor to
145:             * initialize the form.
146:             * WARNING: Do NOT modify this code. The content of this method is
147:             * always regenerated by the Form Editor.
148:             */
149:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
150:            private void initComponents() {
151:                java.awt.GridBagConstraints gridBagConstraints;
152:
153:                delimiterLabel = new javax.swing.JLabel();
154:                delimiter = new javax.swing.JTextField();
155:                exportHeaders = new javax.swing.JCheckBox();
156:                quoteCharLabel = new javax.swing.JLabel();
157:                quoteChar = new javax.swing.JTextField();
158:                jPanel1 = new javax.swing.JPanel();
159:                quoteAlways = new javax.swing.JCheckBox();
160:                escapeRange = new javax.swing.JComboBox();
161:                escapeLabel = new javax.swing.JLabel();
162:                lineEndingLabel = new javax.swing.JLabel();
163:                lineEnding = new javax.swing.JComboBox();
164:                decimalLabel = new javax.swing.JLabel();
165:                decimalChar = new javax.swing.JTextField();
166:
167:                setLayout(new java.awt.GridBagLayout());
168:
169:                delimiterLabel.setText(ResourceMgr
170:                        .getString("LblFieldDelimiter"));
171:                gridBagConstraints = new java.awt.GridBagConstraints();
172:                gridBagConstraints.gridx = 0;
173:                gridBagConstraints.gridy = 7;
174:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
175:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
176:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
177:                add(delimiterLabel, gridBagConstraints);
178:                gridBagConstraints = new java.awt.GridBagConstraints();
179:                gridBagConstraints.gridx = 0;
180:                gridBagConstraints.gridy = 8;
181:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
182:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
183:                gridBagConstraints.weightx = 1.0;
184:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
185:                add(delimiter, gridBagConstraints);
186:
187:                exportHeaders.setText(ResourceMgr
188:                        .getString("LblExportIncludeHeaders"));
189:                exportHeaders.setToolTipText("");
190:                gridBagConstraints = new java.awt.GridBagConstraints();
191:                gridBagConstraints.gridx = 0;
192:                gridBagConstraints.gridy = 1;
193:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
194:                add(exportHeaders, gridBagConstraints);
195:
196:                quoteCharLabel.setText(ResourceMgr.getString("LblQuoteChar"));
197:                gridBagConstraints = new java.awt.GridBagConstraints();
198:                gridBagConstraints.gridx = 0;
199:                gridBagConstraints.gridy = 9;
200:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
201:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
202:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
203:                add(quoteCharLabel, gridBagConstraints);
204:                gridBagConstraints = new java.awt.GridBagConstraints();
205:                gridBagConstraints.gridx = 0;
206:                gridBagConstraints.gridy = 10;
207:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
208:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
209:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
210:                add(quoteChar, gridBagConstraints);
211:                gridBagConstraints = new java.awt.GridBagConstraints();
212:                gridBagConstraints.gridx = 0;
213:                gridBagConstraints.gridy = 13;
214:                gridBagConstraints.weighty = 1.0;
215:                add(jPanel1, gridBagConstraints);
216:
217:                quoteAlways.setText(ResourceMgr
218:                        .getString("LblExportQuoteAlways"));
219:                gridBagConstraints = new java.awt.GridBagConstraints();
220:                gridBagConstraints.gridx = 0;
221:                gridBagConstraints.gridy = 2;
222:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
223:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
224:                add(quoteAlways, gridBagConstraints);
225:
226:                gridBagConstraints = new java.awt.GridBagConstraints();
227:                gridBagConstraints.gridx = 0;
228:                gridBagConstraints.gridy = 4;
229:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
230:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
231:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
232:                add(escapeRange, gridBagConstraints);
233:
234:                escapeLabel.setText(ResourceMgr
235:                        .getString("LblExportEscapeType"));
236:                gridBagConstraints = new java.awt.GridBagConstraints();
237:                gridBagConstraints.gridx = 0;
238:                gridBagConstraints.gridy = 3;
239:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
240:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
241:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
242:                add(escapeLabel, gridBagConstraints);
243:
244:                lineEndingLabel.setText(ResourceMgr
245:                        .getString("LblExportLineEnding"));
246:                gridBagConstraints = new java.awt.GridBagConstraints();
247:                gridBagConstraints.gridx = 0;
248:                gridBagConstraints.gridy = 5;
249:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
250:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
251:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
252:                add(lineEndingLabel, gridBagConstraints);
253:
254:                lineEnding.setModel(new javax.swing.DefaultComboBoxModel(
255:                        new String[] { "LF", "CRLF" }));
256:                gridBagConstraints = new java.awt.GridBagConstraints();
257:                gridBagConstraints.gridx = 0;
258:                gridBagConstraints.gridy = 6;
259:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
260:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
261:                add(lineEnding, gridBagConstraints);
262:
263:                decimalLabel.setText(ResourceMgr.getString("LblDecimalSymbol"));
264:                decimalLabel.setToolTipText(ResourceMgr
265:                        .getDescription("LblDecimalSymbol"));
266:                gridBagConstraints = new java.awt.GridBagConstraints();
267:                gridBagConstraints.gridx = 0;
268:                gridBagConstraints.gridy = 11;
269:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
270:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
271:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
272:                add(decimalLabel, gridBagConstraints);
273:                gridBagConstraints = new java.awt.GridBagConstraints();
274:                gridBagConstraints.gridx = 0;
275:                gridBagConstraints.gridy = 12;
276:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
277:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
278:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
279:                add(decimalChar, gridBagConstraints);
280:            }// </editor-fold>//GEN-END:initComponents
281:
282:            // Variables declaration - do not modify//GEN-BEGIN:variables
283:            private javax.swing.JTextField decimalChar;
284:            private javax.swing.JLabel decimalLabel;
285:            private javax.swing.JTextField delimiter;
286:            private javax.swing.JLabel delimiterLabel;
287:            private javax.swing.JLabel escapeLabel;
288:            private javax.swing.JComboBox escapeRange;
289:            private javax.swing.JCheckBox exportHeaders;
290:            private javax.swing.JPanel jPanel1;
291:            private javax.swing.JComboBox lineEnding;
292:            private javax.swing.JLabel lineEndingLabel;
293:            private javax.swing.JCheckBox quoteAlways;
294:            private javax.swing.JTextField quoteChar;
295:            private javax.swing.JLabel quoteCharLabel;
296:            // End of variables declaration//GEN-END:variables
297:
298:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.