Skip to content

Package: EMFFormsDIRendererService

EMFFormsDIRendererService

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: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.swt.core.di;
15:
16: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
17: import org.eclipse.emf.ecp.view.spi.model.VElement;
18: import org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer;
19:
20: /**
21: * This class defines a renderer service interface for dependency injection renderer services.
22: * It defines the {@link #isApplicable(VElement, ViewModelContext)} method to check if the represented renderer is
23: * suitable for the given {@link VElement} and {@link ViewModelContext} and the {@link #getRendererClass()} method that
24: * returns the {@link Class} of the renderer.
25: *
26: * @author Lucas Koehler
27: *
28: * @param <VELEMENT>
29: */
30: public interface EMFFormsDIRendererService<VELEMENT extends VElement> {
31:
32:         /**
33:          * Constant for {@link #isApplicable(VElement, ViewModelContext)} to indicate, that the EMFFormsDIRendererService
34:          * cannot provide a fitting renderer for the provided VElement.
35:          */
36:         double NOT_APPLICABLE = Double.NaN;
37:
38:         /**
39:          * Check whether the provided {@link VElement} can be rendered by the renderer defined by
40:          * {@link #getRendererClass()}.
41:          *
42:          * @param vElement The {@link VElement} to check
43:          * @param viewModelContext The {@link ViewModelContext} to use for the renderer
44:          * @return {@link #NOT_APPLICABLE} if the renderer doesn't fit, a positive value otherwise
45:          */
46:         double isApplicable(VElement vElement, ViewModelContext viewModelContext);
47:
48:         /**
49:          * Returns the {@link Class} for the renderer of this service.
50:          *
51:          * @return the {@link Class}
52:          */
53:         Class<? extends AbstractSWTRenderer<VELEMENT>> getRendererClass();
54: }