]> err.no Git - sope/blob - sope-appserver/NGObjWeb/NGObjWeb/WODisplayGroup.h
major improvements in resource/template lookup with SoProduct's
[sope] / sope-appserver / NGObjWeb / NGObjWeb / WODisplayGroup.h
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __NGObjWeb_WODisplayGroup_H__
23 #define __NGObjWeb_WODisplayGroup_H__
24
25 #import <Foundation/NSObject.h>
26
27 @class NSDictionary, NSArray, NSNotification, NSMutableDictionary;
28 @class EODataSource, EOQualifier;
29
30 @interface WODisplayGroup : NSObject < NSCoding >
31 {
32   id           delegate;               /* non-retained ! */
33   EODataSource *dataSource;
34   NSArray      *sortOrderings;
35   NSDictionary *insertedObjectDefaults;
36   unsigned     numberOfObjectsPerBatch;
37   NSArray      *selectionIndexes;
38   NSArray      *objects;
39   NSArray      *displayObjects;
40   EOQualifier  *qualifier;
41   NSString     *defaultStringMatchFormat;
42   NSString     *defaultStringMatchOperator;
43   unsigned     currentBatchIndex;
44
45   NSMutableDictionary *_queryBindings;
46   NSMutableDictionary *_queryMatch;
47   NSMutableDictionary *_queryMin;
48   NSMutableDictionary *_queryMax;
49   NSMutableDictionary *_queryOperator;
50   
51   struct {
52     BOOL fetchesOnLoad:1;
53     BOOL selectFirstAfterFetch:1;
54     BOOL validatesChangesImmediatly:1;
55     BOOL inQueryMode:1;
56   } flags;
57 }
58
59
60 /* accessors */
61
62 - (void)setDelegate:(id)_delegate;
63 - (id)delegate;
64
65 - (void)setDataSource:(EODataSource *)_ds;
66 - (EODataSource *)dataSource;
67
68 - (void)setSortOrderings:(NSArray *)_orderings;
69 - (NSArray *)sortOrderings;
70
71 - (void)setFetchesOnLoad:(BOOL)_flag;
72 - (BOOL)fetchesOnLoad;
73
74 - (void)setInsertedObjectDefaultValues:(NSDictionary *)_values;
75 - (NSDictionary *)insertedObjectDefaultValues;
76
77 - (void)setNumberOfObjectsPerBatch:(unsigned)_count;
78 - (unsigned)numberOfObjectsPerBatch;
79
80 - (void)setSelectsFirstObjectAfterFetch:(BOOL)_flag;
81 - (BOOL)selectsFirstObjectAfterFetch;
82
83 - (void)setValidatesChangesImmediatly:(BOOL)_flag;
84 - (BOOL)validatesChangesImmediatly;
85
86 /* display */
87
88 - (void)redisplay;
89
90 /* batches */
91
92 - (BOOL)hasMultipleBatches;
93 - (unsigned)batchCount;
94 - (void)setCurrentBatchIndex:(unsigned)_currentBatchIndex;
95 - (unsigned)currentBatchIndex;
96 - (unsigned)indexOfFirstDisplayedObject;
97 - (unsigned)indexOfLastDisplayedObject;
98 - (id)displayNextBatch;
99 - (id)displayPreviousBatch;
100 - (id)displayBatchContainingSelectedObject;
101
102 /* selection */
103
104 - (BOOL)setSelectionIndexes:(NSArray *)_selection;
105 - (NSArray *)selectionIndexes;
106 - (BOOL)clearSelection;
107
108 - (id)selectNext;
109 - (id)selectPrevious;
110
111 - (void)setSelectedObject:(id)_obj;
112 - (id)selectedObject;
113 - (void)setSelectedObjects:(NSArray *)_objs;
114 - (NSArray *)selectedObjects;
115
116 - (BOOL)selectObject:(id)_obj;
117 - (BOOL)selectObjectsIdenticalTo:(NSArray *)_objs;
118 - (BOOL)selectObjectsIdenticalTo:(NSArray *)_objs
119             selectFirstOnNoMatch:(BOOL)_flag;
120
121 /* objects */
122
123 - (void)setObjectArray:(NSArray *)_objects;
124 - (NSArray *)allObjects;
125 - (NSArray *)displayedObjects;
126
127 - (id)fetch;
128 - (void)updateDisplayedObjects;
129
130 /* query */
131
132 - (void)setInQueryMode:(BOOL)_flag;
133 - (BOOL)inQueryMode;
134
135 - (EOQualifier *)qualifierFromQueryValues;
136 - (NSMutableDictionary *)queryBindings;
137 - (NSMutableDictionary *)queryMatch;
138 - (NSMutableDictionary *)queryMin;
139 - (NSMutableDictionary *)queryMax;
140 - (NSMutableDictionary *)queryOperator;
141
142 - (void)setDefaultStringMatchFormat:(NSString *)_tmp;
143 - (NSString *)defaultStringMatchFormat;
144 - (void)setDefaultStringMatchOperator:(NSString *)_tmp;
145 - (NSString *)defaultStringMatchOperator;
146 + (NSString *)globalDefaultStringMatchFormat;
147 + (NSString *)globalDefaultStringMatchOperator;
148
149 /* qualifiers */
150
151 - (void)setQualifier:(EOQualifier *)_q;
152 - (EOQualifier *)qualifier;
153
154 - (NSArray *)allQualifierOperators;
155 - (NSArray *)stringQualifierOperators;
156 - (NSArray *)relationalQualifierOperators;
157
158 - (void)qualifyDisplayGroup;
159 - (void)qualifyDataSource;
160
161 @end
162
163 @interface NSObject(WODisplayGroupDelegate)
164
165 - (void)displayGroup:(WODisplayGroup *)_dg
166   createObjectFailedForDataSource:(EODataSource *)_ds;
167
168 - (BOOL)displayGroupShouldFetch:(WODisplayGroup *)_dg;
169 - (void)displayGroup:(WODisplayGroup *)_dg
170   didFetchObjects:(NSArray *)_objects;
171
172 - (BOOL)displayGroup:(WODisplayGroup *)_dg
173   shouldInsertObject:(id)_object
174   atIndex:(unsigned int)_idx;
175 - (void)displayGroup:(WODisplayGroup *)_dg
176   didInsertObject:(id)_object;
177
178 - (BOOL)displayGroup:(WODisplayGroup *)_dg
179   shouldDeleteObject:(id)_object;
180 - (void)displayGroup:(WODisplayGroup *)_dg
181   didDeleteObject:(id)_object;
182
183 - (void)displayGroup:(WODisplayGroup *)_dg
184   didSetValue:(id)_value forObject:(id)_object key:(NSString *)_key;
185
186 - (void)displayGroupDidChangeDataSource:(WODisplayGroup *)_dg;
187 - (BOOL)displayGroup:(WODisplayGroup *)_dg
188   shouldRedisplayForEditingContextChangeNotification:(NSNotification *)_not;
189
190 - (BOOL)displayGroup:(WODisplayGroup *)_dg
191   shouldChangeSelectionToIndexes:(NSArray *)_idxs;
192 - (void)displayGroupDidChangeSelectedObjects:(WODisplayGroup *)_dg;
193 - (void)displayGroupDidChangeSelection:(WODisplayGroup *)_dg;
194
195 - (NSArray *)displayGroup:(WODisplayGroup *)_dg
196   displayArrayForObjects:(NSArray *)_objects;
197
198 @end
199
200 #endif /* __NGObjWeb_WODisplayGroup_H__ */