Search in sources :

Example 1 with SnmpTrapFilter

use of org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapFilter in project netxms by netxms.

the class SelectSnmpTrapDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    final Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    dialogArea.setLayout(layout);
    filterText = new FilterText(dialogArea, SWT.NONE, null, false);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    filterText.setLayoutData(gd);
    final String[] names = { Messages.get().SelectSnmpTrapDialog_ColOID, Messages.get().SelectSnmpTrapDialog_ColEvent, Messages.get().SelectSnmpTrapDialog_ColDescription };
    final int[] widths = { 350, 250, 400 };
    viewer = new SortableTableViewer(dialogArea, names, widths, COLUMN_OID, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new TrapListLabelProvider());
    viewer.setComparator(new SnmpTrapComparator());
    viewer.setInput(trapList.toArray());
    filter = new SnmpTrapFilter();
    viewer.addFilter(filter);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 450;
    viewer.getControl().setLayoutData(gd);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            filter.setFilterString(filterText.getText());
            viewer.refresh();
        }
    });
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SnmpTrapFilter(org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapFilter) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) TrapListLabelProvider(org.netxms.ui.eclipse.serverconfig.dialogs.helpers.TrapListLabelProvider) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SnmpTrapComparator(org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapComparator) FilterText(org.netxms.ui.eclipse.widgets.FilterText)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 SnmpTrapComparator (org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapComparator)1 SnmpTrapFilter (org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapFilter)1 TrapListLabelProvider (org.netxms.ui.eclipse.serverconfig.dialogs.helpers.TrapListLabelProvider)1 FilterText (org.netxms.ui.eclipse.widgets.FilterText)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1