public SimpleForm getForm() {
if (securityScansForm == null) {
securityScansForm = new SimpleForm();
PropertyHolderTable propertyHolderTable = new PropertyHolderTable(
SecurityScanUtil.getGlobalSensitiveInformationExposureTokens()) {
protected JTable buildPropertiesTable() {
propertiesModel = new DefaultPropertyHolderTableModel(holder) {
@Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return "Token";
case 1:
return "Description";
}
return null;
}
};
propertiesTable = new PropertiesHolderJTable();
propertiesTable.setSurrendersFocusOnKeystroke(true);
propertiesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
propertiesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
int selectedRow = propertiesTable.getSelectedRow();
if (removePropertyAction != null) {
removePropertyAction.setEnabled(selectedRow != -1);
}
if (movePropertyUpAction != null) {
movePropertyUpAction.setEnabled(selectedRow > 0);
}
if (movePropertyDownAction != null) {
movePropertyDownAction.setEnabled(selectedRow >= 0
&& selectedRow < propertiesTable.getRowCount() - 1);
}
}
});
propertiesTable.setDragEnabled(true);
propertiesTable.setTransferHandler(new TransferHandler("testProperty"));
if (getHolder().getModelItem() != null) {
DropTarget dropTarget = new DropTarget(propertiesTable,
new PropertyHolderTablePropertyExpansionDropTarget());
dropTarget.setDefaultActions(DnDConstants.ACTION_COPY_OR_MOVE);
}
return propertiesTable;
}
};
propertyHolderTable.setPreferredSize(new Dimension(200, 300));
securityScansForm.append(new JLabel(title));
securityScansForm.addSpace();
securityScansForm.addComponent(propertyHolderTable);
}