001: package de.webman.content;
002:
003: import java.util.*;
004: import java.sql.*;
005: import java.io.*;
006: import com.teamkonzept.web.*;
007: import com.teamkonzept.lib.*;
008: import com.teamkonzept.field.*;
009: import com.teamkonzept.field.db.*;
010: import com.teamkonzept.db.*;
011: import com.teamkonzept.webman.mainint.*;
012: import com.teamkonzept.publishing.markups.*;
013: import com.teamkonzept.webman.mainint.events.*;
014: import com.teamkonzept.webman.*;
015: import com.teamkonzept.webman.db.*;
016: import com.teamkonzept.webman.mainint.db.*;
017: import com.teamkonzept.webman.mainint.db.queries.*;
018: import de.webman.content.eventhandler.*;
019: import de.webman.generator.*;
020:
021: /**
022: * The distributor for all content tree related events.
023: *
024: * @author $Author: uli $
025: * @version $Revision: 1.41
026: */
027: public class CEEventDistributor extends CachedEventDistributor
028: implements ParameterTypes, DatabaseDefaults, FrameConstants {
029:
030: /**
031: * Constructs a new event distributor.
032: */
033: public CEEventDistributor() {
034: addEventHandler(CESwitchMutipleContentHandler.getInstance());
035: addEventHandler(CEArrangeMoveHandler.getInstance());
036: addEventHandler(CEArrangeOpenDirHandler.getInstance());
037: addEventHandler(CEArrangeShowHandler.getInstance());
038: addEventHandler(CEArrangeStartHandler.getInstance());
039: addEventHandler(CEBrowseHandler.getInstance());
040: addEventHandler(CECheckHandler.getInstance());
041: addEventHandler(CECompactHandler.getInstance());
042: addEventHandler(CEContentAttributesHandler.getInstance());
043: addEventHandler(CEContentInfoHandler.getInstance());
044: addEventHandler(CEContentVersionsHandler.getInstance());
045: addEventHandler(CEDefaultHandler.getInstance());
046: addEventHandler(CEEditHandler.getInstance());
047: addEventHandler(CEEditNodeHandler.getInstance());
048: addEventHandler(CEExportHandler.getInstance());
049: addEventHandler(CEExtModifyDoneHandler.getInstance());
050: addEventHandler(CEExtModifyHandler.getInstance());
051: addEventHandler(CEForwardHandler.getInstance());
052: addEventHandler(CEFrameHandler.getInstance());
053: addEventHandler(CEImportHandler.getInstance());
054: addEventHandler(CEIntershopHandler.getInstance());
055: addEventHandler(CEMediaGetHandler.getInstance());
056: addEventHandler(CEModifyHandler.getInstance());
057: addEventHandler(CENewNodeHandler.getInstance());
058: addEventHandler(CENodeDeleteHandler.getInstance());
059: addEventHandler(CENodeListMultHandler.getInstance());
060: addEventHandler(CEOnlineHandler.getInstance());
061: addEventHandler(CEOpenMultDirHandler.getInstance());
062: addEventHandler(CESaveHandler.getInstance());
063: addEventHandler(CESaveNewNodeHandler.getInstance());
064: addEventHandler(CESwitchGroupContentHandler.getInstance());
065: addEventHandler(CEUpdateGroupContentHandler.getInstance());
066: addEventHandler(CEUpdateNodeHandler.getInstance());
067: }
068:
069: /**
070: * Handles the specified event.
071: *
072: * @param event the event to be handled.
073: * @throws TKException if any error occurred during event handling.
074: */
075: public void handleEvent(TKEvent event) throws TKException {
076: try {
077: super .handleEvent(event);
078: } catch (TKException tke) {
079: // hier die Exception Klasse abfragen !!!
080: if (tke.getErrorCode() == INVALID_EVENT) {
081: try {
082: String name = event.getName();
083:
084: if (name.equalsIgnoreCase("CE_PREV_INDEX")) {
085: Preview preview = new Preview(event);
086: preview.doPreviewIndexPerContent();
087: return;
088: }
089:
090: if (name.equalsIgnoreCase("CE_PREVIEW")) {
091: Preview preview = new Preview(event);
092: preview.doPreview();
093: return;
094: }
095:
096: if (name
097: .equalsIgnoreCase("CE_DISPLAY_TEXT_ATTRIBUTES")) {
098: TKWMAttrEdit attrEdit = new TKWMAttrEdit(event);
099: attrEdit.displayLinks();
100: return;
101: }
102:
103: if (name.equalsIgnoreCase("CE_EMPTY")) {
104: event.doEmptyPage();
105: return;
106: }
107:
108: throw tke;
109: } catch (FileNotFoundException fnfe) {
110: throw new TKUserException("Template not Found",
111: UserCodes.TEMPLATE_NOT_FOUND,
112: ErrorCodes.USER_SEVERITY, false,
113: new Object[] { fnfe.getMessage() }, fnfe);
114: } catch (TKTemplateSyntaxException tktse) {
115: throw new TKUserException("Template Syntax Error",
116: UserCodes.WRONG_TEMPLATE_SYNTAX,
117: ErrorCodes.USER_SEVERITY, false,
118: new Object[] { tktse.getMessage() }, tktse);
119: } catch (Throwable t) {
120: throw WebmanExceptionHandler.getException(t);
121: }
122: } else {
123: throw tke;
124: }
125: }
126: }
127:
128: /**
129: * Checks wether this handler is capable to handle the specified event.
130: *
131: * @param event the event to be handled.
132: * @return <CODE>true</CODE> if this handler is capable to handle the
133: * specified event, otherwise <CODE>false</CODE>.
134: */
135: public boolean isHandler(TKEvent event) {
136: return event.getName().startsWith("CE");
137: }
138:
139: }
|