Java Code Examples for org.eclipse.jface.viewers.TableViewer#addFilter()
The following examples show how to use
org.eclipse.jface.viewers.TableViewer#addFilter() .
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: MultiPageCSVEditor.java From gama with GNU General Public License v3.0 | 6 votes |
/** * */ private void createTablePage() { final Composite parent = getContainer(); final Composite intermediate = new Composite(parent, SWT.NONE); final Composite composite = GamaToolbarFactory.createToolbars(this, intermediate); tableViewer = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); tableViewer.setUseHashlookup(true); final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); // set the sorter for the table tableViewer.setComparator(tableSorter); // set a table filter tableViewer.addFilter(tableFilter); addPage(intermediate); setPageText(indexTBL, "Table"); }
Example 2
Source File: ManageJarDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createTree(final Composite composite) { tableViewer = new TableViewer(composite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); tableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).create()); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.addFilter(searchFilter); tableViewer.setLabelProvider(new FileStoreLabelProvider()); tableViewer.setInput(libStore.getChildren()); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent arg0) { if(removeButton != null){ removeButton.setEnabled(!tableViewer.getSelection().isEmpty()); } } }); }
Example 3
Source File: ConstraintEditionControl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createConstraintsDefinitionViewer(AbstractBdmFormPage formPage, Composite parent) { constraintViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE); constraintViewer.getTable() .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create()); constraintViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, CONSTRAINTS_LIST_VIEWER_ID); formPage.getToolkit().adapt(constraintViewer.getTable()); ColumnViewerToolTipSupport.enableFor(constraintViewer); constraintViewer.setUseHashlookup(true); constraintViewer.getTable().setHeaderVisible(true); constraintViewer.getTable().setLinesVisible(true); constraintViewer.addFilter(createSearchFilter()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, true)); layout.addColumnData(new ColumnWeightData(1, true)); constraintViewer.getTable().setLayout(layout); createConstraintnameColumn(constraintViewer); createAttributesColumn(constraintViewer); constraintViewer.setContentProvider(new ObservableListContentProvider()); constraintViewer.setInput(constraintsObservable); selectedConstraintObservable = ViewerProperties.singleSelection(UniqueConstraint.class).observe(constraintViewer); }
Example 4
Source File: IndexControl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createIndexViewer(Composite parent) { indexViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE); indexViewer.getTable() .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).hint(350, SWT.DEFAULT).create()); indexViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, INDEX_LIST_VIEWER_ID); formPage.getToolkit().adapt(indexViewer.getTable()); ColumnViewerToolTipSupport.enableFor(indexViewer); indexViewer.setUseHashlookup(true); indexViewer.getTable().setHeaderVisible(true); indexViewer.getTable().setLinesVisible(true); indexViewer.addFilter(createSearchFilter()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, true)); layout.addColumnData(new ColumnWeightData(1, true)); indexViewer.getTable().setLayout(layout); createIndexNameColumn(indexViewer); createAttributesColumn(indexViewer); indexViewer.setContentProvider(new ObservableListContentProvider()); indexViewer.setInput(indexObservable); selectedIndexObservable = ViewerProperties.singleSelection(Index.class).observe(indexViewer); }
Example 5
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 6
Source File: ConnectorSection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createConnectorComposite(final Composite parent) { final Composite buttonsComposite = getWidgetFactory() .createComposite(parent); buttonsComposite.setLayoutData(GridDataFactory.fillDefaults() .grab(false, true).create()); buttonsComposite.setLayout(GridLayoutFactory.fillDefaults() .numColumns(1).margins(5, 0).spacing(0, 3).create()); createAddConnectorButton(buttonsComposite); updateConnectorButton = createUpdateConnectorButton(buttonsComposite); removeConnectorButton = createRemoveConnectorButton(buttonsComposite); upConnectorButton = createUpConnectorButton(buttonsComposite); downConnectorButton = createDownConnectorButton(buttonsComposite); moveButton = createMoveConnectorButton(buttonsComposite); tableViewer = new TableViewer(parent, GTKStyleHandler.removeBorderFlag(SWT.BORDER | SWT.MULTI | SWT.NO_FOCUS)); getWidgetFactory().adapt(tableViewer.getTable(), false, false); tableViewer.getTable().setLayoutData( GridDataFactory.fillDefaults().grab(true, true) .hint(SWT.DEFAULT, 120).create()); tableViewer.addDoubleClickListener(this); tableViewer.addSelectionChangedListener(this); tableViewer.getTable().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { e.doit = false; removeSelectedConnectors(); } } }); tableViewer.setContentProvider(new EMFListFeatureTreeContentProvider( getConnectorFeature())); tableViewer.setLabelProvider(new StyledConnectorLabelProvider()); tableViewer.addFilter(getViewerFilter()); }
Example 7
Source File: AttributeEditionControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createAttributeTableViewer(Composite parent) { viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ATTRIBUTE_LIST_VIEWER_ID); formPage.getToolkit().adapt(viewer.getTable()); ColumnViewerToolTipSupport.enableFor(viewer); viewer.setUseHashlookup(true); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(true); viewer.addFilter(new SearchFilter<>(fieldToFilter)); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(5, true)); layout.addColumnData(new ColumnWeightData(4, true)); layout.addColumnData(new ColumnWeightData(3, true)); layout.addColumnData(new ColumnWeightData(3, true)); viewer.getTable().setLayout(layout); createNameColumn(viewer); createTypeColumn(viewer); createMultipleColumn(viewer); createMandatoryColumn(viewer); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setInput(fieldsObservable); selectedFieldObservable = ViewerProperties.singleSelection(Field.class).observe(viewer); addDragAndDropSupport(); }
Example 8
Source File: QueryDetailsControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createParametersTable(Composite parent) { parametersTableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); parametersTableViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create()); parametersTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, QUERY_PARAMETERS_VIEWER_ID); ColumnViewerToolTipSupport.enableFor(parametersTableViewer); parametersTableViewer.getTable().setHeaderVisible(true); parametersTableViewer.setContentProvider(new ObservableListContentProvider()); parametersTableViewer.addFilter(createSearchFilter()); TableLayout tableLayout = new TableLayout(); tableLayout.addColumnData(new ColumnWeightData(1)); tableLayout.addColumnData(new ColumnWeightData(1)); tableLayout.addColumnData(new ColumnWeightData(2)); parametersTableViewer.getTable().setLayout(tableLayout); createNameColumn(parametersTableViewer); createTypeColumn(parametersTableViewer); createDescriptionColumn(parametersTableViewer); selectedQueryParameterObservableList = EMFObservables.observeDetailList(Realm.getDefault(), querySelectedObservable, BusinessDataModelPackage.Literals.QUERY__QUERY_PARAMETERS); parametersMultipleSelectionObservable = ViewerProperties.multipleSelection(QueryParameter.class) .observe(parametersTableViewer); parametersTableViewer.setInput(selectedQueryParameterObservableList); }
Example 9
Source File: ConfigurationWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createPageChooserComposite(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(GridDataFactory.fillDefaults().span(1, 2).create()); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 10).create()); pageChooserViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); pageChooserViewer.getTable().setLayoutData( GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL).grab(false, true).create()); pageChooserViewer.setContentProvider(new WizardPageContentProvider()); ILabelDecorator decorator = new WizardPageDecorator(this); pageChooserViewer.setLabelProvider(new DecoratingLabelProvider(new WizardPageLabelProvider(this), decorator)); pageChooserViewer.setInput(getWizard().getPages()); pageChooserViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { IProcessConfigurationWizardPage page = (IProcessConfigurationWizardPage) element; if (!isSimpleMode) { return true; } return page.isDefault() || page.isConfigurationPageValid(getConfiguration()) != null; } }); pageChooserViewer.addSelectionChangedListener(this); pageChooserViewer.getTable().setEnabled(false); addPageChangedListener(this); }
Example 10
Source File: ValidationPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private Control createValidators(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).create()); Composite labelComp = new Composite(main, SWT.NONE); labelComp.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).numColumns(2) .spacing(2, SWT.DEFAULT).create()); labelComp.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create()); Label label = new Label(labelComp, SWT.NONE); label.setText(Messages.ValidationPreferencePage_LBL_Validators); Label helpImage = new Label(labelComp, SWT.NONE); helpImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP)); helpImage.setToolTipText(Messages.ValidationPreferencePage_EnablingValidatorWarning); Group group = new Group(main, SWT.NONE); group.setLayout(GridLayoutFactory.swtDefaults().margins(4, 4).create()); group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Table table = new Table(group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setLayoutData(GridDataFactory.fillDefaults().hint(300, 100).grab(true, false).create()); table.setLinesVisible(true); table.setHeaderVisible(true); // set up columns // Name column TableColumn name = new TableColumn(table, SWT.LEFT); name.setWidth(250); name.setText(Messages.ValidationPreferencePage_NameColumn); name.setToolTipText(Messages.ValidationPreferencePage_NameColumn); // Build column TableColumn build = new TableColumn(table, SWT.CENTER); build.setWidth(40); build.setText(Messages.ValidationPreferencePage_BuildColumn); build.setToolTipText(Messages.ValidationPreferencePage_BuildColumn); // Reconcile column TableColumn reconcile = new TableColumn(table, SWT.CENTER); reconcile.setWidth(75); reconcile.setText(Messages.ValidationPreferencePage_ReconcileColumn); reconcile.setToolTipText(Messages.ValidationPreferencePage_ReconcileColumn); // Now set up table viewer! validatorsViewer = new TableViewer(table); // validatorsViewer.setUseHashlookup(true); validatorsViewer.setColumnProperties(new String[] { NAME, BUILD, RECONCILE }); // Assign the cell editors to the viewer validatorsViewer.setCellEditors(new CellEditor[] { null, new CheckboxCellEditor(table), new CheckboxCellEditor(table) }); // Set the cell modifier for the viewer validatorsViewer.setCellModifier(new ParticipantCellModifier(validatorsViewer)); // Now set up content/label providers validatorsViewer.setContentProvider(ArrayContentProvider.getInstance()); validatorsViewer.setLabelProvider(new ParticipantLabelProvider()); // Hide required participants validatorsViewer.addFilter(new RequiredParticipantFilter()); // check the selected build participant, show it's filters validatorsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateFilterExpressions(); } }); // Now set input validatorsViewer.setInput(this.participants); return main; }
Example 11
Source File: AbstractOrganizationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected StructuredViewer createViewer(final Composite parent) { final Composite viewerComposite = new Composite(parent, SWT.NONE); viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewerComposite.setLayout( GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).margins(0, 0).spacing(0, 5).create()); final Text searchBox = new Text(viewerComposite, SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL); searchBox.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); searchBox.setMessage(Messages.search); final Composite tableViewerComposite = new Composite(viewerComposite, SWT.NONE); tableViewerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create()); tableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final TableViewer tableViewer = new TableViewer(tableViewerComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); final Table table = tableViewer.getTable(); table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 270).create()); table.setLinesVisible(true); table.setHeaderVisible(true); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.addFilter(new ViewerFilter() { @Override public boolean select(final Viewer viewer, final Object parentElement, final Object element) { return viewerSelect(element, searchQuery); } }); searchBox.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { searchQuery = searchBox.getText(); tableViewer.refresh(); } }); return tableViewer; }
Example 12
Source File: DBConnectorsPreferencePage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createDBConnectorsList(Composite parent) { final Composite connectorListComposite = new Composite(parent, SWT.NONE); connectorListComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create()); connectorListComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final Text searchField = new Text(connectorListComposite, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); searchField.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); searchField.setMessage(Messages.search); viewer = new TableViewer(connectorListComposite, SWT.BORDER | SWT.FULL_SELECTION); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(200, SWT.DEFAULT).create()); viewer.setLabelProvider(new DabaBaseConnectorDefinitionLabelProvider()); viewer.setContentProvider(new DatabaseConnectorDefinitionContentProvider()); viewer.setInput(getCategory()); connectorFilter = new DbConnectorsPreferenceFilter(); viewer.addFilter(connectorFilter); searchField.addKeyListener(new KeyAdapter() { /* * (non-Javadoc) * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent) */ @Override public void keyReleased(KeyEvent e) { connectorFilter.setSearchText(searchField.getText()); viewer.refresh(); } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { final ConnectorDefinition def = getSelectedConnector(); if (def != null) { final String defId = def.getId(); automaticallyAddDriver.setSelection(getAutoAddDriverProperty(defId)); driversLabelProvider.setDefaultDriver(getDefaultDriver(defId)); driverManagerViewer.setInput(defId); } } }); }
Example 13
Source File: AbstractDataSection.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void createDataComposite(final Composite parent) { createViewerHeaderLabel(parent); final Composite buttonsComposite = getWidgetFactory().createComposite(parent, SWT.NONE); buttonsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 3).create()); buttonsComposite.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).create()); createAddDataButton(buttonsComposite); updateDataButton = createEditDataButton(buttonsComposite); removeDataButton = createRemoveDataButton(buttonsComposite); promoteDataButton = createMoveDataButton(buttonsComposite); dataTableViewer = new TableViewer( getWidgetFactory().createTable(parent, GTKStyleHandler .removeBorderFlag(SWT.BORDER | SWT.MULTI | SWT.NO_FOCUS | SWT.H_SCROLL | SWT.V_SCROLL))); dataTableViewer.getTable().setLayout(GridLayoutFactory.fillDefaults().create()); dataTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, SWTBotConstants.SWTBOT_ID_PROCESS_DATA_LIST); dataTableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create()); dataTableViewer.setSorter(new ViewerSorter()); dataTableViewer.addDoubleClickListener(this); dataTableViewer.getTable().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { e.doit = false; removeData((IStructuredSelection) dataTableViewer.getSelection()); } } }); final ObservableListContentProvider contentProvider = new ObservableListContentProvider(); dataTableViewer.setContentProvider(contentProvider); dataTableViewer.addFilter(hideBusinessObjectData()); // create the label provider including monitoring // of the changes of the labels final IObservableSet knownElements = contentProvider.getKnownElements(); final IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements, new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME, ProcessPackage.Literals.DATA__DATA_TYPE }); dataTableViewer.setLabelProvider(new DataStyledTreeLabelProvider(labelMaps)); }