]> err.no Git - sope/blob - sope-appserver/WEExtensions/WETableView/WETableView.h
fixed copyrights for 2005
[sope] / sope-appserver / WEExtensions / WETableView / WETableView.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 __WETableView_H__
23 #define __WETableView_H__
24
25 #include <NGObjWeb/WODynamicElement.h>
26
27 /*
28   
29   WETableView attributes:
30     
31     list          - list to iterate through                          (NSArray)
32     batchSize     - size of a page                                   (unsigned)
33     currentBatch  - current page                                     (unsigned)
34     
35     item          - current item                                     (id)
36     index         - current item index                               (unsigned)
37     identifier    - unique id for element                            (id)
38     previousItem  - previous item       // used to calculate groupBy (id)
39     previousIndex - previous item index // used to calculate groupBy (unsigned)
40     
41     indexOfFirst  - index of first item of current page              (unsigned)
42     indexOfLast   - index of last  item of current page              (unsigend)
43     
44     sortedKey     -                                                  (NSString)
45     isDescending  - sort descending                                  (BOOL)
46     groups        -                                                  (id)
47     showGroup     -                                                  (BOOL)
48
49     collapseOnClient       - use JavaScript for collapsing (only IE) (BOOL)
50     scrollOnClient         - use JavaScript for scrolling  (only IE) (BOOL)
51     autoScroll             - use overflow-scrolling        (only IE) (int)
52     showBatchResizeButtons - default = YES                           (BOOL)
53
54   WETableHeader attributes:
55    
56     sortKey       - unique key; if set, a sorticon will be displayed (NSString) 
57     negateSortDir - if YES, default sort dir is NSDescending         (BOOL)
58     bgColor       - background color                                 (NSString)
59     
60
61   WETableData attributes:
62   
63     sortKey       - unique key; if set, a sorticon will be displayed (NSString)
64     negateSortDir - if YES, default sort dir is NSDescending         (BOOL)
65     bgColor       - background color                                 (NSString)
66     title         - title of header -> no header cell is needed      (NSString)
67     isGroup       -
68   
69   WETableView config attributes:
70
71     titleColor
72     headerColor
73     footerColor
74     evenColor
75     oddColor
76     fontColor
77     fontFace
78     fontSize
79
80     nonSortIcon
81     downwardSortIcon
82     upwardSortIcon
83   
84     firstIcon
85     firstBlindIcon
86     previousIcon
87     previousBlindIcon
88     nextIcon
89     nextBlindIcon
90     lastIcon
91     lastBlindIcon
92
93     plusResizeIcon
94     minusResizeIcon
95
96     groupOpenedIcon
97     groupClosedIcon
98  
99     ofLabel
100     toLabel
101     firstLabel
102     previousLabel
103     nextLabel
104     lastLabel
105     pageLabel
106     sortLabel
107
108     border
109     cellpadding
110     cellspacing
111    
112   WETableHeader, WETableData config attributes:
113   
114     upwardSortIcon;
115     downwardSortIcon;
116     nonSortIcon;
117     sortLabel;
118 */
119
120 @class WETableViewLabelConfig, WETableViewIconConfig;
121 @class WETableViewColorConfig, WETableViewIconConfig;
122 @class WETableViewState;
123
124 @interface WETableView : WODynamicElement
125 {
126   // WODynamicElement: extraAttributes
127   // WODynamicElement: otherTagString
128 @protected
129   WOAssociation  *list;           // list of objects
130   WOAssociation  *batchSize;      // batch size
131   WOAssociation  *currentBatch;   // index of the displayed batch
132   
133   WOAssociation  *item;           // current item in the array
134   WOAssociation  *index;          // current index
135   WOAssociation  *identifier;     // unique id for element
136   WOAssociation  *previousItem;   // predecessor of item  (used by isGroup)
137   WOAssociation  *previousIndex;  // predecessor of index (used by isGroup)
138
139   WOAssociation  *indexOfFirst;   // index of first displayed object
140   WOAssociation  *indexOfLast;    // index of last  displayed object
141   
142   WOAssociation  *sortedKey;      // 
143   WOAssociation  *isDescending;   //
144   WOAssociation  *groups;         //
145   WOAssociation  *showGroup;      //
146
147   WOAssociation  *selection;      // 
148
149   WOAssociation  *collapseOnClient; // use JS for collapsing default = NO
150   WOAssociation  *scrollOnClient;   // use JS for scrolling  default = NO
151   WOAssociation  *autoScroll;       // use overflow-scrolling (only IE)
152   WOAssociation  *showBatchResizeButtons; // 
153   
154   WOAssociation  *sortAction;     // called if sort     button is clicked
155   WOAssociation  *firstAction;    // called if first    button is clicked
156   WOAssociation  *previousAction; // called if previous button is clicked
157   WOAssociation  *nextAction;     // called if next     button is clicked
158   WOAssociation  *lastAction;     // called if last     button is clicked
159
160   // config stuff:
161   WETableViewColorConfig *colors;
162   WOAssociation  *groupColor;
163   WOAssociation  *fontColor;
164   WOAssociation  *fontFace;
165   WOAssociation  *fontSize;
166
167   WETableViewIconConfig *icons;
168   WOAssociation  *groupOpenedIcon;
169   WOAssociation  *groupClosedIcon;
170
171   WETableViewLabelConfig *labels;
172   
173   WOAssociation  *border;
174   WOAssociation  *cellspacing;
175   WOAssociation  *cellpadding;
176
177   WOAssociation  *showGroupTitle;
178   
179   // private stuff:
180   NSArray          *allObjects;
181   BOOL             doScript;       // generate JavaScript
182   NSString         *scriptID;      // to unify the JavaScript
183   WETableViewState *state;
184   WOElement        *template;
185 }
186
187 - (void)_appendHeader:(WOResponse *)_response inContext:(WOContext *)_ctx;
188 - (void)_appendData:(WOResponse *)_response inContext:(WOContext *)_ctx;
189 - (void)_appendFooter:(WOResponse *)_response inContext:(WOContext *)_ctx;
190
191 - (void)updateStateInContext:(WOContext *)_ctx; // returns isAutoScroll
192
193 @end /* WETableView */
194
195 #include "WETableViewDefines.h"
196 #include "WETableViewState.h"
197 #include "WETableViewInfo.h"
198
199 static inline NSString *WETableLabelForKey(NSString *_key, WOContext *_ctx)
200      __attribute__((unused));
201
202 #include <NGObjWeb/WOContext.h>
203 #import <Foundation/NSString.h>
204
205 static NSString *WETableLabelForKey(NSString *_key, WOContext *_ctx) {
206   NSString *key;
207   id tmp;
208   
209   key = [[NSString alloc] initWithFormat:@"WETableView_%@Label", _key];
210   tmp = [_ctx objectForKey:key];
211   [key release];
212   return tmp;
213 }
214
215 @interface WETableView(Private)
216 - (void)_appendBatchResizeButtons:(WOResponse *)_response
217   rowSpan:(unsigned int)_rowSpan
218   actionUrl:(NSString *)_actionUrl
219   inContext:(WOContext *)_ctx;
220 @end /* WETableView(Private) */
221
222 #endif /* __WETableView_H__ */