use of org.netxms.ui.eclipse.objectmanager.propertypages.helpers.SubnetComparator in project netxms by netxms.
the class VPNSubnets method createNetworkList.
/**
* Creates network list
*
* @param dialogArea
* @param viewList viewer to be created and added to view
* @param data elements that should be added as a content of this viewer
*/
private void createNetworkList(Composite dialogArea, String title, TableViewer viewList, final List<InetAddressEx> data) {
Group clientArea = new Group(dialogArea, SWT.NONE);
clientArea.setText(title);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
GridData gd = new GridData();
clientArea.setLayout(layout);
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
clientArea.setLayoutData(gd);
viewList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.verticalSpan = 2;
gd.heightHint = 100;
viewList.getTable().setLayoutData(gd);
viewList.getTable().setSortDirection(SWT.UP);
viewList.setContentProvider(new ArrayContentProvider());
viewList.setComparator(new SubnetComparator());
viewList.setInput(data.toArray());
final TableViewer list = viewList;
final ImageHyperlink linkAdd = new ImageHyperlink(clientArea, SWT.NONE);
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(list, data);
}
});
final ImageHyperlink linkRemove = new ImageHyperlink(clientArea, SWT.NONE);
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(list, data);
}
});
}
Aggregations