2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include <NGObjWeb/WOComponent.h>
24 @class NSArray, NSMutableDictionary;
26 @interface TreeView : WOComponent < NSCoding >
29 NSMutableDictionary *state;
39 @implementation TreeView
42 if ((self = [super init])) {
43 WOResourceManager *rm;
46 rm = [[self application] resourceManager];
48 path = [rm pathForResourceNamed:@"TreeView.plist"
52 self->root = [[NSArray alloc] initWithContentsOfFile:path];
53 self->state = [[NSMutableDictionary alloc] init];
59 [self->currentPath release];
62 [self->state release];
72 - (NSArray *)oneTags {
73 return [NSArray arrayWithObject:@"one"];
76 - (void)setItem:(id)_item {
77 ASSIGN(self->item, _item);
83 - (void)setClicks:(int)_clicks {
84 self->clicks = _clicks;
90 - (void)setCurrentPath:(NSString *)_value {
91 ASSIGN(self->currentPath, _value);
94 return self->currentPath;
97 - (NSString *)keyPath {
98 return [[[self valueForKey:@"currentPath"]
99 valueForKey:@"key"] componentsJoinedByString:@"."];
102 - (void)setIsZoom:(BOOL)_flag {
105 key = [self keyPath];
107 NSLog(@"setIsZoom is %@", key);
109 [self->state setObject:[NSNumber numberWithBool:_flag] forKey:key];
114 key = [self keyPath];
116 NSLog(@"isZoom is %@", key);
121 return [[self->state objectForKey:key] boolValue];
125 return ([[self keyPath] hasSuffix:@"two"] ||
126 [[self keyPath] hasSuffix:@"four"])
135 return nil /* stay on page */;
139 NSLog(@"... droppedObject is %@", [self valueForKey:@"droppedObject"]);
145 - (void)encodeWithCoder:(NSCoder *)_coder {
146 [super encodeWithCoder:_coder];
147 [_coder encodeObject:self->root];
148 [_coder encodeObject:self->state];
149 [_coder encodeObject:self->item];
151 - (id)initWithCoder:(NSCoder *)_coder {
152 if ((self = [super initWithCoder:_coder])) {
153 self->root = [[_coder decodeObject] retain];
154 self->state = [[_coder decodeObject] retain];
155 self->item = [[_coder decodeObject] retain];