1 /*
2 * @(#)$Id: TextDescriptor.java 760 2009-08-25 20:10:41Z kurmannu $
3 *
4 * Author : Ueli Kurmann, igesture@uelikurmann.ch
5 *
6 * Purpose : Textual descriptor.
7 *
8 * -----------------------------------------------------------------------
9 *
10 * Revision Information:
11 *
12 * Date Who Reason
13 *
14 * Dec 26, 2006 ukurmann Initial Release
15 * Mar 22, 2007 bsigner Cleanup
16 *
17 * -----------------------------------------------------------------------
18 *
19 * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20 *
21 * This software is the proprietary information of ETH Zurich.
22 * Use is subject to license terms.
23 *
24 */
25
26
27 package org.ximtec.igesture.core;
28
29 import org.sigtec.util.Constant;
30
31
32 /**
33 * Textual descriptor.
34 *
35 * @version 1.0, Dec 2006
36 * @author Ueli Kurmann, igesture@uelikurmann.ch
37 * @author Beat Signer, signer@inf.ethz.ch
38 */
39 public class TextDescriptor extends DefaultDescriptor {
40
41 public static final String PROPERTY_TEXT = "text";
42
43 private String text;
44
45
46 /**
47 * Constructs a new text descriptor.
48 *
49 */
50 public TextDescriptor() {
51 this(Constant.EMPTY_STRING);
52 }
53
54
55 /**
56 * Constructs a new text descriptor with a given text.
57 *
58 * @param text the textual description.
59 */
60 public TextDescriptor(String text) {
61 super();
62 setText(text);
63 }
64
65
66 /**
67 * Sets the text description.
68 *
69 * @param text the textual description to be added.
70 */
71 public void setText(String text) {
72 String oldValue = this.text;
73 this.text = text;
74 propertyChangeSupport.firePropertyChange(PROPERTY_TEXT, oldValue, text);
75 } // setText
76
77
78 /**
79 * Returns the textual description.
80 *
81 * @return the textual description.
82 */
83 public String getText() {
84 return text;
85 } // getText
86
87
88 /**
89 * {@inheritDoc}
90 */
91 @Override
92 public void accept(Visitor visitor) {
93 visitor.visit(this);
94 }
95
96
97 @Override
98 public String toString() {
99 return this.getClass().getSimpleName();
100 } // toString
101
102
103 @Override
104 public String getName() {
105 return this.getClass().getSimpleName();
106 }
107
108 }