2002-03-06 23:13:23 +00:00
|
|
|
/** GSWComponent.m - <title>GSWeb: Class GSWComponent</title>
|
2002-05-14 11:28:50 +00:00
|
|
|
|
2004-04-06 11:18:33 +00:00
|
|
|
Copyright (C) 1999-2004 Free Software Foundation, Inc.
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-03-06 23:13:23 +00:00
|
|
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
2003-03-21 14:32:57 +00:00
|
|
|
Date: Jan 1999
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-03-06 23:13:23 +00:00
|
|
|
$Revision$
|
|
|
|
$Date$
|
2003-01-19 15:33:07 +00:00
|
|
|
$Id$
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-03-06 23:13:23 +00:00
|
|
|
<abstract></abstract>
|
|
|
|
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
|
|
|
|
<license>
|
2000-01-22 12:49:49 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2002-03-06 23:13:23 +00:00
|
|
|
</license>
|
|
|
|
**/
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
#include "config.h"
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
RCS_ID("$Id$")
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
#include "GSWeb.h"
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
#include "GSWPrivate.h"
|
2010-06-10 09:37:23 +00:00
|
|
|
#include "WOKeyValueUnarchiver.h"
|
2010-06-05 21:08:12 +00:00
|
|
|
#include <GNUstepBase/NSObject+GNUstepBase.h>
|
|
|
|
#include <GNUstepBase/NSString+GNUstepBase.h>
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//====================================================================
|
|
|
|
@implementation GSWComponent
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
/* Static variables */
|
|
|
|
|
|
|
|
static NSMutableDictionary * TheTemplateNameDictionary;
|
|
|
|
static NSLock * TheTemplateNameDictionaryLock;
|
|
|
|
static Class GSWHTMLBareStringClass = Nil;
|
|
|
|
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [GSWComponent class]) {
|
|
|
|
TheTemplateNameDictionary = [NSMutableDictionary new];
|
|
|
|
TheTemplateNameDictionaryLock = [[NSLock alloc] init];
|
|
|
|
GSWHTMLBareStringClass = [GSWHTMLBareString class];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// deprecated. use initWithContext:
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
-(id)init
|
|
|
|
{
|
2010-04-22 04:28:50 +00:00
|
|
|
// NSLog(@"%s init: deprecated. use initWithContext", class_getName([self class]));
|
2007-04-13 18:32:02 +00:00
|
|
|
return [self initWithContext:[GSWComponentDefinition TheTemporaryContext]];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (id)initWithContext:(GSWContext *) aContext
|
|
|
|
{
|
|
|
|
Class myClass = Nil;
|
|
|
|
GSWComponentDefinition* aComponentDefinition = nil;
|
|
|
|
|
|
|
|
if ((self=[super init])) {
|
|
|
|
if (aContext == nil) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"Attempt to init component without a context. In %s",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
|
|
|
|
[self _setContext:aContext];
|
|
|
|
myClass = [self class];
|
|
|
|
if (myClass == ([GSWComponent class])) {
|
|
|
|
ASSIGN(_name, [aContext _componentName]);
|
|
|
|
} else {
|
2010-04-22 04:28:50 +00:00
|
|
|
ASSIGN(_name, [NSString stringWithCString:object_getClassName(self)]);
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2010-04-22 04:28:50 +00:00
|
|
|
ASSIGN(_templateName,[NSString stringWithCString:class_getName(myClass)]);
|
2007-04-13 18:32:02 +00:00
|
|
|
_isPage = NO;
|
|
|
|
_subComponents = nil;
|
|
|
|
[self setCachingEnabled:[GSWApp isCachingEnabled]];
|
|
|
|
ASSIGN(_componentDefinition, [aContext _tempComponentDefinition]);
|
|
|
|
aComponentDefinition = [self _componentDefinition];
|
|
|
|
if (aComponentDefinition != nil) {
|
|
|
|
[aComponentDefinition finishInitializingComponent:self];
|
|
|
|
}
|
|
|
|
_isSynchronized = [self synchronizesVariablesWithBindings];
|
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
return self;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
DESTROY(_keyAssociations);
|
|
|
|
DESTROY(_childTemplate);
|
|
|
|
DESTROY(_componentDefinition);
|
|
|
|
DESTROY(_defaultAssociations);
|
2002-05-14 11:28:50 +00:00
|
|
|
DESTROY(_name);
|
|
|
|
DESTROY(_subComponents);
|
|
|
|
DESTROY(_template);
|
2007-04-13 18:32:02 +00:00
|
|
|
DESTROY(_templateName);
|
2002-05-14 11:28:50 +00:00
|
|
|
DESTROY(_userAssociations);
|
2007-04-13 18:32:02 +00:00
|
|
|
DESTROY(_userDictionary);
|
2002-05-14 11:28:50 +00:00
|
|
|
DESTROY(_validationFailureMessages);
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
DESTROY(_context); //_context=nil;
|
|
|
|
_parent = nil;
|
|
|
|
_session = nil;
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(id)copyWithZone: (NSZone*)zone
|
|
|
|
{
|
|
|
|
GSWComponent* clone = [[isa allocWithZone: zone] init];
|
2002-05-14 11:28:50 +00:00
|
|
|
ASSIGNCOPY(clone->_name,_name);
|
|
|
|
ASSIGNCOPY(clone->_subComponents,_subComponents);
|
|
|
|
ASSIGNCOPY(clone->_templateName,_templateName);
|
|
|
|
ASSIGN(clone->_template,_template);
|
|
|
|
ASSIGN(clone->_componentDefinition,_componentDefinition);
|
|
|
|
ASSIGN(clone->_parent,_parent);
|
2007-04-13 18:32:02 +00:00
|
|
|
ASSIGNCOPY(clone->_keyAssociations, _keyAssociations);
|
2002-05-14 11:28:50 +00:00
|
|
|
ASSIGNCOPY(clone->_childTemplate,_childTemplate);
|
|
|
|
ASSIGNCOPY(clone->_context,_context);
|
|
|
|
ASSIGNCOPY(clone->_session,_session);
|
|
|
|
clone->_isPage=_isPage;
|
|
|
|
clone->_isCachingEnabled=_isCachingEnabled;
|
2007-04-13 18:32:02 +00:00
|
|
|
// clone->_isParentToComponentSynchronized=_isParentToComponentSynchronized;
|
|
|
|
// clone->_isComponentToParentSynchronized=_isComponentToParentSynchronized;
|
2000-01-22 12:49:49 +00:00
|
|
|
return clone;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
//-(void)encodeWithCoder:(NSCoder*)aCoder
|
|
|
|
//{
|
|
|
|
// //TODOV
|
|
|
|
// [super encodeWithCoder:aCoder];
|
|
|
|
// [aCoder encodeObject:_name];
|
|
|
|
// [aCoder encodeObject:_subComponents];
|
|
|
|
// [aCoder encodeObject:_templateName];
|
|
|
|
// [aCoder encodeObject:_template];
|
|
|
|
// [aCoder encodeObject:_componentDefinition];
|
|
|
|
// [aCoder encodeObject:_parent];
|
|
|
|
// [aCoder encodeObject:_keyAssociations];
|
|
|
|
// [aCoder encodeObject:_childTemplate];
|
|
|
|
// [aCoder encodeObject:_context];
|
|
|
|
// [aCoder encodeObject:_session];
|
|
|
|
// [aCoder encodeValueOfObjCType:@encode(BOOL)
|
|
|
|
// at:&_isPage];
|
|
|
|
// [aCoder encodeValueOfObjCType:@encode(BOOL)
|
|
|
|
// at:&_isCachingEnabled];
|
|
|
|
//// [aCoder encodeValueOfObjCType:@encode(BOOL)
|
|
|
|
//// at:&_isParentToComponentSynchronized];
|
|
|
|
//// [aCoder encodeValueOfObjCType:@encode(BOOL)
|
|
|
|
//// at:&_isComponentToParentSynchronized];
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
////--------------------------------------------------------------------
|
|
|
|
//-(id)initWithCoder:(NSCoder*)aCoder
|
|
|
|
//{
|
|
|
|
// //TODOV
|
|
|
|
// if ((self = [super initWithCoder:aCoder]))
|
|
|
|
// {
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_name];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_subComponents];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_templateName];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_template];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_componentDefinition];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_parent];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_keyAssociations];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_childTemplate];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_context];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(id)
|
|
|
|
// at:&_session];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(BOOL)
|
|
|
|
// at:&_isPage];
|
|
|
|
// [aCoder decodeValueOfObjCType:@encode(BOOL)
|
|
|
|
// at:&_isCachingEnabled];
|
|
|
|
//// [aCoder decodeValueOfObjCType:@encode(BOOL)
|
|
|
|
//// at:&_isParentToComponentSynchronized];
|
|
|
|
//// [aCoder decodeValueOfObjCType:@encode(BOOL)
|
|
|
|
//// at:&_isComponentToParentSynchronized];
|
2010-04-16 00:18:46 +00:00
|
|
|
// }
|
2007-04-13 18:32:02 +00:00
|
|
|
// return self;
|
|
|
|
//}
|
|
|
|
//
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// frameworkName
|
|
|
|
|
|
|
|
-(NSString*)frameworkName
|
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
NSString* aFrameworkName=nil;
|
|
|
|
GSWComponentDefinition* aComponentDefinition=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
aComponentDefinition=[self _componentDefinition];
|
2002-08-04 18:00:11 +00:00
|
|
|
NSAssert(aComponentDefinition,@"No componentDefinition");
|
2002-05-14 11:28:50 +00:00
|
|
|
aFrameworkName=[aComponentDefinition frameworkName];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return aFrameworkName;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2005-04-05 15:54:24 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// logString:
|
|
|
|
|
|
|
|
-(void)logString:(NSString*)aString
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
[GSWApp logString:aString];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2005-04-05 15:54:24 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// logWithFormat:
|
|
|
|
|
2005-04-05 15:54:24 +00:00
|
|
|
-(void)logWithFormat:(NSString*)aFormat,...
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2005-04-05 15:54:24 +00:00
|
|
|
va_list ap;
|
|
|
|
va_start(ap,aFormat);
|
|
|
|
[self logWithFormat:aFormat
|
|
|
|
arguments:ap];
|
|
|
|
va_end(ap);
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// logWithFormat:arguments:
|
|
|
|
|
2005-04-05 15:54:24 +00:00
|
|
|
-(void)logWithFormat:(NSString*)aFormat
|
2002-05-14 11:28:50 +00:00
|
|
|
arguments:(va_list)arguments
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2005-04-05 15:54:24 +00:00
|
|
|
NSString* string=[NSString stringWithFormat:aFormat
|
|
|
|
arguments:arguments];
|
|
|
|
[self logString:string];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// name
|
|
|
|
|
|
|
|
-(NSString*)name
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return _name;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// path
|
|
|
|
|
|
|
|
-(NSString*)path
|
|
|
|
{
|
|
|
|
//TODOV
|
|
|
|
NSBundle* bundle=[NSBundle mainBundle];
|
2002-05-14 11:28:50 +00:00
|
|
|
return [bundle pathForResource:_name
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
ofType:GSWPageSuffix[GSWebNamingConv]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// baseURL
|
|
|
|
|
|
|
|
-(NSString*)baseURL
|
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
return nil;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)description
|
|
|
|
{
|
|
|
|
//TODO
|
2002-05-14 11:28:50 +00:00
|
|
|
NSString* dscr=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
dscr=[NSString stringWithFormat:@"<%s %p>",
|
2010-04-22 04:28:50 +00:00
|
|
|
object_getClassName(self),
|
2000-01-22 12:49:49 +00:00
|
|
|
(void*)self];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return dscr;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
// GSWeb Additions {
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
2000-01-22 12:49:49 +00:00
|
|
|
-(NSDictionary*)userDictionary
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return _userDictionary;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)setUserDictionary:(NSDictionary*)aUserDictionary
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
ASSIGN(_userDictionary,aUserDictionary);
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
2000-01-22 12:49:49 +00:00
|
|
|
-(NSDictionary*)userAssociations
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return _userAssociations;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)setUserAssociations:(NSDictionary*)userAssociations
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
ASSIGN(_userAssociations,userAssociations);
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWAssociation*)userAssociationForKey:(NSString*)key
|
|
|
|
{
|
|
|
|
return [[self userAssociations]objectForKey:key];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2004-12-14 12:54:40 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2000-01-22 12:49:49 +00:00
|
|
|
-(NSDictionary*)defaultAssociations
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSLog(@"WARNING: %s is not WebObjects API",__PRETTY_FUNCTION__);
|
2002-05-14 11:28:50 +00:00
|
|
|
return _defaultAssociations;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)setDefaultAssociations:(NSDictionary*)defaultAssociations
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSLog(@"WARNING: %s is not WebObjects API",__PRETTY_FUNCTION__);
|
2002-05-14 11:28:50 +00:00
|
|
|
ASSIGN(_defaultAssociations,defaultAssociations);
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2004-12-14 12:54:40 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWAssociation*)defaultAssociationForKey:(NSString*)key
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSLog(@"WARNING: %s is not WebObjects API",__PRETTY_FUNCTION__);
|
|
|
|
|
2004-12-14 12:54:40 +00:00
|
|
|
return [[self defaultAssociations]objectForKey:key];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2004-12-14 12:54:40 +00:00
|
|
|
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
// }
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//setCachingEnabled:
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)setCachingEnabled:(BOOL)caching
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
_isCachingEnabled=caching;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//isCachingEnabled
|
|
|
|
|
|
|
|
-(BOOL)isCachingEnabled
|
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
return _isCachingEnabled;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void) _setParent:(GSWComponent*) parent
|
|
|
|
associations:(NSMutableDictionary *) assocdict
|
|
|
|
template:(GSWElement*) template
|
|
|
|
{
|
|
|
|
if (parent != _parent) {
|
|
|
|
_parent = parent;
|
|
|
|
}
|
|
|
|
if (assocdict != _keyAssociations) {
|
|
|
|
ASSIGN(_keyAssociations, assocdict);
|
|
|
|
}
|
|
|
|
if (template != _childTemplate) {
|
|
|
|
ASSIGN(_childTemplate,template);
|
|
|
|
}
|
|
|
|
// not WO!
|
|
|
|
// [self validateAPIAssociations];
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
-(void) _doPushValuesUp
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSEnumerator * enumer = nil;
|
|
|
|
NSString * aKey = nil;
|
|
|
|
GSWAssociation * assoc = nil;
|
|
|
|
|
|
|
|
if (_isSynchronized && (_keyAssociations != nil)) {
|
|
|
|
enumer = [_keyAssociations keyEnumerator];
|
|
|
|
while ((aKey = [enumer nextObject])) {
|
|
|
|
assoc = [_keyAssociations objectForKey: aKey];
|
|
|
|
if ([assoc isValueSettableInComponent:self]) {
|
|
|
|
[assoc setValue:[self valueForKey: aKey]
|
|
|
|
inComponent:_parent];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void) pushValuesToParent
|
|
|
|
{
|
|
|
|
GSWComponentDefinition * componentdefinition = nil;
|
|
|
|
|
|
|
|
if (_isSynchronized) {
|
|
|
|
[self _doPushValuesUp];
|
|
|
|
}
|
|
|
|
componentdefinition = [self _componentDefinition];
|
|
|
|
if ([componentdefinition isStateless]) {
|
|
|
|
[self reset];
|
|
|
|
_parent = nil; // no retain? dw
|
|
|
|
_session = nil;
|
|
|
|
DESTROY(_context);
|
|
|
|
[componentdefinition _checkInComponentInstance:self];
|
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
-(void)synchronizeComponentToParent
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSLog(@"WARNING: %s is deprecated. Use pushValuesToParent instead.", __PRETTY_FUNCTION__);
|
|
|
|
[self pushValuesToParent];
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
-(void) pullValuesFromParent
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSEnumerator * enumer = nil;
|
|
|
|
NSString * myKey = nil;
|
|
|
|
id obj;
|
|
|
|
GSWAssociation * assoc = nil;
|
2010-04-16 00:18:46 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
if (_isSynchronized && (_keyAssociations != nil)) {
|
2010-04-16 00:18:46 +00:00
|
|
|
enumer = [_keyAssociations keyEnumerator];
|
|
|
|
|
|
|
|
while ((myKey = [enumer nextObject])) {
|
|
|
|
assoc = [_keyAssociations objectForKey: myKey];
|
|
|
|
obj = [assoc valueInComponent:_parent];
|
|
|
|
[self setValue: obj
|
|
|
|
forKey: myKey];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2010-04-16 00:18:46 +00:00
|
|
|
|
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void) synchronizeParentToComponent
|
|
|
|
{
|
|
|
|
// NSLog(@"WARNING: %s is deprecated. Use pullValuesFromParent instead.", __PRETTY_FUNCTION__);
|
|
|
|
[self pullValuesFromParent];
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWElement*)_childTemplate
|
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
return _childTemplate;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(GSWElement*) template
|
|
|
|
{
|
|
|
|
GSWElement* element = nil;
|
|
|
|
if (_template != element) {
|
|
|
|
element = _template;
|
|
|
|
} else {
|
|
|
|
element = [self templateWithName:nil];
|
|
|
|
if ([self isCachingEnabled]) {
|
|
|
|
ASSIGN(_template, element);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
-(GSWElement*)_template
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSLog(@"WARNING: %s is deprecated. Use template instead.", __PRETTY_FUNCTION__);
|
|
|
|
|
|
|
|
return [self template];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWComponentDefinition*)_componentDefinition
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWComponentDefinition* aComponentDefinition=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
if (_componentDefinition) {
|
2002-05-14 11:28:50 +00:00
|
|
|
aComponentDefinition=_componentDefinition;
|
2007-04-13 18:32:02 +00:00
|
|
|
} else {
|
|
|
|
NSArray* languages=[self languages];
|
|
|
|
aComponentDefinition=[GSWApp _componentDefinitionWithName:_name
|
|
|
|
languages:languages];
|
|
|
|
if ([self isCachingEnabled]) {
|
|
|
|
ASSIGN(_componentDefinition,aComponentDefinition);
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return aComponentDefinition;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)_templateName
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return _templateName;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2004-04-06 11:18:33 +00:00
|
|
|
-(NSString*)declarationName
|
2002-05-14 11:28:50 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return _templateName;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(BOOL)_isPage
|
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
return _isPage;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)_setIsPage:(BOOL)isPage
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
_isPage=isPage;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)_setContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
// Verified with WO 4.5. We DO retain!
|
|
|
|
ASSIGN(_context, aContext);
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// templateWithName:
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
// templateWithName is deprecated but I do not know in which version of WO
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(GSWElement*)templateWithName:(NSString*)aName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return [[self _componentDefinition] template];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(GSWComponent*)subComponentForElementID:(NSString*)elementId
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWComponent* subc=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
subc=[_subComponents objectForKey:elementId];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return subc;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void)_setSubcomponent:(GSWComponent*)component
|
|
|
|
forElementID:(NSString*)elementId
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
if (!_subComponents)
|
|
|
|
_subComponents=[NSMutableDictionary new];
|
|
|
|
[_subComponents setObject:component
|
|
|
|
forKey:elementId];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(void)makeParentsPerformSelectorIfPossible:(SEL)aSelector
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSArray* parents=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
parents=[self parents];
|
|
|
|
[parents makeObjectsPerformSelectorIfPossible:aSelector];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(void)makeParentsPerformSelectorIfPossible:(SEL)aSelector
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:(id)object
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSArray* parents=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
parents = [self parents];
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
[parents makeObjectsPerformSelectorIfPossible:aSelector
|
|
|
|
withObject:object];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(void)makeParentsPerformSelectorIfPossible:(SEL)aSelector
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:(id)object1
|
|
|
|
withObject:(id)object2
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSArray* parents=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
parents=[self parents];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
[parents makeObjectsPerformSelectorIfPossible:aSelector
|
|
|
|
withObject:object1
|
|
|
|
withObject:object2];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(id)makeAParentPerformSelectorIfPossible:(SEL)aSelector
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
id retValue=nil;
|
2003-03-21 14:32:57 +00:00
|
|
|
GSWComponent* obj=[self parent];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
while(obj)
|
|
|
|
{
|
|
|
|
if ([obj respondsToSelector:aSelector])
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
retValue=[obj performSelector:aSelector];
|
2000-01-22 12:49:49 +00:00
|
|
|
obj=nil;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
obj=[obj parent];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return retValue;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(id)makeAParentPerformSelectorIfPossible:(SEL)aSelector
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:(id)object
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
id retValue=nil;
|
2003-03-21 14:32:57 +00:00
|
|
|
GSWComponent* obj=[self parent];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
while(obj)
|
|
|
|
{
|
|
|
|
if ([obj respondsToSelector:aSelector])
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
retValue=[obj performSelector:aSelector
|
|
|
|
withObject:object];
|
2000-01-22 12:49:49 +00:00
|
|
|
obj=nil;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
obj=[obj parent];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return retValue;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(id)makeAParentPerformSelectorIfPossible:(SEL)aSelector
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:(id)object1
|
|
|
|
withObject:(id)object2
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
id retValue=nil;
|
2003-03-21 14:32:57 +00:00
|
|
|
GSWComponent* obj=[self parent];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
while(obj)
|
|
|
|
{
|
|
|
|
if ([obj respondsToSelector:aSelector])
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
retValue=[obj performSelector:aSelector
|
|
|
|
withObject:object1
|
|
|
|
withObject:object2];
|
2000-01-22 12:49:49 +00:00
|
|
|
obj=nil;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
obj=[obj parent];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return retValue;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(void)makeSubComponentsPerformSelectorIfPossible:(SEL)aSelector
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSEnumerator* enumerator=nil;
|
2003-03-21 14:32:57 +00:00
|
|
|
GSWComponent* component=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
enumerator= [_subComponents objectEnumerator];
|
|
|
|
while ((component=[enumerator nextObject]))
|
|
|
|
{
|
|
|
|
[component performSelectorIfPossible:aSelector];
|
|
|
|
[component makeSubComponentsPerformSelectorIfPossible:aSelector];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(void)makeSubComponentsPerformSelectorIfPossible:(SEL)aSelector
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:(id)object
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSEnumerator* enumerator=nil;
|
2003-03-21 14:32:57 +00:00
|
|
|
GSWComponent* component=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
enumerator= [_subComponents objectEnumerator];
|
|
|
|
while ((component=[enumerator nextObject]))
|
|
|
|
{
|
|
|
|
[component performSelectorIfPossible:aSelector
|
|
|
|
withObject:object];
|
|
|
|
[component makeSubComponentsPerformSelectorIfPossible:aSelector
|
|
|
|
withObject:object];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(void)makeSubComponentsPerformSelectorIfPossible:(SEL)aSelector
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:(id)object1
|
|
|
|
withObject:(id)object2
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSEnumerator* enumerator=nil;
|
2003-03-21 14:32:57 +00:00
|
|
|
GSWComponent* component=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
enumerator= [_subComponents objectEnumerator];
|
|
|
|
while ((component=[enumerator nextObject]))
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
[component performSelectorIfPossible:aSelector
|
|
|
|
withObject:object1
|
|
|
|
withObject:object2];
|
|
|
|
[component makeSubComponentsPerformSelectorIfPossible:aSelector
|
|
|
|
withObject:object1
|
|
|
|
withObject:object2];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
//PRIVATE
|
|
|
|
-(GSWComponent*) _subcomponentForElementWithID:(NSString*) str
|
|
|
|
{
|
|
|
|
if ((_subComponents != nil) && (str != nil)) {
|
|
|
|
return [_subComponents objectForKey:str];
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(GSWAssociation*)_associationWithName:(NSString*)aName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWAssociation* assoc=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
if (_keyAssociations != nil) {
|
|
|
|
assoc = [_keyAssociations objectForKey: aName];
|
|
|
|
}
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return assoc;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(BOOL)hasBinding:(NSString*)parentBindingName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
BOOL hasBinding = NO;
|
|
|
|
GSWAssociation * association = [self _associationWithName: parentBindingName];
|
|
|
|
|
|
|
|
hasBinding = (association != nil);
|
|
|
|
if (hasBinding) {
|
|
|
|
hasBinding = [association _hasBindingInParent:_parent];
|
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
return hasBinding;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)setValue:(id)value
|
|
|
|
forBinding:(NSString*)parentBindingName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWAssociation* assoc=nil;
|
2010-04-16 00:18:46 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
if (_parent)
|
2010-04-16 00:18:46 +00:00
|
|
|
{
|
|
|
|
assoc=[self _associationWithName:parentBindingName];
|
|
|
|
if(assoc)
|
|
|
|
[assoc setValue:value
|
|
|
|
inComponent:_parent];
|
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(id)valueForBinding:(NSString*)parentBindingName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
id aValue=nil;
|
|
|
|
GSWAssociation* assoc=nil;
|
2010-04-16 00:18:46 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
if (_parent)
|
2010-04-16 00:18:46 +00:00
|
|
|
{
|
|
|
|
assoc=[self _associationWithName:parentBindingName];
|
|
|
|
if(assoc)
|
|
|
|
aValue=[assoc valueInComponent:_parent];
|
|
|
|
}
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return aValue;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-11-18 11:14:55 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
/** Do we need to synchronize parent to component **/
|
|
|
|
-(BOOL)synchronizesParentToComponentVariablesWithBindings
|
|
|
|
{
|
|
|
|
//OK
|
|
|
|
NSDictionary* userDictionary=nil;
|
|
|
|
id synchronizesParentToComponentVariablesWithBindingsValue=nil;
|
|
|
|
BOOL synchronizesParentToComponentVariablesWithBindings=YES;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-11-18 11:14:55 +00:00
|
|
|
userDictionary=[self userDictionary];
|
|
|
|
synchronizesParentToComponentVariablesWithBindingsValue=[userDictionary objectForKey:@"synchronizesParentToComponentVariablesWithBindings"];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-11-18 11:14:55 +00:00
|
|
|
//NDFN
|
|
|
|
if (synchronizesParentToComponentVariablesWithBindingsValue)
|
|
|
|
{
|
|
|
|
synchronizesParentToComponentVariablesWithBindings=[synchronizesParentToComponentVariablesWithBindingsValue boolValue];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
synchronizesParentToComponentVariablesWithBindings=[self synchronizesVariablesWithBindings];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-11-18 11:14:55 +00:00
|
|
|
return synchronizesParentToComponentVariablesWithBindings;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2002-11-18 11:14:55 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(BOOL)synchronizesVariablesWithBindings
|
2002-11-18 11:14:55 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return (![self isStateless]);
|
|
|
|
}
|
2002-11-18 11:14:55 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
-(BOOL) isStateless
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(NSDictionary*)bindingAssociations
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return _keyAssociations;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// sleep
|
|
|
|
|
|
|
|
-(void)sleep
|
|
|
|
{
|
|
|
|
//Does Nothing
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)sleepInContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWComponentDefinition* aComponentDefinition=nil;
|
|
|
|
NS_DURING
|
|
|
|
{
|
|
|
|
aComponentDefinition=[self _componentDefinition];
|
|
|
|
[aComponentDefinition sleep];
|
|
|
|
[self sleep];
|
|
|
|
[self _setContext:nil];
|
|
|
|
[_subComponents makeObjectsPerformSelector:@selector(sleepInContext:)
|
|
|
|
withObject:aContext];
|
|
|
|
}
|
|
|
|
NS_HANDLER
|
|
|
|
{
|
|
|
|
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In sleepInContext:");
|
|
|
|
[localException raise];
|
|
|
|
}
|
|
|
|
NS_ENDHANDLER;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// appendToResponse:inContext:
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)appendToResponse:(GSWResponse*)aResponse
|
|
|
|
inContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWComponent * component = nil;
|
|
|
|
GSWElement * element = nil;
|
|
|
|
|
|
|
|
[aContext _setResponse: aResponse];
|
|
|
|
element = [self template];
|
|
|
|
|
|
|
|
if (element != nil) {
|
|
|
|
if (([self parent] == nil) && ([aContext page] != self)) {
|
|
|
|
component = [aContext component];
|
|
|
|
[aContext _setCurrentComponent:self];
|
2002-05-14 11:28:50 +00:00
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
[element appendToResponse: aResponse
|
|
|
|
inContext: aContext];
|
|
|
|
if (component != nil)
|
2002-05-14 11:28:50 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
[aContext _setCurrentComponent: component];
|
2002-05-14 11:28:50 +00:00
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest
|
|
|
|
inContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWElement* template=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWElement* element=nil;
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2000-02-12 13:08:41 +00:00
|
|
|
NS_DURING
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
template = [self template];
|
|
|
|
if (template != nil) {
|
|
|
|
if ([template class] != GSWHTMLBareStringClass) {
|
|
|
|
element=[template invokeActionForRequest:aRequest
|
2002-05-14 11:28:50 +00:00
|
|
|
inContext:aContext];
|
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-02-12 13:08:41 +00:00
|
|
|
NS_HANDLER
|
2002-05-14 11:28:50 +00:00
|
|
|
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
|
2007-04-13 18:32:02 +00:00
|
|
|
@"In %s", __PRETTY_FUNCTION__);
|
2002-05-14 11:28:50 +00:00
|
|
|
[localException raise];
|
2007-04-13 18:32:02 +00:00
|
|
|
NS_ENDHANDLER
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
return element;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// takeValuesFromRequest:inContext:
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)takeValuesFromRequest:(GSWRequest*)aRequest
|
|
|
|
inContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
BOOL oldValidateFlag=NO;
|
|
|
|
GSWElement* template=nil;
|
2004-12-14 23:48:51 +00:00
|
|
|
GSWDeclareDebugElementIDsCount(aContext);
|
|
|
|
GSWDeclareDebugElementID(aContext);
|
|
|
|
|
2002-05-16 18:01:40 +00:00
|
|
|
GSWStartElement(aContext);
|
|
|
|
GSWAssertCorrectElementID(aContext);
|
2000-02-14 10:57:55 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
[_validationFailureMessages removeAllObjects];
|
|
|
|
oldValidateFlag=[aContext isValidate];
|
|
|
|
[aContext setValidate:YES];
|
2007-04-13 18:32:02 +00:00
|
|
|
template=[self template];
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
[template takeValuesFromRequest:aRequest
|
|
|
|
inContext:aContext];
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2002-05-16 18:01:40 +00:00
|
|
|
GSWStopElement(aContext);
|
2004-12-14 23:48:51 +00:00
|
|
|
GSWAssertDebugElementID(aContext);
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
[aContext setValidate:oldValidateFlag];
|
2004-12-14 23:48:51 +00:00
|
|
|
|
2002-05-16 18:01:40 +00:00
|
|
|
GSWAssertIsElementID(aContext);
|
2004-12-14 23:48:51 +00:00
|
|
|
GSWAssertDebugElementIDsCount(aContext);
|
|
|
|
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
//GSWeb Additions {
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)setValidationFailureMessage:(NSString*)message
|
2002-05-14 11:28:50 +00:00
|
|
|
forElement:(GSWDynamicElement*)element
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
if (!_validationFailureMessages)
|
|
|
|
_validationFailureMessages=[NSMutableDictionary new];
|
|
|
|
[_validationFailureMessages setObject:message
|
|
|
|
forKey:[NSValue valueWithNonretainedObject:element]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)validationFailureMessageForElement:(GSWDynamicElement*)element
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return [_validationFailureMessages objectForKey:[NSValue valueWithNonretainedObject:element]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)handleValidationExceptionDefault
|
|
|
|
{
|
|
|
|
return nil; //Raise !
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(BOOL)isValidationFailure
|
|
|
|
{
|
|
|
|
//TODO ameliorate
|
|
|
|
return [[self allValidationFailureMessages] count]>0;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSDictionary*)validationFailureMessages
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return _validationFailureMessages;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSArray*)allValidationFailureMessages
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSMutableArray* msgs=[NSMutableArray array];
|
|
|
|
NSEnumerator* subComponentsEnum=nil;
|
|
|
|
GSWComponent* component=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
[msgs addObjectsFromArray:[[self validationFailureMessages] allValues]];
|
|
|
|
subComponentsEnum=[_subComponents objectEnumerator];
|
|
|
|
while((component=[subComponentsEnum nextObject]))
|
|
|
|
{
|
|
|
|
[msgs addObjectsFromArray:[component allValidationFailureMessages]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
msgs=[NSArray arrayWithArray:msgs];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return msgs;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
// }
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
-(void) _awakeInContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWComponentDefinition* componentdefinition =nil;
|
|
|
|
|
|
|
|
[self _setContext:aContext];
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
componentdefinition = [self _componentDefinition];
|
|
|
|
[componentdefinition setCachingEnabled:[self isCachingEnabled]];
|
|
|
|
[componentdefinition awake];
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
if (_subComponents) {
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
[_subComponents makeObjectsPerformSelector:@selector(_awakeInContext:)
|
2002-05-14 11:28:50 +00:00
|
|
|
withObject:aContext];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_session = nil;
|
2000-01-22 12:49:49 +00:00
|
|
|
[self awake];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
/*
|
|
|
|
Makes sure that the receiver is awake in aContext.
|
|
|
|
Call this method before using a component which was cached in a variable.
|
|
|
|
*/
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void)ensureAwakeInContext:(GSWContext*)aContext
|
|
|
|
{
|
|
|
|
if ([self context] != aContext) {
|
|
|
|
[self _awakeInContext:aContext];
|
|
|
|
}
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void) reset
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
//Does Nothing
|
|
|
|
}
|
2000-12-03 00:00:18 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void)awake
|
|
|
|
{
|
|
|
|
//Does Nothing
|
|
|
|
}
|
2000-12-03 00:00:18 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void)awakeInContext:(GSWContext*)aContext
|
|
|
|
{
|
|
|
|
NSLog(@"WARNING: %s is deprecated. Use _awakeInContext: instead.", __PRETTY_FUNCTION__);
|
|
|
|
[self _awakeInContext:aContext];
|
|
|
|
}
|
2000-12-03 00:00:18 +00:00
|
|
|
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
- (id<GSWActionResults>)performParentAction:(NSString *)attribute
|
|
|
|
{
|
|
|
|
GSWContext *context = nil;
|
|
|
|
GSWComponent *component = _parent;
|
|
|
|
id<GSWActionResults> actionresults = nil;
|
|
|
|
|
|
|
|
if (!_parent) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
[context _setCurrentComponent:_parent];
|
|
|
|
[self pushValuesToParent];
|
|
|
|
_parent = component; // get the _parent back.
|
|
|
|
|
|
|
|
context = [self context]; // we do NOT use the iVar to enable fancy subclass magic.
|
|
|
|
NS_DURING
|
|
|
|
actionresults = [_parent valueForKey: attribute];
|
|
|
|
NS_HANDLER
|
|
|
|
localException=[localException exceptionByAddingUserInfoFrameInfoFormat:@"In %s",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
[localException raise];
|
|
|
|
NS_ENDHANDLER
|
|
|
|
[self pullValuesFromParent];
|
|
|
|
[context _setCurrentComponent:self];
|
2000-12-03 00:00:18 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
return actionresults;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWComponent*)parent
|
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
return _parent;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(GSWComponent*)topParent
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWComponent* parent=[self parent];
|
|
|
|
GSWComponent* topParent=parent;
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
topParent=parent;
|
|
|
|
parent=[parent parent];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
return topParent;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(NSArray*)parents
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSMutableArray* parents=[NSMutableArray array];
|
|
|
|
GSWComponent* parent=[self parent];
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
[parents addObject:parent];
|
|
|
|
parent=[parent parent];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
return [NSArray arrayWithArray:parents];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(NSArray*)parentsClasses
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSMutableArray* parents=[NSMutableArray array];
|
|
|
|
GSWComponent* parent=[self parent];
|
|
|
|
while (parent)
|
|
|
|
{
|
|
|
|
[parents addObject:[parent class]];
|
|
|
|
parent=[parent parent];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
return [NSArray arrayWithArray:parents];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(GSWComponent*)pageWithName:(NSString*)aName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWComponent* page=nil;
|
|
|
|
GSWContext* aContext=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
aContext=[self context];
|
|
|
|
page=[GSWApp pageWithName:aName
|
|
|
|
inContext:aContext];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return page;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// session
|
|
|
|
|
|
|
|
-(GSWSession*)session
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWSession* session=nil;
|
|
|
|
if (_session)
|
|
|
|
session=_session;
|
|
|
|
else if (_context)
|
|
|
|
session=[_context session];
|
|
|
|
return session;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(BOOL)hasSession
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return (_session!=nil);
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// application
|
|
|
|
|
|
|
|
-(GSWApplication*)application
|
|
|
|
{
|
|
|
|
return [GSWApplication application];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// context
|
|
|
|
|
|
|
|
-(GSWContext*)context
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWContext * ctx = nil;
|
|
|
|
|
|
|
|
if ((_context == nil) && (_session != nil)) {
|
|
|
|
if ((ctx = [_session context])) {
|
|
|
|
[self _awakeInContext: ctx];
|
|
|
|
[_context _takeAwakeComponent:self];
|
|
|
|
}
|
|
|
|
}
|
2002-05-14 11:28:50 +00:00
|
|
|
return _context;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(NSArray*)languages
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSArray* languages=nil;
|
|
|
|
languages=[[self context] languages];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return languages;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2001-10-27 10:27:33 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//Called when an Enterprise Object or formatter failed validation during an
|
|
|
|
//assignment.
|
|
|
|
//The default implementation ignores the error. Subclassers can override to
|
|
|
|
// record the error and possibly return a different page for the current action.
|
2007-11-29 20:30:19 +00:00
|
|
|
|
|
|
|
- (void) validationFailedWithException:(NSException *)exception
|
|
|
|
value:(id)value
|
|
|
|
keyPath:(NSString *)keyPath
|
|
|
|
{
|
|
|
|
// FIXME: check if that code is in WO4.x
|
|
|
|
/*
|
|
|
|
if ([self hasSession]) {
|
|
|
|
[[self session] validationFailedWithException:exception
|
|
|
|
value:value
|
|
|
|
keyPath:keyPath
|
|
|
|
component:self];
|
|
|
|
} else {
|
|
|
|
[GSWApp validationFailedWithException:exception
|
|
|
|
value:value
|
|
|
|
keyPath:keyPath
|
|
|
|
component:self
|
|
|
|
session:null];
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(void)_debugWithString:(NSString*)string
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2001-10-28 10:29:17 +00:00
|
|
|
/* Seems there's a problem with patches... Why this code is here ?
|
|
|
|
if (![self context])
|
|
|
|
{
|
2002-07-04 11:01:56 +00:00
|
|
|
NSDebugMLLog(@"GSWComponent",@"component sleeps, we awake it = %@",self);
|
2002-05-14 11:28:50 +00:00
|
|
|
[self awakeInContext:aContext];
|
2001-10-28 10:29:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
if ([self context] != aContext)
|
2001-10-28 10:29:17 +00:00
|
|
|
{
|
2002-07-04 11:01:56 +00:00
|
|
|
NSDebugMLLog(@"GSWComponent",@"component is already awaken, but has not the current context, we awake it twice with current context = %@",self);
|
2002-05-14 11:28:50 +00:00
|
|
|
[self awakeInContext:aContext];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-28 10:29:17 +00:00
|
|
|
*/
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2005-04-05 15:54:24 +00:00
|
|
|
-(void)debugWithFormat:(NSString*)aFormat,...
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2005-04-05 15:54:24 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
+(void)logWithFormat:(NSString*)aFormat,...
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap,aFormat);
|
|
|
|
[[GSWApplication application] logWithFormat:aFormat
|
|
|
|
arguments:ap];
|
|
|
|
va_end(ap);
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
-(NSString*)_uniqueID
|
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
return nil;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
2003-02-01 19:07:25 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)_appendPageToResponse:(GSWResponse*)response
|
|
|
|
inContext:(GSWContext*)aContext
|
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWSession* session=nil;
|
|
|
|
GSWRequest* request=nil;
|
2008-08-20 20:32:10 +00:00
|
|
|
NSString* httpVersion=@"HTTP/1.0";
|
2002-05-14 11:28:50 +00:00
|
|
|
GSWElement* pageElement=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
BOOL pageChanged=NO;
|
|
|
|
|
2003-01-19 15:33:07 +00:00
|
|
|
NSAssert(aContext,@"No context");
|
|
|
|
NS_DURING
|
2007-04-13 18:32:02 +00:00
|
|
|
{
|
2003-01-19 15:33:07 +00:00
|
|
|
request=[aContext request];
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWContext_deleteAllElementIDComponents(aContext);
|
2008-08-20 20:32:10 +00:00
|
|
|
|
|
|
|
if (request != nil) {
|
|
|
|
httpVersion = [request httpVersion];
|
|
|
|
}
|
|
|
|
|
|
|
|
[response setHTTPVersion:httpVersion];
|
2003-01-19 15:33:07 +00:00
|
|
|
[response setHeader:@"text/html"
|
|
|
|
forKey:@"content-type"];
|
|
|
|
[aContext _setResponse:response];
|
|
|
|
|
|
|
|
pageElement=[aContext _pageElement];
|
|
|
|
|
|
|
|
pageChanged=(self!=(GSWComponent*)pageElement);
|
|
|
|
[aContext _setPageChanged:pageChanged];
|
|
|
|
|
|
|
|
if (pageChanged)
|
|
|
|
[aContext _setPageElement:self];
|
|
|
|
|
|
|
|
[aContext _setCurrentComponent:self];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2003-01-19 15:33:07 +00:00
|
|
|
[self appendToResponse:response
|
|
|
|
inContext:aContext];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2003-01-19 15:33:07 +00:00
|
|
|
session=[aContext _session];
|
2008-08-20 20:32:10 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
if (session) {
|
2003-01-19 15:33:07 +00:00
|
|
|
[session appendCookieToResponse:response];
|
|
|
|
[session _saveCurrentPage];
|
2008-08-20 20:32:10 +00:00
|
|
|
}
|
|
|
|
|
2003-01-19 15:33:07 +00:00
|
|
|
[aContext _incrementContextID];
|
2004-12-31 14:33:16 +00:00
|
|
|
GSWContext_deleteAllElementIDComponents(aContext);
|
2003-01-19 15:33:07 +00:00
|
|
|
[aContext _setPageChanged:YES];
|
|
|
|
}
|
|
|
|
NS_HANDLER
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSLog(@"localException is %@", localException);
|
|
|
|
|
2003-01-19 15:33:07 +00:00
|
|
|
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
|
2010-06-05 21:08:12 +00:00
|
|
|
@"in GSWComponent -_generateResponseInContext:");
|
2003-01-19 15:33:07 +00:00
|
|
|
[localException raise];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2003-01-19 15:33:07 +00:00
|
|
|
NS_ENDHANDLER;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWResponse*)_generateResponseInContext:(GSWContext*)aContext
|
|
|
|
{
|
|
|
|
GSWResponse* response=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
NSAssert(aContext,@"No context");
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
response=[GSWApp createResponseInContext:aContext];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
[self _appendPageToResponse:response
|
2007-04-13 18:32:02 +00:00
|
|
|
inContext:aContext];
|
|
|
|
|
2003-03-21 14:32:57 +00:00
|
|
|
return response;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2003-03-21 14:32:57 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
// actually this is wrong. it should call the validateValue:forKey: of the default implementation
|
|
|
|
// as such it should call the validateXXX stuff like EOs do. dave@turbocat.de
|
|
|
|
|
2004-03-01 16:49:56 +00:00
|
|
|
-(NSException*)validateValue:(id*)valuePtr
|
|
|
|
forKey:(NSString*)key
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2004-03-01 16:49:56 +00:00
|
|
|
NSException* exception=nil;
|
|
|
|
/*
|
|
|
|
// Should all default implementation (i.e. the one which call validateXX:
|
|
|
|
exception=[super validateValue:valuePtr
|
|
|
|
forKey:key];
|
|
|
|
*/
|
|
|
|
return exception;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is called to validate and potentially coerce
|
|
|
|
* VALUE for the receivers key path. This method also assigns
|
|
|
|
* the value if it is different from the current value.
|
|
|
|
* This method will raise an EOValidationException
|
|
|
|
* if validateValue:forKeyPath:error: returns an error.
|
|
|
|
* This method returns new value.
|
|
|
|
**/
|
|
|
|
- (id)validateTakeValue:(id)value forKeyPath:(NSString *)path
|
|
|
|
{
|
2010-06-07 18:49:24 +00:00
|
|
|
NSError * outError = nil;
|
|
|
|
BOOL ok = NO;
|
|
|
|
NSRange dotRange;
|
|
|
|
NSString * errorStr = @"unknown reason";
|
2010-06-10 09:37:23 +00:00
|
|
|
NSString * validatePath = path;
|
2010-06-07 18:49:24 +00:00
|
|
|
|
|
|
|
if (!path) {
|
|
|
|
errorStr = @"keyPath must not be nil";
|
|
|
|
} else {
|
|
|
|
|
|
|
|
id targetObject = self;
|
|
|
|
|
|
|
|
dotRange = [path rangeOfString:@"."
|
|
|
|
options:NSBackwardsSearch];
|
|
|
|
|
|
|
|
if (dotRange.location != NSNotFound) {
|
|
|
|
NSString * newPath = [path substringToIndex:dotRange.location];
|
|
|
|
|
|
|
|
targetObject = [self valueForKeyPath:newPath];
|
|
|
|
|
|
|
|
if (!targetObject) {
|
|
|
|
// If there is no object to set a value, we cannot do any validation.
|
|
|
|
// There is nothing to set on a non-existing object, so just go.
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2010-06-10 09:37:23 +00:00
|
|
|
// 1 is the length of the "."
|
|
|
|
validatePath = [path substringFromIndex: dotRange.location+1];
|
2010-06-07 18:49:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ok = [targetObject validateValue:&value
|
2010-06-10 09:37:23 +00:00
|
|
|
forKeyPath:validatePath
|
2010-06-07 18:49:24 +00:00
|
|
|
error:&outError];
|
|
|
|
}
|
|
|
|
|
2010-04-16 00:18:46 +00:00
|
|
|
if (ok) { // value is ok
|
|
|
|
[self setValue:value
|
2010-06-07 18:49:24 +00:00
|
|
|
forKeyPath:path];
|
2010-04-16 00:18:46 +00:00
|
|
|
|
|
|
|
return value;
|
|
|
|
} else {
|
|
|
|
NSException * exception=nil;
|
|
|
|
NSDictionary * uInfo;
|
|
|
|
|
|
|
|
uInfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
|
|
|
(value ? value : (id)@"nil"), @"EOValidatedObjectUserInfoKey",
|
|
|
|
path, @"EOValidatedPropertyUserInfoKey",
|
|
|
|
nil];
|
|
|
|
|
|
|
|
if ((outError) && ([outError userInfo])) {
|
|
|
|
errorStr = [[outError userInfo] valueForKey:NSLocalizedDescriptionKey];
|
|
|
|
}
|
|
|
|
|
|
|
|
exception=[NSException exceptionWithName:@"EOValidationException"
|
|
|
|
reason:errorStr
|
|
|
|
userInfo:uInfo];
|
|
|
|
|
|
|
|
if (exception) {
|
|
|
|
[exception raise];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// stringForKey:inTableNamed:withDefaultValue:
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)stringForKey:(NSString*)key
|
|
|
|
inTableNamed:(NSString*)tableName
|
|
|
|
withDefaultValue:(NSString*)defaultValue
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
NSString* string=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
string=[GSWApp stringForKey:key
|
|
|
|
inTableNamed:tableName
|
|
|
|
withDefaultValue:defaultValue
|
|
|
|
inFramework:[self frameworkName]
|
|
|
|
languages:[self languages]];
|
|
|
|
return string;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSDictionary*)stringsTableNamed:(NSString*)aName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
NSDictionary* stringsTable=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
stringsTable=[GSWApp stringsTableNamed:aName
|
|
|
|
inFramework:[self frameworkName]
|
|
|
|
languages:[self languages]];
|
|
|
|
return stringsTable;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSArray*)stringsTableArrayNamed:(NSString*)aName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-05-14 11:28:50 +00:00
|
|
|
NSArray* stringsTableArray=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
stringsTableArray=[GSWApp stringsTableArrayNamed:aName
|
|
|
|
inFramework:[self frameworkName]
|
|
|
|
languages:[self languages]];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return stringsTableArray;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// urlForResourceNamed:ofType:
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)urlForResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)type
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//TODO
|
2002-05-14 11:28:50 +00:00
|
|
|
NSString* url=nil;
|
2008-08-20 20:32:10 +00:00
|
|
|
NSString* name;
|
|
|
|
|
|
|
|
if ((type != nil)) {
|
|
|
|
name = [NSString stringWithFormat:@"%@.%@",aName,type];
|
|
|
|
} else {
|
|
|
|
name = aName;
|
|
|
|
}
|
|
|
|
|
|
|
|
url=[GSWApp urlForResourceNamed:name
|
|
|
|
inFramework:[self frameworkName]
|
|
|
|
languages:[self languages]
|
|
|
|
request:nil];//TODO
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return url;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)_urlForResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)type
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
return nil;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// pathForResourceNamed:ofType:
|
|
|
|
// Normally: local search. Here we do a resourceManager serahc.
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)pathForResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)type
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSString* path=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
path=[GSWApp pathForResourceNamed:aName
|
|
|
|
ofType:type
|
|
|
|
inFramework:[self frameworkName]
|
|
|
|
languages:[self languages]];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
return path;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)pathForComponentResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)type_
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSString* path=nil;
|
|
|
|
NSArray* languages=nil;
|
|
|
|
GSWComponentDefinition* aComponentDefinition=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
languages=[self languages];
|
|
|
|
aComponentDefinition=[self _componentDefinition];
|
|
|
|
if (aComponentDefinition)
|
|
|
|
path=[aComponentDefinition pathForResourceNamed:aName
|
|
|
|
ofType:type_
|
|
|
|
languages:languages];
|
|
|
|
return path;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)stringForKey:(id)key
|
|
|
|
inTableNamed:(NSString*)aName
|
|
|
|
withDefaultValue:(NSString*)defaultValue
|
|
|
|
inFramework:(NSString*)aFrameworkName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return [GSWApp stringForKey:key
|
|
|
|
inTableNamed:aName
|
|
|
|
withDefaultValue:defaultValue
|
|
|
|
inFramework:aFrameworkName
|
|
|
|
languages:[self languages]];
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSDictionary*)stringsTableNamed:(NSString*)aName
|
|
|
|
inFramework:(NSString*)aFrameworkName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return [GSWApp stringsTableNamed:aName
|
|
|
|
inFramework:aFrameworkName
|
|
|
|
languages:[self languages]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSArray*)stringsTableArrayNamed:(NSString*)aName
|
|
|
|
inFramework:(NSString*)aFrameworkName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return [GSWApp stringsTableArrayNamed:aName
|
|
|
|
inFramework:aFrameworkName
|
|
|
|
languages:[self languages]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)urlForResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)extension
|
|
|
|
inFramework:(NSString*)aFrameworkName;
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2008-08-20 20:32:10 +00:00
|
|
|
|
|
|
|
NSString * name;
|
|
|
|
|
|
|
|
if ((extension != nil)) {
|
|
|
|
name = [NSString stringWithFormat:@"%@.%@",aName,extension];
|
|
|
|
} else {
|
|
|
|
name = aName;
|
|
|
|
}
|
|
|
|
|
|
|
|
return [GSWApp urlForResourceNamed:name
|
|
|
|
inFramework:aFrameworkName
|
|
|
|
languages:[self languages]
|
|
|
|
request:nil];//TODO
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)pathForResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)extension
|
|
|
|
inFramework:(NSString*)aFrameworkName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return [GSWApp pathForResourceNamed:aName
|
|
|
|
ofType:(NSString*)extension
|
|
|
|
inFramework:aFrameworkName
|
|
|
|
languages:[self languages]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// templateWithHTMLString:declarationString:languages
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-05-14 11:28:50 +00:00
|
|
|
+(GSWElement*)templateWithHTMLString:(NSString*)htmlString
|
|
|
|
declarationString:(NSString*)pageDefString
|
|
|
|
languages:(NSArray*)languages
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
GSWElement* rootElement=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
rootElement=[GSWTemplateParser templateWithHTMLString:htmlString
|
|
|
|
declarationString:pageDefString
|
|
|
|
languages:languages];
|
2000-01-22 12:49:49 +00:00
|
|
|
return rootElement;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// templateWithHTMLString:declarationString:
|
|
|
|
//old
|
2002-05-14 11:28:50 +00:00
|
|
|
+(GSWElement*)templateWithHTMLString:(NSString*)htmlString
|
|
|
|
declarationString:(NSString*)pageDefString
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
return [self templateWithHTMLString:htmlString
|
|
|
|
declarationString:pageDefString
|
|
|
|
languages:nil];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(GSWResponse*)generateResponse
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return [self _generateResponseInContext: [self context]];
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// descriptionForResponse:inContext:
|
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
-(NSString*)descriptionForResponse:(GSWResponse*)aResponse
|
|
|
|
inContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
return _name;
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-05-14 11:28:50 +00:00
|
|
|
+(void)_registerObserver:(id)observer
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
-(void)validateAPIAssociations
|
|
|
|
{
|
2002-05-14 11:28:50 +00:00
|
|
|
NSDictionary* api=[[self _componentDefinition] componentAPI];
|
|
|
|
if (api)
|
|
|
|
{
|
|
|
|
NSArray* required=[api objectForKey:@"Required"];
|
2003-03-21 14:32:57 +00:00
|
|
|
//TODO useit NSArray* optional=[api objectForKey:@"Optional"];
|
2002-05-14 11:28:50 +00:00
|
|
|
int i=0;
|
|
|
|
int count=[required count];
|
|
|
|
id aName=nil;
|
|
|
|
for(i=0;i<count;i++)
|
|
|
|
{
|
|
|
|
aName=[required objectAtIndex:i];
|
|
|
|
if (![self hasBinding:aName])
|
|
|
|
{
|
|
|
|
[NSException raise:NSGenericException
|
|
|
|
format:@"There is no binding for '%@' in parent '%@' for component '%@' [parents : %@]",
|
|
|
|
aName,
|
|
|
|
[_parent class],
|
|
|
|
[self class],
|
|
|
|
[self parentsClasses]];
|
2010-04-16 00:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2010-06-10 09:37:23 +00:00
|
|
|
- (id)unarchiver: (WOKeyValueUnarchiver*)archiver objectForReference: (id)keyPath
|
|
|
|
{
|
|
|
|
if ([keyPath isKindOfClass:[NSString class]])
|
|
|
|
{
|
|
|
|
return [self valueForKeyPath:keyPath];
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
2007-11-29 20:30:19 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
@end
|
2002-11-18 11:14:55 +00:00
|
|
|
|