Search in sources :

Example 1 with AlarmCategoryListFilter

use of org.netxms.ui.eclipse.alarmviewer.widgets.helpers.AlarmCategoryListFilter in project netxms by netxms.

the class AlarmCategoryConfigurator method createPartControl.

@Override
public void createPartControl(Composite parent) {
    FormLayout formLayout = new FormLayout();
    parent.setLayout(formLayout);
    // Create filter area
    filterText = new FilterText(parent, SWT.NONE, null, true);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    filterText.setCloseAction(new Action() {

        @Override
        public void run() {
            enableFilter(false);
            actionShowFilter.setChecked(false);
        }
    });
    dataView = new AlarmCategoryList(this, parent, SWT.NONE, TABLE_CONFIG_PREFIX, true);
    filter = new AlarmCategoryListFilter();
    dataView.getViewer().addFilter(filter);
    // Setup layout
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(filterText);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(100, 0);
    dataView.setLayoutData(fd);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    filterText.setLayoutData(fd);
    dataView.getViewer().addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            dataView.editCategory();
        }
    });
    // Get filter settings
    final IDialogSettings ds = Activator.getDefault().getDialogSettings();
    initShowfilter = safeCast(ds.get(TABLE_CONFIG_PREFIX + "initShowfilter"), ds.getBoolean(TABLE_CONFIG_PREFIX + "initShowfilter"), initShowfilter);
    // Set initial focus to filter input line
    if (initShowfilter)
        filterText.setFocus();
    else
        // Will hide filter area correctly
        enableFilter(false);
    createActions();
    contributeToActionBars();
    activateContext();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) ModifyListener(org.eclipse.swt.events.ModifyListener) AlarmCategoryList(org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCategoryList) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) AlarmCategoryListFilter(org.netxms.ui.eclipse.alarmviewer.widgets.helpers.AlarmCategoryListFilter) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) FilterText(org.netxms.ui.eclipse.widgets.FilterText) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

Action (org.eclipse.jface.action.Action)1 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)1 AlarmCategoryList (org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCategoryList)1 AlarmCategoryListFilter (org.netxms.ui.eclipse.alarmviewer.widgets.helpers.AlarmCategoryListFilter)1 FilterText (org.netxms.ui.eclipse.widgets.FilterText)1