2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGObjWeb_WOComponent_H__
23 #define __NGObjWeb_WOComponent_H__
25 #import <Foundation/NSMapTable.h>
26 #import <NGObjWeb/WOElement.h>
27 #include <NGObjWeb/WOActionResults.h>
29 @class NSString, NSDictionary, NSMutableDictionary, NSURL, NSException, NSURL;
30 @class WOElement, WOContext, WOSession, WOApplication, WOResourceManager;
32 @interface WOComponent : WOElement < WOActionResults, NSCoding >
35 NSDictionary *wocBindings; // bindings to parent component
36 NSString *wocName; // name of component
38 WOComponent *parentComponent; // non-retained;
39 NSDictionary *subcomponents; // subcomponents
40 NSMutableDictionary *wocVariables; // user variables
43 BOOL reloadTemplates:1; // component definition caching
47 @protected // transient (non-retained)
49 WOApplication *application;
53 id cycleContext; // was: _ODCycleCtx
57 - (id)initWithContext:(WOContext *)_ctx;
63 This method needs to be called before using a component cached by yourself.
65 - (void)ensureAwakeInContext:(WOContext *)_ctx;
75 - (WOContext *)context;
76 - (BOOL)hasSession; // new in WO4
78 /* component definition caching */
80 - (void)setCachingEnabled:(BOOL)_flag;
81 - (BOOL)isCachingEnabled;
85 - (NSString *)pathForResourceNamed:(NSString *)_name ofType:(NSString *)_ext;
86 - (NSString *)frameworkName;
90 - (WOElement *)templateWithName:(NSString *)_name;
92 - (WOElement *)templateWithHTMLString:(NSString *)_html
93 declarationString:(NSString *)_wod
94 languages:(NSArray *)_languages;
96 - (id)pageWithName:(NSString *)_name; // new in WO4
98 - (void)setTemplate:(id)_template;
100 /* child components */
102 - (BOOL)synchronizesVariablesWithBindings; // new in WO4
103 - (void)setValue:(id)_value forBinding:(NSString *)_name; // new in WO4
104 - (id)valueForBinding:(NSString *)_name; // new in WO4
105 - (BOOL)hasBinding:(NSString *)_name; // new in WO4
106 - (BOOL)canSetValueForBinding:(NSString *)_name; // new in WO4
107 - (BOOL)canGetValueForBinding:(NSString *)_name; // new in WO4
109 - (id)performParentAction:(NSString *)_attributeName;
114 - (BOOL)isStateless; // new in WO4.5
115 - (void)reset; // new in WO4.5
117 - (void)setObject:(id)_object forKey:(NSString *)_key;
118 - (id)objectForKey:(NSString *)_key;
120 - (void)validationFailedWithException:(NSException *)_exception
122 keyPath:(NSString *)_keyPath; // new in WO4
126 - (BOOL)isEventLoggingEnabled;
128 @end /* WOComponent */
130 @interface WOComponent(Logging)
131 /* implemented in NGExtensions */
133 - (void)logWithFormat:(NSString *)_fmt arguments:(va_list)_arguments;
134 - (void)logWithFormat:(NSString *)_fmt, ...;
135 - (void)debugWithFormat:(NSString *)_fmt, ...;
139 @interface WOComponent(SkyrixExtensions)
141 - (WOResourceManager *)resourceManager;
142 - (id)existingSession;
144 - (id<WOActionResults>)redirectToLocation:(id)_loc;
145 - (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c;
149 @interface WOComponent(DeprecatedMethodsInWO4)
151 - (WOElement *)templateWithHTMLString:(NSString *)_html
152 declarationString:(NSString *)_wod;
154 - (NSString *)stringForKey:(NSString *)_key
155 inTableNamed:(NSString *)_tableName
156 withDefaultValue:(NSString *)_default;
158 @end /* WOComponent(DeprecatedMethodsInWO4) */
160 @interface WOComponent(AdvancedBindingAccessors)
162 - (void)setUnsignedIntValue:(unsigned)_value forBinding:(NSString *)_name;
163 - (unsigned)unsignedIntValueForBinding:(NSString *)_name;
164 - (void)setIntValue:(int)_value forBinding:(NSString *)_name;
165 - (int)intValueForBinding:(NSString *)_name;
167 @end /* WOComponent(AdvancedBindingAccessors) */
169 @interface WOComponent(Statistics)
171 - (NSString *)descriptionForResponse:(WOResponse *)_response
172 inContext:(WOContext *)_context;
174 @end /* WOComponent(Statistics) */
176 @interface WOComponent(DirectActionExtensions)
178 - (void)takeFormValuesForKeyArray:(NSArray *)_keys;
179 - (void)takeFormValuesForKeys:(NSString *)_key1,...;
180 - (id<WOActionResults>)defaultAction;
181 - (id<WOActionResults>)performActionNamed:(NSString *)_actionName;
183 @end /* WOComponent(DirectActionExtensions) */
185 #endif /* __NGObjWeb_WOComponent_H__ */