use of org.zaproxy.zap.view.ZapTable in project zaproxy by zaproxy.
the class SpiderPanel method getUrlsTable.
/**
* Gets the scan results table.
*
* @return the scan results table
*/
private JXTable getUrlsTable() {
if (urlsTable == null) {
// Create the table with a default, empty TableModel and the proper settings
urlsTable = new ZapTable(EMPTY_URLS_TABLE_MODEL);
urlsTable.setColumnSelectionAllowed(false);
urlsTable.setCellSelectionEnabled(false);
urlsTable.setRowSelectionAllowed(true);
urlsTable.setAutoCreateRowSorter(true);
urlsTable.setAutoCreateColumnsFromModel(false);
urlsTable.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new MappedValue(StringValues.EMPTY, IconValues.NONE), JLabel.CENTER));
urlsTable.getColumnExt(0).setHighlighters(new ProcessedCellItemIconHighlighter(0));
urlsTable.getColumnModel().getColumn(0).setMinWidth(80);
// processed
urlsTable.getColumnModel().getColumn(0).setPreferredWidth(90);
urlsTable.getColumnModel().getColumn(1).setMinWidth(60);
// method
urlsTable.getColumnModel().getColumn(1).setPreferredWidth(70);
// name
urlsTable.getColumnModel().getColumn(2).setMinWidth(300);
urlsTable.getColumnModel().getColumn(3).setMinWidth(50);
// flags
urlsTable.getColumnModel().getColumn(3).setPreferredWidth(250);
urlsTable.setName(PANEL_NAME);
urlsTable.setDoubleBuffered(true);
urlsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
urlsTable.setComponentPopupMenu(new JPopupMenu() {
private static final long serialVersionUID = 6608291059686282641L;
@Override
public void show(Component invoker, int x, int y) {
View.getSingleton().getPopupMenu().show(invoker, x, y);
}
});
}
return urlsTable;
}
use of org.zaproxy.zap.view.ZapTable in project zaproxy by zaproxy.
the class ActiveScanPanel method getFilterMessageTable.
private ZapTable getFilterMessageTable() {
if (filterMessageTable == null) {
this.filterMessageTable = new ZapTable(EMPTY_FILTER_MESSAGE_MODEL);
this.filterMessageTable.setName("FilterMessageTable");
this.filterMessageTable.setAutoCreateColumnsFromModel(false);
}
return this.filterMessageTable;
}
use of org.zaproxy.zap.view.ZapTable in project zaproxy by zaproxy.
the class SpiderPanel method getAddedNodesTable.
private JXTable getAddedNodesTable() {
if (addedNodesTable == null) {
// Create the table with a default, empty TableModel and the proper settings
addedNodesTable = new ZapTable(EMPTY_URLS_NO_FLAGS_TABLE_MODEL);
addedNodesTable.setColumnSelectionAllowed(false);
addedNodesTable.setCellSelectionEnabled(false);
addedNodesTable.setRowSelectionAllowed(true);
addedNodesTable.setAutoCreateRowSorter(true);
addedNodesTable.setAutoCreateColumnsFromModel(false);
addedNodesTable.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new MappedValue(StringValues.EMPTY, IconValues.NONE), JLabel.CENTER));
addedNodesTable.getColumnExt(0).setHighlighters(new ProcessedCellItemIconHighlighter(0));
addedNodesTable.getColumnModel().getColumn(0).setMinWidth(80);
// processed
addedNodesTable.getColumnModel().getColumn(0).setPreferredWidth(90);
addedNodesTable.getColumnModel().getColumn(1).setMinWidth(60);
// method
addedNodesTable.getColumnModel().getColumn(1).setPreferredWidth(70);
// name
addedNodesTable.getColumnModel().getColumn(2).setMinWidth(400);
addedNodesTable.getColumnModel().getColumn(2).setPreferredWidth(1000);
addedNodesTable.setName(ADDED_NODES_CONTAINER_NAME);
addedNodesTable.setDoubleBuffered(true);
addedNodesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
addedNodesTable.setComponentPopupMenu(new JPopupMenu() {
private static final long serialVersionUID = 6608291059686282641L;
@Override
public void show(Component invoker, int x, int y) {
View.getSingleton().getPopupMenu().show(invoker, x, y);
}
});
}
return addedNodesTable;
}
use of org.zaproxy.zap.view.ZapTable in project zaproxy by zaproxy.
the class AlertViewPanel method createAlertTagsPanel.
private JPanel createAlertTagsPanel() {
JPanel alertTagsPanel = new JXPanel(new BorderLayout());
alertTagsPanel.setName("Alert Tags Panel");
alertTagsPanel.setBorder(BorderFactory.createTitledBorder(null, Constant.messages.getString("alert.label.tags"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard)));
alertTagsTableModel = new AlertTagsTableModel();
alertTagsTable = new ZapTable(alertTagsTableModel);
alertTagsTable.setPreferredScrollableViewportSize(new Dimension(alertTagsTable.getPreferredSize().width, alertTagsTable.getRowHeight() * 5));
if (!editable) {
alertTagsTable.setCellSelectionEnabled(true);
}
JScrollPane alertTagsSp = new JScrollPane();
alertTagsSp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
alertTagsSp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
alertTagsSp.setViewportView(alertTagsTable);
alertTagsSp.addKeyListener(new KeyAdapter() {
// Change tab key to transfer focus to the next element
@Override
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
alertTagsTable.transferFocus();
}
}
});
if (editable) {
JToolBar alertTagsToolBar = new JToolBar();
alertTagsToolBar.setEnabled(true);
alertTagsToolBar.setFloatable(false);
alertTagsToolBar.setRollover(true);
alertTagsToolBar.setName("Alert Tags Editing Toolbar");
JButton addTagButton = new JButton();
addTagButton.setToolTipText(Constant.messages.getString("alert.tags.button.add"));
addTagButton.setIcon(DisplayUtils.getScaledIcon(new ImageIcon(AlertViewPanel.class.getResource("/resource/icon/16/103.png"))));
addTagButton.addActionListener(e -> showAddAlertTagDialogue());
alertTagsToolBar.add(addTagButton);
JButton deleteTagButton = new JButton();
deleteTagButton.setToolTipText(Constant.messages.getString("alert.tags.button.delete"));
deleteTagButton.setIcon(DisplayUtils.getScaledIcon(new ImageIcon(AlertViewPanel.class.getResource("/resource/icon/16/104.png"))));
deleteTagButton.addActionListener(e -> alertTagsTableModel.deleteTags(alertTagsTable.getSelectedRows()));
deleteTagButton.setEnabled(false);
alertTagsToolBar.add(deleteTagButton);
JButton editTagButton = new JButton();
editTagButton.setToolTipText(Constant.messages.getString("alert.tags.button.modify"));
editTagButton.setIcon(DisplayUtils.getScaledIcon(new ImageIcon(AlertViewPanel.class.getResource("/resource/icon/16/018.png"))));
editTagButton.addActionListener(e -> showModifyAlertTagDialogue());
editTagButton.setEnabled(false);
alertTagsToolBar.add(editTagButton);
alertTagsTable.getSelectionModel().addListSelectionListener(e -> {
if (alertTagsTable.getSelectedRow() == -1) {
deleteTagButton.setEnabled(false);
editTagButton.setEnabled(false);
return;
}
if (!deleteTagButton.isEnabled()) {
deleteTagButton.setEnabled(true);
}
if (!editTagButton.isEnabled()) {
editTagButton.setEnabled(true);
}
});
alertTagsTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JTable table = (JTable) e.getSource();
if (e.getClickCount() == 2 && table.getSelectedRow() != -1) {
showModifyAlertTagDialogue();
}
}
});
alertTagsPanel.add(alertTagsToolBar, BorderLayout.PAGE_START);
}
alertTagsPanel.add(alertTagsSp, BorderLayout.CENTER);
return alertTagsPanel;
}
use of org.zaproxy.zap.view.ZapTable in project zaproxy by zaproxy.
the class OptionsExtensionPanel method getTableExtension.
/**
* This method initializes tableAuth
*
* @return javax.swing.JTable
*/
private ZapTable getTableExtension() {
if (tableExt == null) {
tableExt = new ZapTable() {
private static final long serialVersionUID = 1L;
@Override
protected AutoScrollAction createAutoScrollAction() {
return null;
}
};
tableExt.setAutoScrollOnNewValues(false);
tableExt.setModel(getExtensionModel());
tableExt.setRowHeight(DisplayUtils.getScaledSize(18));
tableExt.getColumnModel().getColumn(0).setPreferredWidth(DisplayUtils.getScaledSize(70));
tableExt.getColumnModel().getColumn(1).setPreferredWidth(DisplayUtils.getScaledSize(70));
tableExt.getColumnModel().getColumn(2).setPreferredWidth(DisplayUtils.getScaledSize(120));
tableExt.getColumnModel().getColumn(3).setPreferredWidth(DisplayUtils.getScaledSize(220));
tableExt.setSortOrder(3, SortOrder.ASCENDING);
ListSelectionListener sl = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent arg0) {
int selectedRow = tableExt.getSelectedRow();
if (selectedRow > -1) {
Extension ext = getExtensionModel().getExtension(tableExt.convertRowIndexToModel(selectedRow));
if (ext != null) {
try {
extName.setText(ext.getUIName());
boolean addOnExtension = ext.getAddOn() != null;
addOnNameLabel.setVisible(addOnExtension);
addOnName.setVisible(addOnExtension);
addOnName.setText(addOnExtension ? ext.getAddOn().getName() : "");
extDescription.setText(ext.getDescription());
extAuthor.setText(ext.getAuthor());
if (ext.getURL() != null) {
extURL.setText(ext.getURL().toString());
getUrlLaunchButton().setEnabled(true);
} else {
extURL.setText("");
getUrlLaunchButton().setEnabled(false);
}
} catch (Exception e) {
// Just to be safe
log.error(e.getMessage(), e);
}
}
}
}
};
tableExt.getSelectionModel().addListSelectionListener(sl);
tableExt.setColumnControlVisible(true);
}
return tableExt;
}
Aggregations