01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.tests.views.properties.tabbed.dynamic.model;
11:
12: /**
13: * A color enumeration for the dynamic tests view. (Should use an enum when we
14: * can use Java 5).
15: *
16: * @author Anthony Hunter
17: */
18: public class DynamicTestsColor {
19:
20: public static final DynamicTestsColor BLACK = new DynamicTestsColor(
21: "black"); //$NON-NLS-1$
22:
23: public static final DynamicTestsColor BLUE = new DynamicTestsColor(
24: "blue"); //$NON-NLS-1$
25:
26: public static final DynamicTestsColor GREEN = new DynamicTestsColor(
27: "green"); //$NON-NLS-1$
28:
29: public static final DynamicTestsColor RED = new DynamicTestsColor(
30: "red"); //$NON-NLS-1$
31:
32: /**
33: * @return the color
34: */
35: public static DynamicTestsColor getColor(String value) {
36: if (RED.getColor().equals(value)) {
37: return RED;
38: } else if (GREEN.getColor().equals(value)) {
39: return GREEN;
40: } else if (BLUE.getColor().equals(value)) {
41: return BLUE;
42: } else if (BLACK.getColor().equals(value)) {
43: return BLACK;
44: }
45: return null;
46: }
47:
48: private String color;
49:
50: private DynamicTestsColor(String aColor) {
51: setColor(aColor);
52: }
53:
54: /**
55: * @return the color
56: */
57: public String getColor() {
58: return color;
59: }
60:
61: /**
62: * @param color
63: * the color to set
64: */
65: public void setColor(String aColor) {
66: this .color = aColor;
67: }
68:
69: public String toString() {
70: return getColor();
71: }
72: }
|