Search in sources :

Example 1 with UserInfoDlg

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("<", "&lt;");
            value = value.replaceAll(">", "&gt;");
            name = name.replaceAll("&", "&amp;");
            name = name.replaceAll("'", "&apos;");
            name = name.replaceAll("`", "&apos;");
            name = name.replaceAll("\"", "&quot;");
            name = name.replaceAll("<", "&lt;");
            name = name.replaceAll(">", "&gt;");
            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);
    }
}
Also used : TwikiTableConverter(alma.acs.logging.tools.TwikiTableConverter) CSVConverter(alma.acs.logging.tools.CSVConverter) ILogEntry(com.cosylab.logging.engine.log.ILogEntry) XMLConverter(alma.acs.logging.tools.XMLConverter) UserInfoDlg(com.cosylab.logging.settings.UserInfoDlg) TextConverter(alma.acs.logging.tools.TextConverter)

Aggregations

CSVConverter (alma.acs.logging.tools.CSVConverter)1 TextConverter (alma.acs.logging.tools.TextConverter)1 TwikiTableConverter (alma.acs.logging.tools.TwikiTableConverter)1 XMLConverter (alma.acs.logging.tools.XMLConverter)1 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)1 UserInfoDlg (com.cosylab.logging.settings.UserInfoDlg)1