Search in sources :

Example 6 with JXTable

use of org.jdesktop.swingx.JXTable in project zaproxy by zaproxy.

the class MultipleOptionsTablePanel method createTable.

protected JXTable createTable() {
    JXTable table = new JXTable();
    table.setColumnControlVisible(true);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    return table;
}
Also used : JXTable(org.jdesktop.swingx.JXTable)

Example 7 with JXTable

use of org.jdesktop.swingx.JXTable in project zaproxy by zaproxy.

the class ParamsPanel method getParamsTable.

protected JXTable getParamsTable() {
    if (paramsTable == null) {
        paramsTable = new JXTable(paramsModel);
        paramsTable.setColumnSelectionAllowed(false);
        paramsTable.setCellSelectionEnabled(false);
        paramsTable.setRowSelectionAllowed(true);
        paramsTable.setAutoCreateRowSorter(true);
        paramsTable.setColumnControlVisible(true);
        this.setParamsTableColumnSizes();
        paramsTable.setName(PANEL_NAME);
        paramsTable.setDoubleBuffered(true);
        paramsTable.addMouseListener(new java.awt.event.MouseAdapter() {

            @Override
            public void mousePressed(java.awt.event.MouseEvent e) {
                showPopupMenuIfTriggered(e);
            }

            @Override
            public void mouseReleased(java.awt.event.MouseEvent e) {
                showPopupMenuIfTriggered(e);
            }

            private void showPopupMenuIfTriggered(java.awt.event.MouseEvent e) {
                if (e.isPopupTrigger()) {
                    // Select table item
                    int row = paramsTable.rowAtPoint(e.getPoint());
                    if (row < 0 || !paramsTable.getSelectionModel().isSelectedIndex(row)) {
                        paramsTable.getSelectionModel().clearSelection();
                        if (row >= 0) {
                            paramsTable.getSelectionModel().setSelectionInterval(row, row);
                        }
                    }
                    View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY());
                }
            }
        });
    }
    return paramsTable;
}
Also used : JXTable(org.jdesktop.swingx.JXTable)

Example 8 with JXTable

use of org.jdesktop.swingx.JXTable in project zaproxy by zaproxy.

the class BreakpointsPanel method getBreakpoints.

protected JXTable getBreakpoints() {
    if (breakpointsTable == null) {
        breakpointsTable = new JXTable(model);
        breakpointsTable.setColumnSelectionAllowed(false);
        breakpointsTable.setCellSelectionEnabled(false);
        breakpointsTable.setRowSelectionAllowed(true);
        breakpointsTable.setColumnControlVisible(true);
        breakpointsTable.getColumnModel().getColumn(0).setPreferredWidth(restoreColumnWidth(BRK_TABLE, 100));
        breakpointsTable.getColumnModel().getColumn(0).addPropertyChangeListener(new ColumnResizedListener(BRK_TABLE));
        breakpointsTable.getColumnModel().getColumn(0).setMaxWidth(250);
        breakpointsTable.getTableHeader().setReorderingAllowed(false);
        breakpointsTable.setName(PANEL_NAME);
        breakpointsTable.setDoubleBuffered(true);
        breakpointsTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        breakpointsTable.addMouseListener(new java.awt.event.MouseAdapter() {

            @Override
            public void mousePressed(java.awt.event.MouseEvent e) {
                showPopupMenuIfTriggered(e);
            }

            @Override
            public void mouseReleased(java.awt.event.MouseEvent e) {
                showPopupMenuIfTriggered(e);
            }

            private void showPopupMenuIfTriggered(java.awt.event.MouseEvent e) {
                if (e.isPopupTrigger()) {
                    // Select table item
                    int row = breakpointsTable.rowAtPoint(e.getPoint());
                    if (row < 0 || !breakpointsTable.getSelectionModel().isSelectedIndex(row)) {
                        breakpointsTable.getSelectionModel().clearSelection();
                        if (row >= 0) {
                            breakpointsTable.getSelectionModel().setSelectionInterval(row, row);
                        }
                    }
                    View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY());
                }
            }

            @Override
            public void mouseClicked(java.awt.event.MouseEvent e) {
                if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) {
                    // Its a double click
                    extension.editUiSelectedBreakpoint();
                }
            }
        });
    }
    return breakpointsTable;
}
Also used : JXTable(org.jdesktop.swingx.JXTable)

Aggregations

JXTable (org.jdesktop.swingx.JXTable)8 ArrayList (java.util.ArrayList)3 JScrollPane (javax.swing.JScrollPane)2 RowSorter (javax.swing.RowSorter)2 TableModelEvent (javax.swing.event.TableModelEvent)2 TableModelListener (javax.swing.event.TableModelListener)2 CompoundHighlighter (org.jdesktop.swingx.decorator.CompoundHighlighter)2 DefaultTableRenderer (org.jdesktop.swingx.renderer.DefaultTableRenderer)2 MappedValue (org.jdesktop.swingx.renderer.MappedValue)2 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 AbstractTableModel (javax.swing.table.AbstractTableModel)1