001: /*
002: * Copyright Javelin Software, All rights reserved.
003: */
004:
005: package com.javelin.swinglets;
006:
007: import java.awt.*;
008: import java.util.*;
009: import java.io.*;
010:
011: import javax.servlet.*;
012:
013: /**
014: * SApplet defines a component that can render an Object
015: * into a Web Page.
016: * <P>
017: * Properties come from the SComponent properties.
018: * <P>
019: * Width and Height come from the SComponent.Dimension.
020: *
021: * @author Robin Sharp
022: */
023:
024: public class SObject extends SComponent {
025: /**
026: * Creates a SObject with horizontal orientation.
027: */
028: public SObject() {
029: }
030:
031: /**
032: * Returns the name of the L&F class that renders this component.
033: */
034: public Class getUIClass() {
035: return SObject.class;
036: }
037:
038: /**
039: * Set the code base. The base URI for classid, data, archive.
040: */
041: public SObject setCodeBase(String codeBase) {
042: firePropertyChange("codeBase", this .codeBase,
043: this .codeBase = codeBase);
044: return this ;
045: }
046:
047: /**
048: * Get the code base. The base URI for classid, data, archive.
049: */
050: public String getCodeBase() {
051: return codeBase;
052: }
053:
054: /**
055: * Set the classId. This identifies an implementation.
056: */
057: public SObject setClassId(String classId) {
058: firePropertyChange("classId", this .classId,
059: this .classId = classId);
060: return this ;
061: }
062:
063: /**
064: * Get the classId. This identifies an implementation.
065: */
066: public String getClassId() {
067: return classId;
068: }
069:
070: /**
071: * Set the codeType. The content type for the classId.
072: */
073: public SObject setCodeType(String codeType) {
074: firePropertyChange("codeType", this .codeType,
075: this .codeType = codeType);
076: return this ;
077: }
078:
079: /**
080: * Get the codeType. The content type for the classId.
081: */
082: public String getCodeType() {
083: return codeType;
084: }
085:
086: /**
087: * Get the data. A reference to object's data.
088: */
089: public String getData() {
090: return data;
091: }
092:
093: /**
094: * Set the data. A reference to object's data.
095: */
096: public SObject setData(String data) {
097: firePropertyChange("data", this .data, this .data = data);
098: return this ;
099: }
100:
101: /**
102: * Set the dataType. The content type for the data property.
103: */
104: public SObject setDataType(String dataType) {
105: firePropertyChange("dataType", this .dataType,
106: this .dataType = dataType);
107: return this ;
108: }
109:
110: /**
111: * Get the dataType. The content type for the data property.
112: */
113: public String getDataType() {
114: return dataType;
115: }
116:
117: /**
118: * Get the data. A space-separated list of URIs for a libraries
119: * to be used by the code.
120: */
121: public String getArchive() {
122: return archive;
123: }
124:
125: /**
126: * Set the archive. A space-separated list of URIs for a libraries
127: * to be used by the code.
128: */
129: public SObject setArchive(String archive) {
130: firePropertyChange("archive", this .archive,
131: this .archive = archive);
132: return this ;
133: }
134:
135: /**
136: * Get the standby message. A message to use while loading.
137: */
138: public String getStandbyMessage() {
139: return standbyMessage;
140: }
141:
142: /**
143: * Set the standby message. A message to use while loading.
144: */
145: public SObject setStandbyMessage(String standbyMessage) {
146: firePropertyChange("standbyMessage", this .standbyMessage,
147: this .standbyMessage = standbyMessage);
148: return this ;
149: }
150:
151: /**
152: * Check whether the Object should be declared only.
153: */
154: public boolean isDeclaredOnly() {
155: return declaredOnly;
156: }
157:
158: /**
159: * Set whether the Object should be declared only.
160: */
161: public SObject setDeclaredOnly(boolean declaredOnly) {
162: firePropertyChange("declaredOnly", this .declaredOnly,
163: this .declaredOnly = declaredOnly);
164: return this ;
165: }
166:
167: /**
168: * @return an enumeration of keys.
169: */
170: public Enumeration getParamKeys() {
171: if (params == null) {
172: params = new Hashtable(2);
173: }
174: return params.keys();
175: }
176:
177: /**
178: * Get the param count.
179: */
180: public int getParamCount() {
181: return (params == null) ? 0 : params.size();
182: }
183:
184: /**
185: * Returns the value of the param with the specified key. Only
186: * params added with <code>putParam</code> will return
187: * a non-null value.
188: */
189: public final Object getParam(String key) {
190: if (params == null) {
191: return null;
192: } else {
193: return params.get(key);
194: }
195: }
196:
197: /**
198: * Add an arbitrary key/value "params" to this component.
199: */
200: public final SObject putParam(String key, Object value) {
201: if (params == null)
202: params = new Hashtable(2);
203:
204: if (value != null)
205: params.put(key, value);
206: else
207: params.remove(key);
208:
209: firePropertyChange(key, null, value);
210:
211: return this ;
212: }
213:
214: // PRIVATE //////////////////////////////////////////////////////////////
215:
216: protected String classId;
217:
218: protected String codeBase;
219: protected String codeType;
220:
221: protected String data;
222: protected String dataType;
223:
224: protected String archive;
225: protected boolean declaredOnly;
226: protected String standbyMessage;
227:
228: protected Hashtable params;
229: }
|