Feature: Implement NSRuleEditor - #856
Open
DTW-Thalion wants to merge 2 commits into
Open
Conversation
Every method was a stub, so an editor had no rows, asked its delegate for nothing and produced no predicate. The editor now keeps its rows in a tree, walks the delegate for the criteria and display values a row starts out with, lays those out a row at a time, and builds a predicate from the parts the delegate gives for each criterion. The row a nesting mode calls for is made along with the first row it holds, and the rows of a list are joined with or.
START_SET creates an autorelease pool and END_SET releases it, so the pool these tests create around the set is redundant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every method of NSRuleEditor was a stub, so an editor had no rows, asked its delegate for nothing and produced no predicate. NSPredicateEditor is built on it and could not work either.
The editor now keeps its rows in a tree. A new row is filled by walking the delegate from the root of its criteria, taking the first child at each step and asking for a display value, until the delegate offers no more. The display values are laid out a row at a time, indented by how deep the row sits. The predicate of a row is assembled from the parts the delegate gives for each of its criteria, and a compound row joins the rows under it with the compound type its own criterion carries. A single editor holds one row, a list joins its rows with or, and the nesting modes that hold rows under a compound row make that row along with the first row it holds.
Choosing another item in a row does not yet rebuild the criteria under it, the formatting dictionary is kept but not applied, and rows are not animated. The class gains instance variables.
Tests/gui/NSRuleEditor/basic.m. 29 assertions fail before the change and pass after.
Refers to #96.