Skip to content

Package: EMFFormsRendererService

EMFFormsRendererService

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.swt.core;
15:
16: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
17: import org.eclipse.emf.ecp.view.spi.model.VElement;
18:
19: /**
20: * The EMFFormsRendererService encapsulates the tester and the access to the {@link AbstractSWTRenderer}.
21: *
22: * @author Eugen Neufeld
23: *
24: * @param <VELEMENT>
25: */
26: public interface EMFFormsRendererService<VELEMENT extends VElement> {
27:
28:         /**
29:          * Constant for {@link #isApplicable(VElement, ViewModelContext)} to indicate, that the EMFFormsRendererService
30:          * cannot provide a
31:          * fitting renderer for the provided VElement.
32:          */
33:         double NOT_APPLICABLE = Double.NaN;
34:
35:         /**
36:          * Check whether the provided {@link VElement} can be rendered by the {@link AbstractSWTRenderer} provided by
37:          * {@link #getRendererInstance(VElement, ViewModelContext)}.
38:          *
39:          * @param vElement The {@link VElement} to check
40:          * @param viewModelContext The {@link ViewModelContext} to use for the renderer instance
41:          * @return {@link #NOT_APPLICABLE} if the renderer doesn't fit, a positive value otherwise
42:          */
43:         double isApplicable(VElement vElement, ViewModelContext viewModelContext);
44:
45:         /**
46:          * Returns a renderer.
47:          *
48:          * @param vElement The {@link VElement} to create the renderer instance for
49:          * @param viewModelContext The {@link ViewModelContext} to use for the renderer instance
50:          * @return The AbstractSWTRenderer
51:          */
52:         AbstractSWTRenderer<VELEMENT> getRendererInstance(VELEMENT vElement, ViewModelContext viewModelContext);
53: }