Skip to content

Package: EMFFormsFilteredViewService

EMFFormsFilteredViewService

nameinstructionbranchcomplexitylinemethod
getView(EObject, VViewModelProperties)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2019 Christian W. Damus and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Christian W. Damus - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.spi.provider;
15:
16: import static java.util.Collections.emptySet;
17:
18: import java.util.Collection;
19:
20: import org.eclipse.emf.ecore.EObject;
21: import org.eclipse.emf.ecp.view.spi.model.VView;
22: import org.eclipse.emf.ecp.view.spi.model.VViewModelProperties;
23:
24: /**
25: * A specialization of the {@link EMFFormsViewService} protocol that makes explicit
26: * the support for filtering views by matching {@linkplain VViewModelProperties properties}
27: * requested by the client. Thus it understands how to interact with {@link IFilteredViewProvider}s
28: * that are {@linkplain EMFFormsViewService #addProvider(IViewProvider) added to it}.
29: *
30: * @since 1.22
31: *
32: * @see IFilteredViewProvider
33: */
34: public interface EMFFormsFilteredViewService extends EMFFormsViewService {
35:
36:         /**
37:          * Retrieve a {@link VView} for a domain model {@code object} without any required
38:          * filter keys.
39:          *
40:          * @param object the domain model object for which a view is to be requested
41:          * @param properties the {@link VViewModelProperties properties} for providing the view, that
42:          * may or may not include matching filters
43:          *
44:          * @return a view model for the given domain model {@code object} or {@code null} if no
45:          * suitable provider could be found to provide one
46:          */
47:         @Override
48:         default VView getView(EObject object, VViewModelProperties properties) {
49:                 return getView(object, properties, emptySet());
50:         }
51:
52:         /**
53:          * Retrieve a {@link VView} for a domain model {@code object} from the most confident of my
54:          * {@linkplain EMFFormsViewService#addProvider(IViewProvider) registered view providers}.
55:          *
56:          * @param object the domain model object for which a view is to be requested
57:          * @param properties the {@link VViewModelProperties properties} for providing the view, that
58:          * may or may not include matching filters
59:          * @param requiredKeys a subset (possibly empty) of the keys in the {@code properties} that
60:          * must be matched by any view model that I would provide. If any of these keys does not match
61:          * a view model, then that view model must not be provided. Otherwise, it may just be less
62:          * preferred than some other view model that does match
63:          *
64:          * @return a view model for the given domain model {@code object} or {@code null} if no
65:          * suitable provider could be found to provide one
66:          */
67:         VView getView(EObject object, VViewModelProperties properties, Collection<String> requiredKeys);
68:
69: }