Search in sources :

Example 21 with JXTable

use of org.jdesktop.swingx.JXTable in project MtgDesktopCompanion by nicho92.

the class MagicEventsDashlet method initGUI.

public void initGUI() {
    provider = new MTGEventProvider();
    JPanel panneauHaut = new JPanel();
    getContentPane().add(panneauHaut, BorderLayout.NORTH);
    cboYear = new JComboBox<>();
    cboYear.addItemListener(ie -> init());
    panneauHaut.add(cboYear);
    lblLoading = new JLabel("");
    lblLoading.setIcon(MTGConstants.ICON_LOADING);
    lblLoading.setVisible(false);
    cboMonth = new JComboBox<>();
    panneauHaut.add(cboMonth);
    panneauHaut.add(lblLoading);
    JScrollPane scrollPane = new JScrollPane();
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    eventsModel = new MagicEventsTableModel();
    table = new JXTable();
    scrollPane.setViewportView(table);
    c = GregorianCalendar.getInstance();
    c.setTime(new Date());
    for (int i = c.get(Calendar.YEAR) - 1; i <= c.get(Calendar.YEAR) + 1; i++) cboYear.addItem(i);
    for (int i = 1; i < 13; i++) cboMonth.addItem(i);
    cboYear.setSelectedItem(c.get(Calendar.YEAR));
    cboMonth.setSelectedItem(c.get(Calendar.MONTH) + 1);
    cboYear.addItemListener(ie -> {
        if (ie.getStateChange() == ItemEvent.SELECTED) {
            init();
        }
    });
    cboMonth.addItemListener(ie -> {
        if (ie.getStateChange() == ItemEvent.SELECTED) {
            init();
        }
    });
    if (getProperties().size() > 0) {
        Rectangle r = new Rectangle((int) Double.parseDouble(getProperty("x")), (int) Double.parseDouble(getProperty("y")), (int) Double.parseDouble(getProperty("w")), (int) Double.parseDouble(getProperty("h")));
        setBounds(r);
    }
    setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JXTable(org.jdesktop.swingx.JXTable) MTGEventProvider(org.magic.services.extra.MTGEventProvider) Rectangle(java.awt.Rectangle) JLabel(javax.swing.JLabel) MagicEventsTableModel(org.magic.gui.models.MagicEventsTableModel) Date(java.util.Date)

Example 22 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 23 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)

Example 24 with JXTable

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

the class PolicyPassiveScanPanel method getPassiveScanRulesTable.

private JXTable getPassiveScanRulesTable() {
    if (passiveScanRulesTable == null) {
        passiveScanRulesTable = new JXTable();
        passiveScanRulesTable.setModel(getPassiveScanTableModel());
        passiveScanRulesTable.setRowHeight(DisplayUtils.getScaledSize(18));
        passiveScanRulesTable.setIntercellSpacing(new java.awt.Dimension(1, 1));
        passiveScanRulesTable.setAutoCreateRowSorter(true);
        // Default sort by name (column 0)
        List<RowSorter.SortKey> sortKeys = new ArrayList<>(1);
        sortKeys.add(new RowSorter.SortKey(0, SortOrder.ASCENDING));
        passiveScanRulesTable.getRowSorter().setSortKeys(sortKeys);
        for (int i = 0; i < passiveScanRulesTable.getColumnCount() - 1; i++) {
            TableColumn column = passiveScanRulesTable.getColumnModel().getColumn(i);
            column.setPreferredWidth(width[i]);
        }
        JComboBox<String> jcb1 = new JComboBox<>();
        for (AlertThreshold level : AlertThreshold.values()) {
            jcb1.addItem(Constant.messages.getString("ascan.policy.level." + level.name().toLowerCase(Locale.ROOT)));
        }
        passiveScanRulesTable.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(jcb1));
    }
    return passiveScanRulesTable;
}
Also used : RowSorter(javax.swing.RowSorter) JXTable(org.jdesktop.swingx.JXTable) JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) TableColumn(javax.swing.table.TableColumn) AlertThreshold(org.parosproxy.paros.core.scanner.Plugin.AlertThreshold) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 25 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)

Aggregations

JXTable (org.jdesktop.swingx.JXTable)25 JScrollPane (javax.swing.JScrollPane)13 JPanel (javax.swing.JPanel)11 JLabel (javax.swing.JLabel)10 Rectangle (java.awt.Rectangle)6 ArrayList (java.util.ArrayList)6 BorderLayout (java.awt.BorderLayout)5 JButton (javax.swing.JButton)5 TableFilterHeader (net.coderazzi.filters.gui.TableFilterHeader)5 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)4 JComboBox (javax.swing.JComboBox)4 MagicEdition (org.magic.api.beans.MagicEdition)4 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)3 Component (java.awt.Component)3 SQLException (java.sql.SQLException)3 List (java.util.List)3 JSpinner (javax.swing.JSpinner)3 JSplitPane (javax.swing.JSplitPane)3 JTabbedPane (javax.swing.JTabbedPane)3 SpinnerNumberModel (javax.swing.SpinnerNumberModel)3