tmf: Update AbstractTimeGraphView and TimeGraphEntry API
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / widgets / timegraph / StateItem.java
CommitLineData
b83af2c3 1/**********************************************************************
ed902a2b 2 * Copyright (c) 2012, 2014 Ericsson
013a5f1c 3 *
b83af2c3
PT
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
013a5f1c
AM
8 *
9 * Contributors:
b83af2c3
PT
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
2bdf0193 12package org.eclipse.tracecompass.tmf.ui.widgets.timegraph;
b83af2c3
PT
13
14import org.eclipse.swt.graphics.RGB;
15
16/**
013a5f1c
AM
17 * Class that contains the color of a state and the corresponding state string
18 * to display.
19 *
20 * @version 1.0
21 * @author Bernd Hufmann
b83af2c3
PT
22 */
23public class StateItem {
24
25 // ------------------------------------------------------------------------
26 // Constants
27 // ------------------------------------------------------------------------
28 /**
29 * Name of state if not known
30 */
31 public static final String UNDEFINED_STATE_NAME = "Undefined"; //$NON-NLS-1$
013a5f1c 32
b83af2c3
PT
33 // ------------------------------------------------------------------------
34 // Attributes
35 // ------------------------------------------------------------------------
36 /**
37 * The State color
38 */
39 private RGB fStateColor;
40 /**
41 * The State string.
42 */
43 private String fStateString;
013a5f1c
AM
44
45
b83af2c3
PT
46 // ------------------------------------------------------------------------
47 // Constructors
48 // ------------------------------------------------------------------------
49
50 /**
51 * Creates a state item with given color and unspecified name.
013a5f1c 52 *
b83af2c3
PT
53 * @param stateColor A state color
54 */
55 public StateItem(RGB stateColor) {
56 this(stateColor, UNDEFINED_STATE_NAME);
57 }
013a5f1c 58
b83af2c3
PT
59 /**
60 * Creates a state color - state string pair.
013a5f1c 61 *
b83af2c3
PT
62 * @param stateColor A state color
63 * @param stateString A state string
64 */
65 public StateItem(RGB stateColor, String stateString) {
66 fStateColor = stateColor;
67 fStateString = stateString;
68 }
69
70 // ------------------------------------------------------------------------
71 // Accessors
72 // ------------------------------------------------------------------------
73 /**
74 * Returns the state color.
013a5f1c 75 *
b83af2c3
PT
76 * @return Returns the state color.
77 */
78 public RGB getStateColor() {
79 return fStateColor;
80 }
81
82 /**
83 * Sets the state color.
013a5f1c 84 *
b83af2c3
PT
85 * @param stateColor A state color to set
86 */
87 public void setStateColor(RGB stateColor) {
88 fStateColor = stateColor;
89 }
90
91 /**
92 * Returns the state string.
013a5f1c 93 *
b83af2c3
PT
94 * @return the state string.
95 */
96 public String getStateString() {
97 return fStateString;
98 }
99
100 /**
101 * Sets the state string
102 * @param stateString A state string to set
103 */
104 public void setStateString(String stateString) {
105 fStateString = stateString;
106 }
107}
This page took 0.096078 seconds and 5 git commands to generate.