public GroupSelector(Vector groupData,
BibtexBaseFrame baseFrame,
SidePaneManager manager,
BibkeeperPrefs prefs) {
super(manager);
ths = this;
this.prefs = prefs;
groups = groupData;
this.manager = manager;
this.baseFrame = baseFrame;
double n = (double)(groups.size() - OFFSET);
while ((n >0) && (n/DIM != Math.floor(n/DIM))) {
groups.removeElementAt(groups.size()-1);
n = (double)(groups.size() - OFFSET);
// If the number of elements is not divisible by DIM, we're
// in trouble, so we must remove one or two elements.
}
Dimension butDim = new Dimension(24, 24);
newButton.setPreferredSize(butDim);
newButton.setMinimumSize(butDim);
refresh.setPreferredSize(butDim);
refresh.setMinimumSize(butDim);
helpButton.setPreferredSize(butDim);
helpButton.setMinimumSize(butDim);
newButton.addActionListener(this);
refresh.addActionListener(this);
andCb.addActionListener(this);
orCb.addActionListener(this);
newButton.setToolTipText("New group");
newButton.setToolTipText("Refresh view");
andCb.setToolTipText("Display only entries belonging to all selected"
+" groups.");
orCb.setToolTipText("Display all entries belonging to one or more "
+"of the selected groups.");
bgr.add(andCb);
bgr.add(orCb);
setLayout(gbl);
SidePaneHeader header = new SidePaneHeader
("Groups", GUIGlobals.groupsIconFile, this);
con.gridwidth = GridBagConstraints.REMAINDER;
con.fill = GridBagConstraints.BOTH;
gbl.setConstraints(header, con);
add(header);
con.gridwidth = 1;
con.weightx = 1;
gbl.setConstraints(newButton, con);
add(newButton);
gbl.setConstraints(refresh, con);
add(refresh);
con.gridwidth = GridBagConstraints.REMAINDER;
HelpAction helpAction = new HelpAction(baseFrame.helpDiag,
GUIGlobals.groupsHelp,
"Help on groups");
helpButton.addActionListener(helpAction);
helpButton.setToolTipText("Help on groups");
gbl.setConstraints(helpButton, con);
add(helpButton);
list = new JList();
revalidateList();
//list.setSelectedIndex(0);
list.addListSelectionListener(this);
list.setPrototypeCellValue("Suitable length");
// The line above decides on the list's preferred width.
list.setVisibleRowCount(GUIGlobals.GROUPS_VISIBLE_ROWS);
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
sp = new JScrollPane
(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
con.gridwidth = GridBagConstraints.REMAINDER;
con.weighty = 1;
gbl.setConstraints(sp, con);
add(sp);
JPanel lower = new JPanel();
lower.setLayout(gbl);
lower.setBorder(BorderFactory.createEtchedBorder());
con.weighty = 0;
con.anchor = GridBagConstraints.WEST;
gbl.setConstraints(andCb, con);
lower.add(andCb);
gbl.setConstraints(orCb, con);
lower.add(orCb);
gbl.setConstraints(lower, con);
add(lower);
definePopup();
}
The first element for each group defines which field to
use for the quicksearch. The next two define the name and
regexp for the group. |