use of org.jabref.logic.openoffice.OOBibStyle in project jabref by JabRef.
the class StyleSelectDialog method setupTable.
private void setupTable() {
styles = new BasicEventList<>();
EventList<OOBibStyle> sortedStyles = new SortedList<>(styles);
tableModel = (DefaultEventTableModel<OOBibStyle>) GlazedListsSwing.eventTableModelWithThreadProxyList(sortedStyles, new StyleTableFormat());
table = new JTable(tableModel);
TableColumnModel cm = table.getColumnModel();
cm.getColumn(0).setPreferredWidth(100);
cm.getColumn(1).setPreferredWidth(200);
cm.getColumn(2).setPreferredWidth(80);
selectionModel = (DefaultEventSelectionModel<OOBibStyle>) GlazedListsSwing.eventSelectionModelWithThreadProxyList(sortedStyles);
table.setSelectionModel(selectionModel);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent mouseEvent) {
if (mouseEvent.isPopupTrigger()) {
tablePopup(mouseEvent);
}
}
@Override
public void mouseReleased(MouseEvent mouseEvent) {
if (mouseEvent.isPopupTrigger()) {
tablePopup(mouseEvent);
}
}
});
selectionModel.getSelected().addListEventListener(new EntrySelectionListener());
}
Aggregations