136 |
143 |
137 #basicsEditor |
144 #basicsEditor |
138 'Default widget type or a selector returning an instance of a user defined widget opened in the cell.' |
145 'Default widget type or a selector returning an instance of a user defined widget opened in the cell.' |
139 |
146 |
140 #basicsFont |
147 #basicsFont |
141 'Sets the font of the label text.' |
148 'Sets the font of the labeled text.' |
142 |
149 |
143 #basicsJustification |
150 #basicsJustification |
144 'Aligns the label text to the left, right, or centered in the cell.' |
151 'Aligns the label to the left, right, or center in the cell.' |
145 |
152 |
146 #basicsLabel |
153 #basicsLabel |
147 'The label of the column or a selector returning a string or an image.' |
154 'The label of the column (String or StringCollection) or a selector returning the label.' |
|
155 |
|
156 #basicsLabelId |
|
157 'Unique identifier of the column (optional).' |
148 |
158 |
149 #basicsLabelIsImage |
159 #basicsLabelIsImage |
150 'Turns on/off image behavior of the label string; i.e. it is used as selector returning an image.' |
160 'Label is actually the selector if a message providing an image-label.' |
|
161 |
|
162 #basicsLabelTranslate |
|
163 'Translate the label via the resource mechanism to a national language string.' |
151 |
164 |
152 #basicsRenderer |
165 #basicsRenderer |
153 'Specifies displaying cell as Text, CheckToggle, ComboBox, ComboList or as a RowSelector.' |
166 'Specifies displaying cell as Text, CheckToggle, ComboBox, ComboList or as a RowSelector.' |
154 |
167 |
155 #browseRowClass |
168 #browseRowClass |
226 |
239 |
227 #selectionCellDoubleClickSelector |
240 #selectionCellDoubleClickSelector |
228 'A selector called if cell was double clicked.' |
241 'A selector called if cell was double clicked.' |
229 |
242 |
230 #selectionCellSelector |
243 #selectionCellSelector |
231 'An optional selector, which is used to test whether the cell in the column is selectable; the ''Is Selectable'' flag must be enabled.' |
244 'Name of the message sent to the row to validate a selection.' |
232 |
245 |
233 #selectionIsSelectable |
246 #selectionIsSelectable |
234 'Turns on/off selection behavior of a column.' |
247 'Turns on/off selection behavior of a column.' |
235 |
248 |
236 #selectionLabelClickSelector |
249 #selectionLabelClickSelector |
237 'A selector called if label cell was clicked.' |
250 'A selector called if a cell was clicked.' |
238 |
251 |
239 #selectionLabelSelectorArgument |
252 #selectionLabelSelectorArgument |
240 'An argument passed to label selection selector.' |
253 'An argument passed to the label selection selector.' |
241 |
254 |
242 #showSelectionHighLighted |
255 #showSelectionHighLighted |
243 'Show selected cell highligthened (change fg/bg color).' |
256 'Show selected cell highligthened (change fg/bg color).' |
244 |
257 |
245 #valuesChoiceSelector |
258 #valuesChoiceSelector |
246 'A selector returning a collection of choices for a cell having a ComboBox or a ComboList widget.' |
259 'Selector to get a collection of choices for a cell having a ComboBox or a ComboList widget.' |
247 |
260 |
248 #valuesMenuSelector |
261 #valuesMenuSelector |
249 'A selector returning a middle button menu.' |
262 'Selector to retrive the middle button menu.' |
250 |
263 |
251 #valuesPrintSelector |
264 #valuesPrintSelector |
252 'A key selector used to register images on a DSVColumnView (the arg). For more detailed info see #register... methods in DSVColumnView.' |
265 'Selector used to register images on a DSVColumnView (the arg). For more detailed info see #register... methods in DSVColumnView.' |
253 |
266 |
254 #valuesReadSelector |
267 #valuesReadSelector |
255 'A selector used to get (string or a bitmap) or set (if the write selector is undefined) the contents of a cell.' |
268 'Selector returning the label to be displayed(string, bitmap or a collection).' |
256 |
269 |
257 #valuesWriteSelector |
270 #valuesWriteSelector |
258 'A selector used to set the value of a cell.' |
271 'Selector used to set the value derived from the editor.' |
259 |
272 |
260 ) |
273 ) |
261 |
274 |
262 "Modified: / 19.5.1998 / 23:20:51 / cg" |
275 "Modified: / 19.5.1998 / 23:20:51 / cg" |
263 ! ! |
276 ! ! |
302 |
315 |
303 #(#FullSpec |
316 #(#FullSpec |
304 #window: |
317 #window: |
305 #(#WindowSpec |
318 #(#WindowSpec |
306 #name: 'DataSet Basic' |
319 #name: 'DataSet Basic' |
307 #layout: #(#LayoutFrame 216 0 173 0 538 0 499 0) |
320 #layout: #(#LayoutFrame 85 0 154 0 407 0 480 0) |
308 #label: 'DataSet Basic' |
321 #label: 'DataSet Basic' |
309 #min: #(#Point 10 10) |
322 #min: #(#Point 10 10) |
310 #max: #(#Point 1280 1024) |
323 #max: #(#Point 1280 1024) |
311 #bounds: #(#Rectangle 216 173 539 500) |
324 #bounds: #(#Rectangle 85 154 408 481) |
312 #usePreferredExtent: false |
325 #usePreferredExtent: false |
313 ) |
326 ) |
314 #component: |
327 #component: |
315 #(#SpecCollection |
328 #(#SpecCollection |
316 #collection: |
329 #collection: |
2134 "generate code for #printSelector" |
2148 "generate code for #printSelector" |
2135 |
2149 |
2136 |sel catg code| |
2150 |sel catg code| |
2137 |
2151 |
2138 catg := 'accessing' asSymbol. |
2152 catg := 'accessing' asSymbol. |
2139 code := 'aGC\' |
2153 code := '\' |
2140 , ' "automatically generated by DataSetBuilder ..."\' |
2154 , ' "automatically generated by DataSetBuilder ..."\' |
2141 , '\' |
2155 , '\' |
2142 , ' "get drawable image or text on a gc"\' |
2156 , ' "get drawable image or text on a gc"\' |
2143 , '\' |
2157 , '\' |
2144 , ' ^nil' |
2158 , ' ^ ' |
2145 . |
2159 . |
2146 |
2160 |
2147 columns do: |
2161 columns do:[:aColumn| |
2148 [:aColumn| |
2162 ( aColumn rendererType ~~ #rowSelector |
2149 (aColumn rendererType ~~ #rowSelector |
2163 and:[(sel := aColumn printSelector) notNil |
2150 and:[(sel := aColumn printSelector) notNil |
2164 and:[(aClass implements:sel) not]] |
2151 and:[(aClass implements:sel) not]]) |
2165 ) ifTrue:[ |
2152 ifTrue: |
2166 |args bcode keys| |
2153 [ |
2167 bcode := sel asString. |
2154 self compile:(sel asString, code) forClass:aClass inCategory:catg |
2168 args := sel numArgs. |
|
2169 |
|
2170 args ~~ 0 ifTrue:[ |
|
2171 args == 1 ifTrue:[ |
|
2172 bcode := bcode, 'aGC' |
|
2173 ] ifFalse:[ |
|
2174 keys := sel keywords. |
|
2175 bcode := (keys at:1), 'aGC ', (keys at:2), 'aColNr'. |
|
2176 ] |
|
2177 ]. |
|
2178 self compile:(bcode, code, '''', bcode, '''') forClass:aClass inCategory:catg |
2155 ] |
2179 ] |
2156 ] |
2180 ] |
2157 ! |
2181 ! |
2158 |
2182 |
2159 generateReadSelectorIn:aClass |
2183 generateReadSelectorIn:aClass |
2177 ifTrue: |
2201 ifTrue: |
2178 [ |
2202 [ |
2179 (aColumn printSelector isNil or:[aColumn canSelect]) |
2203 (aColumn printSelector isNil or:[aColumn canSelect]) |
2180 ifTrue: |
2204 ifTrue: |
2181 [ |
2205 [ |
|
2206 |selName| |
|
2207 selName := sel asString. |
|
2208 |
2182 sel numArgs == 0 |
2209 sel numArgs == 0 |
2183 ifTrue: [bCode := sel asString, code] |
2210 ifTrue: [bCode := selName, code] |
2184 ifFalse:[bCode := sel asString, 'anIndex\', code]. |
2211 ifFalse:[bCode := selName, 'anIndex\', code]. |
2185 aColumn rendererType == #CheckToggle |
2212 aColumn rendererType == #CheckToggle |
2186 ifFalse:[bCode := bCode, ' ^nil'] |
2213 ifFalse:[bCode := bCode, ' ^ ''', selName, ''''] |
2187 ifTrue: [bCode := bCode, ' ^true']. |
2214 ifTrue: [bCode := bCode, ' ^true']. |
2188 self compile:bCode forClass:aClass inCategory:catg |
2215 self compile:bCode forClass:aClass inCategory:catg |
2189 ] |
2216 ] |
2190 ] |
2217 ] |
2191 ] |
2218 ] |
2300 !DataSetBuilder methodsFor:'private'! |
2327 !DataSetBuilder methodsFor:'private'! |
2301 |
2328 |
2302 askForListModification |
2329 askForListModification |
2303 "asks for resource modification" |
2330 "asks for resource modification" |
2304 |
2331 |
2305 modalOpened |
2332 modalOpened ifFalse:[ |
2306 ifFalse: |
2333 ^ super askForListModification |
2307 [ |
|
2308 ^super askForListModification |
|
2309 ]. |
2334 ]. |
2310 ^true |
2335 ^true |
2311 |
2336 |
2312 ! |
2337 ! |
2313 |
2338 |
2314 labelFromColumn:aColumn |
2339 labelFromColumn:aColumn |
2315 |
2340 |
2316 ^ aColumn rendererType == #rowSelector |
2341 ^ aColumn rendererType == #rowSelector ifFalse:[aColumn label] |
2317 ifFalse:[aColumn label] |
2342 ifTrue: ['Row Selector']. |
2318 ifTrue: ['Row Selector']. |
2343 ! |
|
2344 |
|
2345 labelInPreviewPressed:anIndex |
|
2346 (builder componentAt:#labelAndColumns) selection:anIndex |
2319 ! |
2347 ! |
2320 |
2348 |
2321 updateColumnView |
2349 updateColumnView |
2322 "updates column view from column descriptions" |
2350 "updates column view from column descriptions |
|
2351 " |
|
2352 |size| |
2323 |
2353 |
2324 columnView notNil ifTrue:[ |
2354 columnView notNil ifTrue:[ |
2325 |previewColumns columnItems columnList| |
2355 |previewColumns columnItems columnList| |
2326 columnList := List new. |
2356 columnList := List new. |
2327 previewColumns := columns deepCopy. |
2357 previewColumns := columns deepCopy. |
2328 columns notEmpty |
2358 size := previewColumns size. |
2329 ifTrue: |
2359 |
2330 [ |
2360 size ~~ 0 ifTrue:[ |
2331 previewColumns do: |
2361 previewColumns keysAndValuesDo:[:anIndex :column| |
2332 [:column| |
|
2333 column readSelector: #at:; |
2362 column readSelector: #at:; |
2334 writeSelector: #at:put:; |
2363 writeSelector: #at:put:; |
2335 backgroundSelector:nil; |
2364 backgroundSelector:nil; |
2336 foregroundSelector:nil; |
2365 foregroundSelector:nil; |
2337 rowSeparatorSelector:nil; |
2366 rowSeparatorSelector:nil; |
2338 selectSelector: nil; |
2367 selectSelector: nil; |
2339 doubleClickedSelector: nil; |
2368 doubleClickedSelector: nil; |
2340 printSelector: nil; |
2369 printSelector: nil; |
2341 menu: nil; |
2370 menu: nil; |
2342 choices: nil |
2371 labelActionSelector:#labelInPreviewPressed:; |
|
2372 labelActionArgument:anIndex; |
|
2373 choices:#choices |
2343 ]. |
2374 ]. |
2344 #('1' '2' '...' 'x') do: |
2375 #(' 1' ' 2' ' x') do:[:suffix| |
2345 [:suffix| |
2376 columnItems := Row new:size. |
2346 columnItems := Array new: previewColumns size. |
2377 1 to:size do:[:i| columnItems at: i put: ('Cell', suffix)]. |
2347 1 to: previewColumns size do: [:i| columnItems at: i put: (previewColumns at: i) label ? 'Cell', suffix]. |
|
2348 columnList add: columnItems. |
2378 columnList add: columnItems. |
2349 ] |
2379 ] |
2350 ]. |
2380 ]. |
2351 columnView list: #(). |
2381 columnView list: #(). |
2352 columnView columnDescriptors: previewColumns. |
2382 columnView columnDescriptors: previewColumns. |
2403 "changes selected tab and set corresponding specification" |
2427 "changes selected tab and set corresponding specification" |
2404 |
2428 |
2405 |specSelector| |
2429 |specSelector| |
2406 |
2430 |
2407 something == tabSelection ifTrue:[^self]. |
2431 something == tabSelection ifTrue:[^self]. |
2408 self selectedColumn isNil |
2432 |
2409 ifTrue: |
2433 self selectedColumn isNil ifTrue:[ |
2410 [ |
|
2411 tabSelection == 0 ifTrue:[^self]. |
2434 tabSelection == 0 ifTrue:[^self]. |
2412 tabSelection := 0 |
2435 tabSelection := 0 |
2413 ] |
2436 ] ifFalse:[ |
2414 ifFalse: |
2437 (tabSelection := something) ~~ 0 ifTrue:[ |
2415 [ |
2438 specSelector := (self class slices at:tabSelection) last |
2416 (tabSelection := something) ~~ 0 |
2439 ] |
2417 ifTrue: [specSelector := (self class slices at:tabSelection) last] |
|
2418 ]. |
2440 ]. |
2419 self specChannel value:specSelector. |
2441 self specChannel value:specSelector. |
2420 (self window notNil and: [self window shown]) ifTrue: [self updateFonts] |
2442 (self window notNil and: [self window shown]) ifTrue: [self updateFonts] |
2421 |
2443 |
2422 ! ! |
2444 ! ! |
2446 ! |
2468 ! |
2447 |
2469 |
2448 postBuildWith:builder |
2470 postBuildWith:builder |
2449 |
2471 |
2450 columnView := self builder componentAt:#columnView. |
2472 columnView := self builder componentAt:#columnView. |
2451 columnView labelView enabled:false. |
2473 "/ columnView labelView enabled:false. |
2452 |
2474 |
2453 super postBuildWith:builder. |
2475 super postBuildWith:builder. |
2454 |
2476 |
2455 (builder componentAt: #labelAndColumns) |
2477 (builder componentAt: #labelAndColumns) |
2456 selectConditionBlock: [:i|self askForItemModification]; |
2478 selectConditionBlock: [:i|self askForItemModification]; |