use of com.cosylab.logging.settings.UserInfoDlg in project ACS by ACS-Community.
the class TablePopupMenu method actionPerformed.
/**
* Handle the events from the menu
*
* @param e The event
*/
public void actionPerformed(ActionEvent e) {
if (textToCopy == null) {
return;
}
if (e.getSource() == copyClipXml) {
copyToClipboard(new XMLConverter());
} else if (e.getSource() == copyClipTxt) {
copyToClipboard(new TextConverter(null));
} else if (e.getSource() == copyClipTwikiTable) {
copyToClipboard(new TwikiTableConverter(null));
} else if (e.getSource() == copyClipCSV) {
copyToClipboard(new CSVConverter());
} else if (e.getSource() == addUserInfo) {
// Show the dialog
UserInfoDlg dlg = new UserInfoDlg();
if (dlg.okPressed()) {
String name = dlg.getInfoName();
String value = dlg.getInfo();
// Replace some chars potentially dangerous for xml
value = value.replaceAll("&", "&");
value = value.replaceAll("'", "'");
value = value.replaceAll("`", "'");
value = value.replaceAll("\"", """);
value = value.replaceAll("<", "<");
value = value.replaceAll(">", ">");
name = name.replaceAll("&", "&");
name = name.replaceAll("'", "'");
name = name.replaceAll("`", "'");
name = name.replaceAll("\"", """);
name = name.replaceAll("<", "<");
name = name.replaceAll(">", ">");
ILogEntry logEntry = model.getVisibleLogEntry(table.convertRowIndexToModel(row));
logEntry.addData(name, value);
model.replaceLog(table.convertRowIndexToModel(row), logEntry);
LogTableDataModel tableModel = (LogTableDataModel) table.getModel();
tableModel.fireTableRowsUpdated(table.convertRowIndexToModel(row), table.convertRowIndexToModel(row));
table.setRowSelectionInterval(row, row);
loggingClient.setLogDetailContent(logEntry);
}
} else if (e.getSource() == saveSelectedAsCSV) {
saveSelectedLogs(new CSVConverter(), saveCsvIcon, "txt");
} else if (e.getSource() == saveSelectedAsText) {
saveSelectedLogs(new TextConverter(null), saveTextIcon, "txt");
} else if (e.getSource() == saveSelectedAsTwiki) {
saveSelectedLogs(new TwikiTableConverter(null), saveTwikiTableIcon, "txt");
} else if (e.getSource() == saveSelectedAsXML) {
saveSelectedLogs(new XMLConverter(), saveXmlIcon, "xml");
} else if (e.getSource() == showErrorStack) {
if (stackId != null && !stackId.isEmpty()) {
loggingClient.addErrorTab(stackId);
}
} else if (e.getSource() == zoomOverSelected) {
Thread t = new Thread(new Runnable() {
public void run() {
table.zoom();
}
});
t.setDaemon(true);
t.setName("TablePopupMenu.actionPerformed.Zoom");
t.start();
} else if (e.getSource() == showsOnlyMI || e.getSource() == filtersOutMI) {
filters(e.getSource() == filtersOutMI);
} else {
System.err.println("Unhandled event " + e);
}
}
Aggregations