Skip to content

Package: ViewTemplateSupplier

ViewTemplateSupplier

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2018 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.emf.ecp.spi.view.template.service;
15:
16: import java.util.Map;
17: import java.util.Set;
18:
19: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
20: import org.eclipse.emf.ecp.view.spi.model.VElement;
21: import org.eclipse.emf.ecp.view.template.model.VTStyleProperty;
22: import org.eclipse.emf.ecp.view.template.model.VTViewTemplate;
23:
24: /**
25: * A {@link ViewTemplateSupplier} collects and provides any number of {@link VTViewTemplate VTViewTemplates}.
26: * <p>
27: * This interface may be implemented by clients to implement custom logic to provide VTViewTemplates and/or
28: * {@link VTStyleProperty VTStyleProperties} for given {@link VElement VElements}.
29: *
30: * @author Lucas Koehler
31: * @since 1.18
32: */
33: public interface ViewTemplateSupplier {
34:
35:         /**
36:          * Return all {@link VTStyleProperty StyleProperties} which are applicable to the provided {@link VElement}.
37:          * The keys of the map are the {@link VTStyleProperty StyleProperties} and the values the corresponding
38:          * specificities.
39:          * <p>
40:          * The returned values might be cached by the caller. Therefore, for the same arguments, the
41:          * {@link ViewTemplateSupplier} is expected to return the same map of {@link VTStyleProperty StyleProperties} and
42:          * specificities.
43:          *
44:          * @param vElement the {@link VElement} to get the {@link VTStyleProperty StyleProperties} for
45:          * @param viewModelContext the {@link ViewModelContext} currently in use
46:          * @return the map of all {@link VTStyleProperty StyleProperties} and their specificities for the given
47:          * {@link VElement} or an empty map
48:          */
49:         Map<VTStyleProperty, Double> getStyleProperties(VElement vElement, ViewModelContext viewModelContext);
50:
51:         /**
52:          * Returns a copy of the view templates known to this supplier.
53:          * Modifications on the copies will not influence any future calls on the {@link ViewTemplateSupplier}
54:          *
55:          * @return a copy of the {@link VTViewTemplate VTViewTemplates} or an empty set
56:          */
57:         Set<VTViewTemplate> getViewTemplates();
58: }