note description: "Objects that represent an EV_TITLED_WINDOW.% %The original version of this class was generated by EiffelBuild." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class WEB_BROWSER_WIDGET inherit WEB_BROWSER_WIDGET_IMP TEXT_OBSERVER undefine copy, is_equal, default_create redefine on_text_fully_loaded end SHARED_OBJECTS undefine copy, default_create, is_equal end create make feature -- Creation make -- Make do default_create end feature {NONE} -- Initialization user_initialization -- called by `initialize'. -- Any custom user initialization that -- could not be performed in `initialize', -- (due to regeneration of implementation class) -- can be added here. do create html_text_container html_text_container.enable_word_wrapping browser_container.extend (html_text_container) end feature -- Commands load_url (a_url: STRING) -- Load `a_url' local l_file: RAW_FILE do if not urls.has (a_url) then add_url (a_url) end create l_file.make_open_read (a_url) if l_file.exists and then l_file.is_open_read then l_file.readstream (l_file.count) html_text_container.set_text (l_file.laststring.twin) end end refresh -- Reload the HTML based upon changes made to `document'. If there is no -- document then simply refresh the loaded url. do if document /= Void then shared_document_manager.save_document load_url (generated_document) end end feature -- Status Setting set_document (a_doc: DOCUMENT) -- Set `document' require doc_not_void: a_doc /= Void local l_util: UTILITY_FUNCTIONS l_target_dir: DIRECTORY l_name: STRING do document := a_doc create l_util l_name := document.name l_name.replace_substring_all ("\", "/") if l_util.file_type (l_name).is_equal ("xml") or l_util.file_type (l_name).is_equal ("html") then create l_target_dir.make (l_util.temporary_html_location (l_name, False)) document_hash.extend (l_target_dir, l_name) load_url (generated_document) end ensure is_set: document = a_doc end feature {NONE} -- Status Setting add_url (a_url: STRING) -- Add url to list require url_not_void: a_url /= Void do if not urls.has (a_url) then urls.extend (a_url) end end feature {NONE} -- Implementation html_text_container: EV_TEXT -- Vision 2 Winforms container lookup_url (a_item: EV_LIST_ITEM) -- Lookup url and load local l_url: STRING do l_url := a_item.text if l_url /= Void then load_url (l_url) end end urls: ARRAYED_LIST [STRING] -- Urls once create Result.make (10) Result.compare_objects end document_hash: HASH_TABLE [DIRECTORY, STRING] -- Documents hashed by location of HTML or XML file and name once create Result.make (5) Result.compare_objects end document: DOCUMENT -- Document history_stack: ARRAYED_STACK [INTEGER] -- History stack once create Result.make (1) end generated_document: STRING -- Generated `document' content require document_known: document_hash.has (document.name) local l_generator: HTML_GENERATOR do create Result.make_empty if document.is_persisted then create l_generator l_generator.generate_file (document, document_hash.item (document.name)) Result.append (l_generator.last_generated_file.name.string) Result.replace_substring_all ("\", "/") end ensure has_result: Result /= Void end on_text_fully_loaded -- Update `Current' when the text has been completely loaded. -- Observer must be registered as "edition_observer" for this feature to be called. local l_consts: SHARED_OBJECTS do create l_consts if l_consts.shared_document_manager.current_document /= Void then set_document (l_consts.shared_document_manager.current_document) end end note copyright: "Copyright (c) 1984-2006, Eiffel Software" license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ This file is part of Eiffel Software's Eiffel Development Environment. Eiffel Software's Eiffel Development Environment is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License (available at the URL listed under "license" above). Eiffel Software's Eiffel Development Environment is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eiffel Software's Eiffel Development Environment; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ]" source: "[ Eiffel Software 356 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class WEB_BROWSER_WIDGET