use of org.jabref.gui.help.HelpAction in project jabref by JabRef.
the class ContentSelectorDialog method initLayout.
private void initLayout() {
fieldNameField.setEnabled(false);
fieldList.setVisibleRowCount(4);
wordList.setVisibleRowCount(10);
final String VAL = "Uren luren himmelturen, ja Besseggen.";
fieldList.setPrototypeCellValue(VAL);
wordList.setPrototypeCellValue(VAL);
fieldPan.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Field name")));
wordPan.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Keyword")));
fieldPan.setLayout(gbl);
wordPan.setLayout(gbl);
con.insets = new Insets(2, 2, 2, 2);
con.fill = GridBagConstraints.BOTH;
con.gridwidth = 2;
con.weightx = 1;
con.weighty = 1;
con.gridx = 0;
con.gridy = 0;
gbl.setConstraints(fPane, con);
fieldPan.add(fPane);
gbl.setConstraints(wPane, con);
wordPan.add(wPane);
con.gridwidth = 1;
con.gridx = 2;
//con.weightx = 0.7;
con.gridheight = 2;
gbl.setConstraints(fieldNamePan, con);
fieldPan.add(fieldNamePan);
gbl.setConstraints(wordEditPan, con);
wordPan.add(wordEditPan);
con.gridx = 0;
con.gridy = 1;
con.weightx = 0;
con.weighty = 0;
con.gridwidth = 1;
con.gridheight = 1;
con.fill = GridBagConstraints.NONE;
con.anchor = GridBagConstraints.WEST;
gbl.setConstraints(newField, con);
fieldPan.add(newField);
gbl.setConstraints(newWord, con);
wordPan.add(newWord);
con.gridx = 1;
//con.anchor = GridBagConstraints.EAST;
gbl.setConstraints(removeField, con);
fieldPan.add(removeField);
gbl.setConstraints(removeWord, con);
wordPan.add(removeWord);
con.anchor = GridBagConstraints.WEST;
con.gridx = 0;
con.gridy = 0;
gbl.setConstraints(fieldNameField, con);
fieldNamePan.add(fieldNameField);
gbl.setConstraints(wordEditField, con);
wordEditPan.add(wordEditField);
// Add buttons:
ButtonBarBuilder bsb = new ButtonBarBuilder(buttonPan);
bsb.addGlue();
bsb.addButton(ok);
bsb.addButton(apply);
bsb.addButton(cancel);
bsb.addRelatedGap();
bsb.addButton(new HelpAction(HelpFile.CONTENT_SELECTOR).getHelpButton());
bsb.addGlue();
// Add panels to dialog:
con.fill = GridBagConstraints.BOTH;
getContentPane().setLayout(gbl);
con.weightx = 1;
con.weighty = 0.5;
con.gridwidth = 1;
con.gridheight = 1;
con.gridx = 0;
con.gridy = 0;
gbl.setConstraints(fieldPan, con);
getContentPane().add(fieldPan);
con.gridy = 1;
gbl.setConstraints(wordPan, con);
getContentPane().add(wordPan);
con.weighty = 0;
con.gridy = 2;
con.insets = new Insets(12, 2, 2, 2);
gbl.setConstraints(buttonPan, con);
getContentPane().add(buttonPan);
}
use of org.jabref.gui.help.HelpAction in project jabref by JabRef.
the class DatabasePropertiesDialog method init.
private void init() {
DirectoryDialogConfiguration directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder().withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build();
DialogService ds = new FXDialogService();
JButton browseFile = new JButton(Localization.lang("Browse"));
JButton browseFileIndv = new JButton(Localization.lang("Browse"));
browseFile.addActionListener(e -> DefaultTaskExecutor.runInJavaFXThread(() -> ds.showDirectorySelectionDialog(directoryDialogConfiguration)).ifPresent(f -> fileDir.setText(f.toAbsolutePath().toString())));
browseFileIndv.addActionListener(e -> DefaultTaskExecutor.runInJavaFXThread(() -> ds.showDirectorySelectionDialog(directoryDialogConfiguration)).ifPresent(f -> fileDirIndv.setText(f.toAbsolutePath().toString())));
setupSortOrderConfiguration();
FormLayout form = new FormLayout("left:pref, 4dlu, pref:grow, 4dlu, pref:grow, 4dlu, pref", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, fill:pref:grow, 180dlu, fill:pref:grow,");
FormBuilder builder = FormBuilder.create().layout(form);
builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
builder.add(Localization.lang("Library encoding")).xy(1, 1);
builder.add(encoding).xy(3, 1);
builder.addSeparator(Localization.lang("Override default file directories")).xyw(1, 3, 5);
builder.add(Localization.lang("General file directory")).xy(1, 5);
builder.add(fileDir).xy(3, 5);
builder.add(browseFile).xy(5, 5);
builder.add(Localization.lang("User-specific file directory")).xy(1, 7);
builder.add(fileDirIndv).xy(3, 7);
builder.add(browseFileIndv).xy(5, 7);
builder.addSeparator(Localization.lang("Save sort order")).xyw(1, 13, 5);
builder.add(saveInOriginalOrder).xyw(1, 15, 5);
builder.add(saveInSpecifiedOrder).xyw(1, 17, 5);
saveOrderPanel = new SaveOrderConfigDisplay();
builder.add(saveOrderPanel.getPanel()).xyw(1, 21, 5);
builder.addSeparator(Localization.lang("Library protection")).xyw(1, 23, 5);
builder.add(protect).xyw(1, 25, 5);
fieldFormatterCleanupsPanel = new FieldFormatterCleanupsPanel(Localization.lang("Enable save actions"), Cleanups.DEFAULT_SAVE_ACTIONS);
builder.addSeparator(Localization.lang("Save actions")).xyw(1, 27, 5);
builder.add(fieldFormatterCleanupsPanel).xyw(1, 29, 5);
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(ok);
bb.addButton(cancel);
bb.addRelatedGap();
bb.addButton(new HelpAction(HelpFile.DATABASE_PROPERTIES).getHelpButton());
bb.addGlue();
bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
pack();
AbstractAction closeAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
};
ActionMap am = builder.getPanel().getActionMap();
InputMap im = builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
am.put("close", closeAction);
ok.addActionListener(e -> {
storeSettings();
dispose();
});
cancel.addActionListener(e -> dispose());
}
Aggregations