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 shape 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 DynamicTestsShape {
19:
20: public static final DynamicTestsShape CIRCLE = new DynamicTestsShape(
21: "circle"); //$NON-NLS-1$
22:
23: public static final DynamicTestsShape SQUARE = new DynamicTestsShape(
24: "square"); //$NON-NLS-1$
25:
26: public static final DynamicTestsShape STAR = new DynamicTestsShape(
27: "star"); //$NON-NLS-1$
28:
29: public static final DynamicTestsShape TRIANGLE = new DynamicTestsShape(
30: "triangle"); //$NON-NLS-1$
31:
32: /**
33: * @return the shape
34: */
35: public static DynamicTestsShape getShape(String value) {
36: if (SQUARE.getShape().equals(value)) {
37: return SQUARE;
38: } else if (CIRCLE.getShape().equals(value)) {
39: return CIRCLE;
40: } else if (TRIANGLE.getShape().equals(value)) {
41: return TRIANGLE;
42: } else if (STAR.getShape().equals(value)) {
43: return STAR;
44: }
45: return null;
46: }
47:
48: private String shape;
49:
50: private DynamicTestsShape(String aShape) {
51: setShape(aShape);
52: }
53:
54: /**
55: * @return the shape
56: */
57: public String getShape() {
58: return shape;
59: }
60:
61: /**
62: * @param shape
63: * the shape to set
64: */
65: public void setShape(String aShape) {
66: this .shape = aShape;
67: }
68:
69: public String toString() {
70: return getShape();
71: }
72:
73: }
|