KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > documenttype > eventhandler > DTEditSubPresSelectionHandler


1 package de.webman.documenttype.eventhandler;
2
3 import com.teamkonzept.web.*;
4 import com.teamkonzept.webman.*;
5 import com.teamkonzept.webman.db.TKWebmanDBManager;
6 import com.teamkonzept.webman.mainint.*;
7 import com.teamkonzept.webman.mainint.db.*;
8
9
10 import com.teamkonzept.webman.mainint.db.queries.*;
11 import com.teamkonzept.webman.mainint.events.*;
12 import com.teamkonzept.lib.*;
13 import com.teamkonzept.field.*;
14 import com.teamkonzept.field.db.*;
15 import com.teamkonzept.db.*;
16 import com.teamkonzept.publishing.markups.*;
17
18 import java.util.*;
19 import java.sql.*;
20
21 /************************************************************************
22 /**
23 * doPREditSubpresSel
24 *
25 * Aendern der sub_presentation-Auswahl einer typedReference-Componente einer Presentation
26 *
27 */

28 public class DTEditSubPresSelectionHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults
29 {
30     private DTEditSubPresSelectionHandler()
31     {}
32     
33     private static DTEditSubPresSelectionHandler instance = new DTEditSubPresSelectionHandler();
34     
35     public static DTEditSubPresSelectionHandler getInstance()
36     {
37         return instance;
38     }
39     
40     public void handleEvent(TKEvent evt) throws TKException
41     {
42         try
43         {
44             WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.PRESENTATIONS);
45             TKHTMLTemplate t = evt.getPrepHTMLTemplate( "pr_compSelect.tmpl" );
46             TKQuery q = TKDBManager.newQuery(TKDBPresentationGet.class);
47             q.execute();
48             ResultSet rs = q.fetchResultSet();
49             TKDBTemplate.prepareListTemplate( rs, t, "PR_SELECTION_LIST" );
50             t.set( evt.getParams().getClass( PARAMETER ) );
51             TKVector subPresSelection = DTUtils.getSelectedPres(evt);
52             if( subPresSelection.size() != 0 ) {
53                 t.set( "SUB_PRESENTATION_ID", subPresSelection.size()>1?subPresSelection:subPresSelection.get(0) );
54                 TKStandardIterator iterator = new TKStandardIterator( subPresSelection, t.getListIterator(), "PR_OLD_SELECTION_LIST", "OLD_SUB_PRESENTATION_ID" );
55                 t.setListIterator( iterator );
56             }
57             WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t, PRESENTATIONS);
58             evt.finishTemplate(t);
59         }
60         catch (Throwable JavaDoc e)
61         {
62             // TO DO : Analyze Exception !
63
throw WebmanExceptionHandler.getException(e);
64         }
65     }
66     
67     public boolean isHandler(TKEvent evt)
68     {
69         return evt.getName().equalsIgnoreCase("PR_EDIT_SUBPRES_SELECTION") ;
70     }
71 }
72
Popular Tags