file folder tree Structure

Screen Shot 2013-08-15 at 3.12.46 AM

– (NSMutableArray *)listItemsAtPath:(NSString *)path {

// NSArray* MessageList = @[@”Message”,@”Discussion”,@”FYI”];
// NSArray* ToDoList = @[@”To Do”,@”Action”,@”Approval”];

NSArray* MessageList = @[TYPE_OPTION_MESSAGE_LS, TYPE_OPTION_DISCUSSION_LS, TYPE_OPTION_FYI_LS];
NSArray* ToDoList = @[TYPE_OPTION_TODO_LS, TYPE_OPTION_ACTION_LS, TYPE_OPTION_APPROVAL_LS];

NSMutableArray* strings = [NSMutableArray array];
[strings addObject:TYPE_OPTION_ALL_LS];
[strings addObject:TYPE_OPTION_MAIL_LS];
[strings addObject:TYPE_OPTION_CHAT_LS];
[strings addObject:TYPE_OPTION_APPROVAL_LS];
// [strings addObject:@”All”];
// [strings addObject:@”Mail”];
// [strings addObject:@”Chat”];

// [strings addObject:@”Announcement”];
[strings addObject:MessageList];
[strings addObject:ToDoList];
item0 = [[CVBaseMenuTreeItem alloc] init];
[item0 setBase:[strings objectAtIndex:0]];
[item0 setPath:@”/”];
[item0 setSubmersionLevel:0];
[item0 setParentSelectingItem:nil];
[item0 setAncestorSelectingItems:[NSMutableArray arrayWithObjects:item1, item2, item3, item4, item5, nil]];
[item0 setNumberOfSubitems:5];

item1 = [[CVBaseMenuTreeItem alloc] init];
[item1 setBase:[strings objectAtIndex:1]];
[item1 setPath:[NSString stringWithFormat:@”/%@”,[strings objectAtIndex:0]]];
[item1 setSubmersionLevel:1];
[item1 setParentSelectingItem:item0];
[item1 setAncestorSelectingItems:[NSMutableArray array]];
[item1 setNumberOfSubitems:0];

item2 = [[CVBaseMenuTreeItem alloc] init];
[item2 setBase:[strings objectAtIndex:2]];
[item2 setPath:[NSString stringWithFormat:@”/%@”,[strings objectAtIndex:0]]];
[item2 setSubmersionLevel:1];
[item2 setParentSelectingItem:item0];
[item2 setAncestorSelectingItems:[NSMutableArray array]];
[item2 setNumberOfSubitems:0];

item3 = [[CVBaseMenuTreeItem alloc] init];
[item3 setBase:[strings objectAtIndex:3]];
[item3 setPath:[NSString stringWithFormat:@”/%@”,[strings objectAtIndex:0]]];
[item3 setSubmersionLevel:1];
[item3 setParentSelectingItem:item0];
[item3 setAncestorSelectingItems:[NSMutableArray array]];
[item3 setNumberOfSubitems:0];

item4 = [[CVBaseMenuTreeItem alloc] init];
[item4 setBase:[[strings objectAtIndex:4] objectAtIndex:0]];
[item4 setPath:[NSString stringWithFormat:@”/%@”,[strings objectAtIndex:0]]];
[item4 setSubmersionLevel:1];
[item4 setParentSelectingItem:item0];
[item4 setAncestorSelectingItems:[NSMutableArray arrayWithObjects:item4_1, item4_2, nil]];
[item4 setNumberOfSubitems:2];

item4_1 = [[CVBaseMenuTreeItem alloc] init];
[item4_1 setBase:[[strings objectAtIndex:4] objectAtIndex:1]];
[item4_1 setPath:[NSString stringWithFormat:@”/%@/%@”,[strings objectAtIndex:0], [[strings objectAtIndex:4] objectAtIndex:0]]];
[item4_1 setSubmersionLevel:2];
[item4_1 setParentSelectingItem:item4];
[item4_1 setAncestorSelectingItems:[NSMutableArray array]];
[item4_1 setNumberOfSubitems:0];

item4_2 = [[CVBaseMenuTreeItem alloc] init];
[item4_2 setBase:[[strings objectAtIndex:4] objectAtIndex:2]];
[item4_2 setPath:[NSString stringWithFormat:@”/%@/%@”,[strings objectAtIndex:0], [[strings objectAtIndex:4] objectAtIndex:0]]];
[item4_2 setSubmersionLevel:2];
[item4_2 setParentSelectingItem:item4];
[item4_2 setAncestorSelectingItems:[NSMutableArray array]];
[item4_2 setNumberOfSubitems:0];

item5 = [[CVBaseMenuTreeItem alloc] init];
[item5 setBase:[[strings objectAtIndex:5] objectAtIndex:0]];
[item5 setPath:[NSString stringWithFormat:@”/%@”,[strings objectAtIndex:0]]];
[item5 setSubmersionLevel:1];
[item5 setParentSelectingItem:item0];
[item5 setAncestorSelectingItems:[NSMutableArray arrayWithObjects:item5_1, item5_2, nil]];
[item5 setNumberOfSubitems:2];

item5_1 = [[CVBaseMenuTreeItem alloc] init];
[item5_1 setBase:[[strings objectAtIndex:5] objectAtIndex:1]];
[item5_1 setPath:[NSString stringWithFormat:@”/%@/%@”,[strings objectAtIndex:0], [[strings objectAtIndex:5] objectAtIndex:0]]];
[item5_1 setSubmersionLevel:2];
[item5_1 setParentSelectingItem:item5];
[item5_1 setAncestorSelectingItems:[NSMutableArray array]];
[item5_1 setNumberOfSubitems:0];

item5_2 = [[CVBaseMenuTreeItem alloc] init];
[item5_2 setBase:[[strings objectAtIndex:5] objectAtIndex:2]];
[item5_2 setPath:[NSString stringWithFormat:@”/%@/%@”,[strings objectAtIndex:0], [[strings objectAtIndex:5] objectAtIndex:0]]];
[item5_2 setSubmersionLevel:2];
[item5_2 setParentSelectingItem:item5];
[item5_2 setAncestorSelectingItems:[NSMutableArray array]];
[item5_2 setNumberOfSubitems:0];

NSLog(@”%@”, path);
if ([path isEqualToString:@”/”]) {
return [NSMutableArray arrayWithObject:item0];
} else if ([path isEqualToString:[NSString stringWithFormat:@”/%@”,[strings objectAtIndex:0]]]) {
return [NSMutableArray arrayWithObjects:item1, item2, item3, item4, item5, nil];
} else if ([path isEqualToString:[NSString stringWithFormat:@”/%@/%@”,[strings objectAtIndex:0], [[strings objectAtIndex:4] objectAtIndex:0]]]) {
return [NSMutableArray arrayWithObjects:item4_1, item4_2, nil];
} else if ([path isEqualToString:[NSString stringWithFormat:@”/%@/%@”,[strings objectAtIndex:0], [[strings objectAtIndex:5] objectAtIndex:0]]]) {
return [NSMutableArray arrayWithObjects:item5_1, item5_2, nil];
} else {
return [NSMutableArray array];
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s