KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > field > TKEmbededSwitch


1 package com.teamkonzept.field;
2
3 import com.teamkonzept.lib.*;
4 import org.w3c.dom.*;
5
6 /**
7  * The embedded - not the <I>embeded</I> - switch control.
8  *
9  * @author $Author: uli $
10  * @version $Revision: 1.13 $
11  */

12 public class TKEmbededSwitch
13     extends TKFieldSwitch
14 {
15     // $Id: TKEmbededSwitch.java,v 1.13 2002/02/25 17:47:40 uli Exp $
16

17     public TKEmbededSwitch( TKVector alternatives )
18     {
19         initFieldSwitch("", "", alternatives, null, CHECK_UNDEFINED);
20     }
21
22     /**
23      * Sets the name of the embedded field.
24      *
25      * @param name the name of the embedded field.
26      */

27     public void setEmbedName (String JavaDoc name)
28     {
29         fieldName = name;
30     }
31
32     public Object JavaDoc getDefault( String JavaDoc alternative )
33     {
34         TKBaseField field = (TKBaseField) fieldHash.get( alternative );
35         if( field == null ) return getDefault();
36         return new TKFieldSwitchData( alternative, alternative, field.getDefault() );
37     }
38
39     public void fillIntoDOM (Document doc, Element node, Object JavaDoc data)
40         throws DOMException
41     {
42         TKFieldSwitchData switchData = (TKFieldSwitchData) data;
43
44         if (switchData.alternative.length() > 0)
45         {
46             TKBaseField field = (TKBaseField) fieldHash.get(switchData.alternative);
47             field.fillIntoDOM(doc, node, switchData.data);
48         }
49     }
50
51 }
52
Free Books   Free Magazines  
Popular Tags