use of org.netxms.ui.eclipse.datacollection.dialogs.helpers.AgentParameterFilter in project netxms by netxms.
the class AbstractSelectParamDlg method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(layout);
Label label = new Label(dialogArea, SWT.NONE);
label.setText(selectTables ? Messages.get().AbstractSelectParamDlg_AvailTables : Messages.get().AbstractSelectParamDlg_AvailableParameters);
filterText = new Text(dialogArea, SWT.BORDER);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
filterText.setLayoutData(gd);
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
filter.setFilter(filterText.getText());
viewer.refresh(false);
}
});
final String[] names = { Messages.get().AbstractSelectParamDlg_Name, selectTables ? Messages.get().AbstractSelectParamDlg_InstanceColumn : Messages.get().AbstractSelectParamDlg_Type, Messages.get().AbstractSelectParamDlg_Description };
final int[] widths = { 150, selectTables ? 150 : 100, 350 };
viewer = new SortableTableViewer(dialogArea, names, widths, 0, SWT.UP, SWT.FULL_SELECTION | SWT.BORDER);
// $NON-NLS-1$
WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), getConfigurationPrefix() + ".viewer");
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(selectTables ? new AgentTableLabelProvider() : new AgentParameterLabelProvider());
viewer.setComparator(selectTables ? new AgentTableComparator() : new AgentParameterComparator());
filter = new AgentParameterFilter();
viewer.addFilter(filter);
viewer.getTable().addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) {
okPressed();
}
@Override
public void mouseDown(MouseEvent e) {
}
@Override
public void mouseUp(MouseEvent e) {
}
});
viewer.getTable().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
// $NON-NLS-1$
WidgetHelper.saveTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), getConfigurationPrefix() + ".viewer");
}
});
createPopupMenu();
gd = new GridData();
gd.heightHint = 250;
gd.grabExcessVerticalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
viewer.getControl().setLayoutData(gd);
fillParameterList();
return dialogArea;
}
Aggregations