use of org.netxms.ui.eclipse.alarmviewer.views.helpers.EventTreeComparator in project netxms by netxms.
the class AlarmDetails method createEventsSection.
/**
* Create events section
*/
private void createEventsSection() {
final Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED | Section.TWISTIE | Section.COMPACT);
section.setText(Messages.get().AlarmDetails_RelatedEvents);
final GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
section.setLayoutData(gd);
section.addExpansionListener(new IExpansionListener() {
@Override
public void expansionStateChanging(ExpansionEvent e) {
gd.grabExcessVerticalSpace = e.getState();
}
@Override
public void expansionStateChanged(ExpansionEvent e) {
}
});
final Composite content = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
content.setLayout(layout);
section.setClient(content);
final String[] names = { Messages.get().AlarmDetails_Column_Severity, Messages.get().AlarmDetails_Column_Source, Messages.get().AlarmDetails_Column_Name, Messages.get().AlarmDetails_Column_Message, Messages.get().AlarmDetails_Column_Timestamp };
final int[] widths = { 130, 160, 160, 400, 150 };
eventViewer = new SortableTreeViewer(content, names, widths, EV_COLUMN_TIMESTAMP, SWT.DOWN, SWT.BORDER | SWT.FULL_SELECTION);
eventViewer.setContentProvider(new EventTreeContentProvider());
eventViewer.setLabelProvider(new EventTreeLabelProvider());
eventViewer.setComparator(new EventTreeComparator());
eventViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final IDialogSettings settings = Activator.getDefault().getDialogSettings();
// $NON-NLS-1$
WidgetHelper.restoreTreeViewerSettings(eventViewer, settings, "AlarmDetails.Events");
eventViewer.getControl().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
// $NON-NLS-1$
WidgetHelper.saveTreeViewerSettings(eventViewer, settings, "AlarmDetails.Events");
}
});
}
Aggregations