Styles.java revision bb18678e1149389693c6051e9c3e5b8e6a5cd164
1/*******************************************************************************
2 * Copyright (c) 2009, 2010 Mountainminds GmbH & Co. KG and Contributors
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *    Marc R. Hoffmann - initial API and implementation
10 *
11 *******************************************************************************/
12package org.jacoco.report.internal.html.resources;
13
14/**
15 * Constants for styles defined by the report style sheet.
16 *
17 * @author Marc R. Hoffmann
18 * @version $qualified.bundle.version$
19 */
20public class Styles {
21
22	/** Breadcrumb bar */
23	public static final String BREADCRUMB = "breadcrumb";
24
25	/** Footer */
26	public static final String FOOTER = "footer";
27
28	/** Test block aligned to the right */
29	public static final String RIGHT = "right";
30
31	/** Report element */
32	public static final String EL_REPORT = "el_report";
33
34	/** Sessions element */
35	public static final String EL_SESSION = "el_session";
36
37	/** Group element */
38	public static final String EL_GROUP = "el_group";
39
40	/** Bundle element */
41	public static final String EL_BUNDLE = "el_bundle";
42
43	/** Package element */
44	public static final String EL_PACKAGE = "el_package";
45
46	/** Source file element */
47	public static final String EL_SOURCE = "el_source";
48
49	/** Class element */
50	public static final String EL_CLASS = "el_class";
51
52	/** Method element */
53	public static final String EL_METHOD = "el_method";
54
55	/** Coverage table */
56	public static final String COVERAGETABLE = "coverage";
57
58	/** Table cells for the first column of a counter */
59	public static final String CTR1 = "ctr1";
60
61	/** Table cells for the second column of a counter */
62	public static final String CTR2 = "ctr2";
63
64	/** Table header for sortable columns */
65	public static final String SORTABLE = "sortable";
66
67	/** Table header for column sorted upwards */
68	public static final String UP = "up";
69
70	/** Table header for column sorted downwards */
71	public static final String DOWN = "down";
72
73	/** Block of source code */
74	public static final String SOURCE = "source";
75
76	/** Line number before each source line */
77	public static final String NR = "nr";
78
79	/** Part of source code that is not covered */
80	public static final String NOT_COVERED = "nc";
81
82	/** Part of source code that is partly covered */
83	public static final String PARTLY_COVERED = "pc";
84
85	/** Part of source code that is fully covered */
86	public static final String FULLY_COVERED = "fc";
87
88	/**
89	 * Returns a combined style from the given styles.
90	 *
91	 * @param styles
92	 *            list of separate styles, entries might be null
93	 * @return combined style or <code>null</code> if no style is given
94	 */
95	public static String combine(final String... styles) {
96		final StringBuilder sb = new StringBuilder();
97		for (final String style : styles) {
98			if (style != null) {
99				if (sb.length() > 0) {
100					sb.append(" ");
101				}
102				sb.append(style);
103			}
104		}
105		return sb.length() == 0 ? null : sb.toString();
106	}
107
108	private Styles() {
109	}
110
111}
112