Search in sources :

Example 1 with TunnelListComparator

use of org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelListComparator 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

Action (org.eclipse.jface.action.Action)1 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)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 TunnelListComparator (org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelListComparator)1 TunnelListLabelProvider (org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelListLabelProvider)1 TunnelManagerFilter (org.netxms.ui.eclipse.agentmanager.views.helpers.TunnelManagerFilter)1 FilterText (org.netxms.ui.eclipse.widgets.FilterText)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1