1 package de.webman.generator; 2 3 import com.teamkonzept.lib.*; 4 import com.teamkonzept.field.*; 5 import com.teamkonzept.field.db.*; 6 7 15 public class ContentFormStatics 16 { 17 18 21 private GeneratorContext context; 22 23 27 private TKHashtable formHash; 29 public ContentFormStatics (GeneratorContext context) 30 { 31 this.context = context != null ? context : GeneratorContext.setup (); 32 this.formHash = null; 33 } 34 35 38 public TKBaseField getContentForm( int formId ) 39 { 40 Integer fID = new Integer ( formId ); 41 42 Object form = formHash.get( fID ); 44 if( form != null ) { 45 return (TKBaseField) form; 46 } 47 48 TKBaseField newForm; 50 try 51 { 52 TKFormDBData formData = new TKFormDBData( formId ); 53 TKFormDBInterface.Get( formData ); 54 newForm = TKFieldRegistry.getFieldFromDB( formData ); 55 } 56 catch (Exception ex) 57 { 58 throw new Error ( ex.getMessage() ); 59 } 60 61 formHash.put( fID, newForm ); 63 return newForm; 64 } 65 66 69 public void prepareFormHash() 70 { 71 formHash = new TKHashtable(); 72 } 73 } | Popular Tags |