use of org.netxms.ui.eclipse.topology.views.helpers.SwitchForwardingDatabaseFilter in project netxms by netxms.
the class SwitchForwardingDatabaseView method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
// Create result area
resultArea = new Composite(parent, SWT.BORDER);
FormLayout formLayout = new FormLayout();
resultArea.setLayout(formLayout);
// Create filter area
filterText = new FilterText(resultArea, SWT.BORDER);
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onFilterModify();
}
});
filterText.setCloseAction(new Action() {
@Override
public void run() {
enableFilter(false);
actionShowFilter.setChecked(initShowFilter);
}
});
// Setup layout
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
;
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
filterText.setLayoutData(fd);
final String[] names = { Messages.get().SwitchForwardingDatabaseView_ColMacAddr, Messages.get().SwitchForwardingDatabaseView_ColPort, Messages.get().SwitchForwardingDatabaseView_ConIface, Messages.get().SwitchForwardingDatabaseView_ColVlan, Messages.get().SwitchForwardingDatabaseView_ColNode, Messages.get().SwitchForwardingDatabaseView_ColType };
final int[] widths = { 180, 100, 200, 100, 250, 110 };
viewer = new SortableTableViewer(resultArea, names, widths, COLUMN_MAC_ADDRESS, SWT.DOWN, SWT.FULL_SELECTION | SWT.MULTI);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new FDBLabelProvider());
viewer.setComparator(new FDBComparator());
filter = new SwitchForwardingDatabaseFilter();
viewer.addFilter(filter);
// $NON-NLS-1$
WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "SwitchForwardingDatabase");
viewer.getTable().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
// $NON-NLS-1$
WidgetHelper.saveTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "SwitchForwardingDatabase");
}
});
// Setup layout
fd = new FormData();
fd.left = new FormAttachment(0, 0);
;
fd.top = new FormAttachment(filterText, 0, SWT.BOTTOM);
fd.bottom = new FormAttachment(100, 0);
fd.right = new FormAttachment(100, 0);
viewer.getControl().setLayoutData(fd);
createActions();
contributeToActionBars();
createPopupMenu();
// Set initial focus to filter input line
if (initShowFilter)
filterText.setFocus();
else
// Will hide filter area correctly
enableFilter(false);
activateContext();
refresh();
}
Aggregations