├── LICENSE.md
├── README.md
├── fetchArxiv
├── build.xml
├── fetchArxiv.1.0.jar
└── src
│ ├── fetchArxiv
│ ├── Actions.java
│ ├── FetchArxivPanel.java
│ └── FetchArxivPlugin.java
│ └── plugin.xml
└── renamefile
├── README.md
├── build.xml
├── lib
└── grouplayout.jar
└── src
├── about.txt
├── plugin.xml
└── renamefile
├── OptionsDialog.java
├── RenameDialog.java
├── RenameFilePanel.java
├── RenameFilePlugin.java
└── Utils.java
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Sergey Kor
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Jabref-plugins
2 |
3 | This is a small collection of plugins for the BibTex editor [JabRef](http://jabref.sourceforge.net/).
4 | Currently it contains plugins:
5 |
6 | * fetchArxiv
7 | * renamefile
8 |
9 | In order to install any plugin one has to
10 |
11 | 1. download the jar file for the plugin
12 | 2. go to Plugins/Manage plugins/Install plugin in JabRef
13 | 3. install the downloaded file
14 |
15 |
16 | ### fetchArxiv
17 | This plugin can be used to download a preprint information from arxiv.org by
18 | providing its arXiv ID. The ID is saved in the BibTex entry field "eprint".
19 |
20 | ### renamefile
21 | This plugin can be used to rename/copy/delete files attached to BibTex entries.
22 | The file information is stored in the entry field "file". Files can be renamed
23 | according to their BibTeX entry. The rename pattern uses an extended syntax of
24 | the [BibTeX key generator](http://jabref.sourceforge.net/help/LabelPatterns.php) of JabRef.
25 | For more infromation and examples see the help page of the plugin.
26 |
27 | The newest versions can be found [here](https://github.com/korv/Jabref-plugins/releases).
28 | The older versions can be found [here](https://github.com/korv/Jabref-plugins/downloads).
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/fetchArxiv/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/fetchArxiv/fetchArxiv.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/korv/Jabref-plugins/d47bc3e980768ac33a9aced1bc9a02c64a4f17f4/fetchArxiv/fetchArxiv.1.0.jar
--------------------------------------------------------------------------------
/fetchArxiv/src/fetchArxiv/Actions.java:
--------------------------------------------------------------------------------
1 | package fetchArxiv;
2 |
3 |
4 | import javax.swing.JOptionPane;
5 |
6 | import net.sf.jabref.*;
7 | import net.sf.jabref.imports.OAI2Fetcher;
8 |
9 | public class Actions {
10 | private BasePanel panel;
11 | private JabRefFrame frame;
12 |
13 | public Actions(JabRefFrame frame){
14 | this.frame=frame;
15 | panel=frame.basePanel();
16 | }
17 |
18 | public void actionNew(){
19 | getInfo(null);
20 | }
21 |
22 | public void actionInfo(){
23 | BibtexEntry[] bes = panel.mainTable.getSelectedEntries();
24 | for(BibtexEntry b:bes)
25 | getInfo(b);
26 | }
27 |
28 | public void actionId(){
29 | BibtexEntry[] bes = panel.mainTable.getSelectedEntries();
30 | for(BibtexEntry b:bes)
31 | getId(b);
32 | }
33 |
34 | private void getInfo(BibtexEntry b){
35 | String key;
36 | if(b!=null) {
37 | key=b.getField("eprint");
38 | key = (String)JOptionPane.showInputDialog(frame,
39 | "author: "+b.getField("author")+"\n"
40 | +"title: "+b.getField("title")+"\n"+
41 | "Please specify the ArXiv id:", "Get Info",
42 | JOptionPane.PLAIN_MESSAGE,null,null,key);
43 | } else {
44 | key = (String)JOptionPane.showInputDialog(frame,
45 | "Please specify the ArXiv id:", "New Entry",
46 | JOptionPane.PLAIN_MESSAGE,null,null,"");
47 |
48 | }
49 | if(key==null || key.isEmpty()) {
50 | return;
51 | }
52 | key=key.trim();
53 | OAI2Fetcher f = new OAI2Fetcher();
54 | // f.status=frame;
55 | BibtexEntry e = f.importOai2Entry(key);
56 | if(e==null || e.getField("author")==null) {
57 | frame.showMessage("Key: "+key+"not found");
58 | return;
59 | }
60 | if(b==null)
61 | b=panel.newEntry(BibtexEntryType.MISC);
62 | String[] fields={"author","title","eprint"};
63 | for(String s:fields)
64 | b.setField(s,e.getField(s));
65 | b.setField("year",getYearFromId(key));
66 | panel.markBaseChanged();
67 | // panel.highlightEntry(b);
68 | panel.showEntry(b);
69 | }
70 |
71 | private String getYearFromId(String key){
72 | // Id has the form math/1109267 or 1109.0267 (September 2011)
73 | int n=key.lastIndexOf("/");
74 | String y=key.substring(n+1,n+3);
75 | if(Integer.parseInt(y)>90)
76 | return "19" + y;
77 | else
78 | return "20" + y;
79 | }
80 |
81 | private void getId(BibtexEntry b){
82 | String key=b.getField("eprint");
83 | key = (String)JOptionPane.showInputDialog(frame,
84 | "author: "+b.getField("author")+"\n"
85 | +"title: "+b.getField("title")+"\n"+
86 | "Please specify the ArXiv id:", "Set id",
87 | JOptionPane.PLAIN_MESSAGE,null,null,key);
88 | if(key==null || key.isEmpty())
89 | return;
90 | b.setField("eprint",key);
91 | panel.markBaseChanged();
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/fetchArxiv/src/fetchArxiv/FetchArxivPanel.java:
--------------------------------------------------------------------------------
1 | package fetchArxiv;
2 |
3 |
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.*;
8 |
9 | import net.sf.jabref.*;
10 |
11 | @SuppressWarnings("serial")
12 | class FetchArxivPanel extends SidePaneComponent implements ActionListener {
13 |
14 | private JButton btnNew,btnInfo,btnId;
15 | private Actions actions;
16 |
17 | public FetchArxivPanel(SidePaneManager manager,JabRefFrame frame,JMenuItem menu) {
18 | super(manager, GUIGlobals.getIconUrl("openUrl"), "Fetch arXiv");
19 | this.manager = manager;
20 | setActiveBasePanel(frame.basePanel());
21 | actions = new Actions(frame);
22 |
23 | btnNew=getButton("New Entry","Create entry from an arXiv eprint","");
24 | btnInfo=getButton("Get Info","Fetch entry information from an arXiv eprint","");
25 | btnId=getButton("Set Id","Set eprint Id","");
26 |
27 | JPanel split = new JPanel();
28 | split.setLayout(new BoxLayout(split, BoxLayout.LINE_AXIS));
29 | split.add(btnNew);
30 | split.add(btnInfo);
31 | split.add(btnId);
32 |
33 | setContent(split);
34 | setName("fetchArxiv");
35 | }
36 |
37 | private JButton getButton(String title,String tip,String icon){
38 | JButton btn=new JButton(GUIGlobals.getImage(icon));
39 | btn.addActionListener(this);
40 | btn.setText(title);
41 | btn.setToolTipText(tip);
42 | return btn;
43 | }
44 |
45 | public void actionPerformed(ActionEvent e) {
46 | if (e.getSource() == btnNew)
47 | actions.actionNew();
48 | else if (e.getSource() == btnInfo)
49 | actions.actionInfo();
50 | else if (e.getSource() == btnId)
51 | actions.actionId();
52 | }
53 |
54 | public void componentOpening() {
55 | Globals.prefs.putBoolean("FAShow",true);
56 | }
57 |
58 | public void componentClosing() {
59 | Globals.prefs.putBoolean("FAShow",false);
60 | }
61 |
62 |
63 | }
--------------------------------------------------------------------------------
/fetchArxiv/src/fetchArxiv/FetchArxivPlugin.java:
--------------------------------------------------------------------------------
1 | package fetchArxiv;
2 |
3 |
4 | import net.sf.jabref.*;
5 | import net.sf.jabref.plugin.*;
6 |
7 | import javax.swing.*;
8 |
9 | import java.awt.event.*;
10 |
11 |
12 | public class FetchArxivPlugin implements SidePanePlugin, ActionListener {
13 |
14 | private JabRefFrame frame;
15 | protected SidePaneManager manager;
16 | private JMenuItem toggleMenu;
17 | private FetchArxivPanel comp;
18 |
19 | public void init(JabRefFrame frame, SidePaneManager manager) {
20 | this.manager = manager;
21 | this.frame = frame;
22 | toggleMenu = new JMenuItem("Toggle fetch arXiv panel",new ImageIcon(GUIGlobals.getIconUrl("openUrl")));
23 | toggleMenu.setMnemonic(KeyEvent.VK_F);
24 | toggleMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK+ActionEvent.ALT_MASK));
25 | toggleMenu.addActionListener(this);
26 | Globals.prefs.defaults.put("FAShow",true);
27 | }
28 |
29 | public SidePaneComponent getSidePaneComponent() {
30 | if (comp == null)
31 | comp = new FetchArxivPanel(manager,frame,toggleMenu);
32 | return comp;
33 | }
34 |
35 | public JMenuItem getMenuItem() {
36 | if (Globals.prefs.getBoolean("FAShow"))
37 | manager.show("fetchArxiv");
38 | return toggleMenu;
39 | }
40 |
41 | public String getShortcutKey() {
42 | return null;
43 | }
44 |
45 | public void actionPerformed(ActionEvent e) {
46 | if (e.getSource() == toggleMenu)
47 | manager.toggle("fetchArxiv");
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/fetchArxiv/src/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/renamefile/README.md:
--------------------------------------------------------------------------------
1 | # Renamefile
2 |
3 | This is a plugin for the BibTex editor [Jabref](http://jabref.sourceforge.net/).
4 | It can be used to rename/copy/delete files attached to BibTex entries.
5 | The file information is stored in the entry field "file".
6 | Files can be renamed according to their BibTeX entry. The rename pattern uses an extended syntax of
7 | the [BibTeX key generator](http://jabref.sourceforge.net/help/LabelPatterns.php) of JabRef.
8 | For more infromation and examples see the help page of the plugin.
9 |
10 | The newest versions can be found [here](https://github.com/korv/Jabref-plugins/releases).
11 | The older versions can be found [here](https://github.com/korv/Jabref-plugins/downloads).
12 |
13 | In order to install this plugin one has to
14 |
15 | 1. download the jar file for the plugin
16 | 2. go to Plugins/Manage plugins/Install plugin in JabRef
17 | 3. install the downloaded file
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/renamefile/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/renamefile/lib/grouplayout.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/korv/Jabref-plugins/d47bc3e980768ac33a9aced1bc9a02c64a4f17f4/renamefile/lib/grouplayout.jar
--------------------------------------------------------------------------------
/renamefile/src/about.txt:
--------------------------------------------------------------------------------
1 | Rename file plugin v1.6.2.
2 |
3 | This plugin can be used to rename/copy/delete files attached
4 | to the BibTex entries (stored in the field "file").
5 |
6 | 1. Name patterns
7 |
8 | Files can be renamed according to their BibTeX entry.
9 | The rename pattern uses the same syntax as the BibTeX
10 | key generator of JabRef. For more details see
11 | http://jabref.sourceforge.net/help/LabelPatterns.php
12 |
13 | Additionally to the existing keys there is a key [type]
14 | for an entry type.
15 |
16 | Additionally to the existing modifiers (:lower, :upper, :abbr)
17 | there is a modifier :regex:str1:str2 that replaces string str1
18 | by string str2. One can apply several modifiers to one field.
19 |
20 | Some examples of name patterns:
21 | [bibtexkey]
22 | folder/subfolder/[auth]. [shorttitle]
23 | [type]/[auth]-[year]-[title]
24 | [authors]. [title]
25 | [auth]-[year]-[shorttitle]
26 | [auth:lower]_[veryshorttitle:lower]_[year]
27 | [auth]_[title:regex: :_] - replaces spaces by underscores
28 | [authors:regex:':] - removes ' from all names
29 |
30 |
31 | 2. Folders
32 |
33 | 2.1. One can move files relative to their current position:
34 | Uncheck "Use folder".
35 |
36 | 2.2 One can move files relative to the file directory:
37 | Check "Use folder" and specify the relative folder.
38 | Example: folder/subfolder or folder\subfolder.
39 |
40 | The file directory should be defined in
41 | Options/Preferences/External programs/Main file directory
42 | If it is empty, then the location of the bib file is used.
43 |
44 | 2.3 One can move files using absolute paths:
45 | Check "Use folder" and specify the absolute folder.
46 | Example c:\folder\subfolder.
47 |
48 | 3. Several files in one entry
49 | If there are several files attached to one entry, then
50 | numbers are added at the end of file names.
51 |
52 |
53 | History
54 |
55 | Version 1.6.2 (Jul 2014)
56 | * Substitution for \ss, \aa, \AA, \o, \i, \l, \L
57 | * Remove accents \", \', \^, \v, \H, etc.
58 | * Remove all latex commands like \mathrm, \mathbb, etc.
59 |
60 | Version 1.6.1 (Jul 2014)
61 | * Bug fixes
62 | * Added modifier :regex:str1:str2
63 | * Compatibilty with JabRef 2.10.
64 |
65 | Version 1.5 (Feb 2014)
66 | * Added key [type] for an entry type.
67 | * Remove symbols \,/,<,>,?,{,},$,",:,\n from file names
68 |
69 | Version 1.4 (Jul 2012)
70 | * Help is added
71 | * Compatibility with JabRef 2.6
72 | * Dialog if file can not be deleted
73 | * Add numbers at the end of file names (with a confirmation
74 | dialog) if files to be created already exist.
75 | * No base change mark after copying of files.
76 |
77 | Version 1.3 (Jul 2012)
78 | * Compatibility with JabRef 2.8.1
79 | * Update entry editor after renaming of files.
80 |
81 | Version 1.2 (Sep 2011)
82 | * Remove some symbols from filenames.
83 |
84 | Version 1.1 (Nov 2010)
85 | * Rename/Copy/Delete implementation
86 |
--------------------------------------------------------------------------------
/renamefile/src/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/renamefile/src/renamefile/OptionsDialog.java:
--------------------------------------------------------------------------------
1 | package renamefile;
2 |
3 |
4 |
5 |
6 | import java.awt.*;
7 | import java.awt.event.*;
8 |
9 | import javax.swing.*;
10 |
11 | import net.sf.jabref.Globals;
12 |
13 | import org.dyno.visual.swing.layouts.*;
14 | import org.dyno.visual.swing.layouts.GroupLayout;
15 |
16 | public class OptionsDialog extends JDialog implements ActionListener{
17 | private static final long serialVersionUID = 1L;
18 | private JCheckBox cbName,cbDir;
19 | private JTextField tfDir,tfPattern;
20 | private JButton btnOk,btnCancel;
21 |
22 | public void mess(String s){
23 | JOptionPane.showMessageDialog (this,s, "Message", JOptionPane.INFORMATION_MESSAGE);
24 | }
25 |
26 | public OptionsDialog(Frame parent) {
27 | super(parent);
28 | initComponents();
29 | }
30 |
31 |
32 | private void initComponents() {
33 | initElements();
34 | readValues();
35 | JPanel p,p1;
36 |
37 | JPanel panel=new JPanel();
38 | panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
39 | add(panel);
40 |
41 | p=new JPanel();
42 | p.setLayout(new GroupLayout());
43 | p.add(cbDir, new Constraints(new Leading(10, 150, 8, 8), new Leading(10, 10, 10)));
44 | p.add(cbName, new Constraints(new Leading(10, 150, 8, 8), new Leading(38, 8, 8)));
45 | p.add(tfDir, new Constraints(new Bilateral(170, 12, 4), new Leading(12, 12, 12)));
46 | p.add(tfPattern, new Constraints(new Bilateral(170, 12, 4), new Leading(40, 12, 12)));
47 |
48 | p1=new JPanel();
49 | p1.setLayout(new BoxLayout(p1, BoxLayout.X_AXIS));
50 | p1.add(p);
51 | panel.add(p1);
52 |
53 | p=new JPanel();
54 | p.add(btnOk);
55 | p.add(btnCancel);
56 | p1=new JPanel();
57 | p1.setLayout(new BoxLayout(p1,BoxLayout.X_AXIS));
58 | p1.add(p);
59 | panel.add(p1);
60 |
61 | setSize(800, 120);
62 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
63 | setTitle("Options");
64 | setLocationRelativeTo(null);
65 | getContentPane().setPreferredSize(getSize());
66 | pack();
67 | setVisible(true);
68 | }
69 |
70 | private void initElements(){
71 | cbDir = new JCheckBox();
72 | cbDir.setText("Use folder:");
73 | cbName = new JCheckBox();
74 | cbName.setText("Use name pattern:");
75 | tfDir = new JTextField();
76 | tfDir.addActionListener(this);
77 | tfPattern = new JTextField();
78 | btnOk = new JButton();
79 | btnOk.setText("Ok");
80 | btnOk.addActionListener(this);
81 | btnOk.setPreferredSize(new Dimension(100, 26));
82 | btnCancel = new JButton();
83 | btnCancel.setText("Cancel");
84 | btnCancel.addActionListener(this);
85 | btnCancel.setPreferredSize(new Dimension(100, 26));
86 | }
87 |
88 | @Override
89 | public void actionPerformed(ActionEvent e) {
90 | Object o=e.getSource();
91 | if(o==btnOk) {
92 | saveValues();
93 | dispose();
94 | } else if(o==btnCancel)
95 | dispose();
96 | }
97 |
98 | private void readValues(){
99 | cbDir.setSelected(!Globals.prefs.getBoolean("SameFolder"));
100 | cbName.setSelected(!Globals.prefs.getBoolean("SameName"));
101 | tfDir.setText(Globals.prefs.get("MoveFolder"));
102 | tfPattern.setText(Globals.prefs.get("RenamePattern"));
103 | }
104 | private void saveValues(){
105 | Globals.prefs.putBoolean("SameFolder",!cbDir.isSelected());
106 | Globals.prefs.putBoolean("SameName",!cbName.isSelected());
107 | Globals.prefs.put("MoveFolder",tfDir.getText());
108 | Globals.prefs.put("RenamePattern",tfPattern.getText());
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/renamefile/src/renamefile/RenameDialog.java:
--------------------------------------------------------------------------------
1 | package renamefile;
2 |
3 |
4 | import javax.swing.*;
5 | import javax.swing.table.*;
6 |
7 | import org.dyno.visual.swing.layouts.Bilateral;
8 | import org.dyno.visual.swing.layouts.Constraints;
9 | import org.dyno.visual.swing.layouts.GroupLayout;
10 | import org.dyno.visual.swing.layouts.Leading;
11 |
12 | import java.awt.*;
13 | import java.awt.event.*;
14 | import java.io.File;
15 | import java.io.IOException;
16 | import java.util.HashMap;
17 | import java.util.ArrayList;
18 | import net.sf.jabref.*;
19 | import net.sf.jabref.gui.*;
20 |
21 | public class RenameDialog extends JDialog implements ActionListener, FocusListener{
22 | private static final long serialVersionUID = 1L;
23 | private final int[] renWidth={10,100,100,300,300,300};
24 | private final int[] delWidth={10,100,100,300,300};
25 | private JabRefFrame frame;
26 | private BibtexEntry[] bes;
27 | private int mode;
28 |
29 |
30 | private FLTableModel tm;
31 | private JTable table;
32 | private JPanel panel;
33 | private JCheckBox cbName,cbDir;
34 | private JTextField tfDir,tfPattern;
35 | private JButton btnOk,btnCancel;
36 |
37 | private final String[] titleString={"Rename/move files","Copy files","Delete files"};
38 |
39 | public RenameDialog(JabRefFrame frame,BibtexEntry[] bes ) {
40 | this(frame,bes,0);
41 | }
42 |
43 | public RenameDialog(JabRefFrame frame,BibtexEntry[] bes, int mode) {
44 | super(frame);
45 | this.frame=frame;
46 | this.bes=bes;
47 | this.mode=mode;
48 | initElements();
49 |
50 | JPanel p,p1;
51 | panel=new JPanel();
52 | panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
53 | add(panel);
54 |
55 | p = new JPanel();
56 | p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
57 | p.add(new JScrollPane(table));
58 | p.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
59 | panel.add(p);
60 |
61 | if(mode!=2){
62 | p=new JPanel();
63 | p.setLayout(new GroupLayout());
64 | p.add(cbDir, new Constraints(new Leading(10, 150, 8, 8), new Leading(10, 10, 10)));
65 | p.add(cbName, new Constraints(new Leading(10, 150, 8, 8), new Leading(38, 8, 8)));
66 | p.add(tfDir, new Constraints(new Bilateral(170, 12, 4), new Leading(12, 12, 12)));
67 | p.add(tfPattern, new Constraints(new Bilateral(170, 12, 4), new Leading(40, 12, 12)));
68 |
69 | p1=new JPanel();
70 | p1.setLayout(new BoxLayout(p1, BoxLayout.X_AXIS));
71 | p1.add(p);
72 | panel.add(p1);
73 | }
74 |
75 | p=new JPanel();
76 | p.add(btnOk);
77 | p.add(btnCancel);
78 | p1=new JPanel();
79 | p1.setLayout(new BoxLayout(p1,BoxLayout.X_AXIS));
80 | p1.add(p);
81 | panel.add(p1);
82 |
83 | setTitle(titleString[mode]);
84 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
85 | getRootPane().setDefaultButton(btnOk);
86 | pack();
87 | setLocationRelativeTo(null);
88 | setVisible(true);
89 | }
90 |
91 | private void initElements(){
92 | if(mode!=2){
93 | cbDir = new JCheckBox();
94 | cbDir.setText("Use folder:");
95 | cbDir.addActionListener(this);
96 | cbName = new JCheckBox();
97 | cbName.setText("Use name pattern:");
98 | cbName.addActionListener(this);
99 | tfDir = new JTextField();
100 | tfDir.addFocusListener(this);
101 | tfDir.addActionListener(this);
102 | tfPattern = new JTextField();
103 | tfPattern.addFocusListener(this);
104 | tfPattern.addActionListener(this);
105 | readValues();
106 | }
107 | btnOk = new JButton();
108 | btnOk.setText("Ok");
109 | btnOk.addActionListener(this);
110 | btnOk.setPreferredSize(new Dimension(100, 26));
111 | btnCancel = new JButton();
112 | btnCancel.setText("Cancel");
113 | btnCancel.addActionListener(this);
114 | btnCancel.setPreferredSize(new Dimension(100, 26));
115 | tm = new FLTableModel(bes,mode);
116 | table = new JTable(tm);
117 | table.setPreferredScrollableViewportSize(new Dimension(800, 200));
118 | table.setFillsViewportHeight(true);
119 | // table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
120 | int[] width = mode==2 ? delWidth : renWidth;
121 | for(int i=0;i> data;
132 | private int mode;
133 |
134 | public FLTableModel(BibtexEntry[] b,int mode) {
135 | this.mode=mode;
136 | columnNames = mode==2 ? delNames : renNames;
137 | setData(b);
138 | }
139 |
140 | public void setData(BibtexEntry[] b){
141 | data = new ArrayList>();
142 | FileListTableModel m;
143 | for (BibtexEntry e:b) {
144 | m = new FileListTableModel();
145 | m.setContent(e.getField("file"));
146 | for (int j=0;j r= new HashMap