use of org.netxms.ui.eclipse.logviewer.widgets.helpers.OrderingColumnEditingSupport in project netxms by netxms.
the class FilterBuilder method createOrderingSection.
/**
* Create ordering section
*/
private void createOrderingSection() {
ordering = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
ordering.setText(Messages.get().FilterBuilder_Ordering);
TableWrapData twd = new TableWrapData();
twd.grabHorizontal = false;
twd.align = TableWrapData.FILL;
ordering.setLayoutData(twd);
final Composite clientArea = toolkit.createComposite(ordering);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
clientArea.setLayout(layout);
ordering.setClient(clientArea);
orderingList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
toolkit.adapt(orderingList.getTable());
TableViewerColumn column = new TableViewerColumn(orderingList, SWT.LEFT);
column.getColumn().setText(Messages.get().FilterBuilder_Column);
column.getColumn().setWidth(200);
column = new TableViewerColumn(orderingList, SWT.LEFT);
column.getColumn().setText(Messages.get().FilterBuilder_Descending);
column.getColumn().setWidth(60);
column.setEditingSupport(new OrderingColumnEditingSupport(orderingList));
orderingList.getTable().setLinesVisible(true);
orderingList.getTable().setHeaderVisible(true);
orderingList.setContentProvider(new ArrayContentProvider());
orderingList.setLabelProvider(new OrderingListLabelProvider());
orderingList.setInput(orderingColumns.toArray());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalSpan = 2;
gd.heightHint = 60;
orderingList.getControl().setLayoutData(gd);
final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkAdd.setText(Messages.get().FilterBuilder_Add);
linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
linkAdd.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
addSortingColumn(linkAdd);
}
});
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkAdd.setLayoutData(gd);
final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkRemove.setText(Messages.get().FilterBuilder_Remove);
linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
linkRemove.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
removeSortingColumn();
}
});
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkRemove.setLayoutData(gd);
linkRemove.setEnabled(false);
orderingList.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
linkRemove.setEnabled(!orderingList.getSelection().isEmpty());
}
});
}
Aggregations