Skip to content

Package: DefaultRenderingResultFactory

DefaultRenderingResultFactory

nameinstructionbranchcomplexitylinemethod
DefaultRenderingResultFactory()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createRenderingResultRow(Control[])
M: 62 C: 0
0%
M: 10 C: 0
0%
M: 6 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 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.emf.ecp.edit.internal.swt.util;
15:
16: import org.eclipse.emf.ecp.view.spi.renderer.RenderingResultRow;
17: import org.eclipse.emf.ecp.view.spi.renderer.RenderingResultRowFactory;
18: import org.eclipse.swt.widgets.Control;
19:
20: /**
21: * @author Eugen Neufeld
22: *
23: */
24: @Deprecated
25: public final class DefaultRenderingResultFactory implements RenderingResultRowFactory<Control> {
26:
27:         /**
28:          * {@inheritDoc}
29:          *
30:          * @see org.eclipse.emf.ecp.view.spi.renderer.RenderingResultRowFactory#createRenderingResultRow(org.eclipse.swt.widgets.Control[])
31:          */
32:         @Override
33:         public RenderingResultRow<Control> createRenderingResultRow(Control... controls) {
34:•                if (controls == null) {
35:                         throw new IllegalArgumentException("Controls must not be null."); //$NON-NLS-1$
36:                 }
37:•                if (controls.length == 0) {
38:                         throw new IllegalArgumentException("Controls must not be empty."); //$NON-NLS-1$
39:                 }
40:•                if (controls.length == 1) {
41:                         return new SingleColumnRow(controls[0]);
42:                 }
43:•                if (controls.length == 2) {
44:                         return new DoubleColumnRow(controls[0], controls[1]);
45:                 }
46:•                if (controls.length == 3) {
47:                         return new ThreeColumnRow(controls[0], controls[1], controls[2]);
48:                 }
49:                 throw new IllegalArgumentException(
50:                         "DefaultRenderingResultFactory cannot handle more then three controls per row."); //$NON-NLS-1$
51:         }
52:
53: }