diff --git a/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate b/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate index 0202be35a164aa776ec32b7a689a5db0108646b1..c1bb18ae55cac755d737f19347057e3affb6ae6b 100644 Binary files a/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate and b/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.h b/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.h index e2a08d8d6b48005a2ec304d87792e7c6584eef6a..15078789ffb22076544b028516065a79a87e8ef4 100644 --- a/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.h +++ b/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.h @@ -23,10 +23,10 @@ #import <UIKit/UIKit.h> -@class CISDOBIpadEntity; +@class CISDOBIpadEntity, CISDOBOpenBisModel; @interface CISDOBDetailViewController : UIViewController <UISplitViewControllerDelegate> -@property (strong, nonatomic) CISDOBIpadEntity *detailItem; +@property (strong, nonatomic) CISDOBOpenBisModel *openBisModel; @property (weak, nonatomic) IBOutlet UITableView *propertiesTableView; @property (weak, nonatomic) IBOutlet UILabel *summaryHeaderLabel; @@ -34,4 +34,7 @@ @property (weak, nonatomic) IBOutlet UILabel *identifierLabel; @property (weak, nonatomic) IBOutlet UIImageView *imageView; +// Actions +- (void)selectionDidChange; + @end diff --git a/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m b/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m index e09340e30e8cae6c9c11ecb9ff8e59224d530670..21c1cc00fe0b5c074b54a4dbf2976ba6962394d7 100644 --- a/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m +++ b/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m @@ -23,9 +23,12 @@ #import "CISDOBDetailViewController.h" #import "CISDOBIpadEntity.h" +#import "CISDOBOpenBisModel.h" @interface CISDOBDetailViewController () @property (strong, nonatomic) UIPopoverController *masterPopoverController; +@property (readonly) CISDOBIpadEntity *detailItem; + - (void)configureView; - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath; @end @@ -34,28 +37,26 @@ #pragma mark - Managing the detail item -- (void)setDetailItem:(id)newDetailItem +- (void)selectionDidChange { - if (_detailItem != newDetailItem) { - _detailItem = newDetailItem; - - // Update the view. - [self configureView]; - } + // Update the view. + [self configureView]; if (self.masterPopoverController != nil) { [self.masterPopoverController dismissPopoverAnimated:YES]; - } + } } +- (CISDOBIpadEntity *)detailItem { return [self.openBisModel selectedObject]; } + - (void)configureView { // Update the user interface for the detail item. if (!self.detailItem) return; - self.summaryHeaderLabel.text = [[self.detailItem valueForKey:@"summaryHeader"] description]; - self.summaryLabel.text = [[self.detailItem valueForKey:@"summary"] description]; - self.identifierLabel.text = [[self.detailItem valueForKey:@"identifier"] description]; + self.summaryHeaderLabel.text = [self.detailItem.summaryHeader description]; + self.summaryLabel.text = [self.detailItem.summary description]; + self.identifierLabel.text = [self.detailItem.identifier description]; if (self.detailItem.imageUrl) { NSURL *imageUrl = [NSURL URLWithString: self.detailItem.imageUrl]; @@ -106,7 +107,7 @@ { if (!self.detailItem) return 0; - return [_detailItem.properties count]; + return [self.detailItem.properties count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/openbis-ipad/openBIS/openBIS/CISDOBMasterViewController.m b/openbis-ipad/openBIS/openBIS/CISDOBMasterViewController.m index 20b36ba17791f98ecfd372ea87ef3469161aa52b..5c20e1456486c22f854bf1e252ea85a5553fa65b 100644 --- a/openbis-ipad/openBIS/openBIS/CISDOBMasterViewController.m +++ b/openbis-ipad/openBIS/openBIS/CISDOBMasterViewController.m @@ -54,6 +54,7 @@ // UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; // self.navigationItem.rightBarButtonItem = addButton; self.detailViewController = (CISDOBDetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController]; + self.detailViewController.openBisModel = self.openBisModel; } - (void)didReceiveMemoryWarning @@ -127,7 +128,7 @@ // Segue to the detail view unless we are on the ipad if ([[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPad) return; - CISDOBIpadEntity *object = [self.openBisModel selectObjectAtIndexPath: indexPath]; + [self.openBisModel selectObjectAtIndexPath: indexPath]; if ([self.openBisModel isSelectionGroup]) { UIStoryboard *storyboard = self.storyboard; CISDOBMasterViewController *child = [storyboard instantiateViewControllerWithIdentifier: @"Master"]; @@ -135,7 +136,7 @@ [self.navigationController pushViewController: child animated: YES]; } else { - self.detailViewController.detailItem = object; + [self.detailViewController selectionDidChange]; } } @@ -143,17 +144,15 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showDetail"]) { - NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; - CISDOBIpadEntity *object = [self.openBisModel objectAtIndexPath: indexPath]; - [[segue destinationViewController] setDetailItem:object]; + [[segue destinationViewController] setOpenBisModel: self.openBisModel]; } } - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { CISDOBIpadEntity *object = [self.openBisModel objectAtIndexPath: indexPath]; - cell.textLabel.text = [object valueForKey:@"summaryHeader"]; - cell.detailTextLabel.text = [object valueForKey:@"summary"]; + cell.textLabel.text = object.summaryHeader; + cell.detailTextLabel.text = object.summary; if ([object.childrenPermIds count] > 0) { cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } else { diff --git a/openbis-ipad/openBIS/openBIS/en.lproj/MainStoryboard_iPad.storyboard b/openbis-ipad/openBIS/openBIS/en.lproj/MainStoryboard_iPad.storyboard index 4415cd622e553b6ee561c660cf666cf157ff49ff..a906f98a2437dccb5f0e4fd5e0529a5136d1542e 100644 --- a/openbis-ipad/openBIS/openBIS/en.lproj/MainStoryboard_iPad.storyboard +++ b/openbis-ipad/openBIS/openBIS/en.lproj/MainStoryboard_iPad.storyboard @@ -188,7 +188,7 @@ <outlet property="delegate" destination="19" id="21"/> </connections> </tableView> - <navigationItem key="navigationItem" title="Entity" id="40"/> + <navigationItem key="navigationItem" title="Categories" id="40"/> </tableViewController> <placeholder placeholderIdentifier="IBFirstResponder" id="23" sceneMemberID="firstResponder"/> </objects>