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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations