01: package de.webman.form.eventhandler;
02:
03: import com.teamkonzept.web.*;
04: import com.teamkonzept.webman.*;
05: import com.teamkonzept.webman.db.TKWebmanDBManager;
06: import com.teamkonzept.webman.mainint.*;
07: import com.teamkonzept.webman.mainint.db.*;
08:
09: import com.teamkonzept.webman.mainint.db.queries.*;
10: import com.teamkonzept.webman.mainint.events.*;
11: import com.teamkonzept.lib.*;
12: import com.teamkonzept.field.*;
13: import com.teamkonzept.field.db.*;
14: import com.teamkonzept.db.*;
15: import com.teamkonzept.publishing.markups.*;
16:
17: import java.sql.*;
18: import java.io.*;
19:
20: /************************************************************************
21: /**
22: * liefert neue Formularseite mit Defaultwerten zurueck
23: *
24: *
25: */
26: public class CTDefaultHandler extends DefaultEventHandler implements
27: ParameterTypes, FrameConstants, DatabaseDefaults {
28: private CTDefaultHandler() {
29: }
30:
31: private static CTDefaultHandler instance = new CTDefaultHandler();
32:
33: public static CTDefaultHandler getInstance() {
34: return instance;
35: }
36:
37: public void handleEvent(TKEvent evt) throws TKException {
38: try {
39: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
40: ContextConstants.CONTENT_TREE);
41: TKHTMLTemplate t = evt
42: .getPrepHTMLTemplate("ct_fields.tmpl");
43: TKBaseField field = CTUtils
44: .getStructure(Integer.parseInt(evt.getParameter(
45: PARAMETER, "FORM_TYPE")));
46:
47: Object realData = field.getDefault();
48:
49: field.fillIntoTemplate(t, realData, "");
50: CTUtils.keepCTContext(evt, t);
51: WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t,
52: CONTENT_TREE);
53: evt.finishTemplate(t);
54: } catch (Throwable e) {
55: // TO DO : Analyze Exception !
56: throw WebmanExceptionHandler.getException(e);
57: }
58: }
59:
60: public boolean isHandler(TKEvent evt) {
61: return evt.getName().equalsIgnoreCase("CT_DEFAULT");
62: }
63: }
|