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);
}
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();
}
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();
}
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);
}
Aggregations