01: package com.teamkonzept.field;
02:
03: import com.teamkonzept.lib.*;
04: import org.w3c.dom.*;
05:
06: /**
07: * The embedded - not the <I>embeded</I> - switch control.
08: *
09: * @author $Author: uli $
10: * @version $Revision: 1.13 $
11: */
12: public class TKEmbededSwitch extends TKFieldSwitch {
13: // $Id: TKEmbededSwitch.java,v 1.13 2002/02/25 17:47:40 uli Exp $
14:
15: public TKEmbededSwitch(TKVector alternatives) {
16: initFieldSwitch("", "", alternatives, null, CHECK_UNDEFINED);
17: }
18:
19: /**
20: * Sets the name of the embedded field.
21: *
22: * @param name the name of the embedded field.
23: */
24: public void setEmbedName(String name) {
25: fieldName = name;
26: }
27:
28: public Object getDefault(String alternative) {
29: TKBaseField field = (TKBaseField) fieldHash.get(alternative);
30: if (field == null)
31: return getDefault();
32: return new TKFieldSwitchData(alternative, alternative, field
33: .getDefault());
34: }
35:
36: public void fillIntoDOM(Document doc, Element node, Object data)
37: throws DOMException {
38: TKFieldSwitchData switchData = (TKFieldSwitchData) data;
39:
40: if (switchData.alternative.length() > 0) {
41: TKBaseField field = (TKBaseField) fieldHash
42: .get(switchData.alternative);
43: field.fillIntoDOM(doc, node, switchData.data);
44: }
45: }
46:
47: }
|