KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > config > eventhandler > COPropListHandler


1 package de.webman.config.eventhandler;
2
3 import java.util.*;
4
5 import com.teamkonzept.web.*;
6 import com.teamkonzept.db.*;
7 import com.teamkonzept.lib.*;
8 import java.sql.*;
9 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 ParameterTypes, DatabaseDefaults, FrameConstants
20 {
21     private COPropListHandler() {}
22     
23     private static COPropListHandler instance = new COPropListHandler();
24     
25     public static COPropListHandler getInstance()
26     {
27         return instance;
28     }
29
30     public void handleEvent(TKEvent evt) throws TKException
31     {
32         try {
33             WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), 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.getPrepHTMLTemplate( "co_proplist.tmpl" );
39             TKDBTemplate.prepareListTemplate( rs, list, "CO_PROP_LIST" );
40             
41             list.set( "RTARGET", RIGHT_TARGET );
42             
43             WebManEvent.fillEventsIntoTemplate( evt.getRemoteUser(), list, CUSTOMIZE_PROPERTIES );
44             evt.finishTemplate( list );
45
46         }
47         catch (Throwable JavaDoc ex)
48         {
49             throw WebmanExceptionHandler.getException(ex);
50         }
51     }
52     
53     public boolean isHandler(TKEvent evt)
54     {
55         return evt.getName().equalsIgnoreCase( "CO_PROP_LIST" );
56     }
57
58 }
59
Popular Tags