use of org.zaproxy.zap.extension.httppanel.view.paramtable.addins.ParamAddinInterface in project zaproxy by zaproxy.
the class HttpPanelParamTableModel method setValueAt.
@Override
public void setValueAt(Object value, int row, int col) {
boolean changed = false;
HtmlParameter htmlParameter = allParams.get(row);
if (col == 0) {
htmlParameter.setType((HtmlParameter.Type) value);
changed = true;
} else if (col == 1) {
htmlParameter.setName((String) value);
changed = true;
} else if (col == 2) {
htmlParameter.setValue((String) value);
changed = true;
} else if (col == 3) {
if (value instanceof ParamAddinInterface) {
try {
htmlParameter.setValue(((ParamAddinInterface) value).convertData(htmlParameter.getValue()));
changed = true;
col = 2;
} catch (UnsupportedEncodingException e) {
log.warn(e.getMessage(), e);
}
}
}
if (changed) {
hasChanged = true;
this.fireTableCellUpdated(row, col);
}
if (row == allParams.size() - 1) {
htmlParameter = allParams.getLast();
if (!(htmlParameter.getName().isEmpty() && htmlParameter.getValue().isEmpty())) {
allParams.add(getDefaultHtmlParameter());
this.fireTableRowsInserted(row + 1, row + 1);
}
}
}
use of org.zaproxy.zap.extension.httppanel.view.paramtable.addins.ParamAddinInterface in project zaproxy by zaproxy.
the class HttpPanelParamTableView method initAddins.
private void initAddins() {
// Get all addins
addins = new LinkedList<>();
addins.add(new ParamAddinMagic());
addins.add(new ParamAddinUrlencode());
comboBoxAddIns = new JComboBox<>();
comboBoxAddIns.addItem(ADD_INS);
for (ParamAddinInterface addin : addins) {
comboBoxAddIns.addItem(addin);
}
comboBoxAddIns.addActionListener(new ComboBoxAddinsActionListener());
table.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(getComboBoxTypes()));
table.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
if (table.getColumnCount() != 4) {
return;
}
table.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(comboBoxAddIns));
table.getColumnModel().getColumn(3).setCellRenderer(new ComboBoxCellRenderer(comboBoxAddIns));
}
Aggregations