1 package com.teamkonzept.webman.field; 2 3 import com.teamkonzept.webman.mainint.*; 4 import com.teamkonzept.webman.mainint.db.queries.TKDBContentTreeGetType; 5 import com.teamkonzept.webman.mainint.db.queries.*; 6 import de.webman.content.eventhandler.CEUtils; 7 8 import com.teamkonzept.lib.*; 9 import com.teamkonzept.publishing.markups.*; 10 import com.teamkonzept.web.*; 11 import com.teamkonzept.field.db.*; 12 import com.teamkonzept.field.db.queries.*; 13 import com.teamkonzept.db.*; 14 import com.teamkonzept.field.*; 15 import com.teamkonzept.international.LanguageManager; 16 import de.webman.generator.*; 17 import java.sql.*; 18 import java.util.*; 19 import org.apache.log4j.Category; 20 21 27 public class TKFormTypeSelectorField 28 extends TKSelectField 29 { 30 33 public static final String CLASS_ID = "FORMLIST"; 34 35 38 private static Category cat = Category.getInstance(TKFormTypeSelectorField.class); 39 40 43 public static final Integer STRUCTURE_FORM_TYPE = new Integer (1); 44 45 48 public static final Integer FRAGMENT_FORM_TYPE = new Integer (2); 49 50 53 public static final Integer CONTENT_FORM_TYPE = new Integer (3); 54 55 58 protected Integer formType = null; 59 60 63 public TKFormTypeSelectorField () 64 { 65 super(); 66 } 67 68 public TKFormTypeSelectorField( 69 String name, 70 String showName, 71 Integer fType 72 ) 73 { 74 initSelectorField( CLASS_ID, name, showName, fType ); 75 } 76 77 public void initSelectorField( 78 String type, 79 String name, 80 String showName, 81 Integer fType 82 ) 83 { 84 initSelectField( type, name, showName, new TKVector(), 1, false ); 85 formType = fType; 86 } 87 88 public void fillIntoTemplate( TKHTMLTemplate t, Object value, String prefix ) 89 { 90 TKVector tmpOptionList = optionList; 91 try { 92 TKQuery q = TKDBManager.newQuery( TKDBFormGetAll69.class ); 94 q.execute(); 96 ResultSet res = q.fetchResultSet(); 97 TKVector newOptionList = new TKVector(); 98 newOptionList.addElement(new TKOptionFieldEntry(LanguageManager.getText("form", "OPTIONLIST_POSSIBILITIES"), "0")); 99 while( res.next() ) { 100 String name = res.getString("FORM_NAME"); 101 newOptionList.addElement( 102 new TKOptionFieldEntry( 103 name, 104 String.valueOf( res.getInt("FORM_ID") ) 105 ) 106 ); 107 } 108 res.close(); 109 optionList = newOptionList; 110 } 111 catch( SQLException e ) { 112 cat.error("fillIntoTemplate", e); 113 return; 114 } 115 super.fillIntoTemplate( t, value, prefix ); 116 optionList = tmpOptionList; 117 } 118 119 128 public boolean equals (Object object) 129 { 130 if (! super.equals(object)) 131 { 132 return false; 133 } 134 135 TKFormTypeSelectorField field = (TKFormTypeSelectorField) object; 136 137 return (this.formType == null ? field.formType == null : this.formType.equals(field.formType)); 138 } 139 140 145 public int hashCode () 146 { 147 return super.hashCode(); 149 } 150 151 } 152 | Popular Tags |