Java Code Examples for org.eclipse.jface.viewers.TableViewer#setFilters()
The following examples show how to use
org.eclipse.jface.viewers.TableViewer#setFilters() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditExpressionDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createExpressionTypePanel(final Composite parentForm) { final Composite parentComposite = new Composite(parentForm, SWT.NONE); parentComposite .setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.FILL).grab(false, true).create()); parentComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create()); final Label expressionTypeLabel = new Label(parentComposite, SWT.NONE); expressionTypeLabel.setText(Messages.expressionTypeLabel); expressionTypeLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create()); expressionTypeViewer = new TableViewer(parentComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE); expressionTypeViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); expressionTypeViewer.setContentProvider(new ExpressionTypeContentProvider()); expressionTypeViewer.setLabelProvider(new ExpressionTypeLabelProvider()); expressionTypeViewer.setSorter(new ViewerSorter() { @Override public int compare(final Viewer viewer, final Object e1, final Object e2) { final IExpressionProvider p1 = (IExpressionProvider) e1; final IExpressionProvider p2 = (IExpressionProvider) e2; return p1.getTypeLabel().compareTo(p2.getTypeLabel()); } }); if (viewerTypeFilters != null) { expressionTypeViewer.setFilters(viewerTypeFilters); } if (!filteredEditor.isEmpty()) { expressionTypeViewer.addFilter(filterEditor()); } ColumnViewerToolTipSupport.enableFor(expressionTypeViewer, ToolTip.NO_RECREATE); expressionTypeViewer.setInput(expressionViewer.getInput()); }
Example 2
Source File: IndexEditionControl.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createAvailableAttributesTableViewer(Composite parent) { Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED); section.setLayout(GridLayoutFactory.fillDefaults().create()); section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); section.setText(Messages.availableAttributes); Composite client = formPage.getToolkit().createComposite(section); client.setLayout(GridLayoutFactory.fillDefaults().create()); client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); availableAttributesTableViewer = new TableViewer(client, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); availableAttributesTableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); availableAttributesTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, AVAILABLE_FIELDS_VIEWER_ID); formPage.getToolkit().adapt(availableAttributesTableViewer.getTable()); ColumnViewerToolTipSupport.enableFor(availableAttributesTableViewer); availableAttributesTableViewer.setUseHashlookup(true); availableAttributesTableViewer.getTable().setLinesVisible(true); availableAttributesTableViewer.setFilters(indexableFieldFilter, indexedFieldsFilter()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, true)); availableAttributesTableViewer.getTable().setLayout(layout); createAttributesColumn(availableAttributesTableViewer); availableAttributesTableViewer.setContentProvider(new ObservableListContentProvider()); availableAttributesTableViewer.setInput(actualsFieldsObservable); selectedAvailableAttributeObservable = ViewersObservables.observeMultiSelection(availableAttributesTableViewer); availableAttributesTableViewer.getTable().addMouseMoveListener(e -> updateCursor(e, availableAttributesTableViewer)); availableAttributesTableViewer.addDragSupport(DND.DROP_MOVE, new Transfer[] { FieldTransfer.getInstance() }, dragSourceAdapter(selectedAvailableAttributeObservable)); availableAttributesTableViewer.addDropSupport(DND.DROP_MOVE, new Transfer[] { FieldTransfer.getInstance() }, new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { dragLeave(event); indexedFieldsObservable.removeAll((Collection<?>) event.data); } }); section.setClient(client); }
Example 3
Source File: ContactSelectorView.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@Override public void createPartControl(Composite parent){ Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); Composite compositeSearch = new Composite(composite, SWT.NONE); compositeSearch.setLayout(new GridLayout(1, false)); compositeSearch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtFilter = new Text(compositeSearch, SWT.BORDER | SWT.SEARCH | SWT.CANCEL); txtFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); tableViewerContacts = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); Table table = tableViewerContacts.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite compositeStatus = new Composite(composite, SWT.NONE); compositeStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeStatus.setLayout(new GridLayout(1, false)); lblStatus = new Label(compositeStatus, SWT.NONE); lblStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); tableViewerContacts.setComparator(new ContactSelectorViewerComparator(tableViewerContacts)); filterAnzeigeTyp = new KontaktAnzeigeTypViewerFilter(tableViewerContacts); ViewerFilter[] filters = new ViewerFilter[] { filterAnzeigeTyp, filterPositionTitle }; tableViewerContacts.setFilters(filters); int operations = DND.DROP_COPY | DND.DROP_MOVE; Transfer[] transferTypes = new Transfer[] { TextTransfer.getInstance() }; tableViewerContacts.addDragSupport(operations, transferTypes, new ContactSelectorDragListener(tableViewerContacts)); tableViewerContacts.addDropSupport(operations, transferTypes, new ContactSelectorDropListener(tableViewerContacts)); txtFilter.addKeyListener(new FilterKeyListener(txtFilter, tableViewerContacts)); txtFilter.addSelectionListener(new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e){ if (e.detail == SWT.CANCEL) { filterPositionTitle.setSearchText(null); tableViewerContacts.getControl().setRedraw(false); tableViewerContacts.refresh(); tableViewerContacts.getControl().setRedraw(true); } } }); initDataBindings(); MenuManager menuManager = new MenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); tableViewerContacts.getTable().setMenu( menuManager.createContextMenu(tableViewerContacts.getTable())); getSite().registerContextMenu(menuManager, tableViewerContacts); getSite().setSelectionProvider(tableViewerContacts); contactList.getRealm().asyncExec(loadContactsRunnable); tableViewerContacts .addSelectionChangedListener(new ContactSelectionChangedToEventDispatcher()); tableViewerContacts.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event){ StructuredSelection ss = (StructuredSelection) event.getSelection(); tableViewerContacts.refresh(ss.getFirstElement()); } }); }
Example 4
Source File: ProcessResultPage.java From olca-app with Mozilla Public License 2.0 | 4 votes |
private void decorateResultViewer(TableViewer table) { table.setFilters(new ViewerFilter[] { new CutOffFilter() }); UI.gridData(table.getTable(), true, true); Tables.bindColumnWidths(table.getTable(), 0.20, 0.30, 0.20, 0.20, 0.10); }