Search in sources :

Example 11 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class ServerConfigurationEditor method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
public void createPartControl(Composite parent) {
    content = new Composite(parent, SWT.NONE);
    content.setLayout(new FormLayout());
    // Create filter area
    filterText = new FilterText(content, SWT.NONE);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    final String[] names = { Messages.get().ServerConfigurationEditor_ColName, Messages.get().ServerConfigurationEditor_ColValue, "Default value", Messages.get().ServerConfigurationEditor_ColRestart, "Description" };
    final int[] widths = { 200, 150, 150, 80, 500 };
    viewer = new SortableTableViewer(content, names, widths, 0, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER, SortableTableViewer.DEFAULT_STYLE);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new ServerVariablesLabelProvider());
    viewer.setComparator(new ServerVariableComparator());
    filter = new ServerVariablesFilter();
    viewer.addFilter(filter);
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            editVariable();
        }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            actionEdit.setEnabled(selection.size() == 1);
            actionDelete.setEnabled(selection.size() > 0);
            actionDefaultValue.setEnabled(selection.size() > 0);
        }
    });
    // 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);
    viewer.getTable().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);
    final IDialogSettings settings = Activator.getDefault().getDialogSettings();
    // $NON-NLS-1$
    WidgetHelper.restoreTableViewerSettings(viewer, settings, "ServerConfigurationEditor");
    viewer.getTable().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            // $NON-NLS-1$
            WidgetHelper.saveTableViewerSettings(viewer, settings, "ServerConfigurationEditor");
        }
    });
    // Create the help context id for the viewer's control
    // $NON-NLS-1$
    PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.netxms.nxmc.serverconfig.viewer");
    activateContext();
    createActions();
    contributeToActionBars();
    createPopupMenu();
    filterText.setCloseAction(actionShowFilter);
    // Set initial focus to filter input line
    if (initShowFilter)
        filterText.setFocus();
    else
        // Will hide filter area correctly
        enableFilter(false);
    session = ConsoleSharedData.getSession();
    refresh();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) DisposeListener(org.eclipse.swt.events.DisposeListener) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) ServerVariablesLabelProvider(org.netxms.ui.eclipse.serverconfig.views.helpers.ServerVariablesLabelProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) ServerVariableComparator(org.netxms.ui.eclipse.serverconfig.views.helpers.ServerVariableComparator) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) FilterText(org.netxms.ui.eclipse.widgets.FilterText) ServerVariablesFilter(org.netxms.ui.eclipse.serverconfig.views.helpers.ServerVariablesFilter) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 12 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText 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();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) DisposeListener(org.eclipse.swt.events.DisposeListener) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) FDBComparator(org.netxms.ui.eclipse.topology.views.helpers.FDBComparator) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FDBLabelProvider(org.netxms.ui.eclipse.topology.views.helpers.FDBLabelProvider) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SwitchForwardingDatabaseFilter(org.netxms.ui.eclipse.topology.views.helpers.SwitchForwardingDatabaseFilter) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) FilterText(org.netxms.ui.eclipse.widgets.FilterText) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 13 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class SelectSnmpTrapDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    final Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    dialogArea.setLayout(layout);
    filterText = new FilterText(dialogArea, SWT.NONE, null, false);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    filterText.setLayoutData(gd);
    final String[] names = { Messages.get().SelectSnmpTrapDialog_ColOID, Messages.get().SelectSnmpTrapDialog_ColEvent, Messages.get().SelectSnmpTrapDialog_ColDescription };
    final int[] widths = { 350, 250, 400 };
    viewer = new SortableTableViewer(dialogArea, names, widths, COLUMN_OID, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new TrapListLabelProvider());
    viewer.setComparator(new SnmpTrapComparator());
    viewer.setInput(trapList.toArray());
    filter = new SnmpTrapFilter();
    viewer.addFilter(filter);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 450;
    viewer.getControl().setLayoutData(gd);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            filter.setFilterString(filterText.getText());
            viewer.refresh();
        }
    });
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SnmpTrapFilter(org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapFilter) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) TrapListLabelProvider(org.netxms.ui.eclipse.serverconfig.dialogs.helpers.TrapListLabelProvider) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SnmpTrapComparator(org.netxms.ui.eclipse.serverconfig.dialogs.helpers.SnmpTrapComparator) FilterText(org.netxms.ui.eclipse.widgets.FilterText)

Example 14 with FilterText

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

Example 15 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class TunnelManager method createPartControl.

/* (non-Javadoc)
    * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
    */
@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new 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);
        }
    });
    final String[] names = { "ID", "State", "Node", "IP address", "Channels", "System name", "Hostname", "Platform", "System information", "Agent version" };
    final int[] widths = { 80, 80, 140, 150, 80, 150, 150, 250, 300, 150 };
    viewer = new SortableTableViewer(parent, names, widths, 0, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new TunnelListLabelProvider());
    viewer.setComparator(new TunnelListComparator());
    filter = new TunnelManagerFilter();
    viewer.addFilter(filter);
    final IDialogSettings settings = Activator.getDefault().getDialogSettings();
    initShowfilter = settings.getBoolean(ID + "initShowFilter");
    WidgetHelper.restoreTableViewerSettings(viewer, settings, "TunnelManager");
    viewer.getTable().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            WidgetHelper.saveTableViewerSettings(viewer, settings, "TunnelManager");
            settings.put(ID + "initShowFilter", initShowfilter);
        }
    });
    // 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);
    viewer.getControl().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);
    createActions();
    contributeToActionBars();
    createPopupMenu();
    activateContext();
    // Set initial focus to filter input line
    if (initShowfilter)
        filterText.setFocus();
    else
        // Will hide filter area correctly
        enableFilter(false);
    refresh();
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) DisposeListener(org.eclipse.swt.events.DisposeListener) Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) TunnelListComparator(org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelListComparator) ModifyListener(org.eclipse.swt.events.ModifyListener) TunnelListLabelProvider(org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelListLabelProvider) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TunnelManagerFilter(org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelManagerFilter) FilterText(org.netxms.ui.eclipse.widgets.FilterText) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)19 ModifyListener (org.eclipse.swt.events.ModifyListener)19 FilterText (org.netxms.ui.eclipse.widgets.FilterText)19 FormAttachment (org.eclipse.swt.layout.FormAttachment)15 FormData (org.eclipse.swt.layout.FormData)15 FormLayout (org.eclipse.swt.layout.FormLayout)15 Composite (org.eclipse.swt.widgets.Composite)15 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)12 Action (org.eclipse.jface.action.Action)11 DisposeEvent (org.eclipse.swt.events.DisposeEvent)11 DisposeListener (org.eclipse.swt.events.DisposeListener)11 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)10 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)10 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)10 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)9 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)8 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)8 GridLayout (org.eclipse.swt.layout.GridLayout)6