2 // HMJSONViewWindowController.m
5 // Created by Hori,Masaki on 2014/02/09.
6 // Copyright (c) 2014年 Hori,Masaki. All rights reserved.
9 #import "HMJSONViewWindowController.h"
11 @interface HMJSONViewWindowController ()
12 @property (retain, readwrite) NSMutableArray *commands;
14 @property (assign, readwrite) id json;
17 @implementation HMJSONViewWindowController
21 self = [super initWithWindowNibName:NSStringFromClass([self class])];
23 _commands = [NSMutableArray new];
30 [self.apis addObserver:self
31 forKeyPath:@"selection"
32 options:NSKeyValueObservingOptionNew
36 - (void)setCommand:(NSDictionary *)command
38 [self willChangeValueForKey:@"commands"];
39 [self.commands addObject:command];
40 [self didChangeValueForKey:@"commands"];
43 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
45 if([keyPath isEqualToString:@"selection"]) {
46 [self willChangeValueForKey:@"arguments"];
47 self.arguments = [self.apis valueForKeyPath:@"selection.argument"];
48 [self didChangeValueForKey:@"arguments"];
50 [self willChangeValueForKey:@"json"];
51 self.json = [self.apis valueForKeyPath:@"selection.json"];
52 [self didChangeValueForKey:@"json"];
54 // [self.argumentsView reloadData];
55 [self.jsonView reloadData];
60 [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
64 - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
68 - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
72 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
76 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item