Skip to content

Package: RevealHelper

RevealHelper

nameinstructionbranchcomplexitylinemethod
drillDown(Object)
M: 0 C: 5
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.emfforms.spi.core.services.reveal;
15:
16: import org.eclipse.emf.ecore.EObject;
17: import org.eclipse.emf.ecp.view.spi.model.VElement;
18:
19: /**
20: * Helper utility for common revealing patterns.
21: *
22: * @since 1.22
23: * @noimplement This interface is not intended to be implemented by clients.
24: * @noextend This interface is not intended to be extended by clients.
25: */
26: public interface RevealHelper {
27:
28:         /**
29:          * Create an intermediate step that drills down into the best fitting of the children
30:          * of the view-model element in the current scope.
31:          *
32:          * @param drillDownStep a computation of the drill-down step. Must have a
33:          * method annotated with {@link Reveal @Reveal} and result type conforming to
34:          * {@link RevealStep}
35:          *
36:          * @return the intermediate drill-down step
37:          * @see #drillDown(Object, Object)
38:          */
39:         default RevealStep drillDown(Object drillDownStep) {
40:                 return drillDown(drillDownStep, null);
41:         }
42:
43:         /**
44:          * Create an intermediate step that drills down into the best fitting of the children
45:          * of the view-model element in the current scope.
46:          * In addition to the usual injections, the drill-down step computation is also provided
47:          * the {@link RevealStep} that is the next step in the sequence, revealing the object in
48:          * whatever child of the parent element the computed step reveals.
49:          *
50:          * @param drillDownStep a computation of the drill-down step. Must have a
51:          * method annotated with {@link Reveal @Reveal} and result type conforming to
52:          * {@link RevealStep}
53:          * @param childrenFunction an optional function returning the subset of the {@code element}'s
54:          * children to consider for drilling down into. If omitted, all of the
55:          * {@link EObject#eContents()} of the {@code element} that are
56:          * {@link VElement}s are implied. Must have a method annotated with
57:          * {@link DrillDown @DrillDown} and result type conforming to
58:          * {@link Iterable Iterable<? extends VElement>}
59:          *
60:          * @return the intermediate drill-down step
61:          */
62:         RevealStep drillDown(Object drillDownStep, Object childrenFunction);
63:
64:         /**
65:          * Create a deferred reveal step that will attempt to reveal the domain model object
66:          * in the current context.
67:          *
68:          * @param deferredStep a computation of the deferred reveal step. Must have a
69:          * method annotated with {@link Reveal @Reveal} and result type conforming to
70:          * {@link RevealStep}
71:          *
72:          * @return the deferred terminal reveal step
73:          */
74:         RevealStep defer(Object deferredStep);
75:
76:         /**
77:          * Create a master/detail reveal step that will reveal the master of the object to be
78:          * revealed in the current context and then reveal that detail object, if it is a detail
79:          * of some master.
80:          *
81:          * @param masterStep in the case that a master object is found to reveal, a computation of the
82:          * reveal step for the master selection. Must have a method annotated with
83:          * {@link Reveal @Reveal} and result type conforming to {@link RevealStep}
84:          * @param masterFunction a function to compute the master object of which the {@code object} is a
85:          * detail in the presentation of the given {@code element}. If the function returns either
86:          * the input {@link EObject} domain model object or {@code null}, then that input is
87:          * considered to be a master itself, and not a detail. Must have a method annotated with
88:          * {@link DrillUp @DrillUp} and result type conforming to {@link EObject}
89:          *
90:          * @return the master/detail reveal step
91:          */
92:         RevealStep masterDetail(Object masterStep, Object masterFunction);
93:
94: }