Search in sources :

Example 1 with SnmpUsmComparator

use of org.netxms.ui.eclipse.snmp.views.helpers.SnmpUsmComparator in project netxms by netxms.

the class SnmpCredentials method createSnmpUsmCredSection.

/**
 * Create "Address Filters" section
 */
private void createSnmpUsmCredSection() {
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
    section.setText(Messages.get().SnmpConfigurator_SectionUSM);
    section.setDescription(Messages.get().SnmpConfigurator_SectionUSMDescr);
    TableWrapData td = new TableWrapData();
    td.align = TableWrapData.FILL;
    td.grabHorizontal = true;
    section.setLayoutData(td);
    Composite clientArea = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    clientArea.setLayout(layout);
    section.setClient(clientArea);
    snmpUsmCredList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    toolkit.adapt(snmpUsmCredList.getTable());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.verticalSpan = 2;
    gd.heightHint = 150;
    snmpUsmCredList.getTable().setLayoutData(gd);
    snmpUsmCredList.setContentProvider(new ArrayContentProvider());
    snmpUsmCredList.setLabelProvider(new SnmpUsmLabelProvider());
    snmpUsmCredList.setComparator(new SnmpUsmComparator());
    final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkAdd.setText(Messages.get().SnmpConfigurator_Add);
    linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    linkAdd.setLayoutData(gd);
    linkAdd.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            addUsmCredentials();
        }
    });
    final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkRemove.setText(Messages.get().SnmpConfigurator_Remove);
    linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    linkRemove.setLayoutData(gd);
    linkRemove.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            removeUsmCredentials();
        }
    });
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Section(org.eclipse.ui.forms.widgets.Section) SnmpUsmLabelProvider(org.netxms.ui.eclipse.snmp.views.helpers.SnmpUsmLabelProvider) TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SnmpUsmComparator(org.netxms.ui.eclipse.snmp.views.helpers.SnmpUsmComparator) TableViewer(org.eclipse.jface.viewers.TableViewer) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)1 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)1 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)1 Section (org.eclipse.ui.forms.widgets.Section)1 TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)1 SnmpUsmComparator (org.netxms.ui.eclipse.snmp.views.helpers.SnmpUsmComparator)1 SnmpUsmLabelProvider (org.netxms.ui.eclipse.snmp.views.helpers.SnmpUsmLabelProvider)1