Class

NSRuleEditor

An interface for configuring a rule-based list of options.

Declaration

@interface NSRuleEditor : NSControl

Overview

A rule editor lets the user visually create and configure a list of options that are expressed as a predicate (as described in Predicate Programming Guide). Each row displayed by the rule editor represents a particular path down a tree of choices. The rule editor's delegate provides the tree of choices to be displayed. The rule editor presents those choices to the user as a row of popup buttons, static text fields, and custom views.

NSRuleEditor exposes one binding, rows. You can bind rows to an ordered collection (such as an instance of NSMutableArray). Each object in the collection should have the following properties:

@"rowType"

An integer representing the type of the row (NSRuleEditorRowType).

@"subrows"

An ordered to-many relation (such as an instance of NSMutableArray) containing the directly nested subrows for the given row.

@"displayValues"

An ordered to-many relation containing the display values for the row.

@"criteria"

An ordered to-many relation containing the criteria for the row.

Topics

Configuring the Delegate

delegate

The rule editor’s delegate.

NSRuleEditorDelegate

The NSRuleEditorDelegate protocol defines the optional methods implemented by delegates of NSRuleEditor objects.

Configuring a Rule Editor

editable

A Boolean value that determines whether the rule editor is editable.

nestingMode

The rule editor’s nesting mode.

NSRuleEditorNestingMode

Specifies a type for nesting modes.

canRemoveAllRows

A Boolean value that indicates whether all the rows can be removed.

rowHeight

The rule editor’s row height.

Working with Formatting

formattingDictionary

The formatting dictionary for the rule editor.

formattingStringsFilename

The name of the rule editor’s strings file.

Providing Data

- reloadCriteria

Instructs the receiver to refetch criteria from its delegate.

- setCriteria:andDisplayValues:forRowAtIndex:

Modifies the row at a given index to contain the given items and values.

- criteriaForRow:

Returns the currently chosen items for a given row.

- displayValuesForRow:

Returns the chosen values for a given row.

Obtaining Row Information

numberOfRows

The number of rows in the rule editor.

- parentRowForRow:

Returns the index of the parent of a given row.

- rowForDisplayValue:

Returns the index of the row containing a given value.

- rowTypeForRow:

Returns the type of a given row.

NSRuleEditorRowType

Specifies a type for row types.

- subrowIndexesForRow:

Returns the immediate subrows of a given row.

Working with the Selection

selectedRowIndexes

The indexes of the rule editor’s selected rows.

- selectRowIndexes:byExtendingSelection:

Sets in the receiver the indexes of rows that are selected.

Manipulating Rows

- addRow:

Adds a row to the receiver.

- insertRowAtIndex:withType:asSubrowOfRow:animate:

Adds a new row of a given type at a given location.

- removeRowAtIndex:

Removes the row at a given index.

- removeRowsAtIndexes:includeSubrows:

Removes the rows at given indexes.

Working with Predicates

predicate

The rule editor’s predicate.

- reloadPredicate

Instructs the receiver to regenerate its predicate by invoking the corresponding delegate method.

- predicateForRow:

Returns the predicate for a given row.

Supporting Bindings

rowClass

The class used to create a new row in the “rows” binding.

rowTypeKeyPath

The key path for the row type.

subrowsKeyPath

The key path for the subrows.

criteriaKeyPath

The criteria key path.

displayValuesKeyPath

The display values key path.

Overriding viewDidMoveToWindow

- viewDidMoveToWindow

Overrides the NSView implementation.

Notifications

NSRuleEditorRowsDidChangeNotification

This notification is posted to the default notification center whenever the view's rows change.

Relationships

Inherits From

See Also

Controls

NSButton

A control that defines an area on the screen that can be used to trigger actions.

NSColorWell

A control that displays a color value and lets the user change that color value.

Date Picker

Display a calendar date and provide controls for editing the date value.

NSImageView

A display of image data from an NSImage object in a frame.

NSLevelIndicator

A visual representation of a level or quantity, using discrete values.

Path Control

A display of a file system path or virtual path information.

NSPopUpButton

A display of a single item from a list of items, and provide an interface for selecting items from the list.

NSProgressIndicator

An interface that provides visual feedback to the user about the status of an ongoing task.

NSPredicateEditor

A defined set of rules that allows the editing of predicate objects.

Search Field

Provide a text field that is optimized for text-based search interfaces.

NSSegmentedControl

Display one or more buttons in a single horizontal group.

Slider

Display a range of values from which the user selects a single value.

NSStepper

An interface with up and down arrow buttons for incrementing or decrementing a value.

Text Field

Provide a simple interface for displaying and editing text, including support for password fields and secure forms of text entry.

Token Field

Provide a text field whose text can be rendered in a visually distinct way so that users can recognize portions more easily.

Toolbar

Provide a space for controls under a window's title bar and above your custom content.

Combo Box

Display a list of values in a pop-up menu that lets the user select a value or type in a custom value.

NSMatrix

A legacy interface for grouping radio buttons or other types of cells together.