/[eiffelstudio]/branches/eth/eve/Src/Eiffel/interface/new_graphical/information/outgoing/interface/es_eis_tool_widget.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/interface/new_graphical/information/outgoing/interface/es_eis_tool_widget.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 92964 - (show annotations)
Fri Sep 20 05:41:23 2013 UTC (6 years ago) by jasonw
File size: 19037 byte(s)
<<Merged from trunk#92963.>>
1 note
2 description: "Information tool GUI widget"
3 status: "See notice at end of class."
4 legal: "See notice at end of class."
5 date: "$Date$"
6 revision: "$Revision$"
7
8 class
9 ES_EIS_TOOL_WIDGET
10
11 inherit
12 EV_VERTICAL_BOX
13
14 PROGRESS_OBSERVER
15 export
16 {NONE} all
17 undefine
18 is_equal,
19 default_create,
20 copy
21 end
22
23 EB_SHARED_MANAGERS
24 export
25 {NONE} all
26 undefine
27 is_equal,
28 default_create,
29 copy
30 end
31
32 ES_SHARED_PROMPT_PROVIDER
33 export
34 {NONE} all
35 undefine
36 is_equal,
37 default_create,
38 copy
39 end
40
41 EB_RECYCLABLE
42 undefine
43 is_equal,
44 default_create,
45 copy
46 end
47
48 EB_CONSTANTS
49 export
50 {NONE} all
51 undefine
52 is_equal,
53 default_create,
54 copy
55 end
56
57 create
58 make
59
60 feature {NONE} -- Initialization
61
62 make (a_panel: ES_INFORMATION_TOOL_PANEL)
63 -- Initialization
64 require
65 a_panel_not_void: a_panel /= Void
66 do
67 default_create
68 panel := a_panel
69 context_menu_factory := a_panel.develop_window.menus.context_menu_factory
70 build_interface
71 ensure
72 panel_set: panel /= Void
73 end
74
75 build_interface
76 --
77 local
78 l_frame: EV_FRAME
79 -- l_hbox: EV_HORIZONTAL_BOX
80 -- l_search_box: like build_search_box
81 l_progress_hbox: EV_HORIZONTAL_BOX
82 l_toolbar: SD_TOOL_BAR
83 l_vbox: EV_VERTICAL_BOX
84 l_whole_vbox: EV_VERTICAL_BOX
85 do
86 create l_frame
87 extend (l_frame)
88 create l_whole_vbox
89 l_whole_vbox.set_padding (layout_constants.tiny_padding_size)
90 l_frame.extend (l_whole_vbox)
91
92 -- Search is not implemented yet.
93 -- create l_hbox
94 -- l_whole_vbox.extend (l_hbox)
95 -- l_whole_vbox.disable_item_expand (l_hbox)
96
97 -- l_search_box := build_search_box
98 -- l_hbox.extend (l_search_box)
99 -- l_hbox.disable_item_expand (l_search_box)
100 -- l_hbox.extend (create {EV_CELL})
101
102 create split_area
103 l_whole_vbox.extend (split_area)
104
105 -- Progress bar
106 create l_progress_hbox
107 l_progress_hbox.set_padding_width (layout_constants.tiny_padding_size)
108 l_whole_vbox.extend (l_progress_hbox)
109 l_whole_vbox.disable_item_expand (l_progress_hbox)
110 create l_toolbar.make
111
112 -- Edit auto EIS node button
113 create edit_auto_gen_button.make
114 edit_auto_gen_button.set_tooltip (interface_names.t_edit_auto_eis_node)
115 edit_auto_gen_button.set_pixel_buffer (pixmaps.icon_pixmaps.information_edit_auto_node_icon_buffer)
116 edit_auto_gen_button.select_actions.extend (agent on_edit_eis_auto_node)
117 edit_auto_gen_button.disable_sensitive
118 register_action (edit_auto_gen_button.drop_actions, agent on_drop_auto_node)
119 edit_auto_gen_button.drop_actions.set_veto_pebble_function (agent is_stone_editable_for_auto_node)
120 l_toolbar.extend (edit_auto_gen_button)
121
122 -- Separator
123 l_toolbar.extend (create {SD_TOOL_BAR_SEPARATOR}.make)
124
125 -- Auto sweep button
126 create auto_sweep_button.make
127 auto_sweep_button.set_tooltip (interface_names.t_auto_sweeping_the_system)
128 auto_sweep_button.set_pixel_buffer (pixmaps.icon_pixmaps.information_auto_sweeping_icon_buffer)
129 auto_sweep_button.select_actions.extend (agent panel.on_auto_sweep_button_selected (auto_sweep_button))
130 l_toolbar.extend (auto_sweep_button)
131 -- Sweep button
132 create sweep_now_button.make
133 sweep_now_button.set_tooltip (interface_names.t_sweeping_the_system_now)
134 sweep_now_button.set_pixel_buffer (pixmaps.icon_pixmaps.information_sweep_now_icon_buffer)
135 sweep_now_button.select_actions.extend (agent panel.on_sweep_now)
136 l_toolbar.extend (sweep_now_button)
137
138 l_progress_hbox.extend (l_toolbar)
139 l_toolbar.compute_minimum_size
140 l_progress_hbox.disable_item_expand (l_toolbar)
141 -- The progress bar
142 create l_vbox
143 l_progress_hbox.extend (l_vbox)
144 create background_sweeping_progress_bar
145 l_vbox.extend (create {EV_CELL})
146 l_vbox.extend (background_sweeping_progress_bar)
147 l_vbox.disable_item_expand (background_sweeping_progress_bar)
148 l_vbox.extend (create {EV_CELL})
149
150 build_tree
151 build_list
152 end
153
154 build_search_box: EV_HORIZONTAL_BOX
155 -- Build search box
156 local
157 l_search_label: EV_LABEL
158 do
159 create Result
160 create l_search_label.make_with_text (interface_names.l_search_for)
161 Result.extend (l_search_label)
162 create search_field
163 search_field.set_minimum_width (200)
164 Result.extend (search_field)
165 Result.disable_item_expand (l_search_label)
166
167 create search_button.make_with_text (interface_names.b_search)
168 search_button.set_minimum_width (layout_constants.default_button_width)
169 search_button.set_minimum_height (layout_constants.default_button_height)
170 Result.extend (search_button)
171 Result.disable_item_expand (search_button)
172
173 Result.set_padding (layout_constants.small_padding_size)
174 Result.set_border_width (layout_constants.small_border_size)
175 ensure
176 build_search_box_not_void: build_search_box /= Void
177 end
178
179 build_tree
180 -- Build left tree of the panel.
181 local
182 l_tree: like tree
183 l_vbox: EV_VERTICAL_BOX
184 -- l_toolbar: SD_TOOL_BAR
185 -- l_button: SD_TOOL_BAR_BUTTON
186 -- l_hbox: EV_HORIZONTAL_BOX
187 do
188 create l_vbox
189 split_area.set_first (l_vbox)
190
191 -- The tree
192
193 create l_tree.make_eis_tree (context_menu_factory, Current)
194 l_tree.select_actions.extend (agent on_tree_selected)
195 tree := l_tree
196 l_vbox.extend (l_tree)
197 l_tree.set_minimum_width (Layout_constants.dialog_unit_to_pixels (200))
198 l_tree.refresh
199 register_action (l_tree.drop_actions, agent target_stone)
200
201 -- create l_hbox
202 -- create l_toolbar.make
203 -- create l_button.make
204 -- l_button.set_pixel_buffer (pixmaps.icon_pixmaps.tool_advanced_search_icon_buffer)
205 -- l_button.set_tooltip (interface_names.e_show_class_cluster)
206 -- l_button.select_actions.extend (agent on_show_editing_item)
207 -- l_toolbar.extend (l_button)
208 -- l_toolbar.compute_minimum_size
209 -- l_hbox.extend (l_toolbar)
210 -- l_hbox.disable_item_expand (l_toolbar)
211
212 -- l_hbox.extend (create {EV_CELL})
213
214 -- -- Tool bar
215 -- create l_toolbar.make
216
217 -- create l_button.make
218 -- l_button.set_pixel_buffer (pixmaps.icon_pixmaps.general_remove_icon_buffer)
219 -- l_button.set_tooltip (interface_names.t_clean_up_affected_items)
220 -- l_button.select_actions.extend (agent on_clean_up_affected_item)
221 -- l_toolbar.extend (l_button)
222
223 ---- create l_button.make
224 ---- l_button.set_text ("Define variables")
225 ---- l_toolbar.extend (l_button)
226
227 -- l_toolbar.compute_minimum_size
228 -- l_hbox.extend (l_toolbar)
229 -- l_hbox.disable_item_expand (l_toolbar)
230 -- l_vbox.extend (l_hbox)
231 -- l_vbox.disable_item_expand (l_hbox)
232 end
233
234 build_list
235 -- EIS item detail panel.
236 local
237 l_vbox: EV_VERTICAL_BOX
238 l_border: ES_BORDERED_WIDGET [EV_WIDGET]
239 l_toolbar: SD_TOOL_BAR
240 l_button: SD_TOOL_BAR_BUTTON
241 do
242 create l_vbox
243 split_area.set_second (l_vbox)
244 create list_area_widget
245 l_vbox.extend (list_area_widget)
246 l_vbox.extend (nothing_widget)
247
248 -- Entry list
249 create entry_list.make (panel)
250 create l_border.make (entry_list)
251 list_area_widget.extend (l_border)
252 display_nothing
253
254 -- Tool bar
255 create l_toolbar.make
256 toolbar := l_toolbar
257
258 -- Add button
259 create l_button.make
260 add_button := l_button
261 l_button.set_text (interface_names.b_add)
262 l_button.set_tooltip (interface_names.t_Add_eis_entry)
263 l_button.set_pixel_buffer (pixmaps.icon_pixmaps.general_add_icon_buffer)
264 l_button.select_actions.extend (agent on_entry_add)
265 l_toolbar.extend (l_button)
266 register_action (l_button.drop_actions, agent panel.add_information_to)
267
268 -- Delete button
269 create l_button.make
270 delete_button := l_button
271 l_button.set_text (interface_names.b_delete_command)
272 l_button.set_tooltip (interface_names.t_delete_selected_items)
273 l_button.set_pixel_buffer (pixmaps.icon_pixmaps.general_delete_icon_buffer)
274 l_button.select_actions.extend (agent on_entry_delete)
275 l_toolbar.extend (l_button)
276
277 l_toolbar.extend (create {SD_TOOL_BAR_SEPARATOR}.make)
278
279 -- Go to button
280 create l_button.make
281 l_button.set_text (interface_names.b_go_to)
282 l_button.set_tooltip (interface_names.t_go_to_info)
283 l_button.set_pixel_buffer (pixmaps.icon_pixmaps.general_information_icon_buffer)
284 l_button.select_actions.extend (agent on_go_to_button_pressed)
285 l_toolbar.extend (l_button)
286
287 -- Acknowledge button
288 create l_button.make
289 acknowledge_button := l_button
290 l_button.set_text (interface_names.b_acknowledge)
291 l_button.set_tooltip (interface_names.t_acknowledge_change)
292 l_button.set_pixel_buffer (pixmaps.icon_pixmaps.general_tick_icon_buffer)
293 l_button.select_actions.extend (agent on_acknowledge_button_selected)
294 l_toolbar.extend (l_button)
295
296 list_area_widget.extend (l_toolbar)
297 l_toolbar.compute_minimum_size
298 list_area_widget.disable_item_expand (l_toolbar)
299
300 create grid_support.make_with_grid (entry_list)
301 grid_support.enable_grid_item_pnd_support
302 grid_support.enable_ctrl_right_click_to_open_new_window
303 grid_support.synchronize_scroll_behavior_with_editor
304 grid_support.set_context_menu_factory_function (agent context_menu_factory)
305 register_action (entry_list.drop_actions, agent target_stone)
306 end
307
308 context_menu_factory: EB_CONTEXT_MENU_FACTORY
309 -- Context menu factory
310
311 grid_support: EB_EDITOR_TOKEN_GRID_SUPPORT
312 -- Grid support for `entry_list'
313
314 feature -- Synchronization
315
316 refresh_list
317 -- Refresh the entry list.
318 do
319 if tree /= Void then
320 tree.rebuild_list_if_possible
321 end
322 end
323
324 feature -- Access
325
326 panel: ES_INFORMATION_TOOL_PANEL
327 -- Information tool panel
328
329 tree: ES_EIS_TREE
330 -- The tree showing all nodes in the system.
331
332 entry_list: ES_EIS_ENTRY_GRID
333 -- List of EIS entries
334
335 search_field: EV_TEXT_FIELD
336 -- Search text field
337
338 split_area: EV_HORIZONTAL_SPLIT_AREA
339 -- Split area for tree and list.
340
341 search_button: EV_BUTTON
342 -- Button to lauch a new search.
343
344 edit_auto_gen_button: SD_TOOL_BAR_BUTTON
345 -- Edit auto EIS node button.
346
347 auto_sweep_button: SD_TOOL_BAR_TOGGLE_BUTTON
348 -- Auto sweep button
349
350 sweep_now_button: SD_TOOL_BAR_BUTTON
351 -- Sweep now button
352
353 background_sweeping_progress_bar: EV_HORIZONTAL_PROGRESS_BAR
354 -- Progress bar to display progress of background sweeping.
355
356 list_area_widget: detachable EV_VERTICAL_BOX
357 -- The widget to display entry list
358
359 add_button: detachable SD_TOOL_BAR_BUTTON
360 -- Add button
361
362 delete_button: detachable SD_TOOL_BAR_BUTTON
363 -- Delete button
364
365 acknowledge_button: detachable SD_TOOL_BAR_BUTTON
366 -- Acknowledge button
367
368 toolbar: SD_TOOL_BAR
369 -- The toolbar
370
371 feature -- Callbacks
372
373 on_show_editing_item
374 -- On show editing item selected.
375 local
376 l_window: EB_DEVELOPMENT_WINDOW
377 do
378 l_window := panel.develop_window
379 if l_window /= Void and then attached l_window.stone as l_stone then
380 target_stone (l_stone)
381 if not last_stone_targeted then
382 prompts.show_warning_prompt (Warning_messages.w_Could_not_locate (l_stone.stone_signature), l_window.window, Void)
383 end
384 end
385 end
386
387 on_clean_up_affected_item
388 -- On clean up affected items.
389 do
390
391 end
392
393 on_entry_add
394 -- On Add button selected.
395 local
396 l_view: ES_EIS_COMPONENT_VIEW [ANY]
397 do
398 l_view := tree.current_view
399 if l_view /= Void and then l_view.new_entry_possible then
400 l_view.create_new_entry
401 end
402 end
403
404 on_entry_delete
405 -- On delete button selected.
406 local
407 l_view: ES_EIS_COMPONENT_VIEW [ANY]
408 do
409 l_view := tree.current_view
410 if l_view /= Void then
411 l_view.delete_selected_entries
412 end
413 end
414
415 on_tree_selected
416 -- On tree selected
417 local
418 l_enable: BOOLEAN
419 do
420 -- Enable/disable Auto-node button.
421 if attached {EB_CLASSES_TREE_TARGET_ITEM} tree.selected_item then
422 l_enable := True
423 elseif attached {EB_CLASSES_TREE_FOLDER_ITEM} tree.selected_item as l_item then
424 if attached {CONF_LIBRARY} l_item.stone.group as l_library then
425 l_enable := not l_library.is_readonly
426 end
427 end
428 if l_enable then
429 edit_auto_gen_button.enable_sensitive
430 else
431 edit_auto_gen_button.disable_sensitive
432 end
433
434 end
435
436 on_edit_eis_auto_node
437 -- On edit EIS auto node property of a target
438 local
439 l_target: detachable CONF_TARGET
440 do
441 if attached {EB_CLASSES_TREE_TARGET_ITEM} tree.selected_item as l_item then
442 l_target := l_item.stone.target
443 elseif attached {EB_CLASSES_TREE_FOLDER_ITEM} tree.selected_item as l_folder_item then
444 if l_folder_item.stone.group.is_library then
445 if attached {CONF_LIBRARY} l_folder_item.stone.group as l_library and then not l_library.is_readonly then
446 l_target := l_library.library_target
447 end
448 end
449 end
450 if l_target /= Void then
451 show_target_auto_node_dialog (l_target)
452 end
453 end
454
455 on_drop_auto_node (a_stone: STONE)
456 -- Dropping a stone on the auto node button
457 local
458 l_target: detachable CONF_TARGET
459 do
460 if attached {TARGET_STONE} a_stone as l_stone then
461 l_target := l_stone.target
462 elseif
463 attached {CLUSTER_STONE} a_stone as l_stone and then
464 attached {CONF_LIBRARY} l_stone.group as l_library and then
465 not l_library.is_readonly
466 then
467 l_target := l_library.library_target
468 end
469 if l_target /= Void then
470 show_target_auto_node_dialog (l_target)
471 end
472 end
473
474 on_go_to_button_pressed
475 -- Go to button pressed
476 do
477 if attached tree.current_view as l_view then
478 l_view.show_help
479 end
480 end
481
482 on_acknowledge_button_selected
483 -- On acknowledge button selected
484 do
485 if attached {ES_EIS_AFFECTED_VIEW} tree.current_view as l_view then
486 l_view.acknowledge_selected_items
487 end
488 end
489
490 feature -- Progress notification
491
492 on_progress_start
493 -- On starting visiting the system
494 do
495 background_sweeping_progress_bar.set_proportion (0)
496 end
497
498 on_progress_progress (a_value: REAL)
499 -- On progress has been made
500 do
501 background_sweeping_progress_bar.set_proportion (1 - a_value)
502 end
503
504 on_progress_finish
505 -- On finishing progress
506 do
507 background_sweeping_progress_bar.set_proportion (0)
508 refresh_list
509 end
510
511 on_progress_stop
512 -- On stop visiting the system
513 do
514 background_sweeping_progress_bar.set_proportion (0)
515 refresh_list
516 end
517
518 feature -- Element Change
519
520 target_stone (a_stone: STONE)
521 -- Target `a_stone' in the tool
522 do
523 last_stone_targeted := True
524 if not tree.is_built then
525 tree.build
526 end
527 if attached {CLASSI_STONE} a_stone as l_conv_class then
528 tree.show_class (l_conv_class.class_i)
529 tree.item_selected
530 elseif attached {CLUSTER_STONE} a_stone as l_conv_cluster then
531 tree.show_subfolder (l_conv_cluster.group, l_conv_cluster.path)
532 tree.item_selected
533 elseif attached {TARGET_STONE} a_stone as l_target_stone then
534 tree.show_target (l_target_stone.target)
535 tree.item_selected
536 else
537 last_stone_targeted := False
538 end
539 end
540
541 add_new_entry_for_stone (a_stone: STONE)
542 -- Try adding new entry for `a_stone'.
543 do
544 if attached {FEATURE_STONE} a_stone as l_feature_stone then
545 -- For a feature, we need to specify the feature when adding an entry
546 if attached {ES_EIS_CLASS_VIEW} tree.current_view as l_view and then l_view.new_entry_possible then
547 if attached l_feature_stone.e_feature as l_f then
548 l_view.create_new_entry_for_feature (l_f)
549 end
550 end
551 else
552 -- For other items we can add a new entry directly.
553 on_entry_add
554 end
555 end
556
557 reset_stone
558 -- Reset current targeted stone
559 do
560 panel.reset_stone
561 end
562
563 display_list
564 -- Display entry list in the list area.
565 do
566 if attached list_area_widget as l_list then
567 nothing_widget.hide
568 l_list.show
569 end
570 end
571
572 display_nothing
573 -- Display nothing in the list area.
574 do
575 if attached list_area_widget as l_list then
576 l_list.hide
577 nothing_widget.show
578 end
579 end
580
581 refresh_buttons (a_view: ES_EIS_COMPONENT_VIEW [ANY])
582 -- Inform the widget GUI current view displayed is editable or not.
583 -- Change the sensitivity of buttons accordingly.
584 require
585 a_view_not_void: a_view /= Void
586 do
587 if attached add_button as l_ab and then attached delete_button as l_db then
588 if a_view.component_editable then
589 l_ab.enable_sensitive
590 l_db.enable_sensitive
591 else
592 l_ab.disable_sensitive
593 l_db.disable_sensitive
594 end
595 end
596 if attached acknowledge_button as l_b then
597 if attached {ES_EIS_AFFECTED_VIEW} a_view then
598 toolbar.extend (l_b)
599 else
600 toolbar.prune (l_b)
601 end
602 end
603 toolbar.refresh_now
604 end
605
606 feature -- Query
607
608 last_stone_targeted: BOOLEAN
609 -- Was last stone targeted by `target_stone'?
610
611 feature {NONE} -- Implementation
612
613 is_stone_editable_for_auto_node (a_stone: STONE): BOOLEAN
614 -- Is `a_stone' editable for auto node entries?
615 do
616 Result := attached {TARGET_STONE} a_stone or else
617 (attached {CLUSTER_STONE} a_stone as l_stone and then
618 attached {CONF_LIBRARY} l_stone.group as l_library and then
619 not l_library.is_readonly)
620 end
621
622 show_target_auto_node_dialog (a_target: CONF_TARGET)
623 -- Show auto node dialog for `a_target'.
624 require
625 a_target_set: a_target /= Void
626 local
627 l_dialog: ES_EIS_AUTO_ENTRY_DIALOG
628 do
629 create l_dialog.make_with_target (a_target, agent refresh_list)
630 l_dialog.set_is_modal (True)
631 l_dialog.show_on_active_window
632 end
633
634 nothing_widget: EV_HORIZONTAL_BOX
635 -- Widget to display nothing.
636 local
637 l_border: ES_BORDERED_WIDGET [EV_WIDGET]
638 l_hbox: EV_HORIZONTAL_BOX
639 once
640 create Result
641 create l_hbox
642 create l_border.make (l_hbox)
643 Result.extend (l_border)
644 l_hbox.extend (create {EV_LABEL}.make_with_text (interface_names.l_no_information_available))
645 ensure
646 Result_not_void: Result /= Void
647 end
648
649 internal_recycle
650 -- <precursor>
651 do
652 grid_support.desynchronize_scroll_behavior_with_editor
653 entry_list.recycle
654 tree.recycle
655 end
656
657 invariant
658 context_menu_factory_not_void: context_menu_factory /= Void
659 panel_not_void: panel /= Void
660 tree_not_void: tree /= Void
661
662 note
663 copyright: "Copyright (c) 1984-2013, Eiffel Software"
664 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
665 licensing_options: "http://www.eiffel.com/licensing"
666 copying: "[
667 This file is part of Eiffel Software's Eiffel Development Environment.
668
669 Eiffel Software's Eiffel Development Environment is free
670 software; you can redistribute it and/or modify it under
671 the terms of the GNU General Public License as published
672 by the Free Software Foundation, version 2 of the License
673 (available at the URL listed under "license" above).
674
675 Eiffel Software's Eiffel Development Environment is
676 distributed in the hope that it will be useful, but
677 WITHOUT ANY WARRANTY; without even the implied warranty
678 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
679 See the GNU General Public License for more details.
680
681 You should have received a copy of the GNU General Public
682 License along with Eiffel Software's Eiffel Development
683 Environment; if not, write to the Free Software Foundation,
684 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
685 ]"
686 source: "[
687 Eiffel Software
688 5949 Hollister Ave., Goleta, CA 93117 USA
689 Telephone 805-685-1006, Fax 805-685-6869
690 Website http://www.eiffel.com
691 Customer support http://support.eiffel.com
692 ]"
693
694
695
696
697 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23