1 |
|
---|
2 | #import "GSResultItem.h"
|
---|
3 | #import "GreenstoneApplication.h"
|
---|
4 |
|
---|
5 | #import "QueryCascadeView.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | @implementation QueryCascadeView
|
---|
9 |
|
---|
10 |
|
---|
11 | -(id) initWithFrame:(CGRect)rect withParent:(UIView*)parent
|
---|
12 | withCollection:(NSString*)collection withTitle:(NSString*)title withGID:(NSString*)gid
|
---|
13 | {
|
---|
14 | _queryViews = [[NSMutableArray alloc] initWithCapacity:MCInitCapacity];
|
---|
15 |
|
---|
16 | return [super initWithFrame:rect withParent:parent withCollection:collection
|
---|
17 | withTitle:title withGID:gid];
|
---|
18 | }
|
---|
19 |
|
---|
20 | -(void) appendMenuItem:(NSObject*)app withItem:(NSString*)item_label withGID:(NSString*)childGID
|
---|
21 | {
|
---|
22 | [super appendMenuItem:app withItem:item_label withGID:childGID];
|
---|
23 |
|
---|
24 | CGRect workarea_rect = [GreenstoneApplication workAreaRect];
|
---|
25 | QueryView* queryView = [[QueryView alloc] initWithFrame:workarea_rect
|
---|
26 | withParent:self withCollection:childGID withTitle:item_label];
|
---|
27 |
|
---|
28 | [_queryViews addObject:queryView];
|
---|
29 |
|
---|
30 | }
|
---|
31 |
|
---|
32 | -(void) tableRowSelected:(NSNotification*)notification
|
---|
33 | {
|
---|
34 | UITable* table = [notification object];
|
---|
35 | int rowId = [table selectedRow];
|
---|
36 |
|
---|
37 | GreenstoneAPI* greenstoneAPI = [GreenstoneApplication greenstoneAPI];
|
---|
38 |
|
---|
39 | NSString* childTitle = [[_oidItem objectAtIndex:rowId] title];
|
---|
40 | NSString* childGID = [[_oidItem objectAtIndex:rowId] oid];
|
---|
41 |
|
---|
42 | NSString* chosenCollection = [[NSString alloc] initWithString:childGID];
|
---|
43 |
|
---|
44 | CGRect workarea_rect = [GreenstoneApplication workAreaRect];
|
---|
45 | QueryView* queryView = [_queryViews objectAtIndex:rowId];
|
---|
46 |
|
---|
47 | [GreenstoneApplication setInCollection:chosenCollection];
|
---|
48 | [GreenstoneApplication transitionView:UITransitionBothShiftLeft
|
---|
49 | fromView:self toView:queryView];
|
---|
50 | }
|
---|
51 |
|
---|
52 | -(UIView*) directEntry:(int)rowId
|
---|
53 | {
|
---|
54 | return [_queryViews objectAtIndex:rowId];
|
---|
55 | }
|
---|
56 |
|
---|
57 | -(void) dealloc
|
---|
58 | {
|
---|
59 | [_queryViews release];
|
---|
60 |
|
---|
61 | [super dealloc];
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | @end
|
---|