Search in sources :

Example 1 with AlarmCategoryList

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

the class AlarmCategorySelectionDialog 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.horizontalSpacing = WidgetHelper.OUTER_SPACING;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    // Create filter area
    filterText = new FilterText(dialogArea, SWT.NONE, null, false);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    filterText.setLayoutData(gd);
    alarmCategoryList = new AlarmCategoryList(dialogArea, SWT.NONE, TABLE_CONFIG_PREFIX, false);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 2;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 350;
    alarmCategoryList.setLayoutData(gd);
    alarmCategoryList.getViewer().addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            okPressed();
        }
    });
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) AlarmCategoryList(org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCategoryList) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) FilterText(org.netxms.ui.eclipse.widgets.FilterText) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent)

Example 2 with AlarmCategoryList

use of org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCategoryList 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

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