001: package net.sourceforge.squirrel_sql.plugins.sqlscript.table_script;
002:
003: import net.sourceforge.squirrel_sql.fw.util.StringManager;
004: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
005:
006: import javax.swing.*;
007: import java.awt.*;
008: import java.awt.event.ActionEvent;
009: import java.awt.event.KeyEvent;
010:
011: public class TableScriptConfigFrame extends JDialog {
012:
013: private static final StringManager s_stringMgr = StringManagerFactory
014: .getStringManager(TableScriptConfigFrame.class);
015:
016: JRadioButton optConstAndIndAtEnd;
017: JRadioButton optConstAndIndAfterTable;
018: JCheckBox constToTablesNotInScript;
019: JButton btnOk;
020: JButton btnCancel;
021:
022: public TableScriptConfigFrame(JFrame mainFrame) {
023: // i18n[sqlscript.configMultiTableScript=Configuration of multi table scripts]
024: super (mainFrame, s_stringMgr
025: .getString("sqlscript.configMultiTableScript"), true);
026:
027: JPanel pnl = new JPanel(new GridBagLayout());
028:
029: GridBagConstraints gbc;
030:
031: // i18n[sqlscript.configYourMultiTableScript=Configure your multi table script:]
032: Label lbl = new Label(s_stringMgr
033: .getString("sqlscript.configYourMultiTableScript"));
034: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
035: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
036: new Insets(5, 5, 5, 5), 0, 0);
037: pnl.add(lbl, gbc);
038:
039: // i18n[sqlscript.configYourMultiTableScriptIxAtEnd=Constraints and indexes at end of script]
040: optConstAndIndAtEnd = new JRadioButton(
041: s_stringMgr
042: .getString("sqlscript.configYourMultiTableScriptIxAtEnd"));
043: gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
044: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
045: new Insets(0, 5, 5, 5), 0, 0);
046: pnl.add(optConstAndIndAtEnd, gbc);
047:
048: // i18n[sqlscript.configYourMultiTableScriptIxAfterEach=Constraints and indexes after each table]
049: optConstAndIndAfterTable = new JRadioButton(
050: s_stringMgr
051: .getString("sqlscript.configYourMultiTableScriptIxAfterEach"));
052: gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0,
053: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
054: new Insets(0, 5, 5, 5), 0, 0);
055: pnl.add(optConstAndIndAfterTable, gbc);
056:
057: // i18n[sqlscript.configYourMultiTableScriptConstr=Include constraints to tables not in selection]
058: constToTablesNotInScript = new JCheckBox(
059: s_stringMgr
060: .getString("sqlscript.configYourMultiTableScriptConstr"));
061: gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0,
062: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
063: new Insets(0, 5, 5, 5), 0, 0);
064: pnl.add(constToTablesNotInScript, gbc);
065:
066: JPanel pnlButtons = new JPanel(new GridLayout(1, 2, 5, 0));
067:
068: // i18n[sqlscript.configYourMultiTableScriptOk=OK]
069: btnOk = new JButton(s_stringMgr
070: .getString("sqlscript.configYourMultiTableScriptOk"));
071: pnlButtons.add(btnOk);
072:
073: // i18n[sqlscript.configYourMultiTableScriptCancel=Cancel]
074: btnCancel = new JButton(
075: s_stringMgr
076: .getString("sqlscript.configYourMultiTableScriptCancel"));
077: pnlButtons.add(btnCancel);
078:
079: gbc = new GridBagConstraints(0, 4, 1, 1, 0, 0,
080: GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
081: new Insets(0, 5, 5, 5), 0, 0);
082: pnl.add(pnlButtons, gbc);
083:
084: ButtonGroup buttonGroup = new ButtonGroup();
085: buttonGroup.add(optConstAndIndAfterTable);
086: buttonGroup.add(optConstAndIndAtEnd);
087:
088: getContentPane().setLayout(new BorderLayout());
089: getContentPane().add(pnl, BorderLayout.NORTH);
090: getContentPane().add(new JPanel(), BorderLayout.CENTER);
091:
092: setSize(326, 178);
093:
094: AbstractAction closeAction = new AbstractAction() {
095: public void actionPerformed(ActionEvent actionEvent) {
096: setVisible(false);
097: dispose();
098: }
099: };
100: KeyStroke escapeStroke = KeyStroke.getKeyStroke(
101: KeyEvent.VK_ESCAPE, 0);
102: getRootPane().getInputMap(
103: JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
104: escapeStroke, "CloseAction");
105: getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
106: .put(escapeStroke, "CloseAction");
107: getRootPane().getInputMap(JComponent.WHEN_FOCUSED).put(
108: escapeStroke, "CloseAction");
109: getRootPane().getActionMap().put("CloseAction", closeAction);
110:
111: getRootPane().setDefaultButton(btnOk);
112:
113: }
114: }
|