01: package de.webman.config.eventhandler;
02:
03: import java.util.*;
04:
05: import com.teamkonzept.web.*;
06: import com.teamkonzept.db.*;
07: import com.teamkonzept.lib.*;
08: import java.sql.*;
09: import com.teamkonzept.webman.*;
10: import com.teamkonzept.webman.mainint.*;
11: import com.teamkonzept.webman.mainint.db.queries.TKDBPropGetAll;
12: import com.teamkonzept.webman.mainint.events.*;
13:
14: /**
15: Displays a list of properties
16: * @author $Author: alex $
17: * @version $Revision: 1.2 $
18: */
19: public class COPropListHandler extends DefaultEventHandler implements
20: ParameterTypes, DatabaseDefaults, FrameConstants {
21: private COPropListHandler() {
22: }
23:
24: private static COPropListHandler instance = new COPropListHandler();
25:
26: public static COPropListHandler getInstance() {
27: return instance;
28: }
29:
30: public void handleEvent(TKEvent evt) throws TKException {
31: try {
32: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
33: ContextConstants.CUSTOMIZE_PROPERTIES); // check if event is allowed
34: TKQuery q = TKDBManager.newQuery(TKDBPropGetAll.class);
35: q.execute();
36: ResultSet rs = q.fetchResultSet();
37:
38: TKHTMLTemplate list = evt
39: .getPrepHTMLTemplate("co_proplist.tmpl");
40: TKDBTemplate.prepareListTemplate(rs, list, "CO_PROP_LIST");
41:
42: list.set("RTARGET", RIGHT_TARGET);
43:
44: WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(),
45: list, CUSTOMIZE_PROPERTIES);
46: evt.finishTemplate(list);
47:
48: } catch (Throwable ex) {
49: throw WebmanExceptionHandler.getException(ex);
50: }
51: }
52:
53: public boolean isHandler(TKEvent evt) {
54: return evt.getName().equalsIgnoreCase("CO_PROP_LIST");
55: }
56:
57: }
|