Bug 378401: Implementation of time graph widget.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / StateItem.java
1 /**********************************************************************
2 * Copyright (c) 2012 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.linuxtools.tmf.ui.widgets.timegraph;
13
14 import org.eclipse.swt.graphics.RGB;
15
16 /**
17 * <p>
18 * Class that contains the color of a state and the corresponding state string to display.
19 * </p>
20 */
21 public class StateItem {
22
23 // ------------------------------------------------------------------------
24 // Constants
25 // ------------------------------------------------------------------------
26 /**
27 * Name of state if not known
28 */
29 public static final String UNDEFINED_STATE_NAME = "Undefined"; //$NON-NLS-1$
30
31 // ------------------------------------------------------------------------
32 // Attributes
33 // ------------------------------------------------------------------------
34 /**
35 * The State color
36 */
37 private RGB fStateColor;
38 /**
39 * The State string.
40 */
41 private String fStateString;
42
43
44 // ------------------------------------------------------------------------
45 // Constructors
46 // ------------------------------------------------------------------------
47
48 /**
49 * Creates a state item with given color and unspecified name.
50 *
51 * @param stateColor A state color
52 */
53 public StateItem(RGB stateColor) {
54 this(stateColor, UNDEFINED_STATE_NAME);
55 }
56
57 /**
58 * Creates a state color - state string pair.
59 *
60 * @param stateColor A state color
61 * @param stateString A state string
62 */
63 public StateItem(RGB stateColor, String stateString) {
64 fStateColor = stateColor;
65 fStateString = stateString;
66 }
67
68 // ------------------------------------------------------------------------
69 // Accessors
70 // ------------------------------------------------------------------------
71 /**
72 * Returns the state color.
73 *
74 * @return Returns the state color.
75 */
76 public RGB getStateColor() {
77 return fStateColor;
78 }
79
80 /**
81 * Sets the state color.
82 *
83 * @param stateColor A state color to set
84 */
85 public void setStateColor(RGB stateColor) {
86 fStateColor = stateColor;
87 }
88
89 /**
90 * Returns the state string.
91 *
92 * @return the state string.
93 */
94 public String getStateString() {
95 return fStateString;
96 }
97
98 /**
99 * Sets the state string
100 * @param stateString A state string to set
101 */
102 public void setStateString(String stateString) {
103 fStateString = stateString;
104 }
105 }
This page took 0.04976 seconds and 5 git commands to generate.