Source Code Cross Referenced for GeneralPreferencesPanel.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » client » preferences » 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 » squirrel sql 2.6.5a » net.sourceforge.squirrel_sql.client.preferences 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.squirrel_sql.client.preferences;
002:
003:        /*
004:         * Copyright (C) 2001-2004 Colin Bell
005:         * colbell@users.sourceforge.net
006:         *
007:         * This library is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:         *
012:         * This library is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this library; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         */
021:        import java.awt.Component;
022:        import java.awt.GridBagConstraints;
023:        import java.awt.GridBagLayout;
024:        import java.awt.Insets;
025:
026:        import javax.swing.BorderFactory;
027:        import javax.swing.JCheckBox;
028:        import javax.swing.JPanel;
029:        import javax.swing.JScrollPane;
030:        import javax.swing.JTextField;
031:
032:        import net.sourceforge.squirrel_sql.client.ApplicationArguments;
033:        import net.sourceforge.squirrel_sql.client.IApplication;
034:        import net.sourceforge.squirrel_sql.client.util.ApplicationFiles;
035:        import net.sourceforge.squirrel_sql.fw.util.StringManager;
036:        import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
037:
038:        class GeneralPreferencesPanel implements  IGlobalPreferencesPanel {
039:            /** Internationalized strings for this class. */
040:            private static final StringManager s_stringMgr = StringManagerFactory
041:                    .getStringManager(GeneralPreferencesPanel.class);
042:
043:            /** Panel to be displayed in preferences dialog. */
044:            private MyPanel _myPanel;
045:            private JScrollPane _myScrollPane;
046:
047:            /** Application API. */
048:            private IApplication _app;
049:
050:            /**
051:             * Default ctor.
052:             */
053:            public GeneralPreferencesPanel() {
054:                super ();
055:            }
056:
057:            public void initialize(IApplication app) {
058:                if (app == null) {
059:                    throw new IllegalArgumentException("IApplication == null");
060:                }
061:
062:                _app = app;
063:
064:                getPanelComponent();
065:                _myPanel.loadData(_app.getSquirrelPreferences());
066:
067:            }
068:
069:            public void uninitialize(IApplication app) {
070:            }
071:
072:            public synchronized Component getPanelComponent() {
073:                if (_myPanel == null) {
074:                    _myPanel = new MyPanel();
075:                    _myScrollPane = new JScrollPane(_myPanel);
076:                }
077:                return _myScrollPane;
078:            }
079:
080:            public void applyChanges() {
081:                _myPanel.applyChanges(_app.getSquirrelPreferences());
082:            }
083:
084:            public String getTitle() {
085:                return s_stringMgr
086:                        .getString("GeneralPreferencesPanel.tabtitle");
087:            }
088:
089:            public String getHint() {
090:                return s_stringMgr.getString("GeneralPreferencesPanel.tabhint");
091:            }
092:
093:            @SuppressWarnings("serial")
094:            private static final class MyPanel extends JPanel {
095:
096:                private JCheckBox _showAliasesToolBar = new JCheckBox(
097:                        s_stringMgr
098:                                .getString("GeneralPreferencesPanel.showaliasestoolbar"));
099:                private JCheckBox _showDriversToolBar = new JCheckBox(
100:                        s_stringMgr
101:                                .getString("GeneralPreferencesPanel.showdriverstoolbar"));
102:                private JCheckBox _showMainStatusBar = new JCheckBox(
103:                        s_stringMgr
104:                                .getString("GeneralPreferencesPanel.showmainwinstatusbar"));
105:                private JCheckBox _showMainToolBar = new JCheckBox(
106:                        s_stringMgr
107:                                .getString("GeneralPreferencesPanel.showmainwintoolbar"));
108:                private JCheckBox _showContents = new JCheckBox(
109:                        s_stringMgr
110:                                .getString("GeneralPreferencesPanel.showwindowcontents"));
111:                private JCheckBox _showToolTips = new JCheckBox(s_stringMgr
112:                        .getString("GeneralPreferencesPanel.showtooltips"));
113:                private JCheckBox _useScrollableTabbedPanes = new JCheckBox(
114:                        s_stringMgr
115:                                .getString("GeneralPreferencesPanel.usescrolltabs"));
116:                private JCheckBox _maximimizeSessionSheet = new JCheckBox(
117:                        s_stringMgr
118:                                .getString("GeneralPreferencesPanel.maxonopen"));
119:
120:                private JCheckBox _showColoriconsInToolbar = new JCheckBox(
121:                        s_stringMgr
122:                                .getString("GeneralPreferencesPanel.showcoloricons"));
123:                private JCheckBox _showPluginFilesInSplashScreen = new JCheckBox(
124:                        s_stringMgr
125:                                .getString("GeneralPreferencesPanel.showpluginfiles"));
126:                //      private JLabel _executionLogFileNameLbl = new OutputLabel(" ");
127:                //      // Must have at least 1 blank otherwise width gets set to zero.
128:                //      private JLabel _logConfigFileNameLbl = new OutputLabel(" ");
129:                //      // Must have at least 1 blank otherwise width gets set to zero.
130:                private JCheckBox _confirmSessionCloseChk = new JCheckBox(
131:                        s_stringMgr
132:                                .getString("GeneralPreferencesPanel.confirmSessionClose"));
133:                private JCheckBox _warnJreJdbcMismatch = new JCheckBox(
134:                        s_stringMgr
135:                                .getString("GeneralPreferencesPanel.warnJreJdbcMismatch"));
136:                private JCheckBox _warnForUnsavedFileEdits = new JCheckBox(
137:                        s_stringMgr
138:                                .getString("GeneralPreferencesPanel.warnForUnsavedFileEdits"));
139:                private JCheckBox _warnForUnsavedBufferEdits = new JCheckBox(
140:                        s_stringMgr
141:                                .getString("GeneralPreferencesPanel.warnForUnsavedBufferEdits"));
142:                private JCheckBox _showSessionStartupTimeHint = new JCheckBox(
143:                        s_stringMgr
144:                                .getString("GeneralPreferencesPanel.showSessionStartupTimeHint"));
145:                private JCheckBox _savePreferencesImmediately = new JCheckBox(
146:                        s_stringMgr
147:                                .getString("GeneralPreferencesPanel.savePreferencesImmediately"));
148:
149:                MyPanel() {
150:                    super (new GridBagLayout());
151:                    createUserInterface();
152:                }
153:
154:                void loadData(SquirrelPreferences prefs) {
155:                    _showContents.setSelected(prefs
156:                            .getShowContentsWhenDragging());
157:                    _showToolTips.setSelected(prefs.getShowToolTips());
158:                    _useScrollableTabbedPanes.setSelected(prefs
159:                            .getUseScrollableTabbedPanes());
160:                    _showMainStatusBar
161:                            .setSelected(prefs.getShowMainStatusBar());
162:                    _showMainToolBar.setSelected(prefs.getShowMainToolBar());
163:                    _showAliasesToolBar.setSelected(prefs
164:                            .getShowAliasesToolBar());
165:                    _showDriversToolBar.setSelected(prefs
166:                            .getShowDriversToolBar());
167:                    _maximimizeSessionSheet.setSelected(prefs
168:                            .getMaximizeSessionSheetOnOpen());
169:                    _showColoriconsInToolbar.setSelected(prefs
170:                            .getShowColoriconsInToolbar());
171:                    _showPluginFilesInSplashScreen.setSelected(prefs
172:                            .getShowPluginFilesInSplashScreen());
173:
174:                    _confirmSessionCloseChk.setSelected(prefs
175:                            .getConfirmSessionClose());
176:                    _warnJreJdbcMismatch.setSelected(prefs
177:                            .getWarnJreJdbcMismatch());
178:                    _warnForUnsavedFileEdits.setSelected(prefs
179:                            .getWarnForUnsavedFileEdits());
180:                    _warnForUnsavedBufferEdits.setSelected(prefs
181:                            .getWarnForUnsavedBufferEdits());
182:                    _showSessionStartupTimeHint.setSelected(prefs
183:                            .getShowSessionStartupTimeHint());
184:                    _savePreferencesImmediately.setSelected(prefs
185:                            .getSavePreferencesImmediately());
186:
187:                }
188:
189:                void applyChanges(SquirrelPreferences prefs) {
190:                    prefs.setShowContentsWhenDragging(_showContents
191:                            .isSelected());
192:                    prefs.setShowToolTips(_showToolTips.isSelected());
193:                    prefs.setUseScrollableTabbedPanes(_useScrollableTabbedPanes
194:                            .isSelected());
195:                    prefs.setShowMainStatusBar(_showMainStatusBar.isSelected());
196:                    prefs.setShowMainToolBar(_showMainToolBar.isSelected());
197:                    prefs.setShowAliasesToolBar(_showAliasesToolBar
198:                            .isSelected());
199:                    prefs.setShowDriversToolBar(_showDriversToolBar
200:                            .isSelected());
201:                    prefs.setMaximizeSessionSheetOnOpen(_maximimizeSessionSheet
202:                            .isSelected());
203:                    prefs.setShowColoriconsInToolbar(_showColoriconsInToolbar
204:                            .isSelected());
205:                    prefs
206:                            .setShowPluginFilesInSplashScreen(_showPluginFilesInSplashScreen
207:                                    .isSelected());
208:                    prefs.setConfirmSessionClose(_confirmSessionCloseChk
209:                            .isSelected());
210:                    prefs.setWarnJreJdbcMismatch(_warnJreJdbcMismatch
211:                            .isSelected());
212:                    prefs.setWarnForUnsavedFileEdits(_warnForUnsavedFileEdits
213:                            .isSelected());
214:                    prefs
215:                            .setWarnForUnsavedBufferEdits(_warnForUnsavedBufferEdits
216:                                    .isSelected());
217:                    prefs
218:                            .setShowSessionStartupTimeHint(_showSessionStartupTimeHint
219:                                    .isSelected());
220:                    prefs
221:                            .setSavePreferencesImmediately(_savePreferencesImmediately
222:                                    .isSelected());
223:                }
224:
225:                private void createUserInterface() {
226:                    final GridBagConstraints gbc = new GridBagConstraints();
227:                    gbc.fill = GridBagConstraints.HORIZONTAL;
228:                    gbc.anchor = GridBagConstraints.NORTHWEST;
229:                    gbc.insets = new Insets(4, 4, 4, 4);
230:                    gbc.gridx = 0;
231:                    gbc.gridy = 0;
232:                    gbc.weightx = 1;
233:                    add(createAppearancePanel(), gbc);
234:                    ++gbc.gridx;
235:                    add(createGeneralPanel(), gbc);
236:                    gbc.gridx = 0;
237:                    ++gbc.gridy;
238:                    gbc.gridwidth = 2;
239:                    add(createLoggingPanel(), gbc);
240:                    gbc.gridx = 0;
241:                    ++gbc.gridy;
242:                    gbc.gridwidth = 2;
243:                    add(createPathsPanel(), gbc);
244:                }
245:
246:                private JPanel createAppearancePanel() {
247:                    final JPanel pnl = new JPanel(new GridBagLayout());
248:                    pnl.setBorder(BorderFactory.createTitledBorder(s_stringMgr
249:                            .getString("GeneralPreferencesPanel.appearance")));
250:                    pnl.setLayout(new GridBagLayout());
251:
252:                    final GridBagConstraints gbc = new GridBagConstraints();
253:                    gbc.fill = GridBagConstraints.HORIZONTAL;
254:                    gbc.insets = new Insets(2, 4, 2, 4);
255:                    gbc.gridx = 0;
256:                    gbc.gridy = 0;
257:                    gbc.weightx = 1;
258:                    pnl.add(_showContents, gbc);
259:                    ++gbc.gridy;
260:                    pnl.add(_showToolTips, gbc);
261:
262:                    gbc.insets.top = 0;
263:                    ++gbc.gridy;
264:                    pnl.add(_useScrollableTabbedPanes, gbc);
265:                    //gbc.insets = oldInsets;
266:
267:                    ++gbc.gridy;
268:                    pnl.add(_showMainToolBar, gbc);
269:                    ++gbc.gridy;
270:                    pnl.add(_showMainStatusBar, gbc);
271:                    ++gbc.gridy;
272:                    pnl.add(_showDriversToolBar, gbc);
273:                    ++gbc.gridy;
274:                    pnl.add(_showAliasesToolBar, gbc);
275:                    ++gbc.gridy;
276:                    pnl.add(_maximimizeSessionSheet, gbc);
277:                    ++gbc.gridy;
278:                    pnl.add(_showColoriconsInToolbar, gbc);
279:                    ++gbc.gridy;
280:                    pnl.add(_showPluginFilesInSplashScreen, gbc);
281:
282:                    return pnl;
283:                }
284:
285:                private JPanel createGeneralPanel() {
286:                    final JPanel pnl = new JPanel();
287:                    pnl.setBorder(BorderFactory.createTitledBorder(s_stringMgr
288:                            .getString("GeneralPreferencesPanel.general")));
289:                    pnl.setLayout(new GridBagLayout());
290:
291:                    final GridBagConstraints gbc = new GridBagConstraints();
292:                    gbc.fill = GridBagConstraints.HORIZONTAL;
293:                    gbc.insets = new Insets(2, 4, 2, 4);
294:                    gbc.gridx = 0;
295:                    gbc.gridy = 0;
296:                    gbc.weightx = 1;
297:                    pnl.add(_confirmSessionCloseChk, gbc);
298:
299:                    gbc.gridx = 0;
300:                    gbc.gridy = 1;
301:                    pnl.add(_warnJreJdbcMismatch, gbc);
302:
303:                    gbc.gridx = 0;
304:                    gbc.gridy = 2;
305:                    pnl.add(_warnForUnsavedFileEdits, gbc);
306:
307:                    gbc.gridx = 0;
308:                    gbc.gridy = 3;
309:                    pnl.add(_warnForUnsavedBufferEdits, gbc);
310:
311:                    gbc.gridx = 0;
312:                    gbc.gridy = 4;
313:                    pnl.add(_showSessionStartupTimeHint, gbc);
314:
315:                    gbc.gridx = 0;
316:                    gbc.gridy = 5;
317:                    pnl.add(_savePreferencesImmediately, gbc);
318:
319:                    return pnl;
320:                }
321:
322:                private JPanel createLoggingPanel() {
323:                    final JPanel pnl = new JPanel();
324:                    pnl.setBorder(BorderFactory.createTitledBorder(s_stringMgr
325:                            .getString("GeneralPreferencesPanel.logging")));
326:
327:                    pnl.setLayout(new GridBagLayout());
328:                    final GridBagConstraints gbc = new GridBagConstraints();
329:                    gbc.fill = GridBagConstraints.HORIZONTAL;
330:                    gbc.fill = GridBagConstraints.NONE;
331:                    gbc.insets = new Insets(2, 4, 2, 4);
332:                    gbc.anchor = GridBagConstraints.NORTHWEST;
333:
334:                    ApplicationFiles appFiles = new ApplicationFiles();
335:                    String execLogFile = appFiles.getExecutionLogFile()
336:                            .getPath();
337:                    String configFile = ApplicationArguments.getInstance()
338:                            .getLoggingConfigFileName();
339:                    configFile = null == configFile ? s_stringMgr
340:                            .getString("GeneralPreferencesPanel.unspecified")
341:                            : configFile;
342:
343:                    gbc.gridx = 0;
344:                    gbc.gridy = 0;
345:                    JTextField execLogFileField = new JTextField(s_stringMgr
346:                            .getString(
347:                                    "GeneralPreferencesPanel.execlogfileNew",
348:                                    execLogFile));
349:                    execLogFileField.setEditable(false);
350:                    execLogFileField.setBackground(pnl.getBackground());
351:                    execLogFileField.setBorder(null);
352:                    pnl.add(execLogFileField, gbc);
353:
354:                    ++gbc.gridy;
355:                    JTextField configFileField = new JTextField(s_stringMgr
356:                            .getString("GeneralPreferencesPanel.configfileNew",
357:                                    configFile));
358:                    configFileField.setEditable(false);
359:                    configFileField.setBackground(pnl.getBackground());
360:                    configFileField.setBorder(null);
361:                    pnl.add(configFileField, gbc);
362:
363:                    gbc.weightx = 1.0;
364:
365:                    gbc.gridy = 0;
366:                    ++gbc.gridx;
367:                    pnl.add(new JPanel(), gbc);
368:
369:                    ++gbc.gridy;
370:                    pnl.add(new JPanel(), gbc);
371:
372:                    return pnl;
373:                }
374:
375:                private JPanel createPathsPanel() {
376:                    final JPanel pnl = new JPanel();
377:                    // i18n[GeneralPreferencesPanel.paths=SQuirreL paths]
378:                    pnl.setBorder(BorderFactory.createTitledBorder(s_stringMgr
379:                            .getString("GeneralPreferencesPanel.paths")));
380:
381:                    pnl.setLayout(new GridBagLayout());
382:                    final GridBagConstraints gbc = new GridBagConstraints();
383:                    gbc.fill = GridBagConstraints.NONE;
384:                    gbc.insets = new Insets(2, 4, 2, 4);
385:                    gbc.anchor = GridBagConstraints.NORTHWEST;
386:
387:                    ApplicationFiles appFiles = new ApplicationFiles();
388:                    String userDir = appFiles.getUserSettingsDirectory()
389:                            .getPath();
390:                    String homeDir = appFiles.getSquirrelHomeDir().getPath();
391:
392:                    gbc.gridx = 0;
393:                    gbc.gridy = 0;
394:                    // i18n[GeneralPreferencesPanel.squirrelHomePath=Home directory: -home {0}]
395:                    JTextField homePathField = new JTextField(s_stringMgr
396:                            .getString(
397:                                    "GeneralPreferencesPanel.squirrelHomePath",
398:                                    homeDir));
399:                    homePathField.setEditable(false);
400:                    homePathField.setBackground(pnl.getBackground());
401:                    homePathField.setBorder(null);
402:                    pnl.add(homePathField, gbc);
403:
404:                    ++gbc.gridy;
405:                    // i18n[GeneralPreferencesPanel.squirrelUserPath=User directory: -userdir {0}]
406:                    JTextField userPathField = new JTextField(s_stringMgr
407:                            .getString(
408:                                    "GeneralPreferencesPanel.squirrelUserPath",
409:                                    userDir));
410:                    userPathField.setEditable(false);
411:                    userPathField.setBackground(pnl.getBackground());
412:                    userPathField.setBorder(null);
413:                    pnl.add(userPathField, gbc);
414:
415:                    gbc.weightx = 1.0;
416:
417:                    gbc.gridy = 0;
418:                    ++gbc.gridx;
419:                    pnl.add(new JPanel(), gbc);
420:
421:                    ++gbc.gridy;
422:                    pnl.add(new JPanel(), gbc);
423:
424:                    return pnl;
425:                }
426:
427:            }
428:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.