diff options
Diffstat (limited to 'Source/SPTableContentFilterController.h')
-rw-r--r-- | Source/SPTableContentFilterController.h | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/Source/SPTableContentFilterController.h b/Source/SPTableContentFilterController.h index 24935d2a..3d4029d6 100644 --- a/Source/SPTableContentFilterController.h +++ b/Source/SPTableContentFilterController.h @@ -28,13 +28,9 @@ // // More info at <https://github.com/sequelpro/sequelpro> -#import <Foundation/Foundation.h> - -@class SPSplitView; @class SPTableData; @class SPDatabaseDocument; @class SPTablesList; -@class SPTableContent; @class SPContentFilterManager; NSString * const SPTableContentFilterHeightChangedNotification; @@ -62,34 +58,91 @@ NSString * const SPTableContentFilterHeightChangedNotification; /** * Makes the first NSTextField found in the rule editor the first responder + * + * MUST BE CALLED ON THE UI THREAD! */ - (void)focusFirstInputField; +/** + * Will reconfigure the columns of the rule editor from the given array. + * Call with nil to reset the editor to its initial empty state. + * Existing rows will be removed in any case! + * + * MUST BE CALLED ON THE UI THREAD! + */ - (void)setColumns:(NSArray *)dataColumns; -- (void)openContentFilterManagerForFilterType:(NSString *)filterType; - +/** + * Converts the current filter expression displayed in the UI into an + * SQL string suitable for use in a WHERE clause. + * + * @param isBINARY Indicates that the filter should use the BINARY qualifier for ignoring + * collations during search. + * @param err Upon return contains and object describing why the SQL conversion failed, + * if it failed or nil, if no errors occured. + * + * MUST BE CALLED ON THE UI THREAD! + */ - (NSString *)sqlWhereExpressionWithBinary:(BOOL)isBINARY error:(NSError **)err; +/** + * Returns the current filter configuration in a serialized form that can be exported and + * reapplied later. + * + * MUST BE CALLED ON THE UI THREAD! + */ - (NSDictionary *)serializedFilter; + +/** + * Restores the filter rule configuration from a given dictionary. + * The current column configuration must match the schema that was used when generating + * the serialized data, otherwise the invalid rules will be ignored. + * + * @param serialized A dictionary previously generated by calling -serializedFilter. + * @return A serialized filter + * + * MUST BE CALLED ON THE UI THREAD! + */ - (void)restoreSerializedFilters:(NSDictionary *)serialized; -- (NSDictionary *)makeSerializedFilterForColumn:(NSString *)colName operator:(NSString *)opName values:(NSArray *)values; +/** + * Create a serialized filter from a given column, operator and operand. + * This is used when navigating foreign key links between tables to create the filter for the target table. + * + * @param colName Name of the column to filter (left side operand) + * @param opName Name of the filter (operator) + * @param values The values to filter with (right side operand) + * @return A serialized filter + * + * This method is thread-safe. + */ ++ (NSDictionary *)makeSerializedFilterForColumn:(NSString *)colName operator:(NSString *)opName values:(NSArray *)values; +/** + * The view height the rule editor needs in order to not have to resort to scrollbars + * + * SHOULD be called on the UI thread, or results may be inconsistent! + */ @property (readonly, assign, nonatomic) CGFloat preferredHeight; /** - * Indicates whether the rule editor has no expressions + * Indicates whether the rule editor has no filter expressions + * + * SHOULD be called on the UI thread, or results may be inconsistent! */ - (BOOL)isEmpty; /** * Adds a new row to the rule editor + * + * MUST BE CALLED ON THE UI THREAD! */ - (void)addFilterExpression; /** * Used when the rule editor wants to trigger filtering + * + * SHOULD be called on the UI thread, or results may be inconsistent! */ @property (assign, nonatomic) id target; @property (assign, nonatomic) SEL action; |