001: /*
002: * DbExplorerOptionsPanel.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.settings;
013:
014: import javax.swing.JPanel;
015: import workbench.gui.components.WbCheckBoxLabel;
016: import workbench.interfaces.Restoreable;
017: import workbench.resource.ResourceMgr;
018: import workbench.resource.Settings;
019:
020: /**
021: *
022: * @author support@sql-workbench.net
023: */
024: public class DbExplorerOptionsPanel extends JPanel implements
025: Restoreable {
026: public DbExplorerOptionsPanel() {
027: initComponents();
028: }
029:
030: public void saveSettings() {
031: Settings set = Settings.getInstance();
032: set.setRetrieveDbExplorer(retrieveDbExplorer.isSelected());
033: set.setShowDbExplorerInMainWindow(this .showDbExplorer
034: .isSelected());
035: set
036: .setStoreExplorerObjectType(this .rememberObject
037: .isSelected());
038: set.setAutoGeneratePKName(autogeneratePK.isSelected());
039: set.setShowTriggerPanel(showTriggerPanel.isSelected());
040: set.setSelectDataPanelAfterRetrieve(autoselectDataPanel
041: .isSelected());
042: set.setRememberSortInDbExplorer(rememberSort.isSelected());
043: set.setShowFocusInDbExplorer(showFocus.isSelected());
044: }
045:
046: public void restoreSettings() {
047: Settings set = Settings.getInstance();
048: autogeneratePK.setSelected(set.getAutoGeneratePKName());
049: }
050:
051: /** This method is called from within the constructor to
052: * initialize the form.
053: * WARNING: Do NOT modify this code. The content of this method is
054: * always regenerated by the Form Editor.
055: */
056: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
057: private void initComponents() {
058: java.awt.GridBagConstraints gridBagConstraints;
059:
060: dbExplorerLabel = new WbCheckBoxLabel();
061: showDbExplorer = new javax.swing.JCheckBox();
062: showTriggerPanel = new javax.swing.JCheckBox();
063: showTriggerPanelLabel = new WbCheckBoxLabel();
064: retrieveDbExplorerLabel = new WbCheckBoxLabel();
065: retrieveDbExplorer = new javax.swing.JCheckBox();
066: rememberObjectLabel = new WbCheckBoxLabel();
067: rememberObject = new javax.swing.JCheckBox();
068: rememberSortLabel = new WbCheckBoxLabel();
069: rememberSort = new javax.swing.JCheckBox();
070: autoSelectDataLabel = new WbCheckBoxLabel();
071: autoselectDataPanel = new javax.swing.JCheckBox();
072: showFocusLabel = new WbCheckBoxLabel();
073: showFocus = new javax.swing.JCheckBox();
074: autogeneratePkLabel = new WbCheckBoxLabel();
075: autogeneratePK = new javax.swing.JCheckBox();
076: jPanel1 = new javax.swing.JPanel();
077:
078: setLayout(new java.awt.GridBagLayout());
079:
080: dbExplorerLabel
081: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
082: dbExplorerLabel.setLabelFor(showDbExplorer);
083: dbExplorerLabel.setText(ResourceMgr
084: .getString("LblDbExplorerCheckBox"));
085: dbExplorerLabel.setToolTipText(ResourceMgr
086: .getDescription("LblDbExplorerCheckBox"));
087: gridBagConstraints = new java.awt.GridBagConstraints();
088: gridBagConstraints.gridx = 0;
089: gridBagConstraints.gridy = 0;
090: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
091: gridBagConstraints.insets = new java.awt.Insets(3, 12, 0, 0);
092: add(dbExplorerLabel, gridBagConstraints);
093:
094: showDbExplorer.setFont(null);
095: showDbExplorer.setSelected(Settings.getInstance()
096: .getShowDbExplorerInMainWindow());
097: showDbExplorer.setBorder(null);
098: showDbExplorer
099: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
100: showDbExplorer
101: .setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
102: showDbExplorer.setIconTextGap(5);
103: gridBagConstraints = new java.awt.GridBagConstraints();
104: gridBagConstraints.gridx = 1;
105: gridBagConstraints.gridy = 0;
106: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
107: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
108: gridBagConstraints.weightx = 1.0;
109: gridBagConstraints.insets = new java.awt.Insets(3, 9, 0, 11);
110: add(showDbExplorer, gridBagConstraints);
111:
112: showTriggerPanel.setSelected(Settings.getInstance()
113: .getShowTriggerPanel());
114: showTriggerPanel.setBorder(javax.swing.BorderFactory
115: .createEmptyBorder(0, 0, 0, 0));
116: showTriggerPanel.setMargin(new java.awt.Insets(0, 0, 0, 0));
117: gridBagConstraints = new java.awt.GridBagConstraints();
118: gridBagConstraints.gridx = 1;
119: gridBagConstraints.gridy = 1;
120: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
121: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
122: gridBagConstraints.insets = new java.awt.Insets(6, 9, 0, 5);
123: add(showTriggerPanel, gridBagConstraints);
124:
125: showTriggerPanelLabel.setLabelFor(showTriggerPanel);
126: showTriggerPanelLabel.setText(ResourceMgr
127: .getString("LblShowTriggerPanel"));
128: showTriggerPanelLabel.setToolTipText(ResourceMgr
129: .getDescription("LblShowTriggerPanel"));
130: gridBagConstraints = new java.awt.GridBagConstraints();
131: gridBagConstraints.gridx = 0;
132: gridBagConstraints.gridy = 1;
133: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
134: gridBagConstraints.insets = new java.awt.Insets(7, 12, 0, 0);
135: add(showTriggerPanelLabel, gridBagConstraints);
136:
137: retrieveDbExplorerLabel.setLabelFor(retrieveDbExplorer);
138: retrieveDbExplorerLabel.setText(ResourceMgr
139: .getString("LblRetrieveDbExplorer"));
140: retrieveDbExplorerLabel.setToolTipText(ResourceMgr
141: .getDescription("LblRetrieveDbExplorer"));
142: gridBagConstraints = new java.awt.GridBagConstraints();
143: gridBagConstraints.gridx = 0;
144: gridBagConstraints.gridy = 2;
145: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
146: gridBagConstraints.insets = new java.awt.Insets(8, 12, 0, 0);
147: add(retrieveDbExplorerLabel, gridBagConstraints);
148:
149: retrieveDbExplorer.setFont(null);
150: retrieveDbExplorer.setSelected(Settings.getInstance()
151: .getRetrieveDbExplorer());
152: retrieveDbExplorer.setBorder(null);
153: retrieveDbExplorer
154: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
155: retrieveDbExplorer
156: .setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
157: retrieveDbExplorer.setIconTextGap(5);
158: gridBagConstraints = new java.awt.GridBagConstraints();
159: gridBagConstraints.gridx = 1;
160: gridBagConstraints.gridy = 2;
161: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
162: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
163: gridBagConstraints.insets = new java.awt.Insets(5, 9, 0, 5);
164: add(retrieveDbExplorer, gridBagConstraints);
165:
166: rememberObjectLabel.setLabelFor(rememberObject);
167: rememberObjectLabel.setText(ResourceMgr
168: .getString("LblRememberObjectType"));
169: rememberObjectLabel.setToolTipText(ResourceMgr
170: .getDescription("LblRememberObjectType"));
171: gridBagConstraints = new java.awt.GridBagConstraints();
172: gridBagConstraints.gridx = 0;
173: gridBagConstraints.gridy = 3;
174: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
175: gridBagConstraints.insets = new java.awt.Insets(7, 12, 0, 0);
176: add(rememberObjectLabel, gridBagConstraints);
177:
178: rememberObject.setSelected(Settings.getInstance()
179: .getStoreExplorerObjectType());
180: rememberObject.setBorder(javax.swing.BorderFactory
181: .createEmptyBorder(0, 0, 0, 0));
182: rememberObject.setMargin(new java.awt.Insets(0, 0, 0, 0));
183: gridBagConstraints = new java.awt.GridBagConstraints();
184: gridBagConstraints.gridx = 1;
185: gridBagConstraints.gridy = 3;
186: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
187: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
188: gridBagConstraints.insets = new java.awt.Insets(7, 9, 0, 0);
189: add(rememberObject, gridBagConstraints);
190:
191: rememberSortLabel.setLabelFor(rememberSort);
192: rememberSortLabel.setText(ResourceMgr
193: .getString("LblRememberDbExpSort"));
194: rememberSortLabel.setToolTipText(ResourceMgr
195: .getDescription("LblRememberDbExpSort"));
196: gridBagConstraints = new java.awt.GridBagConstraints();
197: gridBagConstraints.gridx = 0;
198: gridBagConstraints.gridy = 4;
199: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
200: gridBagConstraints.insets = new java.awt.Insets(7, 12, 0, 0);
201: add(rememberSortLabel, gridBagConstraints);
202:
203: rememberSort.setSelected(Settings.getInstance()
204: .getRememberSortInDbExplorer());
205: rememberSort.setBorder(javax.swing.BorderFactory
206: .createEmptyBorder(0, 0, 0, 0));
207: rememberSort.setMargin(new java.awt.Insets(0, 0, 0, 0));
208: gridBagConstraints = new java.awt.GridBagConstraints();
209: gridBagConstraints.gridx = 1;
210: gridBagConstraints.gridy = 4;
211: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
212: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
213: gridBagConstraints.insets = new java.awt.Insets(7, 9, 0, 0);
214: add(rememberSort, gridBagConstraints);
215:
216: autoSelectDataLabel.setLabelFor(autoselectDataPanel);
217: autoSelectDataLabel.setText(ResourceMgr
218: .getString("LblSelectDataPanel"));
219: autoSelectDataLabel.setToolTipText(ResourceMgr
220: .getDescription("LblSelectDataPanel"));
221: gridBagConstraints = new java.awt.GridBagConstraints();
222: gridBagConstraints.gridx = 0;
223: gridBagConstraints.gridy = 5;
224: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
225: gridBagConstraints.insets = new java.awt.Insets(7, 12, 0, 0);
226: add(autoSelectDataLabel, gridBagConstraints);
227:
228: autoselectDataPanel.setSelected(Settings.getInstance()
229: .getSelectDataPanelAfterRetrieve());
230: autoselectDataPanel.setBorder(javax.swing.BorderFactory
231: .createEmptyBorder(0, 0, 0, 0));
232: autoselectDataPanel.setMargin(new java.awt.Insets(0, 0, 0, 0));
233: gridBagConstraints = new java.awt.GridBagConstraints();
234: gridBagConstraints.gridx = 1;
235: gridBagConstraints.gridy = 5;
236: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
237: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
238: gridBagConstraints.insets = new java.awt.Insets(7, 9, 0, 0);
239: add(autoselectDataPanel, gridBagConstraints);
240:
241: showFocusLabel.setLabelFor(showFocus);
242: showFocusLabel.setText(ResourceMgr.getString("LblShowFocus"));
243: showFocusLabel.setToolTipText(ResourceMgr
244: .getDescription("LblShowFocus"));
245: gridBagConstraints = new java.awt.GridBagConstraints();
246: gridBagConstraints.gridx = 0;
247: gridBagConstraints.gridy = 6;
248: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
249: gridBagConstraints.insets = new java.awt.Insets(7, 12, 0, 0);
250: add(showFocusLabel, gridBagConstraints);
251:
252: showFocus.setSelected(Settings.getInstance()
253: .showFocusInDbExplorer());
254: showFocus.setBorder(javax.swing.BorderFactory
255: .createEmptyBorder(0, 0, 0, 0));
256: showFocus.setMargin(new java.awt.Insets(0, 0, 0, 0));
257: gridBagConstraints = new java.awt.GridBagConstraints();
258: gridBagConstraints.gridx = 1;
259: gridBagConstraints.gridy = 6;
260: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
261: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
262: gridBagConstraints.insets = new java.awt.Insets(7, 9, 0, 0);
263: add(showFocus, gridBagConstraints);
264:
265: autogeneratePkLabel.setLabelFor(autogeneratePK);
266: autogeneratePkLabel.setText(ResourceMgr
267: .getString("LblGeneratePkName"));
268: autogeneratePkLabel.setToolTipText(ResourceMgr
269: .getDescription("LblGeneratePkName"));
270: gridBagConstraints = new java.awt.GridBagConstraints();
271: gridBagConstraints.gridx = 0;
272: gridBagConstraints.gridy = 7;
273: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
274: gridBagConstraints.insets = new java.awt.Insets(8, 12, 0, 0);
275: add(autogeneratePkLabel, gridBagConstraints);
276:
277: autogeneratePK.setSelected(Settings.getInstance()
278: .getStoreExplorerObjectType());
279: autogeneratePK.setBorder(javax.swing.BorderFactory
280: .createEmptyBorder(0, 0, 0, 0));
281: autogeneratePK.setMargin(new java.awt.Insets(0, 0, 0, 0));
282: gridBagConstraints = new java.awt.GridBagConstraints();
283: gridBagConstraints.gridx = 1;
284: gridBagConstraints.gridy = 7;
285: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
286: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
287: gridBagConstraints.insets = new java.awt.Insets(8, 9, 0, 0);
288: add(autogeneratePK, gridBagConstraints);
289: gridBagConstraints = new java.awt.GridBagConstraints();
290: gridBagConstraints.gridx = 1;
291: gridBagConstraints.gridy = 8;
292: gridBagConstraints.weightx = 1.0;
293: gridBagConstraints.weighty = 1.0;
294: add(jPanel1, gridBagConstraints);
295: }// </editor-fold>//GEN-END:initComponents
296:
297: // Variables declaration - do not modify//GEN-BEGIN:variables
298: private javax.swing.JLabel autoSelectDataLabel;
299: private javax.swing.JCheckBox autogeneratePK;
300: private javax.swing.JLabel autogeneratePkLabel;
301: private javax.swing.JCheckBox autoselectDataPanel;
302: private javax.swing.JLabel dbExplorerLabel;
303: private javax.swing.JPanel jPanel1;
304: private javax.swing.JCheckBox rememberObject;
305: private javax.swing.JLabel rememberObjectLabel;
306: private javax.swing.JCheckBox rememberSort;
307: private javax.swing.JLabel rememberSortLabel;
308: private javax.swing.JCheckBox retrieveDbExplorer;
309: private javax.swing.JLabel retrieveDbExplorerLabel;
310: private javax.swing.JCheckBox showDbExplorer;
311: private javax.swing.JCheckBox showFocus;
312: private javax.swing.JLabel showFocusLabel;
313: private javax.swing.JCheckBox showTriggerPanel;
314: private javax.swing.JLabel showTriggerPanelLabel;
315: // End of variables declaration//GEN-END:variables
316:
317: }
|