/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/case_tool/eiffel_view/cluster_figure.e
ViewVC logotype

Annotation of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/case_tool/eiffel_view/cluster_figure.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34581 - (hide annotations)
Fri Oct 4 23:49:44 2002 UTC (17 years, 3 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/case_tool/bon/cluster_figure.e
File size: 10934 byte(s)
Added a nice deny cursor.

1 manus 26913 indexing
2     description:
3     "Graphical representations of clusters without%N%
4     %commitment to any notation."
5     date: "$Date$"
6     revision: "$Revision$"
7    
8     deferred class
9     CLUSTER_FIGURE
10    
11     inherit
12     LINKABLE_FIGURE
13     undefine
14     position_on_figure
15     redefine
16     set_origin,
17     world,
18     cluster_figure
19     end
20    
21     LINKABLE_FIGURE_GROUP
22     rename
23     cluster_figures as subclusters,
24     class_figures as classes
25     undefine
26     default_create,
27     is_equal
28     end
29    
30     feature {NONE} -- Initialization
31    
32     make_with_cluster (lace_cluster: CLUSTER_I) is
33     -- Initialize `Current' with lace_cluster.
34     require
35     lace_cluster_not_void: lace_cluster /= Void
36     do
37     default_create
38     create layout
39     create subclusters.make
40     create classes.make
41     create saved_subclusters.make
42     create saved_classes.make
43     cluster_i := lace_cluster
44     set_name (cluster_i.name_in_upper)
45     initialize
46     create {CLUSTER_FIGURE_STONE} pebble.make (Current)
47     set_accept_cursor (Cursors.cur_Cluster)
48 manus 34581 set_deny_cursor (Cursors.Cur_x_cluster)
49 manus 26913 build_figure
50     end
51    
52     initialize is
53     deferred
54     end
55    
56     feature -- Access
57    
58     parent: LINKABLE_FIGURE_GROUP
59     -- Figure group containing `Current'.
60    
61     world: CLUSTER_DIAGRAM is
62     -- World `Current' belongs to.
63     do
64     Result ?= Precursor
65     end
66    
67     cluster_i: CLUSTER_I
68     -- Cluster this figure is a representation of.
69    
70     resizer_bottom_right: EV_MOVE_HANDLE is
71     -- Mover of `Current'.
72     deferred
73     end
74    
75     resizer_top_left: EV_MOVE_HANDLE is
76     -- Mover of `Current'.
77     deferred
78     end
79    
80     resizer_top_right: EV_MOVE_HANDLE is
81     -- Mover of `Current'.
82     deferred
83     end
84    
85     resizer_bottom_left: EV_MOVE_HANDLE is
86     -- Mover of `Current'.
87     deferred
88     end
89    
90     name_mover: EV_MOVE_HANDLE is
91     -- Mover of `Current' name.
92     deferred
93     end
94    
95     center_point: EV_RELATIVE_POINT is
96     -- Point at the center of `body', origin of `name_mover'.
97     deferred
98     end
99    
100     cluster_figure: CLUSTER_FIGURE is
101     -- Cluster figure `Current' is in directly.
102     -- Void if none or more than one.
103     do
104     Result ?= parent
105     end
106    
107     feature -- Element change
108    
109     add_class (a_class: CLASS_FIGURE) is
110     -- Add `a_class' to `classes'.
111     require
112     a_class_not_void: a_class /= Void
113     do
114     classes.extend (a_class)
115     a_class.set_cluster (Current)
116     a_class.set_origin (point)
117     ensure
118     a_class_added: classes.has (a_class)
119     end
120    
121     remove_class (a_class: CLASS_FIGURE) is
122     -- Remove `a_class' from `classes'.
123     require
124     a_class_not_void: a_class /= Void
125     do
126     classes.prune_all (a_class)
127     ensure
128     a_class_removed: not classes.has (a_class)
129     end
130    
131     add_all_classes is
132     -- Add class figures representing all items
133     -- in `cluster_i'.
134     do
135     world.include_classes_of_cluster (Current, True)
136     end
137    
138     add_subcluster (a_cluster: CLUSTER_FIGURE) is
139     -- Add `a_cluster' to `subclusters'.
140     require
141     a_cluster_not_void: a_cluster /= Void
142     do
143     if not subclusters.has (a_cluster) then
144     subclusters.extend (a_cluster)
145     a_cluster.set_parent (Current)
146     -- EA: a_cluster.point.set_origin (point)
147     a_cluster.point.change_origin (point)
148     end
149     ensure
150     a_cluster_added: subclusters.has (a_cluster)
151     end
152    
153     remove_subcluster (a_cluster: CLUSTER_FIGURE) is
154     -- Remove `a_cluster' from `subclusters'.
155     require
156     a_cluster_not_void: a_cluster /= Void
157     do
158     subclusters.prune_all (a_cluster)
159     a_cluster.set_parent (Void)
160     ensure
161     a_cluster_removed: not subclusters.has (a_cluster)
162     end
163    
164     set_parent (p: LINKABLE_FIGURE_GROUP) is
165     -- Assign `p' to `parent'.
166     -- `p' can be Void if `Current' is a top-level cluster in diagram.
167     do
168     parent := p
169     if p = Void and then world /= Void then
170     point.set_origin (world.point)
171     end
172     ensure
173     parent_assigned: parent = p
174     end
175    
176     remove_from_diagram (exclude_needed: BOOLEAN) is
177     -- Remove `Current' from its diagram, exclude it if `exclude_needed'.
178     local
179     d: CLUSTER_DIAGRAM
180     saved_cursor: CURSOR
181     cf: CLASS_FIGURE
182     do
183     d := world
184     if d.center_cluster /= Current then
185     saved_subclusters.wipe_out
186     saved_classes.wipe_out
187    
188     from
189     classes.start
190     until
191     classes.after
192     loop
193     cf := classes.item
194     classes.forth
195     saved_cursor := classes.cursor
196     saved_classes.extend (cf)
197     cf.remove_from_diagram (exclude_needed)
198     classes.go_to (saved_cursor)
199     end
200    
201     if exclude_needed then
202     d.exclude_cluster (cluster_i)
203     else
204     d.remove_cluster (cluster_i)
205     end
206     end
207     end
208    
209     recursive_remove_from_diagram (exclude_needed: BOOLEAN) is
210     -- Remove `Current' from its diagram, exclude it if `exclude_needed',
211     -- and remove subclusters as well.
212     local
213     d: CLUSTER_DIAGRAM
214     saved_cursor: CURSOR
215     cf: CLASS_FIGURE
216     clf: CLUSTER_FIGURE
217     do
218     d := world
219     if d.center_cluster /= Current then
220     saved_subclusters.wipe_out
221     saved_classes.wipe_out
222    
223     from
224     subclusters.start
225     until
226     subclusters.after
227     loop
228     clf := subclusters.item
229     subclusters.forth
230     saved_cursor := subclusters.cursor
231     saved_subclusters.extend (clf)
232     clf.recursive_remove_from_diagram (exclude_needed)
233     subclusters.go_to (saved_cursor)
234     end
235    
236     from
237     classes.start
238     until
239     classes.after
240     loop
241     cf := classes.item
242     classes.forth
243     saved_cursor := classes.cursor
244     saved_classes.extend (cf)
245     cf.remove_from_diagram (exclude_needed)
246     classes.go_to (saved_cursor)
247     end
248    
249     if exclude_needed then
250     d.exclude_cluster (cluster_i)
251     else
252     d.remove_cluster (cluster_i)
253     end
254     end
255     end
256    
257     put_back_on_diagram (d: CONTEXT_DIAGRAM) is
258     -- Put `Current' back on `d'.
259     local
260     cd: CLUSTER_DIAGRAM
261     do
262     cd ?= d
263     if cd /= Void then
264     cd.add_cluster_figure (Current, False)
265    
266     from
267     saved_subclusters.start
268     until
269     saved_subclusters.after
270     loop
271     saved_subclusters.item.put_back_on_diagram (d)
272     saved_subclusters.forth
273     end
274    
275     from
276     saved_classes.start
277     until
278     saved_classes.after
279     loop
280     saved_classes.item.put_back_on_diagram (d)
281     saved_classes.forth
282     end
283     end
284     end
285    
286     change_origin (new_origin: EV_RELATIVE_POINT) is
287     -- Set the point this figure is relative to.
288     -- Do not change absolute coordinates.
289     do
290     point.change_origin (new_origin)
291     end
292    
293     feature -- Status report
294    
295     iconified: BOOLEAN
296     -- Is `Current' iconified?
297    
298     is_subcluster_of (other: CLUSTER_FIGURE): BOOLEAN is
299     -- Is Current a subcluster of `other' (directly or not)?
300     require
301     other_not_void: other /= Void
302     local
303     tmp: CLUSTER_FIGURE
304     do
305     Result := other = Current
306     from
307     tmp := cluster_figure
308     until
309     Result = True or tmp = Void
310     loop
311     if other = tmp then
312     Result := True
313     end
314     tmp := tmp.cluster_figure
315     end
316     end
317    
318     recursive_has_class (a_class: CLASS_FIGURE): BOOLEAN is
319     -- Does `a_class' belong to `Current' or to one of its subclusters?
320     require
321     a_class_not_void: a_class /= Void
322     do
323     Result := classes.has (a_class)
324     from
325     subclusters.start
326     until
327     Result or else subclusters.after
328     loop
329     Result := subclusters.item.recursive_has_class (a_class)
330     subclusters.forth
331     end
332     end
333    
334     position_strictly_on_figure (x, y: INTEGER): BOOLEAN is
335     -- Is the point on (`x', `y') on this figure?
336     -- (excluding its subclusters).
337     deferred
338     end
339    
340     feature -- Status setting
341    
342     set_origin (a_point: EV_RELATIVE_POINT) is
343     -- Assign `a_point' to the origin of all
344     -- figures related to `Current'.
345     do
346     point.change_origin (a_point)
347     end
348    
349     update is
350     -- `Current' has just been moved/resized.
351     do
352     from
353     subclusters.start
354     until
355     subclusters.after
356     loop
357     subclusters.item.update
358     subclusters.item.move_to_front
359     subclusters.forth
360     end
361     from
362     classes.start
363     until
364     classes.after
365     loop
366     classes.item.update
367     classes.forth
368     end
369     end
370    
371     set_size (a_width, a_height: INTEGER) is
372     -- Resize `Current' to `a_width', `a_height'.
373     require
374     a_width_non_negative: a_width >= 0
375     a_height_non_negative: a_height >= 0
376     deferred
377     end
378    
379     set_minimum_bounds (a_left, a_top, a_right, a_bottom: INTEGER) is
380     -- Assign minimum bounds.
381     deferred
382     end
383    
384     update_minimum_size is
385     -- Figures have been added/removed in `Current',
386     -- minimum size should change.
387 etienne 27319 deferred
388 manus 26913 end
389    
390     set_bounds (a_left, a_top, a_right, a_bottom: INTEGER) is
391     -- Assign bounds.
392     deferred
393     end
394    
395     set_relative_position_and_size (a_x, a_y, a_width, a_height: INTEGER) is
396     -- Assign bounds.
397     deferred
398     end
399    
400     iconify is
401     -- Iconify `Current'.
402     deferred
403     ensure
404     is_iconified: iconified
405     end
406    
407     deiconify is
408     -- Deiconify `Current'.
409     deferred
410     ensure
411     is_not_iconified: not iconified
412     end
413    
414     mask is
415     -- `Current' no longer needs to be displayed.
416     deferred
417     end
418    
419     unmask is
420     -- `Current' needs to be displayed again.
421     deferred
422     end
423    
424     feature {CLUSTER_FIGURE} -- Events
425    
426     move_to_front is
427     -- Make `Current' appear in front of its peers.
428     deferred
429     end
430    
431     feature {NONE} -- Implementation
432    
433     external_client_links: LINKED_LIST [CLIENT_SUPPLIER_FIGURE] is
434     -- Client figures which `supplier' is a figure inside `Current',
435     -- and `client' is a figure outside `Current'.
436     local
437     class_client_links: LINKED_LIST [CLIENT_SUPPLIER_FIGURE]
438     do
439     from
440     classes.start
441     until
442     classes.after
443     loop
444     class_client_links := classes.item.client_figures
445     from
446     class_client_links.start
447     until
448     class_client_links.after
449     loop
450     if class_client_links.item.client.cluster_figure /= Current then
451     Result.extend (class_client_links.item)
452     end
453     class_client_links.forth
454     end
455     classes.forth
456     end
457     --| FIXME: take subclusters into account as well.
458     end
459    
460     external_supplier_links: LINKED_LIST [CLIENT_SUPPLIER_FIGURE] is
461     -- Client figures which `client' is a figure inside `Current',
462     -- and `supplier' is a figure outside `Current'.
463     local
464     class_supplier_links: LINKED_LIST [CLIENT_SUPPLIER_FIGURE]
465     do
466     from
467     classes.start
468     until
469     classes.after
470     loop
471     class_supplier_links := classes.item.supplier_figures
472     from
473     class_supplier_links.start
474     until
475     class_supplier_links.after
476     loop
477     if class_supplier_links.item.supplier.cluster_figure /= Current then
478     Result.extend (class_supplier_links.item)
479     end
480     class_supplier_links.forth
481     end
482     classes.forth
483     end
484     --| FIXME: take subclusters into account as well.
485     end
486    
487     saved_subclusters: LINKED_LIST [CLUSTER_FIGURE]
488     -- Subclusters backup to undo delete command.
489    
490     saved_classes: LINKED_LIST [CLASS_FIGURE]
491     -- Classes backup to undo delete command.
492    
493     on_pebble_request: ANY is
494     -- New CLUSTER_STONE with `Current' as source.
495     do
496     create {CLUSTER_FIGURE_STONE} Result.make (Current)
497     end
498    
499     old_width: INTEGER is
500     -- Backup of `width' for iconifying.
501     deferred
502     end
503    
504     old_height: INTEGER is
505     -- Backup of `height' for iconifying.
506     deferred
507     end
508    
509 etienne 27319 minimum_width: INTEGER is
510     --
511 etienne 27143 deferred
512     end
513    
514 manus 26913 end -- class CLUSTER_FIGURE
515    
516    
517    
518    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23