public StringDialog(BibtexBaseFrame baseFrame,
BibtexDatabase base,
BibkeeperPrefs prefs) {
super(baseFrame);
this.baseFrame = baseFrame;
this.base = base;
this.prefs = prefs;
helpAction = new HelpAction
(baseFrame.helpDiag, GUIGlobals.stringEditorHelp, "Help");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
closeAction.actionPerformed(null);
}
});
// We replace the default FocusTraversalPolicy with a subclass
// that only allows the StringTable to gain keyboard focus.
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
protected boolean accept(Component c) {
return (super.accept(c) && (c instanceof StringTable));
}
});
setLocation(prefs.getInt("stringsPosX"), prefs.getInt("stringsPosY"));
setSize(prefs.getInt("stringsSizeX"), prefs.getInt("stringsSizeY"));
pan.setLayout(gbl);
con.fill = GridBagConstraints.BOTH;
con.weighty = 1;
con.weightx = 1;
table = new StringTable(this, base);
if (base.getStringCount() > 0)
table.setRowSelectionInterval(0,0);
gbl.setConstraints(table.getPane(), con);
pan.add(table.getPane());
InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap am = tlb.getActionMap();
im.put(KeyStroke.getKeyStroke(GUIGlobals.addKey), "add");
am.put("add", newStringAction);
im.put(KeyStroke.getKeyStroke(GUIGlobals.removeKey), "remove");
am.put("remove", removeStringAction);
im.put(KeyStroke.getKeyStroke(GUIGlobals.upKey), "up");
am.put("up", stringUpAction);
im.put(KeyStroke.getKeyStroke(GUIGlobals.downKey), "down");
am.put("down", stringDownAction);
im.put(GUIGlobals.exitDialog, "close");
am.put("close", closeAction);
im.put(GUIGlobals.helpKeyStroke, "help");
am.put("help", helpAction);
im.put(GUIGlobals.undoStroke, "undo");
am.put("undo", undoAction);
im.put(GUIGlobals.redoStroke, "redo");
am.put("redo", redoAction);
//tlb.add(closeAction);
//tlb.addSeparator();
tlb.add(newStringAction);
tlb.add(removeStringAction);
tlb.addSeparator();
tlb.add(stringUpAction);
tlb.add(stringDownAction);
tlb.addSeparator();
tlb.add(helpAction);
conPane.add(tlb, BorderLayout.NORTH);
conPane.add(pan, BorderLayout.CENTER);
if (baseFrame.file != null)
setTitle(GUIGlobals.stringsTitle+baseFrame.file.getName());
else
setTitle(GUIGlobals.untitledStringsTitle);
}
|