Search in sources :

Example 1 with OOBibStyle

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());
}
Also used : OOBibStyle(org.jabref.logic.openoffice.OOBibStyle) MouseEvent(java.awt.event.MouseEvent) JTable(javax.swing.JTable) SortedList(ca.odell.glazedlists.SortedList) MouseAdapter(java.awt.event.MouseAdapter) TableColumnModel(javax.swing.table.TableColumnModel)

Aggregations

SortedList (ca.odell.glazedlists.SortedList)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 JTable (javax.swing.JTable)1 TableColumnModel (javax.swing.table.TableColumnModel)1 OOBibStyle (org.jabref.logic.openoffice.OOBibStyle)1