001: package net.sourceforge.squirrel_sql.client.gui.db.aliasproperties;
002:
003: import net.sourceforge.squirrel_sql.fw.gui.MultipleLineLabel;
004: import net.sourceforge.squirrel_sql.fw.util.StringManager;
005: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
006:
007: import javax.swing.*;
008: import java.awt.*;
009:
010: public class SchemaPropertiesPanel extends JPanel {
011:
012: private static final StringManager s_stringMgr = StringManagerFactory
013: .getStringManager(SchemaPropertiesPanel.class);
014:
015: JRadioButton radLoadAllAndCacheNone;
016: JRadioButton radLoadAndCacheAll;
017: JRadioButton radSpecifySchemas;
018:
019: JButton btnUpdateSchemas;
020:
021: JTable tblSchemas;
022:
023: JComboBox cboSchemaTableUpdateWhat;
024: JComboBox cboSchemaTableUpdateTo;
025: JButton btnSchemaTableUpdateApply;
026:
027: JCheckBox chkCacheSchemaIndepndentMetaData;
028:
029: JButton btnPrintCacheFileLocation;
030: JButton btnDeleteCache;
031:
032: public SchemaPropertiesPanel() {
033: setLayout(new GridBagLayout());
034:
035: GridBagConstraints gbc;
036:
037: // i18n[SchemaPropertiesPanel.hint=Here you may pecify which Schemas to be loaded and displayed in a Session's Object tree.
038: // Code completion and Syntax highlighting will work only for loaded schemas.
039: // If Schemas take a long time to load you may cache them on your hard disk.
040: // Then loading will take long only when you open a Session for the first time.
041: // You can always refesh the cache either by using the Session's 'Refresh all' toolbar button
042: // or by using the 'Refresh Item' right mouse menu on an Object tree node.]
043: MultipleLineLabel lblHint = new MultipleLineLabel(s_stringMgr
044: .getString("SchemaPropertiesPanel.hint"));
045: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
046: GridBagConstraints.NORTHWEST,
047: GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
048: 0, 0);
049: add(lblHint, gbc);
050:
051: // i18n[SchemaPropertiesPanel.loadAllAndCacheNone=Load all Schemas, cache none]
052: radLoadAllAndCacheNone = new JRadioButton(s_stringMgr
053: .getString("SchemaPropertiesPanel.loadAllAndCacheNone"));
054: gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
055: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
056: new Insets(5, 5, 5, 5), 0, 0);
057: add(radLoadAllAndCacheNone, gbc);
058:
059: // i18n[SchemaPropertiesPanel.loadAndCacheAll=Load all and cache all Schemas]
060: radLoadAndCacheAll = new JRadioButton(s_stringMgr
061: .getString("SchemaPropertiesPanel.loadAndCacheAll"));
062: gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0,
063: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
064: new Insets(0, 5, 5, 5), 0, 0);
065: add(radLoadAndCacheAll, gbc);
066:
067: // i18n[SchemaPropertiesPanel.specifySchemas=Specify Schema loading and caching]
068: radSpecifySchemas = new JRadioButton(s_stringMgr
069: .getString("SchemaPropertiesPanel.specifySchemas"));
070: gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0,
071: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
072: new Insets(0, 5, 5, 5), 0, 0);
073: add(radSpecifySchemas, gbc);
074:
075: ButtonGroup bg = new ButtonGroup();
076: bg.add(radLoadAllAndCacheNone);
077: bg.add(radLoadAndCacheAll);
078: bg.add(radSpecifySchemas);
079:
080: // i18n[SchemaPropertiesPanel.refreshSchemas=Connect database to refresh Schema table]
081: btnUpdateSchemas = new JButton(s_stringMgr
082: .getString("SchemaPropertiesPanel.refreshSchemas"));
083: gbc = new GridBagConstraints(0, 4, 1, 1, 0, 0,
084: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
085: new Insets(5, 5, 5, 5), 0, 0);
086: add(btnUpdateSchemas, gbc);
087:
088: // i18n[SchemaPropertiesPanel.schemaTableTitle=Schema table]
089: JLabel lblSchemaTableTitle = new JLabel(s_stringMgr
090: .getString("SchemaPropertiesPanel.schemaTableTitle"));
091: gbc = new GridBagConstraints(0, 5, 1, 1, 0, 0,
092: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
093: new Insets(5, 5, 0, 5), 0, 0);
094: add(lblSchemaTableTitle, gbc);
095:
096: tblSchemas = new JTable();
097: gbc = new GridBagConstraints(0, 6, 1, 1, 1, 1,
098: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
099: new Insets(0, 5, 5, 5), 0, 0);
100: add(new JScrollPane(tblSchemas), gbc);
101:
102: gbc = new GridBagConstraints(0, 7, 1, 1, 0, 0,
103: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
104: new Insets(0, 5, 5, 5), 0, 0);
105: add(createSchemaTableUpdatePanel(), gbc);
106:
107: // i18n[SchemaPropertiesPanel.CacheSchemaIndependentMetaData=Cache Schema independent meta data (Catalogs, Keywords, Data types, Global functions)]
108: chkCacheSchemaIndepndentMetaData = new JCheckBox(
109: s_stringMgr
110: .getString("SchemaPropertiesPanel.CacheSchemaIndependentMetaData"));
111: gbc = new GridBagConstraints(0, 8, 1, 1, 0, 0,
112: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
113: new Insets(10, 5, 5, 5), 0, 0);
114: add(chkCacheSchemaIndepndentMetaData, gbc);
115:
116: gbc = new GridBagConstraints(0, 9, 1, 1, 0, 0,
117: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
118: new Insets(10, 5, 5, 5), 0, 0);
119: add(createCacheFilePanel(), gbc);
120:
121: }
122:
123: private JPanel createCacheFilePanel() {
124: JPanel ret = new JPanel();
125:
126: ret.setLayout(new GridBagLayout());
127: GridBagConstraints gbc;
128:
129: // i18n[SchemaPropertiesPanel.printCacheFileLocation=Print cache file path to message panel]
130: btnPrintCacheFileLocation = new JButton(
131: s_stringMgr
132: .getString("SchemaPropertiesPanel.printCacheFileLocation"));
133: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
134: GridBagConstraints.WEST, GridBagConstraints.NONE,
135: new Insets(0, 0, 5, 5), 0, 0);
136: ret.add(btnPrintCacheFileLocation, gbc);
137:
138: // i18n[SchemaPropertiesPanel.deleteCache=Delete cache file]
139: btnDeleteCache = new JButton(s_stringMgr
140: .getString("SchemaPropertiesPanel.deleteCache"));
141: gbc = new GridBagConstraints(1, 0, 1, 1, 0, 0,
142: GridBagConstraints.WEST, GridBagConstraints.NONE,
143: new Insets(0, 5, 5, 5), 0, 0);
144: ret.add(btnDeleteCache, gbc);
145:
146: return ret;
147: }
148:
149: private JPanel createSchemaTableUpdatePanel() {
150: JPanel ret = new JPanel(new GridBagLayout());
151:
152: GridBagConstraints gbc;
153:
154: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
155: GridBagConstraints.WEST, GridBagConstraints.NONE,
156: new Insets(0, 5, 5, 5), 0, 0);
157: // i18n[SchemaPropertiesPanel.schemaTableUpdateLable1=Set]
158: ret
159: .add(
160: new JLabel(
161: s_stringMgr
162: .getString("SchemaPropertiesPanel.schemaTableUpdateLable1")),
163: gbc);
164:
165: cboSchemaTableUpdateWhat = new JComboBox();
166: gbc = new GridBagConstraints(1, 0, 1, 1, 1, 0,
167: GridBagConstraints.WEST, GridBagConstraints.NONE,
168: new Insets(0, 5, 5, 5), 0, 0);
169: ret.add(cboSchemaTableUpdateWhat, gbc);
170:
171: gbc = new GridBagConstraints(2, 0, 1, 1, 0, 0,
172: GridBagConstraints.WEST, GridBagConstraints.NONE,
173: new Insets(0, 5, 5, 5), 0, 0);
174: // i18n[SchemaPropertiesPanel.schemaTableUpdateLable2=in all Schemas to]
175: ret
176: .add(
177: new JLabel(
178: s_stringMgr
179: .getString("SchemaPropertiesPanel.schemaTableUpdateLable2")),
180: gbc);
181:
182: cboSchemaTableUpdateTo = new JComboBox();
183: gbc = new GridBagConstraints(3, 0, 1, 1, 1, 0,
184: GridBagConstraints.WEST, GridBagConstraints.NONE,
185: new Insets(0, 5, 5, 5), 0, 0);
186: ret.add(cboSchemaTableUpdateTo, gbc);
187:
188: // i18n[SchemaPropertiesPanel.schemaTableUpdateApply=Apply]
189: btnSchemaTableUpdateApply = new JButton(
190: s_stringMgr
191: .getString("SchemaPropertiesPanel.schemaTableUpdateApply"));
192: gbc = new GridBagConstraints(4, 0, 1, 1, 0, 0,
193: GridBagConstraints.WEST, GridBagConstraints.NONE,
194: new Insets(0, 5, 5, 5), 0, 0);
195: ret.add(btnSchemaTableUpdateApply, gbc);
196:
197: return ret;
198: }
199:
200: }
|