/*
Copyright (C) 2000-2005 SKYRIX Software AG
This file is part of SOPE.
SOPE is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOPE 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with SOPE; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
/*
WETreeDate
Take a look at WETreeView for more information.
WETreeData associations:
isTreeElement
icon
cornerIcon
title
string
treeLink (do not generate a -componentActionURL but use the specified link)
Example:
TreeDataCell: WETreeData {
isTreeElement = YES; // this is a tree cell (that means, it has plus
// and minus icons and all that stuff)
}
DataCell: WETreeData {
isTreeElement = NO; // this is NOT a tree cell, i.e. it does NOT
// have any plus or minus icons. (This is just a
// ordinary
"];
}
- (void)appendPaddingCellsOfTreeElement:(id)treeElement
toResponse:(WOResponse *)_response
inContext:(WOContext *)_ctx
{
/*
This renders all the tree-view related lines and plus/minus signs,
padding etc.
*/
unsigned int i;
for (i = 0; i < [treeElement depth]+1; i++) {
NSString *iconWidth;
NSString *treeElm;
iconWidth = [_ctx objectForKey:WETreeView_IconWidth];
treeElm = (i < [treeElement depth])
? [treeElement elementAtIndex:i]
: [treeElement leaf];
if (self->doTable) {
[_response appendContentString:@"
"];
}
/* this appends plus and minus images and links to expand/collapse */
[self _appendTreeElement:treeElm toResponse:_response inContext:_ctx];
if (self->doTable)
[_response appendContentString:@"
"];
}
}
- (void)appendData:(WOResponse *)_response inContext:(WOContext *)_ctx {
/* TODO: split up this method */
_WETreeMatrixElement *treeElement;
WOComponent *cmp = nil;
BOOL isTree = NO;
NSString *content = nil;
cmp = [_ctx component];
isTree = [self->isTreeElement boolValueInComponent:cmp];
content = [self->string stringValueInComponent:cmp];
treeElement = [_ctx objectForKey:WETreeView_TreeElement];
if (isTree) {
/* this is a first cell in a row, it renders the tree controls */
[self appendPaddingCellsOfTreeElement:treeElement
toResponse:_response inContext:_ctx];
if (self->doTable) {
[_response appendContentString:@"
"];
}
/* add cell content */
[self->template appendToResponse:_response inContext:_ctx];
if (content)
[_response appendContentHTMLString:content];
if (self->doTable)
[_response appendContentString:@"
"];
}
else { // ! isTree
/* this is a follow-up cell in a row, it renders just the content */
if (self->doTable) {
[_response appendContentString:@"