Skip to content

Package: LayoutProvider

LayoutProvider

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 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 - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.swt.core.layout;
15:
16: import org.eclipse.emf.ecore.EObject;
17: import org.eclipse.emf.ecp.view.spi.model.VElement;
18: import org.eclipse.swt.graphics.Point;
19: import org.eclipse.swt.widgets.Control;
20: import org.eclipse.swt.widgets.Layout;
21:
22: /**
23: * By providing an own implementation, the layout of the application can be influenced.
24: *
25: * @author Eugen Neufeld
26: * @since 1.3
27: */
28: public interface LayoutProvider {
29:
30:         /**
31:          * The Layout for aligning controls vertically in columns.
32:          *
33:          * @param numColumns the number of columns to create
34:          * @param equalWidth whether the columns should be equal width
35:          * @return the layout to use
36:          */
37:         Layout getColumnLayout(int numColumns, boolean equalWidth);
38:
39:         /**
40:          * The Layout for aligning controls vertically in columns.
41:          *
42:          * @param numColumns the number of columns to create
43:          * @param equalWidth whether the columns should be equal width
44:          * @param margins the margins of the layout
45:          * @return the layout to use
46:          * @since 1.7
47:          */
48:         Layout getColumnLayout(int numColumns, boolean equalWidth, Point margins);
49:
50:         /**
51:          * The LayoutData to use.
52:          *
53:          * @param gridCell the current {@link SWTGridCell}
54:          * @param controlGridDescription the {@link SWTGridDescription} of the rendered {@link VElement}
55:          * @param currentRowGridDescription the {@link SWTGridDescription} of the current row
56:          * @param fullGridDescription the {@link SWTGridDescription} of the whole container
57:          * @param vElement the {@link VElement} which is currently rendered
58:          * @param domainModel The domain model object whose feature is currently rendered
59:          * @param control the rendered {@link Control}
60:          * @return the Object being the layout data to set
61:          * @since 1.6
62:          */
63:         Object getLayoutData(SWTGridCell gridCell, SWTGridDescription controlGridDescription,
64:                 SWTGridDescription currentRowGridDescription, SWTGridDescription fullGridDescription, VElement vElement,
65:                 EObject domainModel, Control control);
66:
67:         /**
68:          * A simple spanning Layout.
69:          *
70:          * @param spanX the horizontal span
71:          * @param spanY the vertical span
72:          * @return the created Layout Data
73:          */
74:         Object getSpanningLayoutData(int spanX, int spanY);
75: }