001: package net.sourceforge.squirrel_sql.plugins.sqlbookmark;
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 javax.swing.tree.DefaultMutableTreeNode;
008: import java.awt.*;
009:
010: public class SQLBookmarkPreferencesPanel extends JPanel {
011: private static final StringManager s_stringMgr = StringManagerFactory
012: .getStringManager(SQLBookmarkPreferencesPanel.class);
013:
014: private interface IPrefKeys {
015: String BM_UP = "button.up.title";
016: String BM_DOWN = "button.down.title";
017: String BM_ADD = "button.add.title";
018: String BM_DEL = "button.del.title";
019: String BM_RUN = "button.run.title";
020: }
021:
022: JTree treBookmarks;
023:
024: JButton btnUp;
025: JButton btnDown;
026: JButton btnAdd;
027: JButton btnEdit;
028: JButton btnDel;
029: JButton btnRun;
030:
031: JCheckBox chkSquirrelMarksInPopup;
032:
033: public SQLBookmarkPreferencesPanel(SQLBookmarkPlugin plugin) {
034: setLayout(new GridBagLayout());
035:
036: GridBagConstraints gbc;
037:
038: treBookmarks = new JTree();
039: gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1,
040: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
041: new Insets(5, 5, 5, 5), 0, 0);
042: add(new JScrollPane(treBookmarks), gbc);
043:
044: JPanel buttonPane = createButtonPane(plugin);
045: gbc = new GridBagConstraints(1, 0, 1, 1, 0, 0,
046: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
047: new Insets(5, 0, 5, 5), 0, 0);
048: add(buttonPane, gbc);
049:
050: JPanel southPane = createSouthPane(plugin);
051: gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
052: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
053: new Insets(0, 5, 5, 5), 0, 0);
054: add(southPane, gbc);
055: }
056:
057: private JPanel createSouthPane(SQLBookmarkPlugin plugin) {
058: JPanel pnlSouth = new JPanel(new GridBagLayout());
059:
060: GridBagConstraints gbc;
061:
062: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
063: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
064: new Insets(5, 5, 5, 5), 0, 0);
065: // i18n[sqlbookmark.squirrelMarksInPopup=Show SQuirreL bookmarks in ctrl+j popup]
066: chkSquirrelMarksInPopup = new JCheckBox(s_stringMgr
067: .getString("sqlbookmark.squirrelMarksInPopup"));
068: pnlSouth.add(chkSquirrelMarksInPopup, gbc);
069:
070: JLabel lblAccesshint = new JLabel(plugin
071: .getResourceString(AddBookmarkDialog.BM_ACCESS_HINT));
072: lblAccesshint.setForeground(Color.red);
073: gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
074: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
075: new Insets(0, 5, 5, 5), 0, 0);
076: pnlSouth.add(lblAccesshint, gbc);
077:
078: gbc = new GridBagConstraints(1, 0, 1, 2, 0, 0,
079: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
080: new Insets(0, 0, 0, 0), 0, 0);
081: pnlSouth.add(new JPanel(), gbc);
082:
083: return pnlSouth;
084: }
085:
086: private JPanel createButtonPane(SQLBookmarkPlugin plugin) {
087: JPanel buttonPane = new JPanel(new GridBagLayout());
088:
089: GridBagConstraints gbc;
090:
091: btnRun = new JButton(plugin.getResourceString(IPrefKeys.BM_RUN));
092: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
093: GridBagConstraints.NORTHWEST,
094: GridBagConstraints.HORIZONTAL, new Insets(0, 1, 1, 1),
095: 0, 0);
096: buttonPane.add(btnRun, gbc);
097:
098: btnUp = new JButton(plugin.getResourceString(IPrefKeys.BM_UP));
099: gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
100: GridBagConstraints.NORTHWEST,
101: GridBagConstraints.HORIZONTAL, new Insets(0, 1, 1, 1),
102: 0, 0);
103: buttonPane.add(btnUp, gbc);
104:
105: btnDown = new JButton(plugin
106: .getResourceString(IPrefKeys.BM_DOWN));
107: gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0,
108: GridBagConstraints.NORTHWEST,
109: GridBagConstraints.HORIZONTAL, new Insets(0, 1, 1, 1),
110: 0, 0);
111: buttonPane.add(btnDown, gbc);
112:
113: btnAdd = new JButton(plugin.getResourceString(IPrefKeys.BM_ADD));
114: gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0,
115: GridBagConstraints.NORTHWEST,
116: GridBagConstraints.HORIZONTAL, new Insets(0, 1, 1, 1),
117: 0, 0);
118: buttonPane.add(btnAdd, gbc);
119:
120: btnEdit = new JButton();
121: gbc = new GridBagConstraints(0, 4, 1, 1, 0, 0,
122: GridBagConstraints.NORTHWEST,
123: GridBagConstraints.HORIZONTAL, new Insets(0, 1, 1, 1),
124: 0, 0);
125: buttonPane.add(btnEdit, gbc);
126:
127: btnDel = new JButton(plugin.getResourceString(IPrefKeys.BM_DEL));
128: gbc = new GridBagConstraints(0, 5, 1, 1, 0, 0,
129: GridBagConstraints.NORTHWEST,
130: GridBagConstraints.HORIZONTAL, new Insets(0, 1, 1, 1),
131: 0, 0);
132: buttonPane.add(btnDel, gbc);
133:
134: gbc = new GridBagConstraints(0, 6, 1, 1, 0, 1,
135: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
136: new Insets(0, 0, 0, 0), 0, 0);
137: buttonPane.add(new JPanel(), gbc);
138: return buttonPane;
139: }
140: }
|