/[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 56535 - (hide annotations)
Tue Jan 17 01:37:10 2006 UTC (14 years ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/case_tool/eiffel_view/cluster_figure.e
File size: 10176 byte(s)
Added text of the GPL license to all classes of the compiler.

1 manus 26913 indexing
2 bennob 47281 description: "Common functionality for all views of ES_CLUSTERs"
3 manus 56535 legal: "See notice at end of class."
4     status: "See notice at end of class."
5 bennob 47281 author: ""
6 manus 26913 date: "$Date$"
7     revision: "$Revision$"
8    
9     deferred class
10 bennob 47281 EIFFEL_CLUSTER_FIGURE
11    
12 manus 26913 inherit
13 bennob 47281 EG_RESIZABLE_CLUSTER_FIGURE
14 manus 26913 redefine
15 bennob 47281 default_create,
16     initialize,
17     model,
18 manus 26913 world,
19 bennob 47281 on_linkable_add,
20     on_handle_start,
21     on_handle_end,
22     recycle
23 manus 26913 end
24 bennob 47281
25     EB_CONSTANTS
26 manus 26913 undefine
27 bennob 47281 default_create
28 manus 26913 end
29 bennob 47394
30 manus 26913 feature {NONE} -- Initialization
31    
32 bennob 47281 default_create is
33     -- Create an CLUSTER_FIGURE.
34 manus 26913 do
35 bennob 47281 Precursor {EG_RESIZABLE_CLUSTER_FIGURE}
36    
37     set_accept_cursor (cursors.cur_cluster)
38     set_deny_cursor (cursors.cur_x_cluster)
39    
40     start_actions.extend (agent save_position)
41     end_actions.extend (agent extend_history)
42     move_actions.extend (agent on_move)
43 manus 26913 end
44 bennob 47281
45 manus 26913 initialize is
46 bennob 47281 -- Initialize `Current' with `model'.
47 manus 26913 do
48 bennob 47281 Precursor {EG_RESIZABLE_CLUSTER_FIGURE}
49 bennob 47394 pebble_function := agent on_pebble_request
50 bennob 47281 model.needed_on_diagram_changed_actions.extend (agent on_needed_on_diagram_changed)
51 manus 26913 end
52    
53 bennob 47281 feature -- Status report
54 manus 26913
55 bennob 47281 is_iconified: BOOLEAN
56     -- Is `Current' iconified.
57    
58     feature -- Access
59 manus 26913
60 bennob 47281 model: ES_CLUSTER
61     -- Model for `Current'.
62    
63     world: EIFFEL_WORLD is
64     -- World `Current' is part of.
65 manus 26913 do
66 bennob 47281 Result ?= Precursor {EG_RESIZABLE_CLUSTER_FIGURE}
67 manus 26913 end
68 bennob 47281
69 manus 26913 feature -- Element change
70    
71 bennob 47281 recycle is
72     -- Free `Current's resources.
73 manus 26913 do
74 bennob 47281 Precursor {EG_RESIZABLE_CLUSTER_FIGURE}
75     start_actions.prune_all (agent save_position)
76     end_actions.prune_all (agent extend_history)
77     move_actions.prune_all (agent on_move)
78 manus 53967 if model /= Void then
79     model.needed_on_diagram_changed_actions.prune_all (agent on_needed_on_diagram_changed)
80     end
81 manus 26913 end
82 bennob 47281
83    
84     apply_right_angles is
85     -- Apply right angles to all links in `links' and all elements in `Current'.
86 manus 26913 local
87 bennob 47281 l_item: EIFFEL_LINK_FIGURE
88     l_links: like links
89     i, nb: INTEGER
90     clu: EIFFEL_CLUSTER_FIGURE
91     cla: EIFFEL_CLASS_FIGURE
92 manus 26913 do
93 bennob 47281 from
94     l_links := links
95     i := 1
96     nb := l_links.count
97     until
98     i > nb
99     loop
100     l_item ?= l_links.i_th (i)
101     if l_item /= Void then
102     l_item.apply_right_angles
103 manus 26913 end
104 bennob 47281 i := i + 1
105 manus 26913 end
106 bennob 47281 from
107     start
108     until
109     after
110     loop
111     clu ?= item
112     if clu /= Void then
113     clu.apply_right_angles
114 manus 26913 else
115 bennob 47281 cla ?= item
116     if cla /= Void then
117     cla.apply_right_angles
118     end
119 manus 26913 end
120 bennob 47281 forth
121 manus 26913 end
122     end
123    
124 bennob 47281 feature {EG_LAYOUT} -- Layouting
125 manus 26913
126 bennob 47281 set_to_minimum_size is
127     -- Set `Current's to `minimum_size'.
128     deferred
129 manus 26913 end
130 bennob 47281
131     feature {EIFFEL_WORLD} -- Show/Hide
132 manus 26913
133 bennob 47281 disable_shown is
134     -- Hide `Current'.
135     deferred
136     ensure
137     set: not is_shown
138 manus 26913 end
139 bennob 47281
140     enable_shown is
141     -- Show `Current'.
142     deferred
143     ensure
144     set: is_shown
145     end
146    
147     is_shown: BOOLEAN
148     -- Is `Current' shown?
149    
150     feature {EIFFEL_CLUSTER_FIGURE} -- Expand/Collapse
151 manus 26913
152 bennob 47281 collapse is
153     -- Hide all elements in `Current' and minimize `Current'.
154 manus 26913 local
155 bennob 47281 linkable_figure: EG_LINKABLE_FIGURE
156     cluster_figure: EIFFEL_CLUSTER_FIGURE
157 bennob 47431 l_links: ARRAYED_LIST [EG_LINK_FIGURE]
158     l_item: EG_LINK_FIGURE
159     i, nb: INTEGER
160 manus 26913 do
161     from
162 bennob 47281 start
163 manus 26913 until
164 bennob 47281 after
165 manus 26913 loop
166 bennob 47281 linkable_figure ?= item
167     if linkable_figure /= Void then
168 bennob 47394 if linkable_figure.is_show_requested then
169 bennob 47281 linkable_figure.hide
170     linkable_figure.disable_sensitive
171     from
172 bennob 47431 l_links := linkable_figure.links
173     i := 1
174     nb := l_links.count
175 bennob 47281 until
176 bennob 47431 i > nb
177 bennob 47281 loop
178 bennob 47431 l_item := l_links.i_th (i)
179     l_item.hide
180     l_item.disable_sensitive
181     i := i + 1
182 bennob 47281 end
183     cluster_figure ?= linkable_figure
184     if cluster_figure /= Void and then not cluster_figure.is_iconified then
185     cluster_figure.collapse
186     end
187     end
188 manus 26913 end
189 bennob 47281 forth
190 manus 26913 end
191 bennob 47281 resizer_top_left.disable_sensitive
192     resizer_top_right.disable_sensitive
193     resizer_bottom_right.disable_sensitive
194     resizer_bottom_left.disable_sensitive
195 manus 26913 end
196 bennob 47281
197     expand is
198     -- Show all not iconified elements in `Current'.
199     local
200     linkable_figure: EG_LINKABLE_FIGURE
201     l_other: EG_LINKABLE_FIGURE
202     l_link: EG_LINK_FIGURE
203     cluster_figure: EIFFEL_CLUSTER_FIGURE
204     e_item: ES_ITEM
205 bennob 47431 l_links: ARRAYED_LIST [EG_LINK_FIGURE]
206     i, nb: INTEGER
207 manus 26913 do
208     from
209 bennob 47281 start
210 manus 26913 until
211 bennob 47281 after
212 manus 26913 loop
213 bennob 47281 linkable_figure ?= item
214     if linkable_figure /= Void then
215     e_item ?= linkable_figure.model
216     if e_item = Void or else e_item.is_needed_on_diagram then
217     linkable_figure.show
218     linkable_figure.enable_sensitive
219     from
220 bennob 47431 l_links := linkable_figure.links
221     i := 1
222     nb := l_links.count
223 bennob 47281 until
224 bennob 47431 i > nb
225 bennob 47281 loop
226 bennob 47431 l_link := l_links.i_th (i)
227 bennob 47281 if l_link.source = linkable_figure then
228     l_other := l_link.target
229     else
230     l_other := l_link.source
231     end
232     if l_other.is_show_requested then
233     l_link.show
234     l_link.enable_sensitive
235     end
236 bennob 47431 i := i + 1
237 bennob 47281 end
238     cluster_figure ?= linkable_figure
239     if cluster_figure /= Void and then not cluster_figure.is_iconified then
240     cluster_figure.expand
241     end
242     end
243     end
244     forth
245 manus 26913 end
246 bennob 47281 resizer_top_left.enable_sensitive
247     resizer_top_right.enable_sensitive
248     resizer_bottom_right.enable_sensitive
249     resizer_bottom_left.enable_sensitive
250 manus 26913 end
251 bennob 47281
252     feature {NONE} -- Implementation
253 manus 26913
254 bennob 47281 on_needed_on_diagram_changed is
255     -- `model'.`is_needed_on_diagram' changed.
256     do
257     if model.is_needed_on_diagram then
258     show
259     enable_sensitive
260     else
261     hide
262     disable_sensitive
263     end
264     request_update
265 manus 26913 end
266    
267 bennob 47281 save_position is
268     -- Make a backup of current coordinates.
269 manus 26913 do
270 bennob 47281 saved_x := port_x
271     saved_y := port_y
272    
273 manus 26913 end
274 bennob 47281
275     saved_x, saved_y: INTEGER
276     -- Saved positions.
277    
278     on_move (ax, ay: INTEGER; x_tilt, y_tilt, pressure: DOUBLE; screen_x, screen_y: INTEGER) is
279     -- Cluster is moving.
280 manus 26913 do
281 bennob 47281 world.context_editor.restart_force_directed
282     if world.is_right_angles then
283     apply_right_angles
284 manus 26913 end
285     end
286    
287 bennob 47281 extend_history is
288     -- Register move in the history.
289     local
290     ce: EB_CONTEXT_EDITOR
291     do
292     ce := world.context_editor
293     world.context_editor.history.do_named_undoable (
294 bennob 47615 interface_names.t_Diagram_move_cluster_cmd (model.name),
295 bennob 47281 [<<agent set_port_position (port_x, port_y), agent ce.restart_force_directed>>],
296     [<<agent set_port_position (saved_x, saved_y), agent ce.restart_force_directed>>])
297     if world.context_editor.is_force_directed_used then
298     set_is_fixed (True)
299     end
300 manus 26913 end
301 bennob 47281
302     on_linkable_add (a_linkable: EG_LINKABLE) is
303     -- `a_linkable' was added to the cluster.
304 manus 26913 local
305 bennob 47281 l_world: like world
306     linkable_fig: EG_LINKABLE_FIGURE
307     link_fig: EG_LINK_FIGURE
308     scsc: EG_CLUSTER_FIGURE
309     e_item: ES_ITEM
310     cs_link: EIFFEL_CLIENT_SUPPLIER_FIGURE
311     i_link: EIFFEL_INHERITANCE_FIGURE
312     c_fig: EG_LINKABLE_FIGURE
313 manus 26913 do
314 bennob 47281 l_world := world
315     if l_world /= Void then
316     linkable_fig ?= l_world.items_to_figure_lookup_table.item (a_linkable)
317     check
318     linkable_fig_is_in_view_but_not_in_cluster: linkable_fig /= Void not has (linkable_fig)
319     end
320     extend (linkable_fig)
321     linkable_fig.set_cluster (Current)
322    
323 manus 26913 from
324 bennob 47281 l_world.links.start
325 manus 26913 until
326 bennob 47281 l_world.links.after
327 manus 26913 loop
328 bennob 47281 link_fig := l_world.links.item
329     if link_fig.source /= Void and then link_fig.target /= Void then
330     e_item ?= link_fig.model
331     if e_item = Void or else e_item.is_needed_on_diagram then
332     scsc := world.smallest_common_supercluster (link_fig.source, link_fig.target)
333     if scsc /= Void and then not scsc.has (link_fig) then
334     scsc.go_i_th (scsc.number_of_figures)
335     cs_link ?= link_fig
336     if cs_link /= Void or else scsc.index = scsc.count then
337     scsc.put_right (link_fig)
338     else
339     from
340     i_link := Void
341     c_fig := Void
342     until
343     i_link /= Void or else c_fig /= Void
344     loop
345     scsc.forth
346     i_link ?= scsc.item
347     c_fig ?= scsc.item
348     end
349     scsc.put_left (link_fig)
350     end
351     end
352     end
353 manus 26913 end
354 bennob 47281 l_world.links.forth
355 manus 26913 end
356     end
357 bennob 47281 request_update
358 manus 26913 end
359 bennob 47281
360     on_handle_start is
361     -- User started to move `Current'.
362     do
363     was_fixed := is_fixed
364     if world.context_editor.is_force_directed_used then
365     set_is_fixed (True)
366     end
367     end
368    
369     on_handle_end is
370     -- User ended to move `Current'.
371     do
372     set_is_fixed (was_fixed)
373     end
374 manus 26913
375 bennob 47281 update_links is
376     -- Update all links in `Current'.
377 manus 26913 local
378 bennob 47281 i, nb: INTEGER
379     l_link: EG_LINK_FIGURE
380 manus 26913 do
381     from
382 bennob 47281 i := 1
383 manus 26913 until
384 bennob 47281 i > nb
385 manus 26913 loop
386 bennob 47281 l_link ?= i_th (i)
387     if l_link /= Void then
388     l_link.update
389 manus 26913 end
390 bennob 47281 i := i + 1
391 manus 26913 end
392     end
393 bennob 47281
394 bennob 47394 on_pebble_request: CLUSTER_STONE is
395     -- Pebble request.
396     do
397     if model /= Void then
398     create Result.make (model.cluster_i)
399     end
400     end
401    
402 manus 56535 indexing
403     copyright: "Copyright (c) 1984-2006, Eiffel Software"
404     license: "GPL version 2 see http://www.eiffel.com/licensing/gpl.txt)"
405     licensing_options: "http://www.eiffel.com/licensing"
406     copying: "[
407     This file is part of Eiffel Software's Eiffel Development Environment.
408    
409     Eiffel Software's Eiffel Development Environment is free
410     software; you can redistribute it and/or modify it under
411     the terms of the GNU General Public License as published
412     by the Free Software Foundation, version 2 of the License
413     (available at the URL listed under "license" above).
414    
415     Eiffel Software's Eiffel Development Environment is
416     distributed in the hope that it will be useful, but
417     WITHOUT ANY WARRANTY; without even the implied warranty
418     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
419     See the GNU General Public License for more details.
420    
421     You should have received a copy of the GNU General Public
422     License along with Eiffel Software's Eiffel Development
423     Environment; if not, write to the Free Software Foundation,
424     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
425     ]"
426     source: "[
427     Eiffel Software
428     356 Storke Road, Goleta, CA 93117 USA
429     Telephone 805-685-1006, Fax 805-685-6869
430     Website http://www.eiffel.com
431     Customer support http://support.eiffel.com
432     ]"
433    
434 bennob 47281 end -- class EIFFEL_CLUSTER_FIGURE

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23