Skip to content
Snippets Groups Projects
Commit 981ad621 authored by cramakri's avatar cramakri
Browse files

Prevent unnecessary recursion into a slection in the navigation

SVN: 27184
parent a6fe3dd2
No related branches found
No related tags found
No related merge requests found
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
CISDOBIpadEntity *object = [self.openBisModel objectAtIndexPath: indexPath]; CISDOBIpadEntity *object = [self.openBisModel objectAtIndexPath: indexPath];
cell.textLabel.text = object.summaryHeader; cell.textLabel.text = object.summaryHeader;
cell.detailTextLabel.text = object.summary; cell.detailTextLabel.text = object.summary;
if ([object.childrenPermIds count] > 0) { if ([self.openBisModel entityHasChildren: object]) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
} else { } else {
cell.accessoryType = UITableViewCellAccessoryNone; cell.accessoryType = UITableViewCellAccessoryNone;
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
//! Select the object and return it //! Select the object and return it
- (CISDOBIpadEntity *)selectObjectAtIndexPath:(NSIndexPath *)indexPath; - (CISDOBIpadEntity *)selectObjectAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)selectionHasChildren; //!< Return YES if the selected object is a group (has children) - (BOOL)selectionHasChildren; //!< Return YES if the selected object has children in the selection context
- (BOOL)entityHasChildren:(CISDOBIpadEntity *)entity; //!< Return YES if the entity has children in the selection context.
// Actions // Actions
- (BOOL)insertNewObjectOrError:(NSError **)error; //!< Return YES if operation succeeded - (BOOL)insertNewObjectOrError:(NSError **)error; //!< Return YES if operation succeeded
......
...@@ -82,7 +82,16 @@ ...@@ -82,7 +82,16 @@
- (BOOL)selectionHasChildren - (BOOL)selectionHasChildren
{ {
return [_selectedObject.childrenPermIds count] > 0; if (!_selectedObject) return NO;
return [self entityHasChildren: _selectedObject];
}
- (BOOL)entityHasChildren:(CISDOBIpadEntity *)entity
{
// In this case we are already looking at the children. No need to allow circular recursion.
if (_parentModel && [entity isEqual: _parentModel.selectedObject]) return NO;
return [entity.childrenPermIds count] > 0;
} }
#pragma mark - Actions #pragma mark - Actions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment