KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > sitetree > eventhandler > STCancelContentSelectionHandler


1 package de.webman.sitetree.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.sql.*;
19 import java.io.*;
20 import java.util.*;
21
22 /************************************************************************
23 /**
24 * Abbruch des Verfeinern der Content-Selection
25 *
26 *
27 *
28 * @param CONTENT_NODE_ID, SELECTION_TYPE, SELECTION_CONTEXT
29 */

30 public class STCancelContentSelectionHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults
31 {
32     private STCancelContentSelectionHandler()
33     {}
34     
35     private static STCancelContentSelectionHandler instance = new STCancelContentSelectionHandler();
36     
37     public static STCancelContentSelectionHandler getInstance()
38     {
39         return instance;
40     }
41     
42     public void handleEvent(TKEvent evt) throws TKException
43     {
44         try
45         {
46             WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.SITE_TREE);
47             String JavaDoc context = evt.getParameter( PARAMETER, "SELECTION_CONTEXT" );
48             if( context.equals( "PRIMARY" ) ) {
49                 TKHTMLTemplate t = evt.getPrepHTMLTemplate( "st_newNode.tmpl" );
50                 SiteTreeUtils.prepareNodeParams( t, evt.getParameter( PARAMETER, "SITE_NODE_TYPE" ) );
51                 t.set( evt.getParams().getClass( PARAMETER ) );
52                 t.set( "NEW_NODE_TYPE", evt.getParameter( PARAMETER, "SITE_NODE_TYPE" ) );
53                 t.set( "THE_CONTENT_NODE_ID", evt.getParameter( PARAMETER, "NODE_ID" ) );
54                 t.set( "THE_SELECTION_TYPE", evt.getParameter( PARAMETER, "SEL_TYPE" ) );
55                 TreeUtils.keepOpenNodes( evt, t );
56                 WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t, SITE_TREE);
57                 evt.finishTemplate(t);
58                 return;
59             }
60             if( context.equals( "EDIT_PRIMARY" ) ) {
61                 TKHTMLTemplate t = evt.getPrepHTMLTemplate( "st_editNode.tmpl" );
62                 SiteTreeUtils.prepareNodeParams( t, evt.getParameter( PARAMETER, "SITE_NODE_TYPE" ) );
63                 t.set( evt.getParams().getClass( PARAMETER ) );
64                 t.set( "THE_CONTENT_NODE_ID", evt.getParameter( PARAMETER, "NODE_ID" ) );
65                 t.set( "THE_SELECTION_TYPE", evt.getParameter( PARAMETER, "SEL_TYPE" ) );
66                 TreeUtils.keepOpenNodes( evt, t );
67                 WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t, SITE_TREE);
68                 evt.finishTemplate(t);
69                 return;
70             }
71             else if( context.equals( "COMPONENT_SAVE" ) || context.equals( "COMPONENT_UPDATE" ) ) {
72                 STEditDocumentHandler.getInstance().handleEvent(evt);
73                 return;
74             }
75         }
76         catch (Throwable JavaDoc e)
77         {
78             // TO DO : Analyze Exception !
79
throw WebmanExceptionHandler.getException(e);
80         }
81     }
82     
83     public boolean isHandler(TKEvent evt)
84     {
85         return evt.getName().equalsIgnoreCase("ST_CANCEL_CONTENT_SELECTION");
86     }
87 }
88
Popular Tags