Search in sources :

Example 1 with AddressListElementComparator

use of org.netxms.ui.eclipse.serverconfig.views.helpers.AddressListElementComparator in project netxms by netxms.

the class NetworkDiscoveryConfigurator method createActiveDiscoverySection.

/**
 * Create "Active Discovery Targets" section
 */
private void createActiveDiscoverySection() {
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
    section.setText(Messages.get().NetworkDiscoveryConfigurator_SectionActiveDiscoveryTargets);
    section.setDescription(Messages.get().NetworkDiscoveryConfigurator_SectionActiveDiscoveryTargetsDescr);
    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);
    activeDiscoveryAddressList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    toolkit.adapt(activeDiscoveryAddressList.getTable());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.verticalSpan = 2;
    gd.heightHint = 100;
    activeDiscoveryAddressList.getTable().setLayoutData(gd);
    activeDiscoveryAddressList.getTable().setSortDirection(SWT.UP);
    activeDiscoveryAddressList.setContentProvider(new ArrayContentProvider());
    activeDiscoveryAddressList.setComparator(new AddressListElementComparator());
    final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkAdd.setText(Messages.get().NetworkDiscoveryConfigurator_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) {
            addTargetAddressListElement();
        }
    });
    final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkRemove.setText(Messages.get().NetworkDiscoveryConfigurator_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) {
            removeTargetAddressListElements();
        }
    });
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) Section(org.eclipse.ui.forms.widgets.Section) TableViewer(org.eclipse.jface.viewers.TableViewer) AddressListElementComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.AddressListElementComparator) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 2 with AddressListElementComparator

use of org.netxms.ui.eclipse.serverconfig.views.helpers.AddressListElementComparator in project netxms by netxms.

the class NetworkDiscoveryConfigurator method createSubnetFilterSection.

/**
 * Create "Address Filters" section
 */
private void createSubnetFilterSection() {
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
    section.setText(Messages.get().NetworkDiscoveryConfigurator_SectionAddressFilters);
    section.setDescription(Messages.get().NetworkDiscoveryConfigurator_SectionAddressFiltersDescr);
    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);
    filterAddressList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    toolkit.adapt(filterAddressList.getTable());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.verticalSpan = 2;
    gd.heightHint = 100;
    filterAddressList.getTable().setLayoutData(gd);
    filterAddressList.getTable().setSortDirection(SWT.UP);
    filterAddressList.setContentProvider(new ArrayContentProvider());
    filterAddressList.setComparator(new AddressListElementComparator());
    final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkAdd.setText(Messages.get().NetworkDiscoveryConfigurator_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) {
            addAddressFilterElement();
        }
    });
    final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
    linkRemove.setText(Messages.get().NetworkDiscoveryConfigurator_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) {
            removeAddressFilterElements();
        }
    });
}
Also used : TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) Section(org.eclipse.ui.forms.widgets.Section) TableViewer(org.eclipse.jface.viewers.TableViewer) AddressListElementComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.AddressListElementComparator) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)2 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)2 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)2 Section (org.eclipse.ui.forms.widgets.Section)2 TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)2 AddressListElementComparator (org.netxms.ui.eclipse.serverconfig.views.helpers.AddressListElementComparator)2