01: package net.sourceforge.squirrel_sql.plugins.hibernate;
02:
03: import net.sourceforge.squirrel_sql.fw.util.StringManager;
04: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
05: import net.sourceforge.squirrel_sql.client.session.mainpanel.SQLResultExecuterPanel;
06: import net.sourceforge.squirrel_sql.client.gui.builders.UIFactory;
07:
08: import javax.swing.*;
09: import java.awt.*;
10:
11: public class HibernateSQLPanel extends JPanel {
12: private static final StringManager s_stringMgr = StringManagerFactory
13: .getStringManager(HibernateSQLPanel.class);
14:
15: JCheckBox _chkAppendSql;
16: JButton _btnFormatSql;
17: JCheckBox _chkAlwaysFormatSql;
18: JCheckBox _chkAlwaysExecuteSql;
19:
20: JTabbedPane _tabResult_code;
21:
22: public HibernateSQLPanel(JComponent textComp,
23: SQLResultExecuterPanel resultExecuterPanel) {
24:
25: setLayout(new BorderLayout());
26: _tabResult_code = new JTabbedPane();//UIFactory.getInstance().createTabbedPane();
27:
28: // i18n[HibernateSQLPanel.code=SQL code]
29: _tabResult_code.addTab(s_stringMgr
30: .getString("HibernateSQLPanel.code"), textComp);
31:
32: // i18n[HibernateSQLPanel.result=SQL result]
33: _tabResult_code.addTab(s_stringMgr
34: .getString("HibernateSQLPanel.result"),
35: resultExecuterPanel);
36:
37: add(_tabResult_code, BorderLayout.CENTER);
38:
39: add(createBottomPanel(), BorderLayout.SOUTH);
40: }
41:
42: private JPanel createBottomPanel() {
43: JPanel ret = new JPanel(new GridBagLayout());
44:
45: GridBagConstraints gbc;
46:
47: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
48: GridBagConstraints.WEST, GridBagConstraints.NONE,
49: new Insets(5, 5, 5, 5), 0, 0);
50: // i18n[HibernateSQLPanel.sql=SQL:]
51: ret.add(new JLabel(s_stringMgr
52: .getString("HibernateSQLPanel.sql")), gbc);
53:
54: gbc = new GridBagConstraints(1, 0, 1, 1, 0, 0,
55: GridBagConstraints.WEST, GridBagConstraints.NONE,
56: new Insets(5, 5, 5, 5), 0, 0);
57: // i18n[HibernateSQLPanel.appendSql=Append]
58: _chkAppendSql = new JCheckBox(s_stringMgr
59: .getString("HibernateSQLPanel.appendSql"));
60: ret.add(_chkAppendSql, gbc);
61:
62: gbc = new GridBagConstraints(2, 0, 1, 1, 0, 0,
63: GridBagConstraints.WEST, GridBagConstraints.NONE,
64: new Insets(5, 5, 5, 5), 0, 0);
65: // i18n[HibernateSQLPanel.format=Format]
66: _btnFormatSql = new JButton(s_stringMgr
67: .getString("HibernateSQLPanel.format"));
68: ret.add(_btnFormatSql, gbc);
69:
70: gbc = new GridBagConstraints(3, 0, 1, 1, 0, 0,
71: GridBagConstraints.WEST, GridBagConstraints.NONE,
72: new Insets(5, 5, 5, 5), 0, 0);
73: // i18n[HibernateSQLPanel.alwaysFormat=Always format]
74: _chkAlwaysFormatSql = new JCheckBox(s_stringMgr
75: .getString("HibernateSQLPanel.alwaysFormat"));
76: ret.add(_chkAlwaysFormatSql, gbc);
77:
78: gbc = new GridBagConstraints(4, 0, 1, 1, 0, 0,
79: GridBagConstraints.WEST, GridBagConstraints.NONE,
80: new Insets(5, 5, 5, 5), 0, 0);
81: // i18n[HibernateSQLPanel.Execute=Execute SQL]
82: _chkAlwaysExecuteSql = new JCheckBox(s_stringMgr
83: .getString("HibernateSQLPanel.Execute"));
84: ret.add(_chkAlwaysExecuteSql, gbc);
85:
86: gbc = new GridBagConstraints(5, 0, 1, 1, 1, 0,
87: GridBagConstraints.WEST, GridBagConstraints.NONE,
88: new Insets(5, 5, 5, 5), 0, 0);
89: ret.add(new JPanel(), gbc);
90:
91: return ret;
92:
93: }
94: }
|