Search in sources :

Example 1 with FDBLabelProvider

use of org.netxms.ui.eclipse.topology.views.helpers.FDBLabelProvider 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)

Aggregations

Action (org.eclipse.jface.action.Action)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 Composite (org.eclipse.swt.widgets.Composite)1 ExportToCsvAction (org.netxms.ui.eclipse.actions.ExportToCsvAction)1 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)1 FDBComparator (org.netxms.ui.eclipse.topology.views.helpers.FDBComparator)1 FDBLabelProvider (org.netxms.ui.eclipse.topology.views.helpers.FDBLabelProvider)1 SwitchForwardingDatabaseFilter (org.netxms.ui.eclipse.topology.views.helpers.SwitchForwardingDatabaseFilter)1 FilterText (org.netxms.ui.eclipse.widgets.FilterText)1 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)1