001: /*
002: * <copyright>
003: *
004: * Copyright 2000-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.tools.csmart.core.property;
028:
029: import org.cougaar.tools.csmart.core.property.name.CompositeName;
030:
031: import java.io.PrintStream;
032: import java.io.Serializable;
033: import java.net.URL;
034: import java.util.Iterator;
035: import java.util.Set;
036:
037: /**
038: * Every property has these attributes:
039: * name, propertyClass, label, defaultValue, value, allowedValues,
040: * These values should be get/set through the ComponentProperties interface.
041: */
042: public interface Property extends Serializable {
043:
044: /**
045: * Gets the name of this property
046: *
047: * @return a <code>CompositeName</code> value
048: */
049: CompositeName getName();
050:
051: /**
052: * Gets the class of this property. The class
053: * defines what type of value this property accepts.
054: *
055: * @return a <code>Class</code> value
056: */
057: Class getPropertyClass();
058:
059: /**
060: * Sets the class of this property. The class
061: * defines what type of value this property accepts.
062: *
063: * @param c Property Class
064: */
065: void setPropertyClass(Class c);
066:
067: /**
068: * Gets the Label for this Property. Each property
069: * contains a description label.
070: *
071: * @return a <code>String</code> value
072: */
073: String getLabel();
074:
075: /**
076: * Sets the label for this Property. Each property
077: * contains a description label.
078: *
079: * @param label
080: */
081: void setLabel(String label);
082:
083: /**
084: * Gets the default value for this property.
085: * All properties can contain default values.
086: *
087: * @return an <code>Object</code> value
088: */
089: Object getDefaultValue();
090:
091: /**
092: * Sets the default value for this property.
093: * All properties can contain default values.
094: *
095: * @param defaultValue
096: */
097: void setDefaultValue(Object defaultValue);
098:
099: /**
100: * Gets the current set value for this property.
101: *
102: * @return an <code>Object</code> value
103: */
104: Object getValue();
105:
106: /**
107: * Sets the value for this property.
108: *
109: * @param value
110: */
111: void setValue(Object value);
112:
113: /**
114: * Gets all Allowed Values for this property.
115: * Each property can define a specific range or set
116: * of valid values.
117: *
118: * @return a <code>Set</code> value
119: */
120: Set getAllowedValues();
121:
122: /**
123: * Sets all Allowed Values for this Property
124: * Each property can define a specific range or set
125: * of valid values.
126: *
127: * @param allowedValues
128: */
129: void setAllowedValues(Set allowedValues);
130:
131: /**
132: * Indicates if the value for this property has been set.
133: *
134: * @return a <code>boolean</code> value
135: */
136: boolean isValueSet();
137:
138: /**
139: * Adds a PropertyListener to this Property.
140: * A property Listener listens for changes to the property
141: * a sets an Event if a change has occured.
142: *
143: * @param l
144: */
145: void addPropertyListener(PropertyListener l);
146:
147: /**
148: * Removes a PropertyListener from this Property
149: *
150: * @param l
151: */
152: void removePropertyListener(PropertyListener l);
153:
154: /**
155: * Gets an <code>Iterator</code> of all PropertyListeners
156: *
157: * @return an <code>Iterator</code> value
158: */
159: Iterator getPropertyListeners();
160:
161: /**
162: * Gets the ConfigurableComponent associated with this property.
163: *
164: * @return a <code>ConfigurableComponent</code> value
165: */
166: ConfigurableComponent getConfigurableComponent();
167:
168: /**
169: * Gets the GUI tooltip for this property.
170: *
171: * @return a <code>String</code> value
172: */
173: String getToolTip();
174:
175: /**
176: * Sets a GUI tooltip for this property.
177: *
178: * @param tt
179: * @return a <code>Property</code> value
180: */
181: Property setToolTip(String tt);
182:
183: /**
184: * Returns a <code>URL</code> for the html help for this property.
185: *
186: * @return an <code>URL</code> value
187: */
188: URL getHelp();
189:
190: /**
191: * Sets the URL for help for this property.
192: *
193: * @param url
194: * @return a <code>Property</code> value
195: */
196: Property setHelp(URL url);
197:
198: void setVisible(boolean visible);
199:
200: boolean isVisible();
201:
202: // For debugging
203: void printProperty(PrintStream out);
204:
205: void printProperty(PrintStream out, String indent);
206: }
|