Search in sources :

Example 1 with LogColumn

use of org.netxms.client.log.LogColumn in project netxms by netxms.

the class FilterBuilder method createColumnSelectionMenu.

/**
 * Create menu for selecting log column
 *
 * @param listener selection listener
 */
private void createColumnSelectionMenu(final ColumnSelectionHandler handler) {
    if (logHandle == null)
        return;
    if (columnSelectionMenu != null)
        columnSelectionMenu.dispose();
    columnSelectionMenu = new Menu(getShell(), SWT.POP_UP);
    getShell().setMenu(columnSelectionMenu);
    for (final LogColumn lc : logHandle.getColumns()) {
        MenuItem item = new MenuItem(columnSelectionMenu, SWT.PUSH);
        item.setText(lc.getDescription());
        item.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handler.columnSelected(lc);
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
    }
    columnSelectionMenu.addMenuListener(new MenuListener() {

        @Override
        public void menuShown(MenuEvent e) {
        }

        @Override
        public void menuHidden(MenuEvent e) {
            getShell().setMenu(null);
        }
    });
    columnSelectionMenu.setVisible(true);
}
Also used : LogColumn(org.netxms.client.log.LogColumn) MenuListener(org.eclipse.swt.events.MenuListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) SelectionListener(org.eclipse.swt.events.SelectionListener) MenuEvent(org.eclipse.swt.events.MenuEvent)

Example 2 with LogColumn

use of org.netxms.client.log.LogColumn in project netxms by netxms.

the class LogTest method testLogInfo.

public void testLogInfo() throws Exception {
    final NXCSession session = connect();
    final Log log = session.openServerLog("EventLog");
    Collection<LogColumn> columns = log.getColumns();
    for (LogColumn c : columns) {
        System.out.println(c.getName() + ":" + c.getType() + ":" + c.getDescription());
    }
    log.close();
}
Also used : LogColumn(org.netxms.client.log.LogColumn) Log(org.netxms.client.log.Log)

Example 3 with LogColumn

use of org.netxms.client.log.LogColumn in project netxms by netxms.

the class LogViewer method setupLogViewer.

/**
 * Setup log viewer after successful log open
 */
private void setupLogViewer() {
    org.eclipse.swt.widgets.Table table = viewer.getTable();
    Collection<LogColumn> columns = logHandle.getColumns();
    for (final LogColumn lc : columns) {
        TableColumn column = new TableColumn(table, SWT.LEFT);
        column.setText(lc.getDescription());
        column.setData(lc);
        column.setWidth(estimateColumnWidth(lc));
        if (lc.getType() == LogColumn.LC_TIMESTAMP) {
            filterBuilder.addOrderingColumn(lc, true);
        }
    }
    // $NON-NLS-1$
    WidgetHelper.restoreColumnSettings(table, Activator.getDefault().getDialogSettings(), "LogViewer." + logHandle.getName());
    viewer.setLabelProvider(createLabelProvider(logHandle));
    filterBuilder.setLogHandle(logHandle);
    filter = filterBuilder.createFilter();
}
Also used : LogColumn(org.netxms.client.log.LogColumn) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 4 with LogColumn

use of org.netxms.client.log.LogColumn in project netxms by netxms.

the class FilterBuilder method createColumnSelectionMenu.

/**
 * Create menu for selecting log column
 *
 * @param listener selection listener
 */
private void createColumnSelectionMenu(final ColumnSelectionHandler handler, Control linkControl) {
    if (logHandle == null)
        return;
    if (columnSelectionMenu != null)
        columnSelectionMenu.dispose();
    columnSelectionMenu = new Menu(getShell(), SWT.POP_UP);
    getShell().setMenu(columnSelectionMenu);
    for (final LogColumn lc : logHandle.getColumns()) {
        MenuItem item = new MenuItem(columnSelectionMenu, SWT.PUSH);
        item.setText(lc.getDescription());
        item.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handler.columnSelected(lc);
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
    }
    columnSelectionMenu.addMenuListener(new MenuListener() {

        @Override
        public void menuShown(MenuEvent e) {
        }

        @Override
        public void menuHidden(MenuEvent e) {
            getShell().setMenu(null);
        }
    });
    columnSelectionMenu.setVisible(true);
    Point p = linkControl.getParent().toDisplay(linkControl.getLocation());
    p.y += linkControl.getSize().y;
    columnSelectionMenu.setLocation(p);
}
Also used : LogColumn(org.netxms.client.log.LogColumn) MenuListener(org.eclipse.swt.events.MenuListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Point(org.eclipse.swt.graphics.Point) SelectionListener(org.eclipse.swt.events.SelectionListener) MenuEvent(org.eclipse.swt.events.MenuEvent)

Aggregations

LogColumn (org.netxms.client.log.LogColumn)4 MenuEvent (org.eclipse.swt.events.MenuEvent)2 MenuListener (org.eclipse.swt.events.MenuListener)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Menu (org.eclipse.swt.widgets.Menu)2 MenuItem (org.eclipse.swt.widgets.MenuItem)2 Point (org.eclipse.swt.graphics.Point)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 Log (org.netxms.client.log.Log)1