Styles.java revision 37115f4ba4f6126b8c3352ac890c653e428a7dd8
1/*******************************************************************************
2 * Copyright (c) 2009, 2013 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 */
17public final class Styles {
18
19	/** Breadcrumb bar */
20	public static final String BREADCRUMB = "breadcrumb";
21
22	/** Footer */
23	public static final String FOOTER = "footer";
24
25	/** Text block aligned to the right */
26	public static final String RIGHT = "right";
27
28	/** Report element */
29	public static final String EL_REPORT = "el_report";
30
31	/** Sessions element */
32	public static final String EL_SESSION = "el_session";
33
34	/** Group element */
35	public static final String EL_GROUP = "el_group";
36
37	/** Bundle element */
38	public static final String EL_BUNDLE = "el_bundle";
39
40	/** Package element */
41	public static final String EL_PACKAGE = "el_package";
42
43	/** Source file element */
44	public static final String EL_SOURCE = "el_source";
45
46	/** Class element */
47	public static final String EL_CLASS = "el_class";
48
49	/** Method element */
50	public static final String EL_METHOD = "el_method";
51
52	/** Coverage table */
53	public static final String COVERAGETABLE = "coverage";
54
55	/** Table cells for a graphical bar */
56	public static final String BAR = "bar";
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 where instructions are not covered */
80	public static final String NOT_COVERED = "nc";
81
82	/** Part of source code where instructions are partly covered */
83	public static final String PARTLY_COVERED = "pc";
84
85	/** Part of source code where instructions are is fully covered */
86	public static final String FULLY_COVERED = "fc";
87
88	/** Part of source code where branches are not covered */
89	public static final String BRANCH_NOT_COVERED = "bnc";
90
91	/** Part of source code where branches are partly covered */
92	public static final String BRANCH_PARTLY_COVERED = "bpc";
93
94	/** Part of source code where branches are fully covered */
95	public static final String BRANCH_FULLY_COVERED = "bfc";
96
97	/**
98	 * Returns a combined style from the given styles.
99	 *
100	 * @param styles
101	 *            list of separate styles, entries might be null
102	 * @return combined style or <code>null</code> if no style is given
103	 */
104	public static String combine(final String... styles) {
105		final StringBuilder sb = new StringBuilder();
106		for (final String style : styles) {
107			if (style != null) {
108				if (sb.length() > 0) {
109					sb.append(" ");
110				}
111				sb.append(style);
112			}
113		}
114		return sb.length() == 0 ? null : sb.toString();
115	}
116
117	private Styles() {
118	}
119
120}
121