WO2003001411A2 - A browser - Google Patents

A browser Download PDF

Info

Publication number
WO2003001411A2
WO2003001411A2 PCT/NO2002/000233 NO0200233W WO03001411A2 WO 2003001411 A2 WO2003001411 A2 WO 2003001411A2 NO 0200233 W NO0200233 W NO 0200233W WO 03001411 A2 WO03001411 A2 WO 03001411A2
Authority
WO
WIPO (PCT)
Prior art keywords
browser application
browser
null
return
string
Prior art date
Application number
PCT/NO2002/000233
Other languages
French (fr)
Other versions
WO2003001411A3 (en
Inventor
Dan Stanculescu
Ciprian Popa
Marcel Petrisor
Original Assignee
The Mobile Media Company As
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from NO20013212A external-priority patent/NO20013212L/en
Application filed by The Mobile Media Company As filed Critical The Mobile Media Company As
Publication of WO2003001411A2 publication Critical patent/WO2003001411A2/en
Publication of WO2003001411A3 publication Critical patent/WO2003001411A3/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Definitions

  • the present invention relates to a browser application, in particular a Web browser.
  • a Web browser (often referred to simply as a browser) is an application program that allows a client to display information, obtained over the Internet. Data is transmitted over the Internet using TCP/IP (Transfer Control Protocol/ Internet Protocol). Particular resources will also use further protocols. For example, browsers mainly use HTTP (Hypertext Transfer Protocol) to request Web pages from servers connected to the Internet.
  • HTTP Hypertext Transfer Protocol
  • Web pages are often written in HTML (Hyper text markup language), in which text is also supplied with formatting instructions and 'hyperlinks' to other files on the internet.
  • HTML Hyper text markup language
  • the browser application will have to have a number of other functions and features, such as language manager, ide manager, menu manager, handling of bookmarks and skins, maintaining a history list of accessed network resources etc. Upgrading such functionality or creating a version based on another language will in the same manner necessitate the production of an updated version of the entire browser.
  • a number of browsers based on the Java programming language including Sun Microsystems' Hot Java and Espial Group's Escape, allow the installation or removal of additional content handlers and protocol handlers in the form of plug-ins. The same is the case for desktop-based browsers like America Online's Netscape and Microsoft's Internet Explorer.
  • a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a kernel program or programs, the browser application also including one or more additional programs which are incorporated according to preferences, these preferences being changeable.
  • a browser application upon a client computer used by a user for accessing a resource over a network from a server computer, the browser application including a kernel program which is preset, the browser application also including one or more additional programs which are incorporated according to actions made by the user.
  • a method of creating a browser application including a kernel program which is preset, the application also including one or more additional programs which are incorporated according to actions made by the user.
  • a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the graphical user interface including selectable representations of functions, the representations being alterable according to actions made by the user.
  • a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, wherein the graphical interface includes a first set of selectable representations of functions and/or status bars, and further including a switching means such that the first set may be substituted for a second set of selectable representations of functions and/or status bars.
  • a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a JavaScript debugging application.
  • a browser application upon a client computer used by a user for accessing a formatted resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a means of displaying the nodes and/or subnodes of a resource as a document object model.
  • a method of accessing a resource over a network from a server computer by a browser application upon a client computer used by a user and displaying at least part of the resource on a graphical user interface the browser application sending an identifier associated with display or function preferences, the server computer generating the form of the resource in response to the identifier.
  • a resource as herein defined.
  • a computer client system programmed with a browser application as herein defined.
  • a computer program product stored on a computer readable medium and constituting, when installed on a client computer, a browser application upon a said client computer as herein defined.
  • FIG 1 shows the architecture of the modules of the browser
  • FIG. 2 shows the structure of the HTTP renderer module
  • Figures 3 and 4 show different skins of the IDE
  • Figures 5 and 6 show a miniaturised IDE
  • Figures 7 and 8 show different language choices applied to the IDE
  • Figures 9 to 11 show the display of favourite items in the IDE
  • Figure 12 shows a contextual menu
  • Figure 13 shows the browser IDE and an editing window
  • Figures 14 to 16 show the browser IDE and a viewing window
  • Figure 17 shows another editing window
  • Figure 18 shows a second browser IDE being open from a first;
  • Figures 19 to 21 show the LAN and ftp explorer panel;
  • Figure 22 shows a ftp dialog box panel
  • Figure 23 shows a schematic view of the information flow between the browser and an Internet portal
  • FIGS. 24 and 25 show the general operation of the Browser
  • FIGS 26 to 31 show details of the Browser operation.
  • the browser application is modular in form.
  • the browser includes a Core Browser Open API Services module 20. This module interfaces with the other modules and controls their operation.
  • the browser includes a number of Content Handler modules 30 to interpret resources of different formats or languages (the material of these resources hereafter referred to simply as 'content') which may be encountered, and a number of Protocol Handlers modules 50 , to allow files to be transferred using the necessary or appropriate transfer protocol.
  • Resources accessed over the Internet, or over other networks such as a LAN (Local Area Network) may be written in many different formats, and different resources may be transferred using different protocols.
  • the Browser also includes a number of Plug-in modules 70, which provide functions to enhance and improve the use of the Browser. Some functions may though be provided by the Core Browser Open API Services module.
  • Java is a very convenient language for this application, since it is portable, modular and secure.
  • the core services module is based on an open API (application program interface), which allows users to create and develop applications and services for the browser.
  • Java is a highly portable language that, is non-platform specific and may operate over a distributed network.
  • the distribution and management of the different modules of the Web browser may therefore be carried out on the server side, to be retrieved and installed or executed by the client when necessary.
  • the retrieval may be performed in a variety of ways, for example downloading a compressed file, and unzipping the file when required.
  • the Core Browser Open API Services module includes all the methods of accessing the functions of the modules.
  • the Core Browser Open API Services module returns the instance of the current services of the modules.
  • the Core Browser Open API Services module can also retrieve the directory in which the browser is installed, instantiate a browser, can retrieve and set the browser's properties.
  • the Core Browser Open API Services module provides access to all the modules in the event that an event occurs that signifies that module is needed, or if a second module requires the first module. When a new plug- in, language, panel, IDE (Integrated Development Environment) event listener, or other module or feature is added, this is added to the Core Browser Open API Services module registry so that the module can be called when required. Similarly, items may be removed from the registry when no longer required.
  • the Content Handlers shown here are a Database module 31 to interpret database files, an HTML + CSS + DOM2 module 32 for displaying Web pages, an XML module 35 for Web pages or data containing XML (Extensible Markup language), a Zip module 38 for decompressing and manipulating zip files, a Jar module 39 for decompressing and manipulating jar (Java Archive) files, an Image module 40 for displaying gif and jpeg files, a Directory module 42 for displaying directories and the directory structure, a sound module 44 for playing or manipulating sound files, a Text module 46 for displaying plain text files, an Applet module 48 for running applets, and a Netscape Plug-in module 49 for accessing Netscape plug-ins.
  • a Database module 31 to interpret database files
  • an HTML + CSS + DOM2 module 32 for displaying Web pages
  • an XML module 35 for Web pages or data containing XML (Extensible Markup language)
  • a Zip module 38 for decompressing and
  • the browser includes a number of Protocol Handlers 50, including a db module 52 for transferring database files, a File module 54 for transferring files using FTP (File transfer Protocol), an About module 56, an HTTP 57 module for transferring files using HTTP (Hyper Text Transfer Protocol), a Jar module 60 for transferring jar files, a Zip module 62 for transferring zip files, a Doc module 64 for transferring document files, and an HTTPS module 66 for allowing the Secure Hyper Text Transfer Protocol to be used.
  • a db module 52 for transferring database files
  • File module 54 for transferring files using FTP (File transfer Protocol)
  • an About module 56 for transferring files using HTTP (Hyper Text Transfer Protocol)
  • HTTP 57 module for transferring files using HTTP (Hyper Text Transfer Protocol)
  • Jar module 60 for transferring jar files
  • Zip module 62 for transferring zip files
  • a Doc module 64 for transferring document files
  • HTTPS module 66 for allowing the Secure Hyper Text Transfer Protocol to be used.
  • the Plug-in modules 70 are divided into System Plug-ins 72, and User
  • the System plug-ins include a Menu Manager module 73, and a IDE Manager Module 74.
  • the User Plug-ins 75 which generally provide applications and tools for the Browser's user, includes a Bookmark Subscription module 80 for automatically caching updated versions of favourite pages, a G-spot module 82 for sending and receiving e-mail messages, a Skin Manager module 84, a Favourites Manager. 86, a History Manager module 88, a LAN and FTP Explorer module 89, and a New Language Manager module 90.
  • the HTML + CSS + DOM2 module comprises an
  • HTML parser module 102 HTML parser module 102, a DOM builder 104, a JavaScript module 106, a layout engine 108, a screen renderer 112, and a CSS parser 110.
  • the content of the resource to be interpreted is brought from the network or the cache 101 to the HTML parser module 102 which parses the content, then a DOM (Document object model) representation 105 of the resource is built by the DOM builder 104.
  • Any JavaScript embedded in the resource is run by the JavaScript module 106 using a Script Engine such as 'Mozilla Rhino' 107 available from the Mozilla organisation.
  • a layout engine 108 processes the CSS attributes 109, and finally a Screen Renderer 112 displays the content.
  • the core services module and the HTML + CSS + DOM2 module together are the minimum practical module requirement for a user wishing to access Web pages.
  • a functional browser may be provided taking up only 700 KB of the client computer. This is particularly useful for portable computers, PDAs (Personal Digital Assistant) and the like, where memory is at a premium.
  • PDAs Personal Digital Assistant
  • the IDE integrated development environment
  • GUI graphical user interface
  • Each skin may control different aspects of appearance of the browser window, such as the size and arrangement of the window and toolbars, and the functions offered.
  • a user may create or download skins and save them, so that the browser may be changed to different customised forms with ease and speed.
  • the Menu manager plug-in controls the content and hierarchy of the pull down menus. It also provides a method of allowing the menus to be manipulated. Menus may thus be created, modified, moved and deleted.
  • the download status bar 130 includes a switching button 132 which replaces the download status bar with input buttons 134.
  • the switching button 132 is present in the input button toolbar 135 also, so that the download status bar 130 may be easily restored.
  • New languages may be stored, and substituted by using the New language manager plug-in for the old language in which the menu options, prompts, etc. that appear in the browser IDE appear.
  • the new languages are each stored as separate modules.
  • Figure 7 shows a new language 142 being selected from a nested pull down menu 141
  • figure 8 shows the IDE after the new language has been imposed on the browser, in particular upon the menu toolbar 140.
  • the Favourites manager module manages a collection of links to bookmarked resources or 'favourites' which the user can delete or add to.
  • the user selects the 'show/hide' option 152 from a pull down menu 150 as shown in figure 9 if the favourite panel is not already open.
  • the favourites 156 are then displayed in a hierarchical structure in a panel 156 of the IDE. The user may access a particular favourite by selecting it from this panel.
  • the pull down menu the user may add and name favourites, create new directories, rename existing directories and favourites, and delete existing directories and favourites using a dialog box 158.
  • the favourites are stored in a separate favourites module.
  • a contextual menu 162 which may be summoned by the user at any time within the IDE 160 by right clicking with the mouse.
  • Available options may typically include navigation options (back forward, stop download, reload page), copy document address, view the document's source code, save document, open a new IDE window, and close the existing window.
  • the contextual window also includes a further tools menu, with offers web page construction tools such as displaying a visualisation of the DOM tree and a JavaScript debugger.
  • Figure 13 shows the source code being viewed in a separate editor window 164
  • figure 14 shows the DOM tree being viewed in another window 166.
  • the DOM may be searched by selecting a portion 170 of the DOM, right clicking with the mouse to bring up a menu 172, and searching the HTLM elements, attributes or text within that portion using the resulting dialog box 174.
  • the Javascript script debugger function which may be selected from the tools menu of the contextual menu, opens a console 180 in which a user can execute script commands, evaluate expressions, and declare, execute and modify functions or objects.
  • Other script languages such as Microsoft Corporation's VBScript, and tcl commands, may be ., installed and supported.
  • a new browser window may be opened through selecting the pull down menu from the file option 181 of the menu toolbar 140, or by selecting a hyperlink on the displayed page with the left mouse button while simultaneously depressing the shift key.
  • the FTP and LAN explorer plug-in module allows the local area network, and any FTP links included in a configuration file to be explored.
  • the network's drives and folders are displayed in a conventional tree structure 194 in a panel 192 on the browser IDE.
  • the tree may be navigated by single or double clicking to respectively select or open folders and files.
  • the files within a selected folder are listed in the bottom section 196 of the panel.
  • Right clicking on a file or folder gives the user a menu 198 to edit the local area network, depending upon the nature of the object selected, as shown in figure 20. For example, the user may have the options of adding and deleting directories, renaming, copying and pasting directories.
  • the user has similar options for files, as shown in figure 21, which the user may select from the list at the bottom section 196 of the panel 192 and bring up a contextual menu 199.
  • the user may manipulate ftp sites through a dialog box panel 200, allowing the user to add ftp sites or delete ftp sites using buttons 202, and enter the ftp properties or change existing ftp properties using the fields 204.
  • the user may also connect and disconnect through this panel.
  • Protocol Handlers may be made available, for example, a db Protocol Handler module for the transferral of databases, a
  • File Protocol Handler module is provided to access local files, a Zip Protocol Handler module to transfer zip files, a Jar Protocol Handler module to transfer jar files, Doc Protocol Handler module to transfer document files, a Https Protocol Handler module to transfer certificates, and a Ref Protocol Handler module to send directly to http (hypertext transfer protocol) referrers.
  • http hypertext transfer protocol
  • the Core Browser Open API Services module includes details of the client computer, and details that the user as entered concerning himself. Referring to figure 23, when the user uses the browser 210 to access a resource through a Web site of portal 220, the Core Browser Open API Services module sends a user ID including information concerning the client and/or the user. The site hosting the resource then dynamically adapts the resource being offered to the user, based upon the user details and upon published preferences. The user may then receive the resource in a way that is particular to him, and more useful than if a static resource had been made available to him.
  • the steps of the operating the browser are typically as follows; the general Browser application module (listed in Annex 1) controls the instantiation of the browser application.
  • a new BrowserServices module 202 is called.
  • the BrowserServices 202 loads the system plug-ins 204 and user plug-ins 206 according to the settings previously saved.
  • the general Browser module retrieves the size and position of the browser's panel using the BrowserPanel module described below to launch a GUI 212, and an Event notifier 208 is activated and a Browsei DEListener 210 is added to receive and respond to user input or other events.
  • an instance 304 of the BrowserServices module (listed in Annex 2) also forms part of the core of the browser application.
  • the BrowserServices module also calls the BrowserProtocolManager 306, the BrowserContentManager 310, the BrowserScriptManager 312, the BrowserMenuManager 314 and the PluginManager 316. The required protocol handlers and content handlers are loaded.
  • the PluginManager (listed in Annex 3) loads the necessary plug-ins, and the content of the resource is opened.
  • the particular plug- ins loaded could, for example, be the language 214 it is wished to work in, the navigation program, such as the file manager 216, and other plug-ins 218 as required, such as plug-ins for different protocols, content handlers, favourite menus, etc.
  • the BrowserServices module can get the current instances of the browser application, as well as setting their properties or removing instances of the browser. To do this, the Browser service checks from the root directory, and enumerates all instances of the browser. For a particular instance, the BrowserServices module calls modules necessary for displaying files on the browser, and associated functions. When getting a browser instance, the BrowserServices module calls the MenuManager module, the IDEManager module, the
  • ContentManager module 706 (shown in figure 30), and the CacheManager module.
  • the BrowserPluginManager co-ordinates other plugin modules, by enumerating the plugin modules, and the associated user names for the plugin modules.
  • the BrowserService 604 calls a new BrowserPluginManager 606 and a new MenuManager 608.
  • the BrowserPluginManager 606 requests the BrowserPluginManager 606 to start a new System Plugin.
  • the BrowserPluginManager also starts a new SkinManager 609, which returns the IDEManager to BrowserServices, adds a BrowserlDEListener and calls the MenuManager before creating a Menultem to the MenuManager.
  • the BrowserPluginManager further allows a new user to register preferences, causing those changes of languages, panels, and IDE listeners necessary for particular modules to be registered.
  • Figure 27 shows the Browser services 406 being created by the testBrowser operation 402, with the user settings BrowserOptions 408 being inputted to the BrowserServices 406, which then loads the Browser according to those options, and loads a new BrowserlDEEvent 412 whilst notifying the EventManager module 414. Th ⁇ resource is opened in the Browser, the BrowserService settings also been shown in the Browser.
  • the BrowserPluginManager For each module, the BrowserPluginManager also activates the BrowserlDEListeners, so that the plugin is responsive to events triggered by the user's actions (such as clicking on a link, or hitting a key). By locating and enumerating the browser's modules, the BrowserPluginManager also enables old plugins to be removed and new plugins to be loaded; this process may be used not only to add new plugins bringing new features to the browser, but to update an existing plugin. The BrowserPluginManager also manages menus modules and the menus owned by particular plugins, and is ⁇ responsive to events occurring from the user choosing options.
  • the general Browser module When the browser has been opened and is responsive to the user, the general Browser module initiates modules to carry out functions equivalent to conventional operations of internet browsers, such as opening and closing documents, storing the document viewing history, navigating through the history, saving a document, refreshing the view of the document, and so on.
  • the BrowserServices 502 calls the Browser module 504, and notifies the EventManager module 506.
  • the EventManager initiates a new Browser, and this is communicated to the SkinManager 508, which loads the necessary images 510, buttons 512, panels 514, and Input 516 and registers 518 with the listeners in order that the new Browser panel responds to user input.
  • the BrowserServices module calls a new ProtocolManager 706 (which is listed in Annex 4) which calls the appropriate Protocol Handler 220, which sets the URL stream 222 to be interpreted.
  • the protocol handlers used by the browser are registered and updated by the ProtocolManager so that they are available when required by the browser.
  • the ContentManager module (listed in Annex 5) enumerates and registers the content Handlers present.
  • the ContentManager module identifies the type of content of the file or resource using the file extension or the mime type. The ContentManager then calls the appropriate content handler to interpret the content for display.
  • the BrowserServices calls 804 a new ContentManager 806 which loads a Content Handler 224 based on the contents MIME type (determined by the MIME Manager 226), and the content is loaded 227, and passed to the ContentHandler 228 to be displayed (the Java and native code being extracted and interpreted).
  • the content formats (such as zip files 250, html files 251 and gif and jpeg files 252) are separated, and the HTML code is parsed by DOM Parser 230.
  • the content is then processed using the Cascading Style Sheet renderer 232.
  • the HTML is then passed to the HTML Handler 234 to be interpreted and displayed.
  • the AContentHandler module renders the images of the file, displays the background colours, displays the script portion of the file, sizes the document, and provides an appropriate scroll, updating the portion of the document being displayed 236 according to the way the user moves the scroll bars.
  • the user inputs a URL 902, which is input into the Browser 904.
  • the URL and/or connection parameters are sent to the
  • BrowserContentLoader 906 which initiates a new URLConnector 908.
  • the MIME type is retrieved, and sent back to the BrowserContentLoader 906, which selects and loads the appropriate ContentHandler 910.
  • the URL Connector 908 interrogates the cache manager 912, and decides whether it necessary to make a network connection or whether the resource can be retrieved from the cache.
  • the (typically html) content is retrieved from the NetURLConnection 908 or the Cache Manager 912, and this input stream 913 is fed to the content parser 914, which creates the DOM tree nodes 916, and carries out the Cascading Style Sheet 918 rendering as previously described.
  • the textual and other content associated with the marked-up language has been rendered, the it is checked whether the contents differ 920. If they do not differ, the rendering process is repeated for a further iteration.
  • the a ContentHandler 922 is called; if there is an Image 924 an ImageProducer 926 is called, which connects to the NetURLConnetion 928, and via this to the Cache Manager to receive the remaining parts of the resource's input stream 930 to obtain the image data.
  • the MenuManager module (listed in Annex 7) supplies the menu options for the browser GUI in response to requests from the
  • the MenuManager module can locate and enumerate all the ordinary (i.e. pull-down) menus and pop-up menus and sub-menus, and may also be used to create, delete and move menus.
  • the browser operation buttons for common functions such as Open file, Save file, New file, Exit file, Forward, Back, Reload, Stop, Refresh, etc.
  • present on the GUI are also included here the MenuManager module also.
  • the event listener (BrowserlDEListener) calls the MenuManager, which gets the plugin corresponding to the menu choice.
  • the BrowserServices module creates a new panel.
  • the BrowserService module can thereby locate, enumerate, add, and delete panels, so that panels can be provided on the browser's GUI to show chosen files, menu options and other data.
  • the user may display and edit the JavaScript code embedded in a Web page or similar resource.
  • the BrowserServices module calls a BrowserScriptManager module (which is listed in Annex 9).
  • the Browsers criptManager module recognises the content type (for example from the file extension), and registers and sets the appropriate script editor, in this case a JavaScript editor, e.g. the 'Mozilla Rhino' Script editor.
  • a JavaScript editor e.g. the 'Mozilla Rhino' Script editor.
  • the Browser is written in with a modular and open architecture, it is relatively straightforward for third parties to develop other content handlers and protocol handlers. The browser may therefore be continuously updated to cope with new contents and protocols as they arise. In a similar way, other features may be added or modified.
  • the History manager plug-in module allows the user to display a history panel listing the Web pages or other resources that he has visited, listed in chronological order. This can assist the user in finding previously visited resources which have not been added to the user's favourites.
  • the look and feel of the browser may be modified according to the user's preference, and by the Web site or Portal through which the user is currently accessing resources. Therefore the content of a particular resource may be used to determine how the content is displayed and edited, using the necessary services from the different Browser modules. Different types of content may be displayed using different content handlers and other modules within the same window.
  • the user may customise any aspect of the browser simply by adding a module to carry out a particular function, such as interpreting a new type of content, transferring resources in a particular protocol, or adding a new tool to the browser.
  • the user may also modify existing functions by simply replacing the relevant module.
  • the particular modules installed on the machine may also be determined by the server, again according to published preferences or preferences specified by the user.
  • the invention as herein described and defined may also be implemented as a computer program product stored on a computer readable medium and constituting, when installed on a client computer, a browser application as described above.
  • the computer readable medium may e.g. be a* ⁇ * CD-ROM or DVD-ROM disc, a magnetic storage medium such as a floppy - * disc or a hard disc, or it may even be a propagated signal carrying information describing the program instructions constituting the computer program or programs included in the computer program product.
  • the browser application may be effected in other languages which are amenable to being written and executed in a modular manner.
  • setLayout new BrowserPanelLayout (panelRight, false) ) ; add (panelContent , "Center” ) ; panelLeft . add (new Button ()) ; panelContent . setLayout (new BorderLayout ( ) ) ;
  • viewport new Viewport (this, options .browserName) ; panelContent. add (viewport ' //trebuie pusa Ich creare viewport deorece //se interogheaza viewportul desprece sau setBrowserTitle ("")
  • Panel panelTop new Panel (); panelTop . setLayout (new
  • cm (ICacheManager ) (new no .mc .protocol . http . CacheManager (this ) ) ;
  • Viewport view (Viewport ) BrowserServices. findViewport (hentry. docViewport
  • loadContent view, hentry. docURL, hentry . docType, hentry . docPosition, null
  • updateHistory true
  • loadContent view, hentry . docURL, hentry . docType, hentry . docPosition, null
  • updateHistory true
  • CacheManager cm (CacheManager) getCacheManager ( ) ;
  • ABrowserServices services BrowserServices . getBrowserServices () ;
  • Enumeration enumeration BrowserServices. browsers. elements ( ) ; while (enumeration . hasMoreElements (
  • setControlsVisible boolean visible ' controls . setVisible (visible) ; checkboxControls . setState (visible) ; validate ( ) ;
  • ActionListener menuListener new ActionListener ( )
  • FileDialog fdo new FileDialog (Browser . this, "Open file”, FileDialog . LOAD) ;
  • BrowserServices.lastDirectory fdo . getDirectory () ;
  • ItemListener checboxListener new ItemListener ( ) ⁇ public void itemStateChanged (ItemEvent event)
  • menultem addActionListener (menuListener) ; menultem. setShortcut (new
  • menultem addActionListener (menuListener) ; menultem. setShortcut (new
  • menultem addActionListener (menuListener) ; menultem. setShortcut (new MenuShortcut ( ' F* ) ) ;
  • menultem addActionListener (menuListener) ; menultem. setShortcut (new MenuShortcut ( 'S' )) ;
  • menultem addActionListener (menuListener ) ; menultem. setShortcut (new MenuShortcut ( ' R' ) ) ;
  • checkboxControls addltemListene (checboxListener) ; checkboxControls . setState (true) ;
  • checkboxStatus addltemListener (checboxListener) ; checkboxStatus . setState (true) ; return bar; ⁇
  • ⁇ urlOrig new URL (urlString) ; // check url if is valid return urlOrig;
  • URL url new URL ( "http : //"+urlString) ; // complete url based on "http” return url;
  • addHistoryEntry view, url , ime, position
  • HOST_PANEL_BOTTOM panelBottom. remove ( (Component) panel ) ; break; case IBrowserlDEManager .
  • HOST_PANEL_LEFT panelLeft. remove ( (Component) panel) ; break; case IBrowserlDEManage .
  • HOST_PANEL_RIGHT panelRight . remove ( (Component) panel) ; break; default : return false;
  • IBrowserPanel [list. size () ] ; list . copylnto ( et ) ;
  • HistoryEntry hentry (HistoryEntry) historyList . elementAt (historylndex) ;
  • ⁇ int size historyList . size () ; if (historyIndex ⁇ size-l ) // truncate history list from current index ⁇ historyIndex++;
  • historyList setSize (historylndex) ;
  • historyList setElementAt (updatedEntry, historylndex- 1) ;
  • URLConnector conector new URLConnector (contentURL, contentType, null) ; // have to treat encoding [ ! ! ]
  • Toolkit toolkit Toolkit .getDefaultToolkit ( ) ;
  • toolbar toolkit. getImage (Browser .class .ge Resource ( "images /toolba r.gif") ) ;
  • toolbar_bg toolkit . getImage (Browser .class. getResource ( "images /toolba r_bg . gif" ) ) ;
  • logo toolkit . getImage (Browser. class. getResource ( "images /logo . g if") ) ;
  • offImage createlmage (width, height )
  • offGraphics offImage . getGraphics () ;
  • BorderLayout ( ) ) ; add (label '
  • addLayoutComponent (Component comp, Object constraints)
  • addLayoutComponent ( " " , comp )
  • addLayoutComponent ( " " , comp )
  • offset + dim. height;
  • Hashtable browsers new Hashtable (7 ) ; // all browsers static Browser activeBrowser ; // active browser public static String lastDirectory ;
  • IniFileSection sect new IniFileSection ( section) ;
  • String ret sect . getValue (propName) ;
  • ⁇ browser new Browser (options ) ;
  • BrowserlDEEvent ideEvent new BrowserlDEEvent (browser, BrowserlDEEvent . IDE_IDEOPENED) ; notifier . notifyListeners (ideEvent) ;
  • Enumeration enumeration browsers . elements () ;
  • Vector list new Vector (browsers . size ()) ; while ( enumeration . hasMoreElements () ) ⁇
  • IBrowser browser (IBrowser) enumeration . nextElement ( ) ; list . addElement (browser) ;
  • IBrowser ret[] new IBrowser [list . size ()] ; list. copylnto (ret) ; return ret; ⁇
  • BrowserlDEEvent (name , BrowserlDEEvent . IDE_USERCHANGED) ; notifier . notifyListeners (ideEvent) ; ⁇ / ⁇ k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k
  • BrowserResource. registerSystemResource (ret.getLanguageId( ) , resEntry) ; if (! isRegistered) // notify in case is a new one ⁇
  • BrowserlDEEvent ideEvent new BrowserlDEEvent (ret , BrowserlDEEvent . IDE_LANGUAGEREGISTERE D) ; notifier . notifyListeners (ideEvent) ; ⁇ return ret;
  • BrowserlDEEvent (language, BrowserlDEEvent . IDE_LANGUAGECHAN GED) ; notifier . notifyListeners (ideEvent) ;
  • BrowserMenuManager updateMenuBar ( (Browser)browsers[i] ) ;
  • BrowserContentManager getSection ( "ContentHandlers” )
  • scriptManager new BrowserScriptManager (getSection ( "ScriptHandlers” ) )
  • BrowserContentManager new BrowserScriptManager (getSection ( "ScriptHandlers” ) )
  • BrowserPluginManager getSection (" PiuginsToLoad") ) ; // create pluginManager menuManager . start (this) ; pluginManager .start (this); pluginManager . startSystemPlugins ( ) ; menuManager . validateLanguages ( ) ; // validate all languages && notify all languages

Abstract

The invention relates to a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a kernel program and one or more additional programs which are incorporated according to preferences, these preferences being changeable.

Description

A Browser
The present invention relates to a browser application, in particular a Web browser.
A Web browser (often referred to simply as a browser) is an application program that allows a client to display information, obtained over the Internet. Data is transmitted over the Internet using TCP/IP (Transfer Control Protocol/ Internet Protocol). Particular resources will also use further protocols. For example, browsers mainly use HTTP (Hypertext Transfer Protocol) to request Web pages from servers connected to the Internet.
Web pages are often written in HTML (Hyper text markup language), in which text is also supplied with formatting instructions and 'hyperlinks' to other files on the internet. Other type of file, and indeed other resources, such as applications, are also available via the internet.
Generally, different resources use different transfer protocols (that is, in addition to TCP/IP). To allow the user to access different resources written in particular formats and using particular transfer protocols, the browser application must include means to interpret the required formats and use the required protocols. Since formats and transfer protocols are continually being developed, browsers must be regularly replaced with updated versions in order to make full use of the available resources.
In addition to being able to access different resources based on various formats and using particular transfer protocols, the browser application will have to have a number of other functions and features, such as language manager, ide manager, menu manager, handling of bookmarks and skins, maintaining a history list of accessed network resources etc. Upgrading such functionality or creating a version based on another language will in the same manner necessitate the production of an updated version of the entire browser. A number of browsers based on the Java programming language, including Sun Microsystems' Hot Java and Espial Group's Escape, allow the installation or removal of additional content handlers and protocol handlers in the form of plug-ins. The same is the case for desktop-based browsers like America Online's Netscape and Microsoft's Internet Explorer.
It is an object of the present invention to provide a browser which efficiently allows a client user to access network resources.
It is a further object of the invention to create a browser application that also locates local browser functionality in the plug-ins, so that the plug-ins not only provides the ability to access and handle resources using particular content formats and transfer protocols, but also makes the browser itself modular in the sense that functions can be added and removed by the user.
According to the present invention there is provided a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a kernel program or programs, the browser application also including one or more additional programs which are incorporated according to preferences, these preferences being changeable.
According to another aspect of the present invention there is provided a browser application upon a client computer used by a user for accessing a resource over a network from a server computer, the browser application including a kernel program which is preset, the browser application also including one or more additional programs which are incorporated according to actions made by the user.
According to another aspect of the present invention there is provided a method of creating a browser application, the browser application including a kernel program which is preset, the application also including one or more additional programs which are incorporated according to actions made by the user. According to another aspect of the present invention there is provided a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the graphical user interface including selectable representations of functions, the representations being alterable according to actions made by the user.
According to another aspect of the present invention there is provided a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, wherein the graphical interface includes a first set of selectable representations of functions and/or status bars, and further including a switching means such that the first set may be substituted for a second set of selectable representations of functions and/or status bars.
According to another aspect of the present invention there is provided a browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a JavaScript debugging application.
According to another aspect of the present invention there is provided a browser application upon a client computer used by a user for accessing a formatted resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser application including a means of displaying the nodes and/or subnodes of a resource as a document object model.
According to another aspect of the present invention there is provided a method of accessing a resource over a network from a server computer by a browser application upon a client computer used by a user and displaying at least part of the resource on a graphical user interface, the browser application sending an identifier associated with display or function preferences, the server computer generating the form of the resource in response to the identifier. According to another aspect of the present invention there is provided a resource as herein defined.
According to another aspect of the present invention there is provided a computer client system programmed with a browser application as herein defined.
According to another aspect of the invention, there is provided a computer program product stored on a computer readable medium and constituting, when installed on a client computer, a browser application upon a said client computer as herein defined.
A browser according to the invention will now be described, by way of example, with reference to the accompanying drawings, in which:
Figure 1 shows the architecture of the modules of the browser;
Figure 2 shows the structure of the HTTP renderer module;
Figures 3 and 4 show different skins of the IDE;
Figures 5 and 6 show a miniaturised IDE;
Figures 7 and 8 show different language choices applied to the IDE;
Figures 9 to 11 show the display of favourite items in the IDE;
Figure 12 shows a contextual menu;
Figure 13 shows the browser IDE and an editing window;
Figures 14 to 16 show the browser IDE and a viewing window;
Figure 17 shows another editing window;
Figure 18 shows a second browser IDE being open from a first; Figures 19 to 21 show the LAN and ftp explorer panel;
Figure 22 shows a ftp dialog box panel;
Figure 23 shows a schematic view of the information flow between the browser and an Internet portal;
Figures 24 and 25 show the general operation of the Browser;
Figures 26 to 31 show details of the Browser operation.
Referring to figure 1 , the browser application is modular in form. The browser includes a Core Browser Open API Services module 20. This module interfaces with the other modules and controls their operation.
The browser includes a number of Content Handler modules 30 to interpret resources of different formats or languages (the material of these resources hereafter referred to simply as 'content') which may be encountered, and a number of Protocol Handlers modules 50 , to allow files to be transferred using the necessary or appropriate transfer protocol. Resources accessed over the Internet, or over other networks such as a LAN (Local Area Network) may be written in many different formats, and different resources may be transferred using different protocols.
The Browser also includes a number of Plug-in modules 70, which provide functions to enhance and improve the use of the Browser. Some functions may though be provided by the Core Browser Open API Services module.
Each module is written in Java. Java is a very convenient language for this application, since it is portable, modular and secure. The core services module is based on an open API (application program interface), which allows users to create and develop applications and services for the browser.
Java is a highly portable language that, is non-platform specific and may operate over a distributed network. The distribution and management of the different modules of the Web browser may therefore be carried out on the server side, to be retrieved and installed or executed by the client when necessary. The retrieval may be performed in a variety of ways, for example downloading a compressed file, and unzipping the file when required.
The Core Browser Open API Services module includes all the methods of accessing the functions of the modules.
In particular, the Core Browser Open API Services module returns the instance of the current services of the modules. The Core Browser Open API Services module can also retrieve the directory in which the browser is installed, instantiate a browser, can retrieve and set the browser's properties. The Core Browser Open API Services module provides access to all the modules in the event that an event occurs that signifies that module is needed, or if a second module requires the first module. When a new plug- in, language, panel, IDE (Integrated Development Environment) event listener, or other module or feature is added, this is added to the Core Browser Open API Services module registry so that the module can be called when required. Similarly, items may be removed from the registry when no longer required.
The Content Handlers shown here are a Database module 31 to interpret database files, an HTML + CSS + DOM2 module 32 for displaying Web pages, an XML module 35 for Web pages or data containing XML (Extensible Markup language), a Zip module 38 for decompressing and manipulating zip files, a Jar module 39 for decompressing and manipulating jar (Java Archive) files, an Image module 40 for displaying gif and jpeg files, a Directory module 42 for displaying directories and the directory structure, a sound module 44 for playing or manipulating sound files, a Text module 46 for displaying plain text files, an Applet module 48 for running applets, and a Netscape Plug-in module 49 for accessing Netscape plug-ins.
Other protocol modules, such as a SSL (Secure Sockets Layer) module to allows the SSL protocol to be used to give secure access to particular Web pages, may be included. In order to send and receive files using different protocols, the browser includes a number of Protocol Handlers 50, including a db module 52 for transferring database files, a File module 54 for transferring files using FTP (File transfer Protocol), an About module 56, an HTTP 57 module for transferring files using HTTP (Hyper Text Transfer Protocol), a Jar module 60 for transferring jar files, a Zip module 62 for transferring zip files, a Doc module 64 for transferring document files, and an HTTPS module 66 for allowing the Secure Hyper Text Transfer Protocol to be used.
The Plug-in modules 70 are divided into System Plug-ins 72, and User
Plug-ins 75. The System plug-ins include a Menu Manager module 73, and a IDE Manager Module 74. The User Plug-ins 75, which generally provide applications and tools for the Browser's user, includes a Bookmark Subscription module 80 for automatically caching updated versions of favourite pages, a G-spot module 82 for sending and receiving e-mail messages, a Skin Manager module 84, a Favourites Manager. 86, a History Manager module 88, a LAN and FTP Explorer module 89, and a New Language Manager module 90.
Referring to figure 2, the HTML + CSS + DOM2 module comprises an
HTML parser module 102, a DOM builder 104, a JavaScript module 106, a layout engine 108, a screen renderer 112, and a CSS parser 110. The content of the resource to be interpreted is brought from the network or the cache 101 to the HTML parser module 102 which parses the content, then a DOM (Document object model) representation 105 of the resource is built by the DOM builder 104. Any JavaScript embedded in the resource is run by the JavaScript module 106 using a Script Engine such as 'Mozilla Rhino' 107 available from the Mozilla organisation. A layout engine 108 processes the CSS attributes 109, and finally a Screen Renderer 112 displays the content.
The core services module and the HTML + CSS + DOM2 module together are the minimum practical module requirement for a user wishing to access Web pages.
The memory requirements of some of the modules is set out in table 1. Table 1;
Figure imgf000010_0001
TOTAL SIZE 2.1 MB
It will be seen that a functional browser may be provided taking up only 700 KB of the client computer. This is particularly useful for portable computers, PDAs (Personal Digital Assistant) and the like, where memory is at a premium.
Of course some capabilities of particular resources will not be utilised with this minimum requirement browser. The modular nature of the browser allows the user to choose to install only the modules that he needs. This makes efficient use of the client computers memory, since modules which are not needed will not be installed.
The IDE (integrated development environment) (which will usually be a GUI (graphical user interface)) is generally, managed by the IDE manager. The form of the IDE of the browser is controlled by the Skin Manager.
Referring to figures 3 and 4, different 'skins' are storable in association with the Skin Manager, these skins determine the characteristics of the IDE/GUI, for example the form of a first set of page back, page forward, stop download and refresh page buttons 120 on the standard toolbar 122. The skin may be changed by selecting a particular skin from a pull down menu 124, so that a new set of buttons 121 are substituted. The Skin Manager then registers the new skin so that it responds correctly to key and mouse events.
Each skin may control different aspects of appearance of the browser window, such as the size and arrangement of the window and toolbars, and the functions offered. A user may create or download skins and save them, so that the browser may be changed to different customised forms with ease and speed.
The Menu manager plug-in controls the content and hierarchy of the pull down menus. It also provides a method of allowing the menus to be manipulated. Menus may thus be created, modified, moved and deleted.
The appearance of the browser to the user may thus be controlled by the IDE manager, the skin manager and the Menu manager. Referring to figures 5 and 6, a browser having a reduced size skin is shown. In order to provide the most efficient use of space in this environment, the download status bar 130 includes a switching button 132 which replaces the download status bar with input buttons 134. The switching button 132 is present in the input button toolbar 135 also, so that the download status bar 130 may be easily restored.
New languages may be stored, and substituted by using the New language manager plug-in for the old language in which the menu options, prompts, etc. that appear in the browser IDE appear. The new languages are each stored as separate modules. Figure 7 shows a new language 142 being selected from a nested pull down menu 141, and figure 8 shows the IDE after the new language has been imposed on the browser, in particular upon the menu toolbar 140.
Referring to figures 9 to 11, the Favourites manager module manages a collection of links to bookmarked resources or 'favourites' which the user can delete or add to. In order to access the favourite sites, the user selects the 'show/hide' option 152 from a pull down menu 150 as shown in figure 9 if the favourite panel is not already open. The favourites 156 are then displayed in a hierarchical structure in a panel 156 of the IDE. The user may access a particular favourite by selecting it from this panel. Again using the pull down menu, the user may add and name favourites, create new directories, rename existing directories and favourites, and delete existing directories and favourites using a dialog box 158. The favourites are stored in a separate favourites module.
Referring to figure 12, more functions may be provided by a contextual menu 162, which may be summoned by the user at any time within the IDE 160 by right clicking with the mouse. Available options may typically include navigation options (back forward, stop download, reload page), copy document address, view the document's source code, save document, open a new IDE window, and close the existing window. The contextual window also includes a further tools menu, with offers web page construction tools such as displaying a visualisation of the DOM tree and a JavaScript debugger. Figure 13 shows the source code being viewed in a separate editor window 164, and figure 14 shows the DOM tree being viewed in another window 166.
Referring to figures 15 and 16, the DOM may be searched by selecting a portion 170 of the DOM, right clicking with the mouse to bring up a menu 172, and searching the HTLM elements, attributes or text within that portion using the resulting dialog box 174.
Referring to figure 17, the Javascript script debugger function, which may be selected from the tools menu of the contextual menu, opens a console 180 in which a user can execute script commands, evaluate expressions, and declare, execute and modify functions or objects. Other script languages, such as Microsoft Corporation's VBScript, and tcl commands, may be ., installed and supported.
Referring to figure 18, in addition to starting another browser instance from the contextual menu, a new browser window may be opened through selecting the pull down menu from the file option 181 of the menu toolbar 140, or by selecting a hyperlink on the displayed page with the left mouse button while simultaneously depressing the shift key.
The FTP and LAN explorer plug-in module allows the local area network, and any FTP links included in a configuration file to be explored. Referring to figure 19, the network's drives and folders are displayed in a conventional tree structure 194 in a panel 192 on the browser IDE. The tree may be navigated by single or double clicking to respectively select or open folders and files. The files within a selected folder are listed in the bottom section 196 of the panel. Right clicking on a file or folder gives the user a menu 198 to edit the local area network, depending upon the nature of the object selected, as shown in figure 20. For example, the user may have the options of adding and deleting directories, renaming, copying and pasting directories. The user has similar options for files, as shown in figure 21, which the user may select from the list at the bottom section 196 of the panel 192 and bring up a contextual menu 199. Similarly, referring to figure 22, the user may manipulate ftp sites through a dialog box panel 200, allowing the user to add ftp sites or delete ftp sites using buttons 202, and enter the ftp properties or change existing ftp properties using the fields 204. The user may also connect and disconnect through this panel.
Similarly, other types of Protocol Handlers may be made available, for example, a db Protocol Handler module for the transferral of databases, a
File Protocol Handler module is provided to access local files, a Zip Protocol Handler module to transfer zip files, a Jar Protocol Handler module to transfer jar files, Doc Protocol Handler module to transfer document files, a Https Protocol Handler module to transfer certificates, and a Ref Protocol Handler module to send directly to http (hypertext transfer protocol) referrers.
The Core Browser Open API Services module includes details of the client computer, and details that the user as entered concerning himself. Referring to figure 23, when the user uses the browser 210 to access a resource through a Web site of portal 220, the Core Browser Open API Services module sends a user ID including information concerning the client and/or the user. The site hosting the resource then dynamically adapts the resource being offered to the user, based upon the user details and upon published preferences. The user may then receive the resource in a way that is particular to him, and more useful than if a static resource had been made available to him.
Referring to figure 24, the steps of the operating the browser are typically as follows; the general Browser application module (listed in Annex 1) controls the instantiation of the browser application. Upon opening the browser, a new BrowserServices module 202 is called. The BrowserServices 202 loads the system plug-ins 204 and user plug-ins 206 according to the settings previously saved. The general Browser module retrieves the size and position of the browser's panel using the BrowserPanel module described below to launch a GUI 212, and an Event notifier 208 is activated and a Browsei DEListener 210 is added to receive and respond to user input or other events.
The on commencing the Browser (through the command testBrowser
302), an instance 304 of the BrowserServices module (listed in Annex 2) also forms part of the core of the browser application. Referring to figure 26, the BrowserServices module also calls the BrowserProtocolManager 306, the BrowserContentManager 310, the BrowserScriptManager 312, the BrowserMenuManager 314 and the PluginManager 316. The required protocol handlers and content handlers are loaded.
The PluginManager (listed in Annex 3) loads the necessary plug-ins, and the content of the resource is opened. The particular plug- ins loaded could, for example, be the language 214 it is wished to work in, the navigation program, such as the file manager 216, and other plug-ins 218 as required, such as plug-ins for different protocols, content handlers, favourite menus, etc.
Referring back to Annex 2, the BrowserServices module can get the current instances of the browser application, as well as setting their properties or removing instances of the browser. To do this, the Browser service checks from the root directory, and enumerates all instances of the browser. For a particular instance, the BrowserServices module calls modules necessary for displaying files on the browser, and associated functions. When getting a browser instance, the BrowserServices module calls the MenuManager module, the IDEManager module, the
ContentManager module 706 (shown in figure 30), and the CacheManager module.
The BrowserPluginManager co-ordinates other plugin modules, by enumerating the plugin modules, and the associated user names for the plugin modules. Referring to figure 29, in order to start the systems plug-ins, the BrowserService 604 calls a new BrowserPluginManager 606 and a new MenuManager 608. The BrowserPluginManager 606 requests the BrowserPluginManager 606 to start a new System Plugin. The BrowserPluginManager also starts a new SkinManager 609, which returns the IDEManager to BrowserServices, adds a BrowserlDEListener and calls the MenuManager before creating a Menultem to the MenuManager. The BrowserPluginManager further allows a new user to register preferences, causing those changes of languages, panels, and IDE listeners necessary for particular modules to be registered. Figure 27 shows the Browser services 406 being created by the testBrowser operation 402, with the user settings BrowserOptions 408 being inputted to the BrowserServices 406, which then loads the Browser according to those options, and loads a new BrowserlDEEvent 412 whilst notifying the EventManager module 414. Thβ resource is opened in the Browser, the BrowserService settings also been shown in the Browser.
For each module, the BrowserPluginManager also activates the BrowserlDEListeners, so that the plugin is responsive to events triggered by the user's actions (such as clicking on a link, or hitting a key). By locating and enumerating the browser's modules, the BrowserPluginManager also enables old plugins to be removed and new plugins to be loaded; this process may be used not only to add new plugins bringing new features to the browser, but to update an existing plugin. The BrowserPluginManager also manages menus modules and the menus owned by particular plugins, and is responsive to events occurring from the user choosing options.
When the browser has been opened and is responsive to the user, the general Browser module initiates modules to carry out functions equivalent to conventional operations of internet browsers, such as opening and closing documents, storing the document viewing history, navigating through the history, saving a document, refreshing the view of the document, and so on. Referring to figure 28, when the user indicates that another browser panel is to be added, the BrowserServices 502 calls the Browser module 504, and notifies the EventManager module 506. The EventManager initiates a new Browser, and this is communicated to the SkinManager 508, which loads the necessary images 510, buttons 512, panels 514, and Input 516 and registers 518 with the listeners in order that the new Browser panel responds to user input.
Referring to figures 24 and 30, when it is desired to receive a document or resource across a network, the BrowserServices module calls a new ProtocolManager 706 (which is listed in Annex 4) which calls the appropriate Protocol Handler 220, which sets the URL stream 222 to be interpreted. The protocol handlers used by the browser are registered and updated by the ProtocolManager so that they are available when required by the browser. The ContentManager module (listed in Annex 5) enumerates and registers the content Handlers present. When the user selects a file or resource, the ContentManager module identifies the type of content of the file or resource using the file extension or the mime type. The ContentManager then calls the appropriate content handler to interpret the content for display. One such module suitable for viewing html files is the AContentHandler module (listed in Annex 6). Referring to figures 24, 25 and 31, The BrowserServices calls 804 a new ContentManager 806 which loads a Content Handler 224 based on the contents MIME type (determined by the MIME Manager 226), and the content is loaded 227, and passed to the ContentHandler 228 to be displayed (the Java and native code being extracted and interpreted). The content formats (such as zip files 250, html files 251 and gif and jpeg files 252) are separated, and the HTML code is parsed by DOM Parser 230. The content is then processed using the Cascading Style Sheet renderer 232. The HTML is then passed to the HTML Handler 234 to be interpreted and displayed. The previously displayed content, if any, is removed, and the new content is stored in a cache. Directed by the content of the retrieved file, the AContentHandler module renders the images of the file, displays the background colours, displays the script portion of the file, sizes the document, and provides an appropriate scroll, updating the portion of the document being displayed 236 according to the way the user moves the scroll bars.
Referring to figure 32, the user inputs a URL 902, which is input into the Browser 904. The URL and/or connection parameters are sent to the
BrowserContentLoader 906, which initiates a new URLConnector 908. The MIME type is retrieved, and sent back to the BrowserContentLoader 906, which selects and loads the appropriate ContentHandler 910.
When the ContentHandler 910 is loaded, the URL Connector 908 interrogates the cache manager 912, and decides whether it necessary to make a network connection or whether the resource can be retrieved from the cache. The (typically html) content is retrieved from the NetURLConnection 908 or the Cache Manager 912, and this input stream 913 is fed to the content parser 914, which creates the DOM tree nodes 916, and carries out the Cascading Style Sheet 918 rendering as previously described. When the textual and other content associated with the marked-up language has been rendered, the it is checked whether the contents differ 920. If they do not differ, the rendering process is repeated for a further iteration. If however the contents do differ, the a ContentHandler 922 is called; if there is an Image 924 an ImageProducer 926 is called, which connects to the NetURLConnetion 928, and via this to the Cache Manager to receive the remaining parts of the resource's input stream 930 to obtain the image data.
The MenuManager module (listed in Annex 7) supplies the menu options for the browser GUI in response to requests from the
BrowserServices module. The MenuManager module can locate and enumerate all the ordinary (i.e. pull-down) menus and pop-up menus and sub-menus, and may also be used to create, delete and move menus. The browser operation buttons (for common functions such as Open file, Save file, New file, Exit file, Forward, Back, Reload, Stop, Refresh, etc.) present on the GUI are also included here the MenuManager module also.
When a menu option is chosen by a user, the event listener (BrowserlDEListener) calls the MenuManager, which gets the plugin corresponding to the menu choice.
If it becomes necessary to add a further viewing panel while using the browser, the BrowserServices module creates a new panel. The BrowserService module can thereby locate, enumerate, add, and delete panels, so that panels can be provided on the browser's GUI to show chosen files, menu options and other data.
As previously mentioned, the user may display and edit the JavaScript code embedded in a Web page or similar resource. When the user selects the JavaScript edit choice from a menu, the BrowserServices module calls a BrowserScriptManager module (which is listed in Annex 9). The Browsers criptManager module recognises the content type (for example from the file extension), and registers and sets the appropriate script editor, in this case a JavaScript editor, e.g. the 'Mozilla Rhino' Script editor. It will be realised that, in a similar way to the Content Handlers, additional Protocol Handlers may be developed over time, and existing Protocol Handlers updated, to take account of new or modified protocols.
As the Browser is written in with a modular and open architecture, it is relatively straightforward for third parties to develop other content handlers and protocol handlers. The browser may therefore be continuously updated to cope with new contents and protocols as they arise. In a similar way, other features may be added or modified.
The History manager plug-in module allows the user to display a history panel listing the Web pages or other resources that he has visited, listed in chronological order. This can assist the user in finding previously visited resources which have not been added to the user's favourites.
Because of the modular architecture of the Browser, the look and feel of the browser may be modified according to the user's preference, and by the Web site or Portal through which the user is currently accessing resources. Therefore the content of a particular resource may be used to determine how the content is displayed and edited, using the necessary services from the different Browser modules. Different types of content may be displayed using different content handlers and other modules within the same window.
The user may customise any aspect of the browser simply by adding a module to carry out a particular function, such as interpreting a new type of content, transferring resources in a particular protocol, or adding a new tool to the browser. The user may also modify existing functions by simply replacing the relevant module.
The particular modules installed on the machine may also be determined by the server, again according to published preferences or preferences specified by the user.
The invention as herein described and defined may also be implemented as a computer program product stored on a computer readable medium and constituting, when installed on a client computer, a browser application as described above. The computer readable medium may e.g. be a*\* CD-ROM or DVD-ROM disc, a magnetic storage medium such as a floppy - * disc or a hard disc, or it may even be a propagated signal carrying information describing the program instructions constituting the computer program or programs included in the computer program product.
It will be realised that the browser application may be effected in other languages which are amenable to being written and executed in a modular manner.
Annex 1 BrowserJava
package no .mc . tester ;
import java.io.*; import java.net.*; import ro .mc . util . imer ; import ro .mc . util . TimerInterface; import ro .mc . util . * ; import java.awt.*; import Java. util.*; import j ava . awt . event .* ; import no .mc .browser .services.*; import no .mc . protocol . http .* ; import no .mc .protocol. http. CacheManager; import ro .mc . util . * ; import ro .mc . component . text .* ; import no .mc . tester .menus .* ;
public final class Browser extends Frame implements IBro ser, IBrowserContext, CacheManagerConstants { private ITrobbler trobbler ; //este setat de SkinManager private ICacheManager cm = null;
//private static Vector historyEntries ; // global history private int activeLoaders ; // active loaders
//private Input input;
//private Controls controls; private boolean mode;
//folosit la commandTrobbler private boolean firstTimer=true;
//folosit la commandTrobbler
//private Status status; private Object chLock = new
Object ( ) ; // lock private Viewport viewport; // browser viewport [package acces] private MenuBar menuBar; // browser viewport private Vector historyList ; // browser history list private int historylndex; // browser history index private boolean updateHisto y; // if move in history //mmm private boolean documentFinished = true;
private CheckboxMenuItem checkboxMenu; // checkbox show/hide menu private CheckboxMenuItem checkboxlnput ; // checkbox show/hide input private CheckboxMenuItem checkboxControls; // checkbox show/hide controls private CheckboxMenuItem checkboxStatus ; // checkbox show/hide status
// toolbar buttons private static final int BACK = 0; // browser info private static final int FORWARD = 1; // browser info private static final int HOME = 2; // browser info private static final int STOP = 3; // browser info private static final int NEW = 4; // browser info private static final int REFRESH = 5; // browser info private static final int DIM = 23; // browser info private static final int STATE_ON_NORMAL = 0; // browser info private static final int STATE_ON_OVER = 1; // browser info private static final int STATE_OFF_NORMAL = 2; // browser info private static final int STATE_OFF_OVER = 3; // browser info / /Marcel final Panel panelTop = new Panel () ;
// panel host for top panels final Panel panelBottom = new Panel () ;
5 // panel host for bottom panels ) final Panel panelLeft = new Panel () ;
// panel host for left panels final Panel panelRight = new Panel () ;
// panel host for right panels 10 final Panel panelContent = new Panel ( ) ;
// panel host for panel content private Object [] specials = new Component [3] ; // special panels [ status /controls /input] 15 private booleanf] visibles = new boolean[4];
// special panels [status/controls/input/menu]
//End Marcel
20 /**
* constructor
*/
Browser (BrowserOptions options)
{ 25 super ( ) ; final ABrowserServices services = BrowserServices . getBrowserServices () ; // assure services initialization addWindowListener (new WindowAdapter ( ) 30 { public void windowClosing (WindowEvent event)
{ close ( ) ; 35 } public void windowActivated (WindowEvent event)
{ BrowserServices . activeBrowser = Browser . this ; 40 }
}) ;
// first browser
/* if 45 (BrowserServices . browsers . isEmpty ( ) ) String lis [ ] = ser ices.getGlobalHistory( historyEntries = new Vector (list . length<<l) ; // double the size for (int i=0 ; i<list . length ; i++) historyEntries. addElement (list [i] ) ;
} */
// init history setBackground( SystemColor .control) ; // set background color
setLayout (new BorderLayout ()) ; historyList = new Vector () ; historylndex = 0;
//Marcel add (panelTop, "North" ) ; panelTop . setLayout (new BrowserPanelLayout (panelTop, true) ) ; add (panelBottom, "South" ) ; panelBottom. setLayout (new BrowserPanelLayout (panelBottom, true) ) ; add (panelLeft , "West " ) ; panelLeft . setLayout (new BrowserPanelLayout (panelLeft, false) ) ; ad (panelRight, "East") ; panelRight . setLayout (new BrowserPanelLayout (panelRight, false) ) ; add (panelContent , "Center" ) ; panelLeft . add (new Button ()) ; panelContent . setLayout (new BorderLayout ( ) ) ;
//End Marcel
viewport = new Viewport (this, options .browserName) ; panelContent. add (viewport' //trebuie pusa dupa creare viewport deorece //se interogheaza viewportul despre numele sau setBrowserTitle ("")
/*Cipi new // init controls input = new Input ( ) ; controls = new Controls () ; status = new Status ();
Panel panelTop = new Panel (); panelTop . setLayout (new
BorderLayout panelTop . add (controls, "Center") ; panelTop . add (input, "South" ) ; add (panelTop, "North") ; add (status, "South" ) ;
*/
// add main viewport
//setMenuBar (createMenuBar ( ) ) ; // set menu bar
BrowserServices . browsers . put (getBrowserName ( ) , this) ; // register browser
// set options setResizable (options .isResizable) ; setLocation (options . location) ; setSize (options . size) ; // set control's visibility
setControlsVisible (options. hasControls) ; setStatusVisible (options . hasStatus ) ; setlnputVisible (options .haslnput) ; setMenuVisible (options . hasMenu) ; // set default update history updateHistory = true;
cm= (ICacheManager ) (new no .mc .protocol . http . CacheManager (this ) ) ;
} public ICacheManager getCacheManager ( )
{ return cm;
}
//nu e apelata; are scop de simetrie public void setCacheManager ( ICacheManager CacheManager)
{ this.cm= CacheManager;
}
public void setDocumentFmished (boolean finished) { documentFinished=finished; if (cm!=null)
( (CacheManager) cm) . setDocumentFmished (finished) ; }
k -k -k -k -k -k -k / /* IMPLEMENT 'IBrowser'
*/
-k -k - -k -k - -k /
* get browser name
*/ public final String getBrowserName ( ) { return viewport . getViewportName ( ) ;
}
/**
* get browser frame */ public final Frame getBrowserFrame ( )
{ return this; }
* get browser frame */ public final IBrowserViewport getBrowserViewport ( )
{ return viewport; }
/**
* open a document */ public final IBrowserViewport openDocument (String urlString, String mime, String viewportName, Hashtable properties)
{ return this . openDocument (urlString, mime, iewportName, properties, false) ;
}
public final IBrowserViewport openDocument (String urlString, String mime, String viewportName, Hashtable properties, boolean isFrameSet)
{ if (urlString==null | | urlString. length ()==0) return null; IBrowserViewport view = null; // get viewport if ( viewportName==null ) view = viewport;
// view = top viewport else
{ view = BrowserServices . findViewport (viewportName) ; // get viewport if ( "_blank" . equalsIgnoreCase (viewportName) ) // autorena e stuff viewportName = null; } if (view==null ) {
// clone current setings BrowserOptions options
= new BrowserOptions () ; options . rowserNa e = viewportName; if (properties ! =null)
// set option from properties
{
Object value = null; value = properties . get (IBrowser . BROWSER_LOCATION) ; if (value!=null && value instanceof Point) options . location = (Point ) value ; value = properties . get ( IBrowser . BROWSER_SI ZE) ; if (value !=null && value instanceof
Dimension) options. size = (Dimension) value; // value = properties . get (IBrowser . BROWSER_INNER_SIZE ) ; options . aslnput = properties . get (IBrowser . BROWSER_NO__INPUT) ==null; options . hasControls = properties . get ( IBrowser . BROWSER_NO_TOOLBAR) ==null; options . hasStatus = properties. get (IBrowser . BROWSER_NO_STATUS) ==null; options . hasMenu = properties . get (IBrowser . BROWSER_NO_MENϋ) ==null; options . isResizable = properties . get ( IBrowser . BROWSER_NO_RESIZE) ==null; } return BrowserServices .getBrowserServices () .createBrowser (option s) . openDocument (urlString, mime, null , roperties ) ;
}
Browser currentBrowser = (Browser ) view. getBrowser () ; // get current browser if ( vie ==currentBrowser .viewport) // test if viewport is top viewport { currentBro ser . setlnput (urlString) ;
currentBrowser . activate ( ) ;
} URL url = makeURL (urlString) ; if (url==null) // invalid URL [must report an error] return null;
//daca nu este frameset (deci este pagina normala) ar trebui sa se opreasca firele care aduc o pagina anterioara parasita. if (! isFrameSet ) //daca sunt frameset-uri nu trebuie sa se opreasca threadurile de aducere a paginilor
resetCacheManager (CM_EXPIRES_ONCE ]
// set update history boolean oldUpdate = currentBrowser . updateHi story; currentBrowser . updateHistory = oldUpdate && (properties==null | | properties. ge (IBrowser. BROWSER_NO_HISTORY) ==null) ; // update flag for history
//loads the content
currentBrowser .loadContent (view, url, mime, null , proper ties) ; currentBrowser . updateHistory = oldUpdate; return view; }
* open a document */ public final void openDocument (AContentHandler handler , IBrowserViewport view, String urlString, String mime , Hashtable parameters)
{ URL url = null; try { url = new URL (urlString) ; } catc (Exception ex) { } if (url==null | | handler==null ) return; ContentLoader loader = new ContentLoader (handler, view, url, mime, parameters ) ; loader = null;
}
* reload document from/without cache */ public final void reloadDocument (boolean fromCache)
{
AContentHandler handler = viewport . getContentHandler ( ) ; if (handler==null | | handler . getURL ( ) ==null) return; updateHistory = false; / /mmm resetCacheMana'ger (CM_EXPIRES_ALWAYS ) ; Point scroll = new Point (handler .getScrollPositionX() , handler .getScrollPosit ionY ( ) ) ;
loadContent (viewport, handler. getURL () , handler. getCon tentType () , scroll, null) ; updateHistory = true; }
/**
* stop loading document */ public void stopDocument ( ) {
(new Thread () { public void run ( ) { CacheManager cm = (CacheManager) getCacheManager ( ) ; cm. setCommand (CM_COMMAND_STOPTHREADS) ; cm. stop ( ) ; //nu se mai da GET cm. getStatus() .resetInfoCacheObject() ; //resets the values for the info object viewport . stop ( ) ;
} }) .start () ; activeLoaders = 0; //commandTrobbler (false) ; }
/**
* go to back document */ public final void backDocument ( ) { if (historylndex<=0) // at the first item return; updateHistory ( ) ; historylndex--; HistoryEntry hentry =
(HistoryEntry) historyList. elementAt (historylndex) ;
Viewport view = (Viewport ) BrowserServices. findViewport (hentry. docViewport
) ; if (view==null | | view . getBrowser ( ) !=this) // invalid viewport , make top viewport view = viewport; updateHistory = false; //mmm resetCacheManager (CM_EXPIRES_NEVER) ;
loadContent (view, hentry. docURL, hentry . docType, hentry . docPosition, null) ; updateHistory = true;
}
/ * *
* go to forward document */ public final void forwardDocument ( ) { if (historyIndex>=historyList . size ( ) - 1) // at the last item return; updateHistory ( ) ; historyIndex++; HistoryEntry hentry = (HistoryEntry) historyList. elementAt (historylndex) ; Viewport view =
(Viewport) BrowserServices. findViewport (hentry . docViewport
) ; if (view==null | | view . getBrowser ( ) !=this) // invalid viewport , make top viewport view = viewport; updateHistory = false; resetCacheManager (CM_EXPIRES_NEVER) ;
loadContent (view, hentry . docURL, hentry . docType, hentry . docPosition, null ) ; updateHistory = true; }
private void resetCacheManager ( int expires)
{ //Maria - CacheManager:
CacheManager cm = (CacheManager ) getCacheManager () ; if (cm!=null) { cm. setCommand (CM_COMMAND_STOPTHREADS) ; cm. stop ( ) ; cm. getStatus() .resetInfoCacheObject() ; //resets the values for the info object cm. setCommand (CM_COMMAND_GET) ;
//resets the GET command cm. setDocumentExpiry (expires ) ; //sets the expiry policy
// setDocumentFmished (false) ; //mmm }
}
* prompt for save */ public final void saveDocument ( ) { saveDocument (null) ; }
/**
* save current document from current viewport */ public final void saveDocument ( String docName' {
AContentHandler handler = viewport . getContentHandler ( ) ; if (handler ! =null )
handler. saveContent (docName ) ;
}
/ * *
* save current document from view port */ public final void saveDocument (String docName , String viewportName)
{
Viewport view = (Viewport ) BrowserServices . findViewport (viewportName) ; if ( view==null') return; AContentHandler handler = view. getContentHandler () ; if (handler ! =null )
handler. saveContent (docName) ; }
/**
* refresh IDE */ public final void updateGUI ( )
{ super . validate () ;
}
/**
* activate browser */ public final void activate ( ) { setVisible (true) ; requestFocus () ; }
/**
* close browser
*/ public final void close ()
{
CacheManager cm = (CacheManager) getCacheManager ( ) ;
cm. setCommand (CM_COMMAND_STOPTHREADS) ; cm. stop ( ) ; //nu se mai da GET
cm. getStatus () .resetInfoCacheObject() ; //resets the values for the info object
//viewport.reset () ; // reset viewports [that will destroy also content handlers] viewport . destroy () ;
setVisible (false) ; dispose ( ) ; /* if (BrowserServices . browsers . size () =-1 ) // last browser
{
Vector list = historyEntries; int size = list.size(); if (size>200) size = 200;
ABrowserServices services = BrowserServices . getBrowserServices () ;
services . removeSection ( "History" ) ; while (size-->0) services . setProperty ( "History" , "h"+size , (String) list . elementAt ( size) ) ; } * /
BrowserServices . closeBrowser ( getBrowserName ( ) ) ; }
* close browser * / public final void exit ( )
{
Enumeration enumeration = BrowserServices. browsers. elements ( ) ; while (enumeration . hasMoreElements (
( (Browser) enumeration . nextElement () ) .close () ; }
//Marcel old
* set status visible
*/ public final void setStatusVisible (boolean visible
{ visibles[0] = visible; IBrowserPanel panel = ( IBrowserPanel ) specials [0] ; if (panel==null | ] panel. isVisible() ==visible) return; panel . setVisible (visible ) ; validate ( ) ; } **
* get status visible
*/ public final boolean isStatusVisible ( )
{ return visibles [ 0] ; }
* set controls visible */ public final void setControlsVisible (boolean visible '
{ visibles[l] = visible; IBrowserPanel panel = (IBrowserPanel) specials [1] ; if (panel==null | | panel. is isible () ==visible) return; panel. setVisible (visible) ; validate ( ) ; }
* get controls visible
*/ public final boolean isControlsVisible ( )
{ return visibles [1];
}
* set input visible
*/ public final void setlnputVisible (boolean vi sible )
{ visibles [2] = visible; IBrowserPanel panel = (IBrowserPanel) specials [2] ; if (panel==null | | panel. isVisible ( ) ==visible ) return; panel. setVisible (visible) ; validate ( ) ; }
/* *
* get input visible
*/ public final boolean islnputvisible ( )
{ return visibles [2 ] ;
} * set menu visible
*/ public final void setMenuVisible (boolean visible'
visibles [3] = visible; if ( visible== (getMenuBar ( ) !=null) return; if (visible)
BrowserMenuManager . updateMenuBar ( this ) ; else setMenuBar (null ) ; }
* get menu visible
*/ public final boolean isMenuVisible ( )
{ return visibles [3];
}
//End Marcel
/*Cipi new public final void setStatusVisible (boolean visible)
{ status . setVisible (visible ) ; checkboxStatus . setState (visible) ; validate ( ) ; }
public final boolean isStatusVisible ( ) { return status . isVisible () ; }
public final void setControlsVisible (boolean visible' controls . setVisible (visible) ; checkboxControls . setState (visible) ; validate ( ) ;
}
public final boolean isControlsVisible
{ return controls . isVisible () ;
}
public final void setlnputVisible (boolean visible)
input. setVisible (visible) ; checkboxlnput . setState (visible) ; validate ( ) ; }
public final boolean islnputvisible ( )
{ return input . isVisible () ;
}
public final void setMenuVisible (boolean visible)
if ( visible== (getMenuBar ( ) !=null) return;
setMenuBar ( (visible) ?createMenuBar ( ) : null ) ; checkboxMenu .setState (visible) ; }
public final boolean isMenuVisible ( )
{ return getMenuBar ( ) !=null;
}
//End Cipi new
*/
* set browser size * / public final void setBrowserSize (int width, int height)
setSize (width, height) ;
}
* get browser size */ public final int getBrowserWidth ( ) { return getSize() .width;
} **
* get browser size */ public final int getBrowserHeight (
{ return getSize() .height;
}
* set browser location
*/ public final void setBrowserLocation ( int x,int y;
{ setLocation (x, y ) ;
}
/ -k -k
* get browser location */ public final int getBrowserX ( )
{ return getLocation ( ) .x;
} **
* get browser location
*/ public final int getBrowserY ( )
{ return getLocation ( ) . y; }
* set browser title
*/ public final void setBrowserTitle ( String title) { setTitle (" [Tester 0.69 - "+viewport . getViewportName ( ) +" ] "+title);
}
/**
* get browser title */ public final String getBrowserTitle ( ) {
String title = getTitle(); return title. substring(title.indexOf ("] "+2));
}
public final void setStatus (String info) { if (specials[0] !=null && (specials [0] instanceof IBrowserStatus))
( (IBrowserStatus) specials [0] ) .setStatus (info) ; }
public final String getStatus ( ) { if (specials[0] !=null && (specials[0] instanceof IBrowserStatus)) return
( ( IBrowserStatus ) specials [0] ) .getStatus () ; return ""; }
/*Cipi new public final void setStatus ( String info)
{ status. setStatus (info) ; } public final String getStatus () { return status . etStatus () ; }
//End Cipi new */
* set browser status
*/ public final void setTransientStatus ( String info '
{
//Marcel if (specials[0] !=null && (specials [0] instanceof IBrowserStatus))
( (IBrowserStatus) specials [0] ) .setTransientStatus (inf o) ;
}
public final void setFinalStatus ( String info)
{ //Marcel if (specials[0] !=null && (specials [0] instanceof IBrowserStatus))
( (IBrowserStatus) specials [0] ) . setFinalStatus (info) ; }
public void resetFinalStatus ( )
{ if (specials [0] ! =null && (specials[0] instanceof IBrowserStatus))
( (IBrowserStatus) specials [0] ) .resetFinalStatus () ; }
* get browser status
*/ public final String getTransientStatus
{
//Marcel return getStatus ( ) ;
//return status . getTransientStatus () }
public void resetStatus ( ) // reset status after a set transient status
{ if ( specials [0] ! =null && (specials [0] instanceof IBrowserStatus))
( (IBrowserStatus) specials [0] ) .resetStatus () ; }
/*Cipi new public final void setlnfo ( String info)
{ status . setlnfo (info) ; }
public final String getInfo()
{ return status . getlnfo () ;
} public final void setlnput (String info)
{ input . setlnput.(info) ; }
public final String getlnput() { return input . getlnput () ;
}
End Cipi new */
/ **
* set browser info */ public final void setlnfo ( String info) { if (specials[0] !=null && (specials[0] instanceof IBrowserStatus))
( (IBrowserStatus) specials [0] ) .setlnfo (info) ; } * get browser info
*/ public final String getInfo()
{ if (specials [0] ! =null && (specials[0] instanceof IBrowserStatus)) return ( (IBrowserStatus) specials [0] ) . getlnfo ( ) ; return " " ; }
/**
* set input text
*/ public final void setlnput ( String info)
{ if (specials [2] ! =null && (specials [2] instanceof IBrowserlnput ) )
( ( IBrowserlnput) specials [2] ) . setlnput (info) ; }
/**
* get input text
*/ public final String getlnput()
{ if (specials [2] ! =null && (specials[2^ instanceof IBrowserlnput) ) return ( ( IBrowserlnput) specials [2] ) . get Inpu ( ) ; return ""; }
/**
* get back history
*/ public final String [] getBackHistory ( )
{ Vector vret = new Vector (); int i = historylndex; while (i>0) { HistoryEntry hentry = (HistoryEntry) historyList . elementAt (i-- ) ;
vret . addElement (hentry . docURL . toExternalFor ( ) ) ;
}
String ret [ ] = new String [vret . si ze ( ) ] ; vret . copylnto ( ret ) ; return ret ; }
/ * *
* get forward history
V public final String [] getForwardHistory ( )
{ Vector vret = new Vector () ; int i = historylndex; int size = historyList . size () ; while (i<size) { HistoryEntry hentry =
(HistoryEntry) historyList . elementAt (i++) ;
vret . addElement (hentry . docURL . toExternalFor ( ) ) ;
} String ret [] = new
String [vret . size ()] ; vret. copylnto (ret) ; return ret; }
* set update history mode
*/ public final boolean setUpdateHistory (boolean mode)
boolean oldMode = updateHistory; updateHistory = mode; return oldMode; * set scale factor */ public final void setScaleFactor ( float factor)
{ if (factor>=0.1f && factor<=3f) {
AContentHandler handler = viewport . getContentHandler ( ) ; if (handler ! =null)
handler. setScaleFactor (factor) ;
} } **
* get scale factor */ public final float getScaleFactor ( )
{
AContentHandler handler = viewport . getContentHandler ( ) ; if (handler ! =null) return handler . getScaleFactor () ; return If; }
"k ~ " & -k -k I
/* IMPLEMENT 'IBrowserContext'
*/
-k -k -k -k -k -k -k /
/ ** * get the browser where is happened the action
*/ public final IBrowser getBrowser ()
{ return this; } * get the viewport where is happened the action */ public final IBrowserViewport getViewport ( )
{ return viewport;
}
/**
* get the document where is happened the action */ public Object getDocument ( )
{ AContentHandler handler = viewport . getContentHandler ( ) ; return (handler ! =null) ?handler . getDocument ( ) : null; }
k'k-k-k'k'k- /
/* extra functions */
k-k- -k-k-k-k /
/**
* Open a new browser
*/ private final void seeAs (String mime)
{
AContentHandler handler = viewport . getContentHandler ( ) ; if (handle ! =null && handler. getURL () !=null)
openDocument (handle . getURL () .toString() , mime, getBro wserName ( ) +" ("+mime+") ",null);
} * test if can push back
*/ private final boolean canGoBackf)
{ return (historylndex>0 ) ; }
/**
* test if can push back *
*/ private final boolean canGoForward ( ) { return (historyIndex<historyList . size ( ) -1 ) ; }
/**
* create menu bar
* is used in the mobile version */ private final MenuBar createMenuBar ( ) { if (menuBar ! =null ) return menuBar; MenuBar bar = new MenuBar () ; Menu file = new Menu ( "File" ) ; Menu view = new Menu ( "View" ) ; bar . add ( file) ; bar . add (view) ; // listeners
ActionListener menuListener = new ActionListener ( )
{ public void actionPerformed (ActionEvent event')
{ Menultem item = (Menultem) event . getSource () ; String label = item. getLabel ( ) ; if (label .equals ( "New") )
{
String newBrowser = null; IBrowser brw = BrowserServices . getBrowserServices ( ) .createBrowser (newBro wser) ;
brw. setlnput (Browser . this . getInput ( ) ) ; } else if (label . equals ( "Close" ) ) c1 o s e ( ) ; else if (label . equals ( "Exit " j ) exit(); else if (label . equals ( "Open" ) ) {
FileDialog fdo = new FileDialog (Browser . this, "Open file", FileDialog . LOAD) ;
fdo.setDirectory (BrowserServices.lastDirectory) ; fdo .setVisible (true) ; if (fdo. getFile () !=null) {
BrowserServices.lastDirectory = fdo . getDirectory () ;
openDocument ( "file : /"+fdo . getDirectory ( ) +fdo . getFile ( ) , ull, null, null) ; }
} else if (label . equals ( "Back" ) ) backDocument ( ) ; else if (label . equals ( "Forward" ) ) forwardDocument ( ) ; else if (label . equals ( "Stop" ) ) stopDocument ( ) ; else if (label . equals ( "Reload" ) ) reloadDocument (false) ; else if (label . equals ( "See as html ...")) seeAs ( "text /html" ) ; else if ( label . equals ( "See as text ...")) seeAs ("text/plain") ; else if (label . equals ( "See as tree ...")) seeAs ("dom/tree") ;
} };
ItemListener checboxListener = new ItemListener ( ) { public void itemStateChanged (ItemEvent event)
{ CheckboxMenuItem item = (CheckboxMenuItem) event.getSource() ; boolean checked = item. getState ( ) ; if (item==checkboxMenu) setMenuVisible (checked) ; else if (item==checkboxControls ) setControlsVisible (checked) ; else if (item==checkboxInput ) setlnputVisible (checked) ; else if (item==checkboxStatus ) setStatusVisible ( checked) ; }
};
Menultem menultem; // File-New file . add (menultem = new Menultem ("New") ) ;
menultem. addActionListener (menuListener) ; menultem. setShortcut (new MenuShortcut ( ' N ' ) ) ; // File-Open file . add (menultem = new Menultem ( "Open") ) ;
menultem. addActionListener (menuListener) ; menultem. setShortcut (new
MenuShortcut ( ' P' ) ) ;
// File-Exit file . add (menultem = new Menultem ("Close") ) ;
menultem. addActionListener (menuListener) ;
//menultem. setShortcut (new MenuShortcut ( 'C ) ) ;
// File-sparator file . add (menultem = new Menultem ("-
" ) ) ;
// File-Exit file . add (menultem = new
Menultem ("Exit") ) ; menultem. addActionListener (menuListener) ; menultem. setShortcut (new MenuShortcut ( 'X' ) ) ; // View-Back view . add (menultem = new Menulte ( "Back" ) ) ;
menultem. addActionListener (menuListener) ; menultem. setShortcut (new
MenuShortcut ( ' B' ) ) ;
// View-Forward view . add (menultem = new Menultem ( "Forward" ) ) ;
menultem. addActionListener (menuListener) ; menultem. setShortcut (new MenuShortcut ( ' F* ) ) ;
// View-Stop view . add (menultem = new
MenuIte C'Stop") ) ;
menultem. addActionListener (menuListener) ; menultem. setShortcut (new MenuShortcut ( 'S' )) ;
// View-Reload view . add (menultem = new Menultem ("Reload") ) ;
menultem. addActionListener (menuListener ) ; menultem. setShortcut (new MenuShortcut ( ' R' ) ) ;
// View-See as .. menu
Menu see; view. add (see = new Menu ("See as.."));
// View-See as-See as html see . add (menultem = new Menulte ( "See as html ...")); menultem. setShortcut (new MenuShortcut ( 'H' )) ;
menultem. addActionListener (menuListener) ;
// View-See as-See as text see . add (menultem = new Menultem ( "See as text ...")); menultem. setShortcut (new MenuShortcut ( ' E ' ) ) ;
menultem. addActionListener (menuListener) ; // View-See as-See as tree see . dd (menultem = new Menulte ( "See as tree ...")); menultem. setShortcut (new MenuShortcut ( ' T * ) ) ;
menultem. addActionListener (menuListener) ;
// View-separator view.add(new Menultem ("-")) ; // View-Menu view. add (checkboxMenu = new
CheckboxMenuItem ("Menu") ) ;
checkboxMenu . addltemListener (checboxListener) ; checkboxMenu .setState (true) ; // View-Toolbar view . add ( checkboxControls = new CheckboxMenuIte ("Toolbar") ) ;
checkboxControls . addltemListene (checboxListener) ; checkboxControls . setState (true) ;
// View-Input vie . add (checkboxlnput = new CheckboxMenuItem ( "Input ") ) ;
checkboxlnput . addltemListener ( checboxListener ) ; checkboxlnput . setState (true) ; // View-Status view . add (checkboxStatus = new CheckboxMenuItem ( "Status") ) ;
checkboxStatus. addltemListener (checboxListener) ; checkboxStatus . setState (true) ; return bar; }
* check url string
*/ private static final URL makeURL ( String urlString) {
// check file
File file = new File (urlString) ; if (file . exists ( ) ) // exists as file urlString = "file:/" + file . getAbsolutePath ( ) ;
// make completion boolean complete = true; char chars [ ] = urlString . toCharArray ( ) ; for (int i=0 ; i<chars . length ; i++) { if (chars [i]==' . ' | | chars [i]==' : ' || chars [i] ==' \ ' \ \ chars [i] =='/' )
{ complete = false; break;
} } if (complete)
// complete url based on "www" + "com" urlString = "http : //www . " + urlString + " . com" ; URL urlOrig = null; try
{ urlOrig = new URL (urlString) ; // check url if is valid return urlOrig;
} catch (Exception ex) // invalid url [not completed] { try
{ URL url = new URL ( "http : //"+urlString) ; // complete url based on "http" return url;
} catch (Exception exc)
{ } } return null; }
* load content from URL & target to viewport
...if in history scroll to position */ private final void loadContent ( IBrowserViewport view, URL url, String mime, Point position, Hashtable parameters)
{ if (url==null | | view==null) return; if ( view==viewport ) // test if viewport is top viewport
setlnput (url . toExternalForm ( ) ) ; if (updateHistory)
addHistoryEntry (view, url , ime, position) ;
ContentLoader loader = new ContentLoader (view, url, mime, position, parameters ) ; loader = null; }
final IBrowserViewport loadContent (URLConnection connection, String target , Hashtable parameters) { IBrowserViewport view =
BrowserServices . findViewport (target) ; if (view==null) return null; return ( (Browser) iew.getBrowser() ) .loadContent (connection, view, parameters ) ; }
private final IBrowserViewport loadContent (URLConnection connection, IBrowserViewport view, Hashtable parameters)
{
URL url = connection . getURL () ; if ( view==viewport ) // test if viewport is top viewport setlnput (url . toExternalForm ( ) ) ; addHistoryEntry (view, url, null, null) ; // add automat to history ContentLoader loader = new
ContentLoader (view, connection, parameters ) ; loader = null; return view;
} //Marcel
/ -k -k
* add a new panel to a host */ final boolean addBrowserPanel ( IBrowserPanel panel)
{
int location = panel . getPanelLocation ( ) ; if
(location==IBrowserIDEManager . HOST_PANEL_TOP)
panelTop . add ( (Component ) panel ) ; else if (location==IBrowserIDEManager.HOST_PANEL_BOTTOM)
panelBottom. add ( (Component ) panel ) ; else if (location==IBrowserIDEManager.HOST_PANEL_LEFT)
panelLeft . ad ( (Component ) panel ) ; else if (location==IBrowserIDEManager . HOST__PANEL_RIGHT)
panelRight . add ( (Component) panel) ; else return false; String name = panel . getPanelName () ; if (panel instanceof IBrowserStatus) { specials [0] = panel;
setStatusVisible (isStatusVisible if (IBrowserIDEManager . PANEL_CONTROLS . equals (name) )
{ specials [1] = panel;
setControlsVisible (isControlsVisible ( ) ) ;
} if (panel instanceof IBrowserlnput) { specials [2] = panel;
setlnputVisible (islnputvisible () ) ;
} validate ( ) ;
return true;
* remove a new panel to a host
*/ boolean removeBrowserPanel ( IBrowserPanel panel) {
switch (panel . getPanelLocation () ) { case IBrowserlDEManager . HOST_PANEL_TOP : panelTop . remove ( (Component) panel) ; break; case
IBrowserlDEManager . HOST_PANEL_BOTTOM : panelBottom. remove ( (Component) panel ) ; break; case IBrowserlDEManager . HOST_PANEL_LEFT : panelLeft. remove ( (Component) panel) ; break; case IBrowserlDEManage . HOST_PANEL_RIGHT : panelRight . remove ( (Component) panel) ; break; default : return false;
} validate ( ) ;
return true;
* *
* add a new panel to a host */ final IBrowserPanel [ ] getBrowserPanels ( ) {
Vector list = new Vector () ; Component components [] ; // filter top panel components = panelTop . getComponents ( ) ; for (int i=0 ; Kcomponents . length ; i++)
{ if ( components [i] instanceof
IBrowserPanel) list . addElement (components [i] ) ;
}
// filter bottom panel components = panelBottom. getComponents ( ) ; for (int i=0 ; Kcomponents . length ; i++)
{ if (components [i] instanceof
IBrowserPanel) list . addElement (components [i] ) ;
}
// filter left panel components = panelLeft . getComponents ( ) ; for (int i=0 ; i<components . length ; i++)
{ if (components [i ] instanceof
IBrowserPanel) list . addElement (components [i] ) ;
}
// filter right panel components = panelRight . getComponents ( ) ; for (int i=0 ; Kcomponents . length ; i++) { if (components [i] instanceof IBrowserPanel ) list . addElement (components [i] ) ;
} IBrowserPanel ret [ ] = new
IBrowserPanel [list. size () ] ; list . copylnto ( et ) ;
return ret;
//Marcel end
* to string
* / public final String toString ( )
{
Dimension size = getSize(); Point loc = getLocation ( ) ; return "Browser [name="+ getBrowserName ( ) +
, sιze: + size. width +
", "+size . height +
, location=" + loc.x + ","+loc.y +
,menu=" + isMenuVisible ( ) +
, controls=" + isControlsVisible ( ) +
, status=" + isStatusVisible ( ) +
, input=" + isStatusVisible () + "]";
/ * * * update history position for current entry
*/ private final void updateHistory ( )
{ if (historyList . isEmpty () ) return; HistoryEntry hentry = (HistoryEntry) historyList . elementAt (historylndex) ;
Viewport view = (Viewport ) BrowserServices .findViewport (hentry. docViewport ) ; if (view==null) return; AContentHandler handler = view. getContentHandler () ; hentry . docPosition = new
Point (handler . getScrollPositionX ( ) , handler .getScrollPosit ionY() ) ;
}
/**
* add a new item in history
*/ private final void addHistoryEntry ( IBrowserViewport view, URL url, String mime, Point pos)
{ int size = historyList . size () ; if (historyIndex<size-l ) // truncate history list from current index { historyIndex++;
historyList. setSize (historylndex) ;
} else
// append to history historylndex = size; // add new entry HistoryEntry newEntry = new HistoryEntry (url, view. getViewportName ( ) , mime , pos) ; historyList . addElement (newEntry) ; // update previous entry AContentHandler handler = vie . getContentHandler ( ) ; if (handler=:=null | | historylndex==0 ) return; Point scroll = new Point (handler . getScrollPositionX ( ) , handler .getScrollPosit ionYO ) ; HistoryEntry updatedEntry = new HistoryEntry (handler. getURL ( ) , view . getVie portName ( ) , hand ler.getContentType ( ) , scroll) ;
historyList. setElementAt (updatedEntry, historylndex- 1) ;
}
/ -k -k * show an error
*/ private final void showError ( String url, String error)
{ new
BrowserDialog ( this , BrowserDialog . DTALOG_ALERT, "Error", "UR L error : "+url+"\nException : "+error , " " ) ; }
public void setTrobbler ( ITrobbler trobbler)
{ this . trobbler=trobbler;
}
* command trobbler
*/ public final void commandTrobbler (boolean mode)
{ if ( trobbler==null) return; if (mode)
{ if ( thi s . mode==mode ) return ; thi s . mode=mode ;
trobbler . commandTrobbler ( true ) ;
/ * if ( firstTimer )
{
Timer . startTimer (controls, 0,100, true) ; firstTimer=false;
} else Timer . resumeTimer (controls, 0) ;
*/ } else { if (this .mode==mode ) return; this .mode=mode;
trobbler . commandTrobbler ( false) ;
/*
Timer . pauseTimer (controls, 0) ;
//Stopul trebuie pus in destroy
//Timer . stopTimer (controls , 0 ) ;
//counter = -1; // reset trobbler image
controls . timerEvent (0' */
/* activeLoaders += (mode)?l:-l; // update active loaders if (mode && ! imer . isTimer ( controls, 0) )
Timer . startTimer (controls, 0,100, true) ; else if (activeLoaders<=0 ) {
Timer . stopTimer (controls , 0 ) ; controls . counter = 6; // reset trobbler image controls . timerEvent ( 0) ; activeLoaders = 0;
}
*/ } * *
* browser history entry
*/ final class HistoryEntry {
URL docURL; // document
URL
String docViewport; // document viewport String docType; // document content type
Point docPosition; // document position (for scroll)
/**
* constructor */
HistoryEntry (URL url, String viewport , String mime, Point pos) { docURL = url; docViewport = viewport; docType = mime; docPosition = pos; }
}
/**
* browser history entry */ final class ContentLoader implements Runnable
{ private IBrowserViewport contentViewport ; // browser viewport private AContentHandler ContentHandler = null; // content handler private URL contentURL;
// content url private URLConnection contentConnection; // content connector private String contentType
= null; // mime type [imposed] private Hashtable contentParameters; // parameters for init private Point contentPosition; // scroll position
/** * constructor used internal for POST
*/
ContentLoader (IBrowserViewport viewport , URLConnection connection, Hashtable parameters)
{ // inited properties contentViewport = viewport; contentConnection = connection; contentParameters = parameters;
(new Thread (this, "ContentLoader [POST] : "+connection . getURL ( ) . toString ( ) ) ) . start ( ) ;
}
* constructor used internal for embeded document
*/ ContentLoader (AContentHandler handler , IBrowserViewport viewport , URL url, String mime, Hashtable parameters)
{
// iήited properties ContentHandler = handler; contentViewport = viewport; contentURL = url; contentType = mime; contentParameters = parameters;
(new Thread (this, "ContentLoader [EMBED] : "-l-url .toString ())). start () ;
}
/**
* constructor used internal for embeded document
*/ ContentLoader (IBrowserViewport viewport, URL url, String mime, Point position, Hashtable parameters )
{ // inited properties contentViewport = viewport; contentURL = url; contentParameters = parameters ; contentType = mime; contentPosition = position; (new Thread (this, "ContentLoader [OPEN] : "+url . toString ( ) ) ) . start ( ) ; }
/**
* run method */ public final void run ( )
{
//commandTrobbler (true) ;
//mmm
Browser browser=Browser . this ;
AContentHandler handler = ContentHandler; boolean mustlnit = true; boolean isApplet = false;
URLConnector conector = new URLConnector (contentURL, contentType, null) ; // have to treat encoding [ ! ! ]
if (contentType ! =null && contentType . equalsignoreCase ( "application/j ava" ) ) isApplet = true; if ( ! isApplet)
{ if (contentURL != null)
( (CacheManager) cm) . addMirrorRequest (contentURL, (IBrowser ) browser ) ; if (contentConnection ! =null ) { conector = new URLConnector (contentConnection, contentType, null) ; contentURL = contentConnection . getURL () ;
} try // pot detecta invalid
URL
{ resetFinalStatus ( ) ; setStatus ( "Connecting to "+contentURL. toExternalForm ( ) ) ; if (contentType==null) // | | ! contentType . equalsIgnoreCase ( "application/j ava" ) ) // skip applets to check
{ conector . getlnputStream () ; contentType = conector . getContentType () ; }
} catch (Throwable ex) { resetStatus ( ) ;
//System. err. println ("CONTENT LOADER ERROR : "+ex) ; //ex .printStackTrace ( ) ; return; }
String contentFile = contentURL . getFile ( ) ;
IBrowserContentManager ContentManager = ABrowserServices . getBrowserServices ( ) . getContentManager ( ) r handl er = ( ContentHandler ! =null ) ? contentHandler : contentViewport . get ContentHandler ( ) ;
// invalid handler [new handler or invalid for current content]
if (handler==null I I ! ContentManager . canHandleContentType (handler . getName ( ) , co ntentType, contentFile) ) handler = ContentManager .createContentHandler (contentType, contentFi le) ; else if (contentHandler==null) // reused the same handler mustlnit = false;
} //end ! isApplet if (handler==null)
{ System. out . println ( "Browser> handler=null" ) ; //showError (conector . getURL () .toString()+" [contentType="+contentType+"] ", "Invalid Content handler ! ! ! " ) ; return;
} if (mustlnit) // new type of content handler { if ( contentViewport ! =null) // set content handler just for valid viewports
contentViewport . setContentHandler (handler) ;
handler .init (ABrowserServices . getBrowserServices ( ) , B rowser . this , contentViewport, contentParameters ) ; if (contentViewport ! =null && handler . useSelfCanvas () ) // set renderer in viewport
contentViewport . setComponent (handler . getRenderer ( ) ) ;
} else // reuse content handler , just reset current content handler
{
/ /synchronized (chLock)
{ handler . reset ( ) ; }
try { // setTransientStatus ( " Load data from "+contentURL . toExternalForm ( ) ) ; //synchronized (chLock)
{ handler . load (conector ) ; // load content resetStatus ( ) ;
}
//Marcel
//if (contentPosition ! =null) // handler. setScrollPosition (contentPosition. x,contentPositi on.y); // set scroll position
} catch (Throwable ex) {
//System. err. println ("CONTENT LOADER ERROR : "-(-ex) ; resetStatus ( ) ; //ex.printStackTraceO ;
//showError (conector. getURL () .toString()+" [contentType="+contentType+"] ", ex. toString () ) ;
}
//commandTrobbler ( false ) ; // clean-up contentViewport = null; ContentHandler = null; contentURL = null; contentConnection = null; contentParameters = null; contentPosition = null; } }
//Cipi New /**
* INPUT control */ /* final class Input extends Panel implements ActionListener
{ private String lastText; // save last direct input private TextFieldCompl textField; // text field private Dimension prefSize; // pref size
Input ( ) { prefSize = new Dimension ( 10, 30 ) ; textField = new TextFieldCo pl () ;
textField. setHistory (historyEntries); setLayout (new BorderLayout ( ) ) ; add (textField) ;
textField. addActionListener ( this ) ;
}
void setlnput ( String text) { textField. setText (text) ; if (historyEntries.indexOf(text)==-l) historyEntries . addElement (text) ; }
String getlnput()
{ return textField . getText () ; }
public void actionPerformed (ActionEvent event)
{ String text = textField. getText ( ) ; if ( text . trim (). equals ("" ) I I text . equals (lastText ) ) // empty or last text , don't add in history return; lastText = text; // save last text
Browser .this . openDocument ( text , null, null , null) ; }
public Insets getlnsets ( )
{ return new Insets ( 3 , 5 , 3 , 10 ) ; } ' - }
*/
//Cipi New /**
* browser history entry */ /* final class Controls extends Component implements MouseListener ,
MouseMotionListener , TimerInterface {
private Image offlmage; // offscreen image private Graphi-cs offGraphics; // status image private Image toolbar; private Image toolbar_bg; private Image logo; private int buttons [] []; private Dimension dim; private int lasthit = -1; private int counter = 7; // trobbler counter
Controls ( )
{ super ( ) ; addMouseListener ( this ) ;
addMouseMotionListener (this) ; buttons = new int [6] [ ] ; buttons [0] = new int [] {STATE_ON_NORMAL, 0,30, 10} ; buttons [1] = new int [] {STATE_ON_NORMAL, 0,70,10}; buttons [2] = new int [] {STATE_ON_NORMAL, 0,110, 10} ; buttons [3] = new int [] {STATE_ON_NORMAL, 0, 150, 10} ; buttons [4] = new int [] {STATE_ON_NORMAL, 0,190, 10} ; buttons [5] = new int [] {STATE ON NORMAL, 0 , 230 , 10 } ; // load skin images
Toolkit toolkit = Toolkit .getDefaultToolkit ( ) ; toolbar = toolkit. getImage (Browser .class .ge Resource ( "images /toolba r.gif") ) ; toolbar_bg = toolkit . getImage (Browser .class. getResource ( "images /toolba r_bg . gif" ) ) ; logo = toolkit . getImage (Browser. class. getResource ( "images /logo . g if") ) ;
MediaTracker traker = new MediaTracker (new Button ()) ; try
{ traker . addImage (toolbar, 0) ; traker . addImage ( toolbar_bg, 1 ) ; traker . addlmage (logo, 2 ) ; traker . waitForAll () ;
} catc (Exception ex) { } dim = new Dimension ( toolbar_bg .getWidth(null) , toolbar_bg .getHeight( null) ) ; offImage = null; }
public final void timerEvent (int id) { if ( ! isVisible ( return; counter++; if (counter==14 ) counter = 0;
Graphics g = getGraphics ( ) ; int width = getSize ( ) .width; g. setClip (width-40, 0,40,40) ; paint (g) ; g . dispose ( ) ; public void mouseClicked (MouseEvent event )
{ int hit = getHitted (event ) ; if (hit==-l) return; if (hit==BACK) { Browser . this . backDocu ent ( ) ;
. } else if (hit==FORWARD) Browser . this . forwardDocument ( ) ; else if (hit==STOP) {
Browser . this . stopDocument ( ) ; return;
} else if (hit==NEW) {
String newBrw = null;
Browser. this. openDocumen (null , null, null , null ) ;
} else if (hit==H0ME) Browser . this . openDocument (System. getProperty ( "GR- BROWSER . home" ) , null, null, null) ;
}
public void mo-usePressed (MouseEvent event) { } public void mouseReleased (MouseEvent event) { } public void mouseEntered (MouseEvent event) { } public void mouseExited (MouseEvent event' {}
public void mouseDragged (MouseEvent event) {}
public void mouseMoved (MouseEvent event)
{ int hit = getHitted (event ) ; if (hit==BACK)
Browser. this. setTransientStatus ( ' Back") ; else if hit==FORWARD) Browser. this .setTransientStatus ( ' Forward" ) ; else if hit==STOP) Browser. this. setTransientStatus ( ' Stop document"); else if hit==NEW) Browser. this. setTransientStatus ( ' New browser") ; else if hit==HOME) Browser. this. setTr nsientStatus ( ' Home") ; if (hit==lasthit return; if (lasthit!=-l
{ buttons [lasthit] [0] = STATE_ON_OVER; buttons [lasthit] [1] = STATE_ON_NORMAL; repaintButton (lasthit ) ;
} if (hit!=-l) { buttons [hit] [0] = STATE_ON_NORMAL; buttons [hit] [1] = STATE__ON_OVER; repaintButton (hit ) ;
} lasthit = hit; }
private final void repaintButton ( int index)
Graphics g = getGraphics ( ) ;
g.setClip (buttons [index] [2], buttons [index] [3] , DIM, DI
M) ; paint (g) ; g . dispose ( ) ;
}
private final void updateToolbar ( ) { buttons [BACK] [1] = canGoBack() ?STATE_ON_OVER : STATE_OFF_OVER; buttons [FORWARD] [1] = canGoForward () ?STATE_ON_OVER : STATE_OFF_OVER; } private int getHitted (MouseEvent event'
int x = event . getX () ; int y = event . getY () ; for ( int i=0 ;
Kbuttons . length ; i++;
{ if (x>=buttons [i] [2] && x<=buttons [i] [2 ] +DIM && y>=buttons [i] [3] && y<=buttons [i] [ 3] +DIM) return i;
} return -1; }
public Dimension getPreferredSize (
{ return dim;
}
public void update (Graphics g) { paint (g) ;
}
public void paint (Graphics g) { if (g==null) return; int width = getSize ( . width; int height = getSize() .height; updateToolbar ( ) ; if (offImage==null | width ! =offImage . getWidth (null) | | height ! =offImage . getHeight (null) )
{ offImage = createlmage (width, height ) ; offGraphics = offImage . getGraphics () ;
offGraphics . drawlmage ( toolbar_bg, 0, 0, width, height, 0, 0 , width, height , null ) ; for (int i=0 ; Kbuttons . length ; i++) int pozX = buttons [i] [2] int pozY = buttons [i] [3] int stat = buttons [i] [0]
offGraphics . drawlmage (toolbar, pozX,pozY, pozX+DIM, poz Y+DIM, DIM*stat,DIM*i,DIM*stat+23,DIM*i+23,null) ; }
} for ( int i=0
Kbuttons . length ; i++)
if (buttons [i] [0] ==buttons [i] [1] ) // update status continue; int pozX = buttons [i] [2] ; int pozY = buttons [i] [3] ; int stat = buttons [i] [1] ; offGraphics . drawlmage ( toolbar, pozX,pozY,pozX+DIM, poz Y+DIM, DIM*stat,DIM*i, DIM*stat+23, DIM*i+23 , null ) ;
}
offGraphics . drawlmage (logo,width- 40, 0, idth, 40, counter*40, 0, ( counter+1) * 40,40, null
g . drawlmage ( offImage, 0,0, idth, height, null) ;
} }
*/ //Cipi New
* browser history entry
*/
/* final class Status extends Panel
{ private Label label; // label private Dimension prefSize; // pref size
Status ( ) { prefSize = new
Dimension (10,25) label = new Label (); setLayout (new
BorderLayout ( ) ) ; add (label '
void setStatus (String text)
label . setText (text) ;
String getStatus ()
return label . getText () ;
void setTransientStatus ( String text!
label . setText (text) ;
String getTransientStatus ( )
return label . getText () ;
void setlnfo (String text)
label . setText (text) ;
String getlnfo ( )
return label . getText () ;
public Dimension getPreferredSize ( )
return prefSize;
public void paint (Graphics g)
super .paint (g) ; Insets insets = getlnsets ( ) ; Dimension size = getSize(); g . setColor (Color . darkGray) ; g . draw3DRect ( insets. left- 1, insets. top-1, size. width-insets. left- insets, right+1, size, height-insets, top- insets . bottom+1 , true) ; 5 }
public Insets getlnsets() { return new Insets ( 4 , 4 , 4 , ) ; 10 }
} */
/** 15 * special layout manager
*/ final class BrowserPanelLayout implements LayoutManager2 { 20 private Container container; // container private Component components [] ; // all sorted component private boolean orientation; // 25 orientation true==VERTICAL , false=HORIZONTAL
/* *
* contructor */ 30 public BrowserPanelLayout (Container cont, boolean orient)
{ orientation = orient; container = cont; 35 components = new
Component [ 0] ;
AC) /k-k-k-k-k-k^-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k
k -k -k -k - -k -k l
/* IMPLEMENT
' LayoutManager ' */ /**
* add a component */ public void addLayoutComponent (Component comp, Object constraints) { addLayoutComponent ( " " , comp ) ; } -k -k * add a component
public void addLayoutComponent ( String s, Component comp)
{ synchronized
(comp . getTreeLock ( ) )
{ if (! (comp instanceof IBrowserPanel)) // remove all non Browser plugin { comp . getParent ( ) . remove ( comp) ; return;
} // add component to internal map Component temp[] = new
Component [components . length+1] ;
System. arraycopy (components , 0 , temp, 0 , components .leng th) ; temp [components . length] = comp; components = temp; } }
/**
* remove a component
*/ public void removeLayoutComponent (Component comp) { synchronized (comp . getTreeLock ( ) )
{ if
(comp . getParent ( ) !=container) return; int size = components . length; for (int i=0 ; Ksize; i++) { if (components [i] !=comp) // remove component from internal map continue; Component temp[] = new Componen [components . length-1] ;
System. arraycopy (components , 0 , temp, 0, i ) ; if (Ksize-1)
System. arraycopy (components , i+l, temp, i, size-i-1) ; components = temp; return;
}
} }
* get preferred size */ public Dimension preferredLayoutSize (Container target)
{ if (container ! =target ) return new Dimension ( 0, 0 ) ;
synchronized (target . getTreeLock ( ) )
{ Dimension ret = new Dimension (0 , 0 ) ; int size = components . length; for (int i=0 ; Ksize; i++) {
Component comp = components [i] ; if (! comp . isVisible () ) continue; Dimension dim = comp . getPreferredSize () ; if (orientation) // vertical orientation
{ ret. height += dim. height; ret. width =
Math .max ( ret . idth, dim. idth) ;
} else // horizontal orientation { ret. width += dim. width; ret . height = Math .max (ret . height, dim. height) ;
} } return ret;
} }
/**
* get minimum size */ public Dimension minimumLayoutSize (Container target) { return preferredLayoutSize (target) ;
}
/**
* get maximum size */ public Dimension maximumLayoutSize (Container target) { return new Dimension (0x7fffffff, 0x7fffffff) ;
/**
* get alignment
*/ public float getLayoutAlignmentX (Container container' { return 0 . 5 F ; }
/ * * * get alignment
*/ public float getLayoutAlignmentY (Container container)
{ return 0.5F;
}
/ -k -k
* invalidate */ public void invalidateLayout (Container container)
{
/* *
* layout container
*/ public void layoutContainer (Container target
{ if (container ! =target) return;
synchronized (target . getTreeLock ( ) )
{
Dimension dimTarget = target . getSize () ; int size = components . length; int offset = 0; for (int i=0 ; Ksize; i++)
{
Component comp = components [i] ; if (! comp . isVisible () ) continue; Dimension dim = comp . getPreferredSize () ; if (orientation) // vertical orientation
{
comp. setSize (dimTarget .width, dim. height) ; comp . setLocation (0, offset | offset += dim. height;
el se // horizontal orientation
comp . setSize (dim. width, dimTarget .height) ; comp . setLocation (offset, 0 ] offset += dim. width; } }
} }
Annex 2 BrowserServices. Java
package no .mc . tester ;
import java.awt.*; import ava. util.*; import java.io.*;
import no .mc .browser . services . * ; import ro .mc . util . * ; import no .mc . tester . languages .* ; import no .mc .tester. BrowserEventNotifier ; import no .mc . protocol . http .* ; import no .mc .tester .menus . BrowserMenuManager; public class BrowserServices extends ABrowserServices implements IBrowserlDEManager, IBrowserlDEListener
{
static final Hashtable browsers = new Hashtable (7 ) ; // all browsers static Browser activeBrowser ; // active browser public static String lastDirectory ;
// last directory for open
//Marcel public static final BrowserEventNotifier notifier = new BrowserEventNotifier () ; // event ulticaster notifier private static BrowserLanguage language; // current language private static String userName="Cipi" ; //default name private static BrowserMenuManager menuManager;
// menu manager private static BrowserPluginManager pluginManager; ' // plugin manager
//End Marcel
private static BrowserProtocolManager protocolManager;
// protocol manager private static BrowserContentManager ContentManager;
// content manager private static BrowserScriptManager scriptManager ;
// script manager private static IniFile iniFile;
// ini file with system properties private static final String iniFileName =
"browser.ini"; // ini file name private static String browserRoot;
// browser root directory private static int browserCount ;
// name generator
k -k /
/* OVERWRITE 'ABrowserServices'
*/
/ k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k - -k -k -k-k -k -k -k -k -k -k -k -k -k k -k k-k -k -k ^ -k -k -k k k k ^ -k -k -k ^ -k -k k -k k k -k /
/ -k-k * get current real instance for services */ private BrowserServices ( )
{ init ( ) ; }
* get current real instance for services */ public static ABrowserServices getBrowserServices ( ) { if (liveServices==null) liveServices = new BrowserServices () ; return liveServices; }
/ -k-k
* get root directory */ public final String getRootDirectory ( ) { return browserRoot; }
' - -k * get a global browser property */ public final String getProperty ( String section, String propName) { if ( iniFile==null | | section==null | | propName==null' return null; IniFileSection sect = iniFile'. getSection (section) ; if (sect==null) return null; return sect . getValue (propName) ;
/ - - * set a global browser property */ public final String setProperty (String section, String propName, String propValue)
{ if (iniFile==null | | section==null | | propName==null ) return null; IniFileSection sect = new IniFileSection ( section) ; String ret = sect . getValue (propName) ; sect. setValue (propName, propValue) ; iniFile . addSection ( sect ) ; return ret; }
/ -k k * remove a global browser property */ public final void removeProperty ( String section, String propName ) { if (iniFile==null | | section==null | | propName==null ) return; IniFileSection sect = iniFile . getSectio ( section) ; if (sect==null) return; sect . removeNa e (propName) ; }
/**
* remove an entire section */ public final void removeSection ( String section) { if ( iniFile==null | | section==null) return; iniFile . removeSection ( section) ; }
I k -k
* reset an entire section */ public final void resetSection ( String section)
{ if ( iniFile==null | | section==null ) return; iniFile . resetSection (section) ;
I k -
* get all names in a secion */ public final String[] getSectionNames (String section] { if (iniFile==null | | section==null ) return null; IniFileSection sect = iniFile . getSection (section) ; if (sect==null) return null; return sect . getNames ( ) ;
}
/ k -k
* get global history */ public final String[] getGlobalHistory ( ) { return getSection ( "History" ) ; }
/** * update status on splash
*/ public final void updatelnitStatus ( String status) {}
* create a new browser by name */ public final IBrowser createBrowser ( String brwName)
{
BrowserOptions options = new BrowserOptions () ; options . browserName = brwName; return createBrowser (options) ; }
/ ** * create a new browser by obtions */ public final IBrowser createBrowser (BrowserOptions options ) { if (options==null ) return null; if (options . browserName==null ) options . browserName = "DOMBrowser "+ (++browserCount ) ; Browser browser =
(Browser) browsers . get (options . browserName) ; if (browser ! =null) return browser; if (options . size==null ) {
Dimension screen = Toolkit . getDefaultToolkit ( ) . getScreenSize ( ) ; int width = getlntValue (getProperty (ABrowserServices . SECTION_BROWSER, "browser. width") , 600) ; int height = getlntValue (getProperty (ABrowserServices . SECTION_BROWSER, "browser . height " ) , 4 00 ) ; options. size = new Dimension (width, height ) ; } if (options . location==null)
{ int x = getlntValue (getProperty (ABrowserServices . SECTIONJ3ROWSER, "browser. ") , 0) ; int y = getlntValue (getProperty (ABrowserServices . SECTION_BROWSER, "browser . y" ) , 0 ) ;
Point point = new Point (x,y); if (activeBrowser ! =null) { point = activeBrowse . getLocation () ; point. translate(20, 20) ; } options . location = point;
} browser = new Browser (options ) ;
//Marcel browsers .put (options .browserName, browser) ; if (browsers . size () ==1 ) // notify ide opened {
BrowserlDEEvent ideEvent = new BrowserlDEEvent (browser, BrowserlDEEvent . IDE_IDEOPENED) ; notifier . notifyListeners (ideEvent) ;
} // notify ide listeners BrowserlDEEvent ideEvent = new BrowserlDEEvent (browser, BrowserlDEEvent . IDE_BROWSERCREATE D) ; notifier . notifyListeners (ideEvent) ;
//End Marcel
// open browser
System. out . rintln ( "browser . sho ( ) ") ;
System. out. println ("options . hasStatus "+options .hasStatus)
/ /System. out . println ( "browser . sho ( ) ") ; //System. out . rintln ( "browser . sho ( ) ") ;
browser . show ( ) ; return browser; }
/* *
* create a new browser by obtions */ public final IBrowserContext getContext ( ) { return activeBrowser; }
/** * enumerate all browsers */ public final IBrowser[] getBrowsers ( ) { Enumeration enumeration = browsers . elements () ; Vector list = new Vector (browsers . size ()) ; while ( enumeration . hasMoreElements () ) {
IBrowser browser = (IBrowser) enumeration . nextElement ( ) ; list . addElement (browser) ;
}
IBrowser ret[] = new IBrowser [list . size ()] ; list. copylnto (ret) ; return ret; }
/ - -k
* get browser by name */ public final IBrowser getBrowser ( String brwName)
{ return ( IBrowser) browsers .get (brwName) ;
}
/* *
* get menu manager */ public final IBrowserMenuManager getMenuManager ( ) {
//Marcel return menuManager; //End marcel }
/**
* get ide manager */ public final IBrowserlDEManager getlDEManager ( ) { return this; }
* get protocol manager */ public final IBrowserProtocolManager getProtocolManager ( ) { return protocolManager;
}
/ -k -k
* get content manager */ public final IBrowserContentManager getContentManager (
{ return ContentManager;
}
/ -k -k
* get content manager */ public final IBrowserScriptManager getScriptManager ( ) { return scriptManager; } k -k * get cache manager */ public final IBrowserDataManager getDataManager (){ return null;}
//Marcel
* enumerate all plugins */ public final IBrowserPlugm [ ] getPlugins ( ) { return pluginManager .getPlugins (); }
/ ** * get a plugin by name */ public final IBrowserPlugm getPlugin (String plgName)
{ return pluginManager . getPlugin (plgName) ; } //Marcel end
/**
* get user name */ public final String getUserName ( ) { return "Cipi";
}
//Marcel / -k * * get a system resource string for a given language */ public static final String getResString (int resld)
{ return getResString ( language, resld) ; }
/ -k -k
* get a system resource string for a given language */ static final String getResString (BrowserLanguage lang, int resld) { if (lang==null) return null; return BrowserResource . getResString (lang, resld) ; }
* utility function to register a new user
*/ static final void setUserName (String name)
{ userName = name; BrowserlDEEvent ideEvent = new
BrowserlDEEvent (name , BrowserlDEEvent . IDE_USERCHANGED) ; notifier . notifyListeners (ideEvent) ; } / k -k -k -k -k -k -k -k -k-k -k -k -k -k -k -k -k -k -k -k -k-k -k -k -k -k -k -k -k -k -k-k -k -k -k-k -k -k -k-k -k -k -k k-k -k -k -k -k -k -k -k -k -k -k k -k /
/* IMPLEMENTS 'IBrowserlDEManager' */
/ k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k k -k -k -k -k -k -k -k -k -k -k k -k /
/**
* register a new language in browser */ public final IBrowserLanguage registerLanguage (Locale locale, IBrowserResourceEntry resEntry) { boolean isRegistered = BrowserLanguage. isRegistered (locale);
BrowserLanguage ret = language. registerLanguage (locale) ; if (ret!=null)
BrowserResource. registerSystemResource (ret.getLanguageId( ) , resEntry) ; if (! isRegistered) // notify in case is a new one {
BrowserlDEEvent ideEvent = new BrowserlDEEvent (ret , BrowserlDEEvent . IDE_LANGUAGEREGISTERE D) ; notifier . notifyListeners (ideEvent) ; } return ret;
* get all available languages
*/ public final IBrowserLanguage [ ] getLanguages
{ return BrowserLanguage . getLanguages ( ) ;
* set current language
*/ public final void setLanguage ( IBrowserLanguage lang' { if (lang==null | | ! (lang instanceof BrowserLanguage) ) return; BrowserLanguage blang = (BrowserLanguage ) lang; if (blang . getLanguageld () ==language . getLanguageld () ) // same language return; language = blang; // notify ide listeners BrowserlDEEvent ideEvent = new
BrowserlDEEvent (language, BrowserlDEEvent . IDE_LANGUAGECHAN GED) ; notifier . notifyListeners (ideEvent) ;
}
/ * -k
* get current language */ public final IBrowserLanguage getLanguage ( ) { return language; }
/ - -k * add a panel to a host
*/ public final boolean addBrowserPanel (IBrowser browser , IBrowserPanel panel)
{ if (browser==null | | ! (browser instanceof Browser) | | panel==null | | ! (panel instanceof Component) ) return false; return ( (Browser) browser) . addBrowserPanel (panel ) ; }
/**
* remove a panel to a host */ public final boolean removeBrowserPanel (IBrowser browser, IBrowserPanel panel)
{ if (browser==null | | ! (browser instanceof Browser) | | panel==null ] I ! (panel instanceof Component)) return false ; return ( (Browser ) browser ). removeBrowserPanel (panel ) ; /* *
* enumerate all panels in a browser */ public final IBrowserPanel [ ] getBrowserPanels ( IBrowser browser)
{ if (browser==null | | ! (browser instanceof Browser)) return null; return ( (Browser) browser) . getBrowserPanels ( ) ; }
* get a panel by name */ public final IBrowserPanel getBrowserPanel (IBrowser browser , String name)
{ IBrowserPanel panels [] = getBrowserPanels (browser ) ; if (panels==null) return null; for (int i=0 ; Kpanels . length ; i++)
{ String panname = panels [i] . getPanelName () ; if (panname . equals (name) ) return panels [i];
} return null; }
* add a browser IDE listener */ public final void addBrowserlDEListener (IBrowserlDEListener listener)
{ notifier . addListener (listener) ;
}
/* *
* remove a browser IDE listener */ public final void removeBrowserlDEListener ( IBrowserlDEListener listener) notifier. removeListener (listener) ;
/ k -k -k -k -k - -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k-k -k-k -k -k -k -k -k -k -k -k -k -k k -k /
/* IMPLEMENT 'IBrowserlDEListener'
*/
/k-k-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-k-k-k-k -k-k-kk-k-k-k-k-k-k-k
* language changed */ public boolean languageChanged (BrowserlDEEvent event) { menuManager . changeLanguage () ; // change visible language
IBrowser browsers [] = getBrowsers ( ) ; // update all browsers if (browsers==null) return false; BrowserMenuManager . updateMenuBar (activeBrowser) ; int size = browsers . length; for (int i=0 ; Ksize ; i++)
{ if ( activeBrowser != (Browser) browsers [i] )
BrowserMenuManager . updateMenuBar ( (Browser)browsers[i] ) ;
} return true;
}
* user changed
*/ public boolean userChanged (BrowserlDEEvent event ] {
//Debuger .debug ("USER CHANGED : "+event . getUserName ( ) ) ; return true; } public boolean browserCreated (BrowserlDEEvent event) {
//Debuger . debug ( "BROWSER CREATED : "+event . getBrowser ( ) ) ; return true; }
public boolean browserClosed (BrowserlDEEvent event)
{ //Debuger. debug ("BROWSER CLOSED : "+event . getBrowser ( ) ) ; return true; }
public boolean languageRegistered (BrowserlDEEvent event )
{
//Debuger . debug ( "LANGUAGE REGISTERED : "+event . getLanguage ( ) ) ; • return true; }
public boolean ideActivated (BrowserlDEEvent event)
{ //Debuger. debug ("IDE ACTIVATED "); return true; }
public boolean ideDeactivated (BrowserlDEEvent event) {
//Debuger. debug ("IDE DEACTIVATED "); return true; }
public boolean ideOpened (BrowserlDEEvent event)
{
//Debuger. debug ("IDE OPENED "); return true; }
public boolean ideClosed (BrowserlDEEvent event)
{
//Debuger. debug ("IDE CLOSED ") ; return true; } //End Marcel
k -k I
/* extra functions */
/ k k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k-k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k k -k -k -k -k -k -k -k k -k 1
/**
* Initialize browser services */ private final void init()
{ liveServices = this;
Properties properties = System. getProperties () ; browserRoot = properties . getProperty ( "user . dir" ) ; if ( ! browserRoot . endsWith (File . separator ) ) browserRoot += File . separator ; lastDirectory = browserRoot;
// read all properties readProperties ( ) ;
// register property http client
String userAgent = getProperty (ABrowserServices . SECTION_BROWSER, "userAgent" )
String brName = getProperty (ABrowserServices . SECTION_BROWSER, "GR- BROWSER.name") ; String codeNa e = getProperty (ABrowserServices . SECTION__BROWSER, "GR- BROWSER. codeName") ;
String version = getProperty (ABrowserServices . SECTION_BROWSER, "GR- BROWSER. ersion") ; if (userAgent==null ) userAgent = "DOM Browser Tester";
if (userAgent ! =null) properties .put ( "http . agent", userAgent) ; // set http agent if (brName ! =null ) properties .put ( "GR-BROWSER . name", brName) ; // set browser name if ( codeName ! =null) properties .put ( "GR-BROWSER. codeName" , codeName) ; // set browser codeName if (version ! =null ) properties .put ( "GR-BROWSER. version" , version) ; // set browser codeName // init managers protocolManager = new BrowserProtocolManager (getSection ( "ProtocolHandlers" ) ) ; ContentManager = new
BrowserContentManager (getSection ( "ContentHandlers" ) ) ; scriptManager = new BrowserScriptManager (getSection ( "ScriptHandlers" ) ) ;
//Marcel language = BrowserLanguage . registerLanguage (new Locale ("en", "","")) ; // default language new BrowserResource ( ) ; // init system resource { ! ! ! ! MUSAI AICI ! ! ! ! } addBrowserlDEListener (this ) ; // register this as ide listener
menuManager = new BrowserMenuManager ( ) ; // create menuManager pluginManager = new
BrowserPluginManager (getSection (" PiuginsToLoad") ) ; // create pluginManager menuManager . start (this) ; pluginManager .start (this); pluginManager . startSystemPlugins ( ) ; menuManager . validateLanguages ( ) ; // validate all languages && notify all languages
//Marcel
/* * find a viewport by name */ public static final IBrowserViewport findViewport (String name)
{ if (name==null | |
"_blank" . equals (name . toLowerCase ()) ) // "_blank" viewport generate a new browser return null; IBrowserViewport panel = null; if (BrowserServices . activeBrowser ! =null )
// start looking first in active browser
{ panel = activeBrowser . getBrowserViewport ( ) . fmdViewportByName (nam e) ; if (panel ! =null) return panel;
} Enumeration enumeration =
BrowserServices .browsers . elements ( ) ; while ( enumeration . hasMoreElements ( ) )
{
Browser browser = (Browser) enumeration . nextElement ( ) ; if (BrowserServices. activeBrowser==browser) , continue; panel = browser . getBrowserViewport ( ) . fmdViewportByName (name ) ; if (panel ! =null) return panel;
} return null;
}
/**
* close a browser */ static final void changeName ( String origname, String newNa e )
{
Browser brw = (Browser ) browsers . get (origname ) ; if (brw!=null) { browsers . remove (origname) ; browsers .put (newName , brw) ; } }
/**
* close a browser
*/ static final void closeBrowser ( String brwName) { if (brwName==null) return; Browser browser = (Browser ) browsers . get (brwName) ; if (browsers . size () ==1 ) {
( (CacheManager) browser . getCacheManager ( ) ) . getCache ( ) .dele teCache ( ) ;
HTTPCookieManager . saveCookies ( ) ; // save cookies
} if (browser==null ) return;
Rectangle bounds = browser . getBounds () ; // get bounds [will be saved for last browser] browsers . remove (brwName) ;
//Marcel
// notify BROWSER CLOSED
BrowserlDEEvent ideEvent = new BrowserlDEEvent (browser , BrowserlDEEvent . IDE_BROWSERCLOSED
) ; notifier . notifyListeners (ideEvent) ; //Marcel end if (browsers . isEmpty () ) {
// notify IDE CLOSED ideEvent = new BrowserlDEEvent (browser , BrowserlDEEvent . IDE_IDECLOSED) ; // can set properties notifier . notifyListeners (ideEvent) ;
// save last browser bounds liveServices . setProperty (ABrowserServices . SECTION_BROWSER , "browser .x", String. valueOf (bounds. x) ) ;
liveServices . setProperty (ABrowserServices . SECTION_BROWSER ,"browser. y", String. alueθf(bounds.y) ) ;
liveServices . setProperty (ABrowserServices . SECTION_BROWSER , "browser. width", String. valueOf (bounds .width) ) ;
liveServices . setProperty (ABrowserServices . SECTION_BROWSER , "browser. height", String. valueOf (bounds. height) ) ; // write all properties writeProperties ( ) ; //ZipURLConnection . reset () ; // reset temporary archive
System. exit ( 0) ; } }
* read properties */ private final void readProperties ( ) { iniFile = new IniFile (); try { iniFile. read (new FilelnputStream (browserRoot+iniFileName) ) ; } catch (Exception ex)
{
System. err . println ( "ERROR - Read properties : "+ex) ; } }
* write properties */ private static final void writeProperties ( )
{ try { String file = browserRoot + iniFileName;
StreamUtil . copyFiles (file, file. substring(0, file. lastIndex Of ( ' . ' ) ) +"_old.ini") ; iniFile . write (new FileOutputStream ( file) ) ;
} catch (Exception ex)
{
System. err . println ( "ERROR - Write properties : "+ex) ; } }
/**
* create a Vector with all handlers info to load */ private static final String[] getSection ( String iniSection) {
IniFileSection sect = iniFile . getSection (iniSection) ; return ( sect ! =null ) ?sect . getValues (): new String[0]; }
/**
* parse an integer value
*/ private static final int getlntValue ( String name, int value) { try
{ return Integer . parselnt (name ) ;
} catch (Exception ex)
{ return value;
} } Annex 3 BrowserPluginManager.Java
package no .mc . tester ;
import j ava . awt . * ; import j ava . awt . event .* ; import java.io.*; import java.util.zip.*; import Java. util.*; import no .mc .browser . services .* ; import ro .mc . util . * ;
/ * *
* The BrowserPluginManager starts the system plugins and all available external plugins when activated
* from the BrowserServices . init ( ) method. The manager also creates a plugin panel for editing
* the load flag for each plugin, as well as the plugin order. The user can open the panel on the * Options/Plugins menu.
* All legal archive files (.jar or .zip) in the "Plugin" directory are created as plugins
* and are eligible for loading. * An entry in the Plugins section should have the form
* (<archive name>)<class name>
* If no entry is found for an archive, the class is assumed to have the same name as the archive.
* The plugin is not loaded automatically by default. * All valid plugin archive have to contain a file named "plugin . info" that contains all classes in archive
* that can be loaded as plugins
* Θauthor Marius Bergan, Norsk Regnesentral / Multimedia Capital, 1999
* Θversion 0.1
* Θsee IBrowserPlugm
* Θsee IBrowserlDEListener
* @see IBrowserMenuItemListener */ class BrowserPluginManager implements IBrowserPlugm, IBrowserlDEListener, IBrowserMenuItemListener, FilenameFilter { static ABrowserServices browserServices ;
// saved browser services static IBrowserMenuManager menuManager;
// saved browser menu manager static IBrowserlDEManager ideManager;
// saved browser IDE manager
private static final String pluginsDir = "Plugins"; // where external plugin archives are kept private static final String pluginlnfo =
"Plugin . info" ; // where external plugin archives are kept private static IBrowserPlug [ ] plugins; // the external plugins
private static String [] archiveNames;
// the archive names for external plugins private static Stringf] classNames;
// the class names for external plugins private static boolean[] loadFlags;
// users load preference for external plugins private static String [] pluginlnit;
// the names from the plugin section of the ini file
private String selectedPlugin;
// the plugin currently selected in the plugin panel private static String [] pluginsToLoad; /**
* contructor
*/
BrowserPluginManager (String list [] )
{ plugins = new IBrowserPlugm [0] ; archiveNames = new String[0]; classNames = new String [0]; loadFlags = new boolean[0]; pluginsToLoad=list; }
* * / /* IMPLEMENT ' IBrowserPlugm '
*/
**/
/* *
* Get the name of a plugin
* Θreturn 'String' - the plugin implementors ' name */ public String getName ( )
{ return "#DefaultPluginManager-#" ; } .
* Get plugin version
* Θreturn 'String' - version number (<major release> . <minor release>) .
* Wildcards (*) means compliance with all matching versions
*/ public String getVersion()
{ return "*.*";
}
/**
* Get plugin creator
* Θreturn 'String' - name of creator/company */ public String getCreator ( )
{ return "Marius Bergan, Norsk Regnesentral / Multimedia Capital 1999 (C)"; }
Get plugin description
*
* Θreturn 'String' - implementor ' s description of the plugin * / public String getDescription ( )
{ return "Global manager for plugins"; }
* Get plugin style
* Θreturn 'int' - the style */ public int getStyle ( )
{ return 0; } * *
* Get a localized string for an id
* Θparam language 'IBrowserLanguage' - locale language
* Θparam resld 'int' - the id
* Θreturn 'String' - the string for the resource (such as menu items)
*/ public String getResString ( IBrowserLanguage language, int resld)
{ return "Plugins";
}
* Starts the plugin manager, system plugins and all available external plugins.
* Θparam services 'ABrowserServices' - the services which invoked this plugin */ public void start (ABrowserServices services)
{ // Save all managers browserServices = services; menuManager = browserServices . getMenuManager () ; ideManager = browserServices . getlDEManager () ; ideManager . addBrowserlDEListener ( this ) ; // Create the menu item to activate the plugin panel // [CIPI] // IBrowserMenuItem menultem = menuManager . createMenuItem ( "PL#ITEM" , 0, true, this ) ; // menuManager . appendMenuItem (menultem, menuManager . getMainMe nu (menuManager. SYS_MENU_OPTIONS) ) ; // menultem. addMenuItemListener ( this ) ; }
/k-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-k-k-k-k-k-k-k k -k /
/* IMPLEMENT 'IBrowserlDEListener'
*/
/-k -k-kk-k-k-k-k-kk-k-k-k-k -kk-k-kkk-k-k-k-k-kk-k-k-kkk-k-k-k-k-k-k-k-k-kk-kk-k-k-k-k-k-k-k-k-kk-k k -k /
/ -k-k * Changes the language setting for this plugin. No-op
* Θparam event 'BrowserlDEEvent' - the event causing the change
* Θreturn 'boolean' - success flag */ public boolean languageChanged (BrowserlDEEvent event) { return true;
}
/ * *
* Changes the user setting for this plugin. No-op.
* Θparam event 'BrowserlDEEvent' - the event causing the change
* Θreturn 'boolean' - success flag */ public boolean userChanged (BrowserlDEEvent event) { return true; }
/ **
* Registers a new language with' this plugin. No-op. * * Θparam event 'BrowserlDEEvent' - the registration event .
* Θreturn 'boolean' - success flag. */ public boolean languageRegistered (BrowserlDEEvent event) { return true; }
/* *
* Creates the plugin panel for this browser.
* Θparam event 'BrowserlDEEvent' - event originating from the browser which has been created
* Θreturn 'boolean' - success flag */ public boolean browserCreated (BrowserlDEEvent event) { /*
IBrowser browser = event . getBrowser () ; PanelTest panel = createPluginPanel ( ) ; ideManager . addBrowserPanel (browser , panel ) ; panel . setVisible (true) ; */ return true; }
/** * Notify that a brower was closed. No-op.
* Θparam event 'BrowserlDEEvent.' - event originating from the browser which has closed
* Θreturn 'boolean' - success flag */ public boolean browserClosed (BrowserlDEEvent event) { return true; }
* Called when IDE has been activated. No-op
* Θparam event 'BrowserlDEEvent' event notifying of the IDE activation * Θreturn 'boolean' - success flag */ public boolean ideActivated (BrowserlDEEvent event)
{ return true;
}
/**
* Called when IDE has been deactivated. No-op. *
* Θparam event 'BrowserlDEEvent' - event notifying of the IDE deactivation
* Θreturn 'boolean' - success flag */ public boolean ideDeactivated (BrowserlDEEvent event) { return true;
}
/**
* Called when IDE has been opened. No-op.
*
* Θparam event 'BrowserlDEEvent' - event notifying of the IDE opening * Θreturn 'boolean' - success flag
*/ public boolean ideOpened (BrowserlDEEvent event)
{ return true; }
/ -k -k
* Called when IDE has been closed. Save all plugins preferences . *
* Θparam event 'BrowserlDEEvent' - event notifying of the IDE closing
* Θreturn 'boolean' - success flag */ public boolean ideClosed (BrowserlDEEvent event) {
browserServices . resetSection (ABrowserServices . SECTION_PLU GINS); // remove all old variable for (int i=0 ; i<archiveNames . length ; i++) { // if (! loadFlags [i] ) // continue;
browserServices . setProperty (ABrowserServices . SECTION _PLUGINS, " ("+archiveNames [i]+") "+classNames [i] , null) ; } return true; }
/k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-kk-k-k-k-k-k-k-k-k-k-k* k -k /
/* IMPLEMENT 'IBrowserMenuItemListener' */
/k-kk-k-k-kk-k-k-k -k-kk-k-k'k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-k k -k /
/**
* Executes commands from menus owned by this plugin. No-op .
* Θparam event 'BrowserMenuItemEvent' - event notifying a menu command has been executed
* Θreturn 'boolean' - success flag */ public boolean executeMenu (BrowserMenuItemEvent event)
{ return true;
/ * *
* Reacts to state changes in menu items owned by this plugin.
* Activates or deactivates the plugin panel when ' Options/Plugins ' is selected.
* Θparam event 'BrowserMenuItemEvent' - event notifying a menu item has changed state
* Θreturn 'boolean' - success flag
*/ public boolean changeMenu (BrowserMenuItemEvent event)
{ IBrowser browser = event . getContext (). getBrowser () ; IBrowserPanel panel = ideManager . getBrowserPanel (browser, " PLUGINS#" ) ; if (panel==null) return false; panel . setVisible (event . getMenuIte ( ) . isChecked ( ) ) ; browser . updateGUI ( ) ; return true; }
/-k*-kk-k*-k-k-k-k-k*-k-k-k-k-k-k*-k-k-kk-k-k-k**-k-k-k-k ±* -k-k-k-k-k±-k-k-k-k-k -k*-k-k-k-k-k-k k -k /
/* IMPLEMENT ' FilenameFilter '
*/
/k-k-k-k-k-k-k-k-k-k-k-k-k- -k-k-k-k-k-k-k-k- - -k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k k k /
/ -k -k * Filter just jar & zip files *
* Θparam dir 'String' - current directory
* Θparam name 'String' - current file name
* Θreturn 'boolean' - return true if accept current file otherwise return false
*/ public boolean accept (File dir, String name)
{ if (name . length () <4 ) return false;
String ext = name . substring (name . length () - 4 ) . toLowerCase ( ) ; return ext . equals (". zip" ) || ext . equals (". j ar" ) ; }
/-k-k-k-k-k-k -k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k kk /
/* Plugin services linked with BrowserServices */
/•k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-kkk-k-k-k-k-k-k-kk-k-k-k-k-k-k -k-k k -k /
/** * Enumerate all plugins
* Θreturn ' IBrowserPlugm [ ] ' - an array of all system plugins and external plugins currently loaded. */ static final IBrowserPlugm [ ] getPlugins ( )
{
IBrowserPlugm ret [] = new IB owserPlugin [plugins . length] ; System. arraycopy (plugins , 0, ret, 0, plugins. length) ; return ret; }
/** * Get a plugin by name
* Θparam plgName 'String' - the implementor ' s name for the plugin (not the class name)
* Θreturn ' IBrowserPlugm ' - the plugin if it exists or null otherwise
*/ static final IBrowserPlugm getPlugin (String plgName)
{ if (plgName==null ) return null;
// Search external plugins for (int i=0 ; Kplugins . length ; i++) { if (plugins [i] . getName ( ) .equals (plgName) ) return plugins [i] ;
} return null;
}
/k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-k-k-k-kkk-k-k-k -k-k-k-k-k-k-k-k-k-k k -k /
/* extra functions */
/ - ^ ^ -k - - - ^ ^ - ^ -k -k - ^ - k ^ ^ - - ^ ic - -k -k kr- -k -k -k -k ^ k-k j /*
---*/
/* Creating and starting plugins
*/ /*
---*/
* Creates and starts 8 system plugins: this, BrowserMenuManager, SkinManager
* HistoryManager , FavoriteManager , Explorer, AdvManager, NewLanguageManager
* NOTE : hear have to be just menu, this , g-spot */ protected static final void startSystemPlugins ( )
{
//Marcel int count = pluginsToLoad . length; for (int i=0; Kcount ; i++) {
if (pluginsToLoad [i] .equalslgnoreCase ( "SkinManager" ) ) (new no .mc .plugin. skin. SkinManager () ) .start (browserServices) ; else if (pluginsToLoad [i] . equalsIgnoreCase ( "Favorites" ) )
(new no .mc .plugin . favorites__light .FavoritesPlugin() ) .start (bro wserServices ) ;
// else // if (pluginName .equalsIgnoreCase ( "NewLanguageManager" ) )
(new NewLanguageManager () ) .start (browserServices) ;
// else
// if (pluginName . equalsIgnoreCase ( "DemoManager" ) ) (new DemoManager ()). start (browserServices ) ;
// else
// if (pluginName . equalsIgnoreCase ( "Explorer ") ) (new no . mc . explorer .Explorer!) ) .start (browserServices) ;
// else // if (pluginName . equalsIgnoreCase ( "Testing" ) ) (new no .mc . test . TestingPlugin ( ) ) . start (browserServices ) ;
}
//Marcel end startPlugins ( ) ; } * * * Creates, loads and starts all external plugins in the order indicated
* by the browser services properties, that is, the Plugins section of
* the browser.ini file. */ private static final void startPlugins ( )
{
String pluginlnit [] = browserServices . getSectionNames (ABrowserServices . SECTION_ PLUGINS) ; if (pluginlnit==null || pluginlnit . length==0 ) return; browserServices .updatelnitStatus ("Loading plugins " ) ; for ( int i=0 ; i<pluginlnit . length ; i++ ) loadPlugin ( pluginlnit [ i ] ) ; brows erServices . updatelnitStatus ( " Plugins loaded " ) ; i f ( plugins . length==0 ) return ; browserService s . updatelnitStatus ( " Starting plugins . . . . I , for (int i=0 ; i<plugins . length ; i++) loadFlags [i] = startPlugin (plugins [i] ) ; // set loading status browserServices . updatelnitStatus ("Plugins started " ) ;
}
/**
* load a specified plugin by ini entry
* Θparam plugEncoded 'String' - encoded archive name & class name for a plugin */ private static final void loadPlugin ( String plugEncoded)
{ int arhStart = plugEncoded . indexOf ( 40 ) ; int arhStop = plugEncoded . indexOf ( 41 ) ; if (arhStart==-l | | arhStop==-l | | arhStart>=arhStop) return; String archiveName = plugEncode . substring (arhStart+1 , arhStop) .trim() ; String className = plugEncoded . substring (arhStop+1 ) .trim() ;
IBrowserPlugin plugin = loadPluginFromArchive (archiveName, className) ; if (addPlugin (plugin) ) addPluginlnfo (archiveName, plugin) ; }
/ k -k
* register a valid plugin in the system ... than can be started
* Θparam plugin 'IBrowserPlugin' - plugin to add */ private static final boolean addPlugin ( IBrowserPlugin plugin)
{ if (plugin==null | | plugin. getName () ==null) return false; if (getPlugin (plugin . getName () ) !=null) // already exists
{
System. out .println ( "Plugin : "+plugin . getName () +" allready exists !!!"); return false; }
IBrowserPlugin temp [ ] = new IBro serPlugin [plugins. length+1 ] ;
System. arraycopy (plugins, 0, temp, 0, plugins. length) ; temp [plugins . length] = plugin; plugins = temp; return true; } * * * register plugin info in system
*
* Θparam archiveName 'String' - archive name
* Θparam plugin 'IBrowserPlugin' - plugin instance */ private static final void addPluginlnfo ( String archiveName, IBrowserPlugin plugin)
{ int size = archiveNames . length; String atemp[] = new String [ size+1] ; // add to archive names
System. arraycopy (archiveNames , 0 , atemp, 0 , size ) ; atemp[size] = archiveName; archiveNames = atemp; String ctemp[] = new String [ size+1] ; // add to archive names
System. arraycopy ( classNames , 0 , ctemp, 0 , size) ; ctemp[size] = plugin . getClass (). getName () ; classNames = ctemp; boolean ltemp[] = new boolean [ size+1] ; // add to load status flags
System. arraycopy (loadFlags, 0, Itemp, 0 , size) ; ltemp[size] = false; loadFlags = ltemp; }
* start plugins */ private static final boolean startPlugin ( IBrowserPlugin plugin)
{ try
{ browserServices . updatelnitStatus ( "Starting plugin :
"+plugin . getName ( ) ) ; long startTime = System. currentTimeMillis () ; plugin. start (browserServices ) ; long stopTime = System. currentTimeMillis () ; System. out . println (plugin . getClass ( ) .getName()+" started [ "+ ( stopTime-startTime) +" ms]"); return true;
} catch (Exception e) {
System. out . println(plugin.getClass() . getName ( ) +" start FAILED "+e) ; return false; } } * Load a plugin from archive provided the arhive name is legal, is located * in the correct directory (Plugins) and it contains the specified class. k
* Θparam archive 'String' - name of the archive (must be . j ar or . zip) * Θparam className 'String' - name of the class (possibly with package path)
* Θreturn 'IBrowserPlugin' - the loaded plugin
*/ private static final IBrowserPlugin loadPluginFromArchive ( String archive, String className)
{
// Validate archive and class name archive = browserServices . getRootDirectory ( ) + pluginsDir + File . separator + archive; if (className . ends ith (". class" ) ) className = className .substring(0, className . length () -6) ; className = className . replace ('/','.'); // Load the plugin try {
ZipFile zipFile = new ZipFile (archive) ; // just to test archive zipFile. close () ; browserServices . updatelnitStatus ( "Loading plugin :
"+className) ;
BrowserPluginLoader loader = new BrowserPluginLoader (archive) ; long startTime = System. currentTimeMillis () ; Class cis = loader . loadClass ( className, true) ;
Object plugin = cis . newlnstance ( ) ; long stopTi e = System. currentTimeMillis () ; if ( ! (plugin instanceof IBrowserPlugin) )
{ System. out . println (plugin . getClass ( ) .getName()+" not a valid 'IBrowserPlugin'"); plugin = null; return null; } System. out .println (plugin . getClass ( ) . getName ( ) +" loaded [ "+ ( stopTime-startTime) +" ms]"); return ( IBrowserPlugin) plugin; } catch (Throwable ex) {
System. out .println ( "Error loading plugin ["+className+"] : 'Hex); return null;
} }
/** * Load all valid plugins from plugins directory, also assign info related with archive, class & status
*/ private final void refreshPlugins ( )
{ // Get the list of available archives File directory = new File (pluginsDir ) ; String archiveList [ ] = directory . list (this ) ; if (archiveList==null ) // no plugins found return; int size = archiveList . length; for (int i=0 ; i<size ; i++) getArchivelnfo (archiveList [i] ) ; }
/**
* Test an archive if contains valid plugins, then set
* Θparam archive 'String' - name of the archive (must be . j ar or . zip) */ private final void getArchivelnfo ( String archive)
{
// Get the list of available archives byte infoBytes[] = BrowserPluginLoader . getResourceBytes (browserServices . getR ootDirectory()+pluginsDir+File.separator+archive,pluginIn fo) ; if (infoBytes==null) // no info file return; IniFile file = new IniFile (); file . read (new ByteArraylnputStream (infoBytes ) ) ; IniFileSection section = file . getSection (ABrowserServices . SECTION_PLUGINS ) ; if ( section==null) return;
String pluginNames [ ] = section . getNames () ; if (pluginNames==null | | pluginNames . length==0 ) // no plugin info return; for (int i=0 ; i<pluginNames . length ; i++) {
IBrowserPlugin plugin = loadPluginFromArchive (archive, pluginNames [i] ) ; if (plugin==null | | getPlugin (plugin . getName () ) !=null) // invalid plugin or is registered continue ; addPluginlnfo (archive, plugin) ; // add new info } }
private static Vector getPluginsToLoad ( )
{
Vector plugins = new Vector () ;
for (int i = 1; i > 0; i++) {
String pluginPropName = "Load" + i; String plugin = null;
// Read from ini skin file extension plugin = browserServices .getProperty ("ProtocolHandlers", pluginPropName) ; if ( (plugin == null) | | (plugin . length ( ) <= 0) ) i = -1; else plugins. addElement (plugin. toLowerCase() ) ; }
return plugins; } Annex 4 BrowserProtocolManager .Java
package no .mc . tester ;
import java.net.*; import Java. util.*; import no .mc . browser .services . * ; import java.io.*;
final class BrowserProtocolManager implements URLStreamHandlerFactory, IBrowserProtocolManager {
private static final Hashtable handlers = new Hashtable ( 3 ) ; // cached handlers
BrowserProtocolManager (String l.ist[] )
{ URL . setURLStreamHandlerFactory (this) ; // register protocols [preload] int count = list. length; for (int i=0; Kcount ; i++)
{ StringTokenizer tok = new
StringTokenizer(list[i] , "| ") ; if (tok . countTokens ( ) 1=2) // allways 2 tokens continue; // register name & classes String name = tok . nextToken () . trim () ; registerProtocol (name, tok.nextToken() . trim ( ) ) ; }
/ -k -k k -k k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k k -k -k -k -k'k -k -k -k -k -k -k -k -k k -k -k k -k -k -k -k -k -k -k -k -k -k -k k -k /
/* IMPLEMENT ' URLStreamHandlerFactory '
*/
/ k k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k-k -k -k -k -k -k -k -k -k k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k -k -k k -k / * create an URLStreamHandler for a given protocol */ public final URLStreamHandler createURLStreamHandler (String protocol) {
Class handlerClass = getProtocolHandler (protocol ) ; if (handlerClass==null ) return null; try { return (URLStreamHandler) handlerClass. newlnstance () ;
} catch (Throwable ex) {
// [debug]
System. err. println ( "URLStreamHandlerFactory [createURLStreamHandler] "+ex) ; return null; } }
/k -k-k- -k^- k- -kk^k - -k-k'k-k- k'k^'kk-k-k- -k-k-kk^'kkk - k-k- -k^ **/
/* IMPLEMENT 'IBrowserProtocolManager'
*/
/•k- ^- -k-k- -k^' - ^-k-k-k-kk-kk- k- 'k'k- -kk-kkk^' ^ -k-k-kk- ^k **/
/ -k -k
* register or update a protocol by class
*/ public final boolean registerProtocol ( String protocol , Class handlerClass)
{ if (protocol==null | | handlerClass==null ) // invalid class return false; protocol = protocol . toLowerCase ( ) ; unregisterProtocol (protocol) ; // make an update handlers . put (protocol, new ProtocolHandlerEntry (protocol, handlerClass ) ) ; return true; }
/ * *
* register or update a protocol by classname */ public final boolean registerProtocol (String protocol , String className) { if (protocol==null | | className==null) // invalid protocol & class name return false; protocol = protocol . toLowerCase ( ) ; unregisterProtocol (protocol) ; // make an update handlers . put (protocol , new ProtocolHandlerEntry (protocol, className) ) ; return true; }
/ -k - * register or update a protocol from a class within an archive (.zip or .jar) */ public final boolean registerProtocol (String protocol , String archiveName, String className) { return false; // disabled }
* register or update a' protocol
*/ public final void unregisterProtocol (String protocol)
{ if (protocol==null) // invalid protocol return; handlers . remove (protocol . toLowerCase ( ) ) ; }
/* * * return protocol handler class */ public final Class getProtocolHandler ( String name)
{
ProtocolHandlerEntry handler = null; if (name==null I I (handler = (ProtocolHandlerEntry) handlers . get (name . toLowerCase ( ) ) ) = null) return null; return handler . getHandlerClass () ; }
/**
* utility class that holds protocol handlers entries */ final class ProtocolHandlerEntry
{ private Class classlnstance; // protocol handler class private String className; // protocol handler class name private String handler; // protocol handler name
/**
* constructor */
ProtocolHandlerEntry (String hand, String clsName)
{ handler = hand; className = clsName; }
/ * * * constructor */ ProtocolHandlerEntry (String hand, Class cis)
{ handler = hand; classlnstance = cis;
}
/ k -k
* get protocol handler class instance */ final Class getHandlerClass ( )
{ if (classlnstance==null)
{ try { classlnstance = Class . forName (className) ; } catch (Throwable ex) {
// [debug] ex .printStackTrace ( ) ; } } return classlnstance;
}
Annex 5 BrowserContentManager Java
package no .mc . tester ;
import j ava . awt . * ; import java.net.*; import Java. util.*; import no .mc . browser .services.*;
final class BrowserContentManager implements IBrowserContentManager {
private static final Hashtable handlers = new Hashtable ( 3 ) ; // cached handlers private static final Hashtable extCache = new Hashtable ( 3 ) ; // lookup for content /extensions private static final Hashtable contents = new Hashtable ( 3 ) ; // lookup for content/handler
BrowserContentManager (String list [ ] ) {
// register content [preload] int count = list. length; for (int i=0; i<count ; i++)
{
StringTokenizer tok = new StringTokenizer (list [i] , " | " ) ; if (tok . countTokens () <3 ) // allways over 3 tokens continue;
// register name & classes
String name = tok . nextToken () . trim () ; // name registerHandler (name, tok.nextToken() . trim ( ) ) ; // class while (tok. hasMoreTokens () ) // content types
{
// content type StringTokenizer typeTok = new
StringTokenizer (tok . nextToken (),";"); String contentType = null; int size = typeTok . countTokens ( ) - 1; if (size==-l) continue; contentType = typeTok . nextToken (). trim () ; String names [] = new String [size] ; for (int k=0 ; k<size ; k++) names [k] = typeTok . nextToken (). tri () ; registerContentType (name, contentType) ; if (size>0) setExtensions (contentType , names ) ;
/ k 'k k' k k ' - - ^ - ^ ^ -k - - -k -k - ^ - -k -k -k - - - - - ^ - k ^ k k - ^ **/
/* IMPLEMENT 'IBrowserContentManager'
*/
/ k -k kr -k -k -k -k -k k -k k k k k -k -k ^ k -k -k -k -k k -k -k -k -k -k -k k -k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k -k ± -k k k -k -k -k **/
/ -k -k
* register or update a content handler by class */ public final boolean registerHandler ( String handler, String handlerClassString)
{ if (handler==null | | handlerClassString==null ) // invalid class return false; handler = handler . toUpperCase () ; unregisterHandler (handler) ; // unregister old name handlers .put (handler, new ContentHandlerEntry (handler, handlerClassString) ) ; return true; }
/ * * * register or update a content handler */ public final void unregisterHandler ( String handler)
{ if (handler==null) // invalid handler return; handlers . remove (handler . toUpperCase ( ) ) ; }
/ -k - * return content handler class */ public final Class getContentHandler ( String name)
{
ContentHandlerEntry handler = null; if (name==null | | (handler =
(ContentHandlerEntry) handlers . get (name . toUpperCase ( ) ) ) ==n ull) return null; return handler . getHandlerClass ( ) ; } **
* register a content type with a content handler */ public final boolean registerContentType ( String handler , String contentType)
{ if (contentType==null ) // invalid handler return false; handler = handler . toUpperCase () ; contentType = contentType . toLowerCase () ; if (! handlers . containsKey (handler ) ) // invalid handler return false; ContentTypeEntry content =
(ContentTypeEntry) contents. get (contentType) ; if (content==null ) // not yet registred
{ content = new
ContentTypeEntry (handler, contentType) ; contents .put (contentType, content) ;
} return true; } * *
* unregister a content type */ public final void unregisterContentType (String contentType)
{ if (contentType==null) // invalid handler return; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents. get (contentType) ; if (content ! =null) // not yet registred contents . remove (contentType) ; }
* get all content type supported by handler */ public final String[] getRegisteredContent ( String handler)
{ if (handler==null | |
! handlers. containsKey (handler=handler . toUpperCase ( ) ) ) // invalid handler return null; Vector list = new Vector () ; Enumeration enu = contents . elements () ; // scan content types hash while ( enum. hasMoreElements ( ) )
{
ContentTypeEntry content = (ContentTypeEntry) enum. nextElement ( ) ; if (handler . equals (content . handler ) ) list . addElement (content . name ) ;
}
String ret [] = new String [list . size ()] ; list . copylnto (ret ) ; return ret;
* register supported content type */ public final void registerSupported ( String contentType, String contentTypeSupported) { if (contentType==null | | contentTypeSupported==null ) // invalid handler return; contentType = contentType . toLowerCase () ; contentTypeSupported = contentTypeSupported . toLowerCase ( ) ;
ContentTypeEntry content = (ContentTypeEntry) contents . get (contentType) ; if ( content ! =null ) // is registred content . addSupported ( contentTypeSupported) ; }
/ -k -k * unregister supported content type */ public final void unregisterSupported ( String contentType, String contentTypeSupported)
( if ( contentType==null | | contentTypeSupported==null ) // invalid handler return; contentType = contentType . toLowerCase () ; contentTypeSupported = contentTypeSupported. toLowerCase ( ) ; ContentTypeEntry content = (ContentTypeEntry) contents .get (contentType) ; if (content ! =null) // is registred content . removeSupported ( contentTypeSupported) ;
}
/ -k -k
* get all supported content type */ public final StringU getSupported ( String contentType)
{ if ( contentType==null) // invalid handler return null; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents. get (contentType) ; if ( content==null ) // is not registred return null; return content . getSupported () ; }
/ -k -k * set description */ public final void setDescription ( String contentType , String description)
{ if (contentType==null) // invalid handler return; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents . get (contentType) ; if (content ! =null) // is registred content . description = description; }
/**
* get description */ public final String getDescription ( String contentType)
{ if (contentType==null) // invalid handler return null; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents . get (contentType) ; if (content==null ) // is not registred return null; return content . description;
}
/* *
* set action */ public final void setAction ( String contentType, int action, String info)
{ if (contentType==null) // invalid handler return; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents .get (contentType) ; if ( content ! =null) // is registred content . setAction (action, info) ;
}
/**
* get action code */ public final int getActionCode ( String contentType)
{ if (contentType==null) // invalid handler return ACTION_NONE; contentType = contentType . oLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents . get (contentType) ; if ( content==null) // is not registred return ACTION_NONE; return content . actionCode ;
* get action info */ public final String getActionlnfo ( String contentType' { if ( contentType==null) // invalid handler return null; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents .get (contentType) ; if (content==null) // is not registred return null; return content . actionlnfo; }
/**
* set extensions
*/ public final void setExtensions (String contentType, String [ ] extensions) { if (contentType==null) // invalid handler return; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents. get (contentType) ; if (content ! =null) // is registred content. setExtensions (extensions) ;
}
/ * *
* get extensions */ public final String [] getExtensions ( String contentType) { if (contentType==null ) // invalid handler return null; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents. get (contentType ) ; if ( cdntent==null ) // is not registred return null; return content . getExtensions () ; }
/* *
* set image o */ public final void setlmage (String contentType, URL url)
{ if (contentType==null | | url==null) // invalid handler return; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents. get (contentType) ; if (content ! =null) // is registred content . imageURL = url ;
}
/ k -k
* get image */ public final URL getlmage (String contentType) { if (contentType==null) // invalid handler return null; contentType = contentType . toLowerCase () ; ContentTypeEntry content = (ContentTypeEntry) contents . get (contentType) ; if (content==null) // is not registred return null; return content . imageURL; }
/* * * get content type based on extension */ public final String getContentTypeFromName (String fileName)
{ _ return guessContentTypeFromName ( fileName) ;
}
/ k -k
* create a content handler from an extension */ public final AContentHandler createContentHandler (String contentType, String contentFile )
{ if (contentType ! =null) // get from imposed mime return createContentHandlerFromType ( contentType ) ; contentType = guessContentTypeFromName ( contentFile ) ; // get from extension return
(contentType ! =null) ?createContentHandlerFromType (contentT ype) : null; }
/**
* test if current content handler can handle content type
*/ public final boolean canHandleContentType (String handler , String contentType, String contentFile) { if (contentType==null) // invalid content type contentType = guessContentTypeFromName (contentFile) ; // check by extension if (contentType==null) // invalid content type return false; ContentTypeEntry content =
(ContentTypeEntry)co tents.get(co tentType.toLowerCase()) r return (content ! =null && content . handler . equals (handler . toUpperCase ( ) ) ) ; }
/k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k -k-k-k-k-kk-k -k-k-k-k-k-k-k-kk-k-k-kk -k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k k -k / /* extra functions
*/
/ k ' - k 'k ' - -k ' 'k ^ - - 'k ^ ^ k - ' ^ -k -k 'k 'k k k -k - - 'k k ^ ' k -^ * - /
/ -k -k
* get content type based on extension */ private static final String guessContentTypeFromName (String fileName) { int dot = fileName . lastlndexOf ('.') ; String ext = fileName; if (dot>0 && dot<ext .length () ) ext = ext . substring (dot+1 ) ; ext = ext . toLowerCase () ;
String content = (String) extCache . get (ext ) ; if ( content ! =null ) return content; return null;
'* Re¬ create a content handler from a content type
7 private static final AContentHandler createContentHandlerFromType (String contentType) {
String oldType = contentType; if (contentType==null | |
! contents . containsKey (contentType=contentType . toLowerCase ())) // invalid handler contentType = "unknown/unknown"; // have to be registered ! ! ! ContentTypeEntry content =
(ContentTypeEntry) contents . get (contentType) ; String handlerName = content . handler ; if (handlerName==null ) // ova load open save dialog handlerName = "ERROR"; // have to be registered ! ! !
ContentHandlerEntry handlerEntry = (ContentHandlerEntry) handlers . get (handlerName . toUpperCase
0 ); Class handlerClass =
(handlerEntry==null ) ?null : handlerEntry. getHandlerClass () ; AContentHandler handlerlnstance = null; try
{ handlerlnstance =
(AContentHandler) handlerClass. newlnstance () ;
} catch (Exception ex)
{ System. err. println ( "CONTENT HANDLER CREATION ERROR
=> "+handlerName+" "+ex) ; ex.printStackTrace () ;
} return handlerlnstance; }
/ -k -k
* utility class that holds content type entries
*/ final class ContentTypeEntry
{
String handler; // associated content handler
String name; // content type name int actionCode; // action code String actionlnfo; // action info String description; // description String extensions [] ; // extensions String supported[]; // supported content handlers
URL imageURL; / / image url
/ -k -k
* constructor
*/
ContentTypeEntry ( String hand, String type]
{ handler = hand; name = type; actionCode = -1; actionlnfo = ""; description = ""; extensions = new String [0]; supported = new String[0]; }
/ -k -k
* set action
*/ final void setAction (int code, String info)
{ switch ( code)
{ case ACTION_NONE : // no action case ACTION ASK : // ask user what action to do case ACTION_BRO SER // open in browser case ACTION_RUN // run executable case ACTION_SAVE // save to local disk default : actionCode = code; actionlnfo = ""; break; case ACTION_EXECUTE // launch ather application case ACTION_PLUGIN // load Netscape plugin actionCode = code; if (info==null) info = ""; actionlnfo = info; break ; }
}
/ * *
* set extensions (duplicate) */ final void setExtensions ( String list[]) { if (list==null) extensions = new String[0]; else
{ extensions = new String [list . length] ; // register extension map for (int i=0 ; i<list . length ; i++) {
String extension = list[i]; if (extension==null ) continue; extension = extension . toLowerCase (") ; extensions [i] = extension; if (extCache . containsKey ( extension) ) // register extension extCache . remove (extension) ; extCache . put (extension, name) ; } } }
* get extensions (duplicate) */ final String[] getExtensions ( ) {
String ret [ ] = new String [extensions . length] ;
System. arraycopy (extensions, 0, ret, 0, extensions . length) ; return ret; }
* add supported (avoid duplicate) */ final void addSupported (String support) { for (int i=0 ; Ksupported . length ; i++) { if (supported [i] . equals (support ) ) // check duplicates return; } String temp[] = new String [supported . length+1] ;
System. arraycopy ( supported, 0 , temp, 0 , supported .length) ; temp [ supported . length] = support; supported = temp; }
/**
* remove supported (avoid duplicate) */ final void removeSupported ( String support)
{ for (int i=0 ; i<supported . length ; i++)
{ if (supported [i] . equals ( support ) ) // check duplicates { String temp[] = new String [supported . length- l];
System. arraycopy ( supported, 0, temp, 0, i ) ; if (i<supported. length)
System. arraycopy ( supported, i+l , supported, i , supported .leng th-i) ; supported = temp; return;
} }
}
/**
* get supported (duplicate) */ final Stringf] getSupported ( ) {
String ret[] = new String [ supported . length] ;
System. arraycopy ( supported, 0 , ret , 0 , supported . length) ; return ret ; }
}
/ -k -k
* utility class that holds content handlers entries */ final class ContentHandlerEntry { private Class classlnstance; // content handler class private String className; // content handler class name private String handler; // content handler name
* constructor */
ContentHandlerEntry ( String hand, String clsName)
{ handler = hand; className = clsName; } * *
* get protocol handler class' instance */ final Class getHandlerClass ( )
{ if ( classlnstance==null )
{ try { classlnstance = Class . forName (className) ;
} catch (Throwable ex)
{ // [debug] ex . printStackTrace ( ) ; } } return classlnstance; } 136
Annex 6 AContentHandler .Java
package no .mc . browser . services ;
import j ava . aw . * ; import java.io.*; import java.net.*; import j ava. util.*;
/**
* This class is a basic implementation for a content handler .
* This class should be extended to enrich the functionality for a custom content handler.
* Θauthor Popa Ciprian
* Θversion 1.00 beta 20.09.2000
* Θsee IBrowser
* Θsee IBrowserViewport * @see ABrowserServices
* Θsee IContentHandlerCallback
* @see IScriptSupport
/
public abstract class AContentHandler {
/k-k-k-k-kk^-k^k-k-k-k-k-k-k^k-k-kkk^-kk-k-kkk^-kk-k^-k-kkk-k-kk-k-k-k-k-k-k-k-k-k-k-k-k^-k-k k -k / /* FIELDS
*/
/k-k-k-k -k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-k-k-kk-k-k -k-k-k-k-k-k-k-k-k -kk-k-k -k-k-k-kk-k-k-k-k-k-kk-k k -k /
public static final int SCROLL_AUTO = 0; // scollbars visibility is based on viepowt size public static final int SCROLL_VERTICAL = 1; // just vertical scrollbar is visible public static final int SCROLL_HORIZONTAL = 2; // just horizontal scrollbar is visible public static final int SCROLL_BOTH = 3; // both vertical and horizontak scrollbars visible public static final int SCROLL_NONE = 4; // no scrollbars visible
private static float defaultScaleFactor ; // cached default scale factor protected String contentType;
// content mime type protected URL contentURL;
// content URL protected IBrowserViewport contentViewport; // content viewport protected IBrowser contentBrowser ;
// content browser protected ABrowserServices browserServices; // browser services protected IContentHandlerCallback browserCallback; // content handler callback protected IScriptSupport scriptSupport ;
// script support
/k-k-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k^k-k-k-k^-k-k-k-k-k-kkk-k-k-k-k-k-k-k-k-kk-k-k-kir-k-k-k k k /
/* IMPLEMENT ' IContentHandler ' */
/k-k k -k -k k -k -k -k -k -k -k -k -k -k -k -k k- -k -k -k -k -k -k k -k -k -k -k -k k -k -k -k -k -k k -k -k -k -k k -k -kk-k -k -k -k -k -k -k -k k -k -k k k /
/**
* Returns content handler name
* Θreturn 'String' - content handler type [unique] */ public abstract String getName ( ) ; * *
* Initialize content handler
* Θparam services 'ABrowserServices' - browser services
* Θparam browser 'IBrowser' - current browser
* Θparam viewport 'IBrowserViewport' - current viewport [for lightware handlers=null] * Θparam properties 'Hashtable-' - handler properties [ex: from a DOM element, scolling, margins , document URL] */ public void init (ABrowserServices services, IBrowser browser , IBrowserViewport viewport , Hashtable properties) { browserServices = services; contentBrowser = browser; contentViewport = viewport; scriptSupport = services . getScriptManager ( ) . createScriptSupport (services, browser , iewport ) ; }
/ - -k
* Load content form connector
* Θparam connector 'URLConnector' - connector */ public void load (URLConnector connector) throws IOException { }
* Stop the content handler */ public void stop() {}
/ -k -k * Reset the content handler */ public void reset () {}
/ k -k * Destroy all internal data [the content handler will be destoyed also] */ public void destroy ( )
{ contentViewport = null; contentBrowser = null; browserServices = null; browserCallback = null; if ( scriptSupport ! =null ) scriptSupport . destroy () ; scriptSupport = null; }
/** * Save content data to a file
* Θparam saveString 'String' - file name */ public void saveContent ( String saveString) {} **
* Set callback object
* Θparam callback 'IContentHandlerCallback' - callback used to comunicate outside
*/ public void setCallback ( IContentHandlerCallback callback)
{ browserCallback = callback;
} **
* Returns content URL
* Θrerurn 'URL' - content URL
*/ public URL getURL ( ) { return contentURL;
/ * *
* Returns content type
*
* Θreturn 'String' - current content type
*/ public String getContentType ( ) { return contentType; }
/ * * * Returns content handler mode. If true is component- based use-"getRenderer ( ) " , otherwise is lightweight use-
"paint () " k * Θreturn 'boolean' - if 'true' , getRenderer ( ) should return a valid component , otherwise use paint ( ) */ public boolean useSelfCanvas ( )
{ return false;
}
/**
* Returns the renderer *
* Θreturn 'Component' - renderer component
*/ public Component getRenderer ( )
{ return null; }
/ -k
* Paint used for lightweight content handlers *
* Θparam g 'Graphics' - parent graphics to draw on
*/ public void paint (Graphics g) { }
/**
* Returns the associated content document
* Θreturn 'Object' - generic object */ public Object getDocument ( )
{ return null;
/ * -k
* Returns the associated script support
* Θreturn ' IScriptSupport ' - script support
*/ public IScriptSupport getScriptSupport ( ) { return scriptSupport; }
/**
* Returns the associated document title
* Θreturn 'String' - internal title */ public String getTitle() { return null; }
/**
* Returns document width */ public int getDocumentWidth ( ) { return getRenderedWidth ( ) ; }
/* *
* Returns document height */ public int getDocumentHeight ( ) { return getRenderedHeight ( ) ; }
/* *
* Returns rendered width
* Θreturn 'int' - rendered width */ public int getRenderedWidth ( ) { return 0; }
Returns rendered height
* Θreturn 'int' - rendered height */ public int getRenderedHeight ( )
{ return 0;
} * *
* Update renderer size
* Θparam width 'int' - new rendered width * Θparam height 'int' - new rendered height
*/ public void setRenderedSize (int width, int height) {}
/ ** * Returns scroll position on X
* Θreturn 'int' - scroll position */ public int getScrollPositionX ( ) { return 0; }
/ -k -k * Returns scroll position on Y.
k
* Θreturn 'int' - scroll position */ public int getScrollPositionY ( ) { return 0; }
/ ** * Update the scoll position
* Θparam x 'int' - new scroll position on X
* Θparam y 'int' - new scroll position on Y */ public void setScrollPosition ( int x,int y) {} **
* Returns the scale/zoom facto'r * * Θreturn 'float' - current scale/zoom factor */ public float getScaleFactor ( ) { return If; 5 }
/**
* Update the scale/zoom factor
k
10 * Θparam factor 'float' - new scale/zoom factor */ public void setScaleFactor ( float factor) {} * * 15 * Returns the scrollbars mode
* Θreturn 'int' - current scrollbars mode */ public int getScrollMode ( ) 20.. {_. return SCROLL_AUTO; }
/* * 25 * Update the scrollbars mode
* Θparam mode ' int ' - new scrollbars mode */ public void setScrollMode ( int mode) {} 30
/ k k -k -k k -k -k -k-k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k k -k k -k k -k k -k k -k k -k -k -k -k k -k -k -k -k-k -k -k -k -k -k -k k -k /
/* INTERNAL FUNCTIONS
35 */
/^kk-k-k-k-kk-k-k-k-k^-kk-k-k-k-k-k-k-k^k-kk-k-kkk-k^-kk-k-k^k-k-k^-k-k-k^-k-k-k-k-k-k-k^-k** k k /
40 /**
* Returns default scale factor [colected from services ]
45 */ protected static final float getDefaultScaleFactor ( ) { if (defaultScaleFactor==Of) // cache default scale factor { defaultScaleFactor = If; try
{
String value = ABrowserServices . getBrowserServices ( ) . getProperty ( "Browse r", "scale") ; defaultScaleFactor = FIoat. valueOf( value) . floatValue () ;
} catch (Exception ex) { }
} return defaultScaleFactor ;
Annex 7 BrowserMenuManager
package no .mc . tester .menus ;
import Java. awt.*; import j ava . io . File; import j ava . util . Hashtable ; import j ava . util . EventListener; import "j ava . util . Enumeration; import j ava . util . Vector ; import no .mc . browser . services . * ; import ro .mc . util . * ; import no .mc . tester .* ; import no .mc . tester. languages . * ; public class BrowserMenuManager implements IBrowserPlugin, IBrowserMenuManager,
IBrowserMenuListener , IBrowserMenuItemListener
{ private static final BrowserEventNotifier notifier = new BrowserEventNotifier () ; // event multicaster notifier private static final StringMapper menulds = new StringMapper (true) ; // menu system mapper (ID- >NAME) static final Hashtable menus = new Hashtable ( 117 ) ; // menus private static BrowserServices browserServices; // browser services private static boolean debug=true;
/ k -k k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k k -k -k -k -k k -k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k -k k k -k -k -k -k -k k -k -k k k -k /
/* IMPLEMENT 'IBrowserPlugin' */
/k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-kkk-k-k-k-k-k-kk-kk-k k -k /
/**
* get plugin name
*/ public String getName ( )
{ return "#DefaultMenuManager#" ; }
* get plugin version */ public String getVersion() { return "*.*"; // compliant to all versions }
/**
* get plugin creator */ public String getCreator ( )
{ return "Popa Ciprian - Integrasoft 1999 (C)";
/** _ _ _ _
* get plugin description
*/ public String getDescription ( )
{ return "Global manager for browser menus";
}
/* *
* get plugin style
*/ public int getStyle()
{ return 0;
}
// [_CIPI_] static final String langnew[] = new String [ ] { "Bulgarian" ,
"Hungarian" ,
"Polish",
"Russian" ,
"Ukrainian" ,
"Czech",
"Dutch",
"Spanish", "Portugese" , "Korean" , "Japanise" , "Chinese" };
/ k *
* get a localized string for an id */ public String getResString ( IBrowserLanguage language, int resld)
{ if (resld>=150 && resld<200) return langnew [resld-150] ; if (resld==1000) return "See as text"; return browserServices . getResString ( resld) ; }
/**
* startup function */ public void start (ABrowserServices services)
{ browserServices = (BrowserServices ) services ; addBrowserMenuListener ( this ) ; registerMenuBar ( ) ; // create first entry in menu populateMenuBar ( ) ; // populate main menu bar
}
/k-kk-k-k-kk-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-k-kk-k-k-k-k-k-k-kkk-k-k-k-k-k-k-k-k-k-kk-k k-k /
/* IMPLEMENT 'IBrowserMenuManager' */
/•k-k- -k-k-k-k-k-k-k-k- -k-k-k- - -k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k-k k -k /
/**
* get menu index in his parent by name */ public int getMenuIndex ( String name)
{ int menuld = getMenuId (name) ; i f (menuld==- l ) return INVALID_MENU_INDEX; BrowserMainMenu bmenu = (BrowserMamMenu) menus . get (_Integer (menuld) ) ; if (bmenu==null) return INVALID_MENU_INDEX; BrowserMainMenu bparent = (BrowserMainMenu) bmenu . getMainMenu ( ) ; if (bparent==null ) return INVALID_MENU_INDEX;
IBrowserMainMenu childs[] = bparent . getChilds () ; for (int i=0 ; Kchilds . length ; i++)
{ if (childs [i] ==bmenu) return i;
} return INVALID_MENU_INDEX;
}
/ * *
* get a main menu by name */ public IBrowserMainMenu getMainMenu ( String name)
{ int menuld = getMenuId (name) ;
Object omenu = menus . get (_Integer (menuld) ) ; if (omenu==null | | (omenu instanceof BrowserMenuItem) ) return null; return (BrowserMainMenu) omenu; }
* get a menu item by name */ public IBrowserMenuItem getMenuItem (String name)
{ int menuld = getMenuId (name) ;
Object omenu = menus . get (_Integer (menuld) ) ; if (omenu !=null && (omenu instanceof BrowserMenuItem) ) return (BrowserMenuItem) omenu; return null;
} * *
* get all registered main menu names without popups */ public synchronized IBrowserMainMenu [ ] getMainMenus ( ) {
Vector vtemp = new Vector (13);
Enumeration menuObj s = menus . elements () ; while (menuObj s . hasMoreElements ( ) )
{ BrowserMainMenu bmenu =
(BrowserMainMenu) menuObj s . nextElement ( ) ; int type = bmenu . getTypeld () ; if (type==BrowserMainMenu.MENU_OBJECT_BAR | | type==BrowserMainMenu.MENU_OBJECT_MENU) vtemp . addElement (bmenu) ;
} if ( vtemp . isEmpty () ) return null; IBrowserMainMenu ret[] = new IBxo.wserMainM.enu [vtemp . size ( ) ] ; vtemp . copylnto (ret ) ; return ret;
/**
* get all registered popups
*/ public synchronized IBrowserMainMenu [ ] getPopupMenus (
{ Vector vtemp = new Vector (5);
Enumeration menuObjs = menus . elements () ; while (menuObj s . hasMoreElements ( ) )
{
BrowserMainMenu bmenu = (BrowserMainMenu) menuObj s . nextElement ( ) ; int type = bmenu . getTypeld () ; if (type==Bro serMainMenu . MENU_OBJECT_POPUP) vtemp . addElement (bmenu) ;
} if ( vtemp . isEmpty () ) return null; IBrowserMainMenu ret[] = new IBrowserMainMenu [vtemp . size ( ) ] ; vtemp .copylnto (ret) ; return ret; }
* get all registered menu items */ public synchronized IBrowserMenuItem [ ] getMenuItems ( ) {
Vector vtemp = new Vector (23); Enumeration menuObjs = menus . elements () ; while (menuObj s . hasMoreElements ( ) ) {
Object omenu = menuObj s . nextElement () ; if (omenu instanceof BrowserMenuItem) { BrowserMenuItem bmenu = (BrowserMenuItem) omenu; vtemp . addElement (bmenu) ; } } if ( temp . isEmpty () ) return null;
"IBrowserMenuItem ret[] = new IBrowserMenuItem [vtemp . size ( ) ] ; vtemp . copylnto (ret) ; return ret; }
* get root main menu {MenuBar} */ public IBrowserMainMenu getRootMainMenu ( )
{ return getMainMenu ( SYS_MENU_BAR) ;
}
/**
* create a main menu from a PopupMenu (get name from popup name)
*/ public IBrowserMainMenu createMainMenu (PopupMenu popup, int resld, IBrowserPlugin owner)
{ if (popup==null ) return null; int menuld = registerMenuId (popup . getName ()) ; if (menuld==-l) // invalid id return null; BrowserMainMenu menu = (BrowserMainMenu) menus . get (_Integer (menuld) ) ; if (menu==null) // have to create a new menu menu = new BrowserMainMenu ( this , menuld, resld, popup, owner) ; return menu;
}
/* *
* create a main menu from a string (as name) */ public IBrowserMainMenu createMainMenu ( String name, int resld, IBrowserPlugin owner)
{ if (name==null) return null; int menuld = registerMenuId (name) ; if (menuld==-l) // invalid id return null; BrowserMainMenu menu = (BrowserMainMenu) menus . get (_Integer (menuld) ) ; if (menu==null) // have to create a new menu menu = new BrowserMainMenu (this , menuld, resld, new Menu ( ) , owner) ; return menu;
}
/* *
* append a main menu relative to other menu */ public boolean appendMainMenu (IBrowserMainMenu menu, IBrowserMainMenu parent)
{ if (menu==null I | parent==null | | ! (menu instanceof BrowserMainMenu) | | ! (parent instanceof BrowserMainMenu) ) return false; BrowserMainMenu bmenu = (BrowserMainMenu) menu;
BrowserMainMenu bparent = (BrowserMainMenu) parent ; if (isRegistered (bmenu . getMenuId ( ) ) )
// new menu exists (avoid inconsistence in menus) return true; boolean ret = bparent . insertChild (bmenu, bparent . getChiIdsCount ( ) ) ; if (ret) { // notify menu listeners
BrowserMenuEvent enuEvent = new BrowserMenuEvent (menu, getContext ( ) , BrowserMenuEvent .MENU INSERTED_MAINMENU) ; notifier . notifyListeners (menuEvent) ; } return ret; }
/** * insert a main menu relative to other menu to given position */ public boolean insertMainMenu ( IBrowserMainMenu menu, IBrowserMainMenu parent, int position) { if (menu==null | | parent==null | | ! (menu instanceof BrowserMainMenu) I I ! (parent instanceof BrowserMainMenu)) return false; BrowserMainMenu bmenu = (BrowserMainMenu) menu; BrowserMainMenu bparent = (BrowserMainMenu) parent ; if (isRegistered (bmenu . getMenuId ( ) ) )
// new menu exists (avoid inconsistence in menus) return true; boolean ret = bparent . insertChild (bmenu, position) ; if (ret) {
// notify menu listeners BrowserMenuEvent menuEvent = new BrowserMenuEvent (menu, getContext ( ) , BrowserMenuEvent .MENU INSERTED_MAINMENU) ; notifier . notifyListeners (menuEvent) ;
} return ret; }
* remove a main menu */ public boolean removeMainMenu ( IBrowserMainMenu menu) { if (menu==null | | ! (menu instanceof BrowserMainMenu) ) return false; if (menu . getMainMenu () ==null ) // avoid to remove menu bar && popups return false; BrowserMainMenu bmenu = (BrowserMainMenu) menu; BrowserMainMenu bparent = (BrowserMainMenu) menu . getMainMenu ( ) ; if (! isRegistered (bmenu . getMenuId ()) ) // menu not exists return false; boolean ret = bparent . removeChild (bmenu) ; if (ret) {
// notify menu listeners BrowserMenuEvent menuEvent = new BrowserMenuEvent (menu, getContext ( ) , BrowserMenuEvent .MENU_ REMOVED_MAINMENU) ; notifier .notifyListeners (menuEvent ) ;
} return ret;
}
/ * *
* create a menu separator
*/ public IBrowserMenuItem createSeparator ( )
{ return new BrowserMenuItem ( this ) ;
/* *
* create a menu item */ public IBrowserMenuItem createMenuItem ( String name, int resld, boolean isCheckbox, IBrowserPlugin owner)
{ int menuld = registerMenuId (name ) ; if (menuld==-l) // invalid id return null; Object omenu = menus . get (_Integer (menuld) ) ; if (omenu==null ) // have to create a new menu return new BrowserMenuItem ( this , menuld, resld, isCheckbox? (new CheckboxMenuItem( ) ) : (new Menultem() ) , owner) ; else if (omenu instanceof BrowserMenuItem) // menu item exists return (BrowserMenuItem) omenu; return null; }
/**
* append a menu item to a given main menu */ public boolean appendMenuItem ( IBrowserMenuItem menu, IBrowserMainMenu parent) { if (menu==null | | parent==null | | ! (menu instanceof BrowserMainMenu) | | ! (parent instanceof BrowserMainMenu) ) return false; BrowserMainMenu bmenu = (BrowserMainMenu) menu; BrowserMainMenu bparent = (BrowserMainMenu) parent ; if (isRegistered (bmenu . getMenuId ()) )
// new menu exists (avoid inconsistence in menus) return true; boolean ret = bparent. insertChild (bmenu, bparent. getChildsCount () ) ; if (ret) {
// notify menu listeners BrowserMenuEvent menuEvent = new
BrowserMenuEvent (menu, getContext ( ) , BrowserMenuEvent .MENU INSERTED_MENUITEM) ; notifier . notifyListeners (menuEvent) ;
} return ret;
}
/ - -k
* insert a menu item to a given position */ public boolean insertMenuItem (IBrowserMenuItem menu, IBrowserMainMenu parent, int position)
{ if (menu==null | | parent==null | | ! (menu instanceof BrowserMainMenu) | | ! (parent instanceof BrowserMainMenu) ) return false; BrowserMainMenu bmenu = (BrowserMainMenu) menu; BrowserMainMenu bparent = (BrowserMainMenu) parent ; if ( isRegistered (bmenu . getMenuId ( ) ) ) // new menu exists (avoid inconsistence in menus) return true; boolean ret = bparent . insertChild (bmenu, position) ; if (ret) {
// notify menu listeners BrowserMenuEvent menuEvent = new BrowserMenuEvent (menu, getContext () , BrowserMenuEvent . MENU_ INSERTED_MENUITEM) ; notifier . notifyListeners (menuEvent) ;
} return ret;
}
/** -
* remove a menu item from menu
*/ public boolean removeMenuItem ( IBrowserMenuItem menu)
{ if (menu==null | | ! (menu instanceof BrowserMainMenu) ) return false; if (menu . getMainMenu () ==null ) // avoid to remove menu bar && popups return false; BrowserMainMenu bmenu = (BrowserMainMenu) menu; BrowserMainMenu bparent = (BrowserMainMenu) menu . getMainMenu ( ) ; if (! isRegistered (bmenu . getMenuId ()) ) // menu not exists return false; boolean ret = bparent . removeChild (bmenu) ; if (ret)
{
// notify menu listeners BrowserMenuEvent menuEvent = new
BrowserMenuEvent (menu, getContext (), BrowserMenuEvent . MENU_ REMOVED_MENUITEM) ; notifier . notifyListeners (menuEvent) ; } return ret; }
/ - -k
* fire a show popup event (should be called by popups before showing)
*/ public void fireShowPopup (IBrowserMainMenu popup)
{ if (popup==null | | ! (popup instanceof BrowserMainMenu) ) return; // notify menu listeners BrowserMenuEvent menuEvent = new BrowserMenuEvent (popup, getContext ( ) , BrowserMenuEvent .MENU _SHOWPOPUP) ; notifier . notifyListeners (menuEvent) ; }
* add a new browser listener */ public void addBrowserMenuListener ( IBrowserMenuListener listener)
{ notifier . addListener (listener ) ; }
/* *
* remove a browser listener */ public void removeBrowserMenuListener (IBrowserMenuListener listener) { notifier. removeListener (listener) ; }
/ k -k -k -k -k -k -k k -k -k-k -k -k -k-k -k -k -k -k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k -k -k k k -k -k -k -k -k k -k -k k -k -k -k k -k -k -k -k k k / /* IMPLEMENT ' IMenuItemListener '
*/
/ ■k ^k k -k -k -k -k -k k-k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k -k k -k -k -k k -k -k -k-k -k -k -k -k -k -k -k -k k -k
k-k i * inserted a main menu */ public boolean insertedMainMenu (BrowserMenuEvent event) {
// [debug]
//Debuger .debug ("INSERT MAIN MENU : "+event . getMainMenu ( ) ) ; return true; }
* inserted a main menu
*/ public boolean removedMamMenu (BrowserMenuEvent event)
{
//Debuger. debug ("REMOVED MAIN MENU : "+event . getMainMenu ( ) ) ; return true; }
/ -k -k
* inserted a main menu */ public boolean insertedMenuItem (BrowserMenuEvent event)
{
//Debuger. debug ("INSERT MENU ITEM : "+event . getMenuItem ( ) ) ; return true; }
/ -k -k
* inserted a main menu */ public boolean removedMenuItem (BrowserMenuEvent event)
{
//Debuger. debug ("REMOVE MENU ITEM : "+event . getMenuItem ( ) ) ; return true; }
/**
* show a popup */ public boolean showPopup (BrowserMenuEvent event) {
//Debuger .debug ("SHOW POPUP : "+event . getMainMenu ()) ; return true; }
/ k -k k k k -k k k k -k -k -k k -k -k -k -k -k k -k -k -k it -k-k -k -k ^ -k ^ -k -k -k -k -k -k -k -k -k -k -k ^ ^ k -k -k ^ -k -k ^ -k k -k -k -k k: k -k /
/* IMPLEMENT ' IMenuItemListener ' */
/ -kk-kk-k-k -k -k-k-k-k-k -k-k-k-k-k-k-k -k -k-k-k-k-k-k-k-k -k-k-k-k-k-k-k-kk-k-k-k-k-k-kk-k -k-kk k -k /
/**
* menu item is actioned */ public boolean executeMenu (BrowserMenuItemEvent event) { int menuld = event . getMenuItem (). getResId( ) ;
IBrowser browser = getContext (). getBrowser () ; switch (menuld)
{ case IBrowserlDEManager . SYS_MENU_FILE_NEW : if (debug) System. out .println ("** NEW **" + browser) ;
String newBrw = null; IBrowser brw = browserServices . createBrowser (newBrw) ; brw . openDocument ( " " , null, null , null) ; break; case IBrowserlDEManager . SYS_MENU_FILE_OPEN : if (debug) System. out .println ("** OPEN **" + browser) ; FileDialog fdo = new
FileDialog (browserServices . getContext ( ) . getBrowser ( ) .getB rowse Frame ( ) , "Open file" , FileDialog . LOAD) ; fdo . setDirectory (browserServices. lastDirectory); f o . setVisible (true) ; if (fdo. getFile () !=null)
{ browserServices . lastDirectory = fdo . getDirectory ( ) ; browser . openDocument ( "file : /"+fdo . getDirectory () +fdo .getF ile (), null, null, null) ; } break; case IBrowserlDEManager . SYS_MENU_FILE_EXIT : if (debug) System. out .println ( "** EXIT **" + browser) ; browser . close ( ) ; break; case IBrowserlDEManager . SYS_MENU__FILE_SAVE : if (debug) System. out .println ("** SAVE **" + browser) ; /* FileDialog fds = new
FileDialog (browserServices . getContext ( ) . getBrowser ( ) .getB rowserFrame ( ) , "Save file", FileDialog. SAVE) ; fds . setDirectory (browserServices . lastDirectory) ; fds. setVisible (true) ; if (fds. getFile () !=null)
' {' browserServices . lastDirectory = fds . getDirectory ( ) ;
browser. saveDocument (fds.getDirectory()+fds.getFile() ) ;
// System. out. println (browserServices. lastDirectory); }
*/ break; case IBrowserlDEManager. SYS_MENU__HELP_ABOUT : if (debug) System. out .println ("** ABOUT **" + browser) ; browser = browserServices . createBrowser ( "_HELP_" ) ; browser . setMenuVisible (false) ; browser .setlnputVisible (false) ; browser . openDocument ("about:", null, null, null) ; brea ; case IBrowserlDEManager . SYS_MENU_VIEW_BACK : if (debug) System. out .println ("** BACK **" + browser) ; browser . backDocument ( ) ; break; case IBrowserlDEManager . SYS__MENU_VIEW_FORWARD : if (debug) System. out .println ("** FORWARD **" + browser) ; browser . forwardDocument ( ) ; break; case IBrowserlDEManager . SYS_MENU_VIEW_RELOAD : if (debug) System. out .printlnC'** RELOAD **" + browser) ; browser . reloadDocument ( true ) ; break; case IBrowserlDEManager . SYS_MENU_VIEW_STOP : if (debug) System. out .println ("** STOP **" + browser) ; browser . stopDocument ( ) ; break; case IBrowserlDEManager . SYS_MENU_ZOOM_IN : // + if (debug) System. out .println ("** ZOOM IN **" + browser) ;
browser. setScaleFactor (browser. getScaleFactor () +0. If ) ; _ break; case IBrowserlDEManager. SYS_MENU_ZOOM_OUT : // - if (debug) System. out .println ("** ZOOM OUT **" + browser) ; browser. setScaleFactor (browser. getScaleFactor ()- O.lf); break; case IBrowserlDEManager. SYS_MENU_ZOOM_RESET : // * if (debug) System. out .println ( "** ZOOM RESET **" + browser) ; browser . setScaleFactor ( If ) ; break; } return true; }
/* *
* menu status is actioned
*/ public boolean changeMenu (BrowserMenuItemEvent event) { int menuld = event . getMenuItem (). getResId () ; Browser browser = (Browser ) getContext (). getBrowser () ; boolean isChecked = event . getMenuItem () . isChecked () ; switch (menuld) { // change status for IDE panels // case IBrowserlDEManager . SYS_MENU_OPTI0NS_C0NTROLS
// Debuger. debug ("** CONTROLS ** "÷isChecked+browser ) ;
// browser . setControlsVisible (isChecked) ; // break;
// case IBrowserlDEManager . SYS_MENU_OPTIONS_STATUS : // Debuger .debug ("** STATUS ** "+isChecked+browse ) ;
// browser. setStatusVisible (isChecked) ; // break;
// case IBrowserlDEManager . SYS_MENU_OPTIONS_INPUT : // Debuger .debug ("** INPUT ** "+isChecked -browser) ;
// browser. setlnputVisible (isChecked) ; / / break; case IBrowserlDEManager . SYS_MENU_OPTIONS_MENU : //Debuger .debug ("** MENU ** "÷isChecked + browser) ;
//browser. setMenuVisible (isChecked) ; break; case 1000 : // * AS#TEXT
//Debuger .debug ("** AS TEXT **" + browser); //browser.asText (isChecked) ; break; // change language default :
IBrowserLanguage lang = browserServices . getLanguage ( ) ; int resLangld = (menuld - IBrowserlDEManager. SYS_LANG_OFFSET_ID) ; if (resLangId==lang . getLanguageld ( ) && event . getSource ( ) instanceof CheckboxMenuItem) // check again same language
( (CheckboxMenuItem) event. getSource () ) . setState (true) ; else if (resLangId>=0 ) //' use language convention
browserServices. setLanguage (lang. getLanguage (resLangld) );
} return true;
} / k ^ -k -k -k -k -k k -k -k -kk -k -k -k k k k k -k k k -k -k -k k -k -k -k -k k^ -k -k k k -k -k -k -k -k -k -kk-k -k -k -k -k -k -k -k -k -k k -k k -k /
/* extra functions */
/k -k -k -k k k -k -k -k -k -k -k -k k -k -k -k -k -k -k -k -k -k -k -k -k k k -k -k -k -k -k -k -k-k -k -k -k -k -k -k -k -k -k -k k -k /
/**
* helper function to consstruct object integer form int */ private static final Integer _Integer(int value)
{ return new Integer (value) ;
}
* register a global menu name & return generated id (if can not register return -1) _
*/ static final int registerMenuId ( String name)
{ return enulds . registerName (name) ; }
/* *
* get menu id by name */ static final int getMenuId ( String name)
{ return menulds . getld (name) ;
}
/**
* get menu name by id */ static final String getMenuName (int id) { return menulds . getName (id) ;
'* * test if is registered */ static final boolean isRegistered (int id)
{ return menus .get(_Integer(id) ) ! =null ; }
/ k -k
* register a menu */ static final void registerMenu (BrowserMainMenu menu) { int id = menu . getMenuId () ; if (! isRegistered (id) ) menus . put (_Integer (id) , menu) ; }
/ -k -k
* unregister a menu
*/ static final void unregisterMenu ( int id)
{ menus . remove (__Integer (id) ) ;
}
/**
* get browser context
*/ public static synchronized final void updateMenuBar (Browser browser) {
MenuBar oldMenuBar = browser . getMenuBar () ; if ( oldMenuBar==null && browser . isVisible () ) // menu not visible return; BrowserMainMenu oldRoot =
(BrowserMainMenu) menus .get (_Integer ( 0) ) ;
BrowserMainMenu root = new BrowserMainMenu ( oldRoot ) ; MenuBar newMenuBar = (MenuBar ) root . getMenuObj ect () ; // -k -k -k -k -k -k -k -k -k -k k k -k update system check menus IBrowserMainMenu menuCheck; // update CONTROLS menuCheck = //root .findMenuByName (SYS_MENU_OPTIONS_CONTROLS ) ; // if (menuCheck ! =null) //menuCheck. setChecked (browser . isControlsVisible ( ) ) ; // update STATUS // menuCheck = //root . findMenuByName (SYS_MENU_OPTIONS_STATUS ) ; // if (menuCheck ! =null)
//menuCheck . setChecked (browser. isStatusVisible() ) ; // update INPUT // menuCheck = root . findMenuByName ( SYS_MENU_OPTIONS_INPUT ) ; // if (menuCheck ! =null)
//menuCheck . setChecked (browser . islnputvisible ( ) ) ; // update MENU menuCheck = root . findMenuByName (SYS_MENU_OPTIONS_MENU) ; if (menuCheck ! =null) menuCheck . setChecked (browser . isMenuVisible ( ) ) ; // * - -k * -k * - - -k * -k * * refresh all menus boolean fake = true; // fake is ACTIVE ! ! ! ! ! if (oldMenuBar==null | | !fake) // browser just created
{ browser . setMenuBar (newMenuBar ) ; return;
} // it's a fake to change menu with animation efect int oldSize = oldMenuBar . getMenuCount () ; int newSize = newMenuBar . getMenuCount () ; int maxSize = Math .max (oldSize, newSize) ; int i = 0; while (i++<maxSize) { if (i<=oldSize) oldMenuBar . remove ( 0) ; if (i<=newSize) oldMenuBar . add (newMenuBar . getMenu ( 0) ) ; // is removed every time
} }
/ -k -k
* get browser context */ static final IBrowserContext getContext ( ) { return browserServices . getContext ( ) ; }
/**
* create & register root main menu */ private final void registerMenuBar ( ) { int menuld = registerMenuId (SYS_MENU_BAR) ; BrowserMainMenu mainBar = new BrowserMainMenu (this, enuld, -1, new MenuBar () , this ) ; menus .put (_Integer (menuld) , mainBar ) ;
}
/**
* helper function to consstruct object integer form int */ private void populateMenuBar ( ) {
IBrowserMainMenu root = (BrowserMainMenu) menus .get (_Integer (registerMenuId ( SYS_ME NU_BAR) ) ) ;
IBrowserMainMenu mainMenu, parent; IBrowserMenuItem menultem;
// **************** create "FILE" menu ***************** mainMenu = createMainMenu ( SYS_MENU_FILE , IBrowserlDEManager . SYS_MENU_ FILE, this) ; appendMainMenu (mainMenu, root) ;
// [NEW] menultem = createMenuItem (SYS_MENU_FILE_NEW, IBrowserlDEManager . SYS_M ENU_FILE_NEW, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ;
// [OPEN] menultem = createMenuItem (SYS_MENU_FILE_OPEN, IBrowserlDEManager. SYS_ MENU_FILE_OPEN, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ;
// [SAVE] menultem = createMenuItem (SYS_MENU_FILE_SAVE, IBrowserlDEManager. SYS MENU_FILE_SAVE, false, this) ; appendMenuIte (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ;
// [SEPARATOR] menultem = createSeparator () ; appendMenuIte (menultem, mainMenu) ;
// [EXIT] menultem = createMenuItem(SYS_MENU_FILE_EXIT, IBrowserlDEManager. SYS MENU_FILE_EXIT, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ;
// **************** create "VIEW" menu
k ' -k -k ' - -k - 'k ' ' ' 'k - -k mainMenu = createMainMenu ( SYS_MENU_VIEW, IBrowserlDEManager . SYS_MENU_ VIEW, this) ; appendMainMenu (mainMenu, root ) ;
// [RELOAD] menultem = createMenuItem (SYS_MENU_VIEW_RELOAD, IBrowserlDEManager . SY S_MENU_VIEW_RELOAD, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ;
// [STOP] menultem = createMenuItem (SYS_MENU_VIEW_STOP, IBrowserlDEManager. SYS_ MENU_VIEW_STOP, false, this) ; appendMenuIte (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ;
// [SEPARATOR] menultem = createSeparator () ; appendMenuItem (menultem, mainMenu) ;
// [BACK] menultem = createMenuItem(SYS_MENU_VIEW_BACK, IBrowserlDEManager. SYS_ MENU_VIEW_BACK, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener (this) ;
// [FORWARD] menultem = createMenuItem (SYS_MENU_VIEW_FORWARD, IBrowserlDEManager. S YS_MENU_VIEW_FORWARD, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener (this ) ;
// [SEPARATOR] menultem = createSeparator () ; appendMenuItem (menultem, mainMenu) ;
// [ZOOM IN {+}] menultem = createMenuItem (SYS_MENU_ZOOM_IN, IBrowserlDEManager . SYS_ME NU_ZOOM_IN, false, this) ; appendMenuIte (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ; // [ZOOM OUT {-}] menultem = createMenuItem (SYS_MENU_ZOOM_OUT, IBrowserlDEManager. SYS_M ENU_ZOOM_OUT, false, this) ; appendMenuItem (menultem, mainMenu) ; menultem. addMenuItemListener (this ) ;
// [ZOOM RESET {*} ] menultem = createMenuItem(SYS_MENU_ZOOM_RESET, IBrowserlDEManager. SYS _MENU_ZOOM_RESET, false, this) ; appendMenuIte (menultem, mainMenu) ; menultem. addMenuItemListener (this) ;
// [SEPARATOR] menultem = createSeparator () ; appendMenuIte (menultem, mainMenu) ;
// [AS TEXT]
//menultem = createMenuItem ("AS#TEXT", 1000 , true, this ) ;
//appendMenuItem (menultem, mainMenu) ; // menultem. addMenuItemListener (this ) ;
// **************** create "OPTIONS" menu
' 'k - -k 'k 'k -k ' -k 'k - 'k -k - ' 'k -k mainMenu = createMainMenu ( SYS_MENU_OPTIONS, IBrowserlDEManager . SYS_ME NU_OPTIONS, this) ; appendMainMenu (mainMenu, root) ; // [CONTROLS] // menultem =
/ /createMenuItem (SYS_MENU_OPTIONS_CONTROLS, IBrowserlDEMan ager . SYS_MENU_OPTIONS_CONTROLS , true , this ) ; // appendMenuItem (menultem, mainMenu) ; // menultem. addMenuItemListener (this ) ;
// [STATUS] // menultem =
//createMenuItem (SYS_MENU_OPTIONS_STATUS, IBrowserlDEManag er . SYS_MENU_OPTIONS_STATUS , true , this ) ; ' // appendMenuItem (menultem, mainMenu) ; // menultem. addMenuItemListener ( this ) ;
// [INPUT] // menultem =
//createMenuItem(SYS_MENU_OPTIONS_INPUT, IBrowserlDEManage r .SYS_MENU_OPTIONS_INPUT, true, this) ;
// appendMenuItem (menultem, mainMenu) ; // menultem. addMenuItemListener (this) ;
// [MENU]
//menultem = createMenuItem (SYS_MENU_OPTIONS_MENU, IBrowserlDEManager . S YS_MENU_OPTIONS_MENU, true, this) ;
//appendMenuItem (menultem, mainMenu) ;
//menultem. addMenuItemListener ( this ) ;
// [SEPARATOR] menultem = createSeparator () ; appendMenuItem (menultem, ainMenu) ;
// add LANGUAGES parent = mainMenu; mainMenu = createMainMenu ( SYS_MENU_LANGUAGE, IBrowserlDEManager . SYS_M ENU_LANGUAGE , this ) ; appendMainMenu (mainMenu, parent) ;
// ******************* aχχ languages are loaded at final ;))) after all pluggins are loaded ********
// **************** create "HELP" menu ***************** mainMenu = createMainMenu (SYS_MENU_HELP, IBrowserlDEManager. SYS_MENU_ HELP, this) ; appendMainMenu (mainMenu, root) ; // [ABOUT] menultem = createMenuItem ( SYS_MENU_HELP_ABOUT, IBrowserlDEManager . SYS MENU HELP ABOUT , false, this ) ; appendMenuItem (menuItern, mainMenu) ; menultem. addMenuItemListener ( this ) ; }
/**
* helper function to get a language string */ static IBrowserLanguage getLanguage ( )
{ return browserServices . getLanguage () ; }
/**
* add all language to menu && notify registration && refresh all labels
*/ public void validateLanguages ( )
{
IBrowserMainMenu mainMenu = (BrowserMainMenu) menus .get (_Integer (registerMenuId ( SYS_ME NU_LANGUAGE) ) ) ;
BrowserLanguage language = (BrowserLanguage) browserServices .getLanguage() ; IBrowserLanguage languages [] = language . getLanguages () ; for (int i=0 ; i<languages . length ; i++)
{
IBrowserLanguage lang = languages [i] ; // use language convention IBrowserMenuItem menultem = createMenuItem (lang.getLanguageCode ()+"#", IBrowserI DEMana ger. SYS_LANG_OFFSET_ID+lang. getLanguageld ( ) , true, this) ; appendMenuIte (menultem, mainMenu) ; menultem. addMenuItemListener ( this ) ; // notify language registration;
BrowserlDEEvent ideEvent = new BrowserlDEEvent (lang, BrowserlDEEvent . IDE_LANGUAGEREGISTER ED) ; browserServices. notifier. notifyListeners (ideEvent) ; }
// refresh all labels IBrowserMenuManager menuManager = browserServices . getMenuManager ( ) ; int index = 150; for (int i=0 ; i<12 ; i++) {
IBrowserMenuItem menultem = createMenuItem ("LEX#"+i, index+i, true, this) ; appendMenuItem (menultem, ainMenu) ; menultem. setEnabled (false) ;
}
// add custom languages [_CIPI_] changeLanguage ( ) ; }
/**
* helper function to change language for all menu items {called from event language changed} */ public synchronized static void changeLanguage ( ) {
IBrowserLanguage language = getLanguage () ; int langld = language. getLanguageld () ; Enumeration menuObjs = menus . elements () ; String label; while (menuObj s . hasMoreElements ( ) )
{
BrowserMainMenu menu = (BrowserMainMenu) menuObj s . nextElement ( ) ; IBrowserPlugin owner = menu. getOwner () ; if (owner==null) continue; int resld = menu. getResId ( ) ; int resLangld = (resld - IBrowserlDEManager. SYS_LANG_OFFSET_ID) ; if (resLangId>=0) // use language convention {
// get label from language label = language. getLanguageString (language. getLanguage (resLangld
));
// check current language & uncheck others menu. setChecked (resLangId==langId) ;
} else label = owner . getResString (language, resld) ; menu. setLabel (label) ; } } } Annex 8 BrowserScriptManager
package no. c. browser . services;
import Java. awt.*; import Java. net .URL;
public interface IBrowserScriptManager
{ /**
* register / update content handler */ public boolean registerHandler (String handler, String handlerClassString) ; // register a content handler by class
/**
* unregister content type */ public void unregisterHandler (String handler);
// unregister a content handler
/** * set/get content type - description */ public void setDescription (String handler, String description) ; // set content type description public String getDescriptio (String handler);
// get content type description ** * set/get content type - extensions
*/ public void setNa es (String handler, String names []); // set content type extensions public String [] getNames (String handler); // get content type extensions
/** * create a script support object */ public IScriptSupport createScriptSupport (ABrowserServices services, IBrowser browser, IBrowserViewport viewport); // get content type based on extension

Claims

Claims
1. A browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface,
the browser application including a kernel program or programs,
the browser application also including one or more additional programs which are incorporated according to preferences, these preferences being changeable.
2. A browser application upon a client computer used by a user for accessing a resource over a network from a server computer,
the browser application including a kernel program which is preset,
the browser application also including one or more additional programs which are incorporated according to actions made by the user.
3. A browser application according to claim 2 wherein the action made by the user is the selection of an additional program.
4. A browser application according to any previous claim wherein an additional program is included on the client computer as a compressed file, to be decompressed when needed.
5. A browser application according to any previous claim wherein an additional program is transferred over the network to the client computer when needed.
6. A browser application according to claim 5 wherein an additional program is transferred over the network to be run on a virtual machine when needed.
7. A browser application according to any previous claim wherein the one or more additional programs include one or more plug-in applications which supply one or more additional functions to the browser.
8. A browser application according to any previous claim wherein the one or more additional programs include one or more content handlers capable of interpreting and/or manipulating content forms or one or more types of resource.
9. A browser application according to any previous claim wherein the one or more additional programs include one or more protocol handlers capable of transferring content according to one or more types of protocol.
10. A browser application according to any previous claim, including at least two additional programs, wherein one additional program may make a request from the other additional program.
11. A browser application according to any previous claim, wherein one or more additional programs are capable of creating panels in the graphical user interface.
12. A browser application according to any previous claim wherein the browser application includes a function which can ascertain the number of the additional programs.
13. A browser application according to any previous claim, wherein the browser application includes a function which can ascertain the directory location of the additional programs.
14. A browser application according to any previous claim wherein one or more additional programs include a Javascript application such that documents may be edited and compiled into Java using the browser application.
15. A browser application according to any previous claim wherein one or more of the additional programs supplies a new language to be used in the graphical user interface.
16. A browser application according to any previous claim, wherein the graphical user interface includes one or more menus, and one or more of the additional programs control the configuration of the menus.
17. A browser application according to any previous claim wherein the browser application includes a function which can ascertain the directory location of the additional programs available to the browser application.
18. A browser application according to any previous claim, the accessed resource including links to another resource, wherein the browser application includes a function for displaying one or more links and a tree structure relating the links.
19. A browser application according to any previous claim, the accessed resource including directions for the resource's display and /or editing in the graphical user interface, the browser application including a function for interpreting the directions included in the resource for its display and/or editing in the graphical user interface.
20. A browser application according any previous claim, wherein there is provided a registry, and a function which can add or remove the additional programs to and from a registry.
21. A browser application according any previous claim, wherein the additional program includes language data so as to alter the language presented upon the graphical user interface.
22. A browser application according to either claim 1 or claim 2 wherein the kernel program or programs are pre-installed on the client computer.
23. A browser application according to either claim 1 or claim 2 wherein the additional programs are downloaded from a network and installed on the client program.
24. A browser application according to either claim 1 or claim 2 wherein
the browser application includes two or more options displayed upon a menu,
the form of this menu being determined according to preferences chosen by the user.
25. A browser application according to claim 24 wherein the browser application includes more than one menu, and browser application includes a function by which new menus can be inserted into and/or removed from the browser application.
26. A browser application according to either claim 24 or 25 wherein the browser application includes a function by which the menus can be aggregated and/or separated.
27. A browser application according to any previous claim, wherein the browser application including direction receiving means for interpreting directions included in the information for its editing on the client computer,
the information including directions for its display on the client computer,
the browser application including two or more protocol handlers, and
the browser application retrieving the display directions independently of the protocol used to retrieve the information.
28. A browser application according to any previous claim wherein the additional program is JavaScript debugging application.
29. A browser application according to any previous claim wherein the additional program is a document object model display application.
30. A method of accessing a resource using a browser application according to any previous claim, including the steps of
determining the protocol from the uniform resource locator address,
activating an appropriate protocol handler,
retrieving the content, identifying the content type using the extension or the mime type,
instantiating an appropriate content handler to display the document.
31. A method according to claim 30 wherein a mime manager maps the content type to appropriate class for a content handler.
32. A method according to either of claims 30 or 31 wherein the document is retrieved from server on a local area network.
33. A method according to any of claims 30 to 32 wherein the browser application is installed upon a first computer, and the document is retrieved from a digital storage means on that first computer.
34. A method according to any of claims 30 to 33 wherein the browser application displays the file structure by which one or more documents are related.
35. A method of creating a browser application,
the browser application including a kernel program which is preset,
the application also including one or more additional programs which are incorporated according to actions made by the user.
36. A method according to claim 35 wherein the actions made by the user comprise the selection of an additional program.
37. A browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface, the browser including user functions, the graphical user interface including a first set of selectable representations of said functions and/or status bars,
the graphical user interface also including a second set of selectable representations of said functions and/or status bars, this second set being substituted for the first set according to actions made by the user.
38. A browser application according to claim 37, wherein the representations are buttons.
39. A browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface,
wherein the graphical interface includes a first set of selectable representations of functions and/or status bars, and further including a switching means such that the first set may be substituted for a second set of selectable representations of functions and/or status bars.
40. A browser application according to claim 39 wherein the switching means is a button.
41. A browser application upon a client computer used by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface,
the browser application including a JavaScript debugging application.
42. A browser application upon a client computer used by a user for accessing a formatted resource over a network from a server computer and displaying at least part of the resource on a graphical user interface,
the browser application including a means of displaying the nodes and/or subnodes of a resource as a document object model.
43. A browser application according to claim 42 wherein the nodes and/or subnodes of the document object model may be searched for a component or property.
44. A method of accessing a resource over a network from a server computer by a browser application upon a client computer used by a user and displaying at least part of the resource on a graphical user interface,
the browser application sending an identifier associated with display or function preferences,
the server computer generating the form of the resource in response to the identifier.
45. A method according to claim 44 wherein the identifier is generated according to user preferences.
46. A method according to claim 44 wherein the identifier is generated according to user profile information.
47. A resource adapted for use in any of claims 44 to 46.
48. A resource according to claim 47, wherein the resource is a Web page.
49 A resource according to claim 47 or claim 48, wherein the resource includes links to other resources.
50. A resource according to any of claims 47 to 49, wherein the links include a plurality of Web sites.
51. A browser application system including a browser application on a client computer usable by a user for accessing a resource over a network from a server computer and displaying at least part of the resource on a graphical user interface,
the browser application including a kernel program or programs,
the client computer capable of downloading one or more additional programs to be included in the browser application.
52. A computer client system programmed with a browser application according to one of the previous claims.
53. A computer program product stored on a computer readable medium and constituting, when installed on a client computer, a browser application upon said client computer in accordance with one of the previous claims.
54. A computer program product according to claim 53, wherein said computer readable medium is a CD-ROM, a DVD disc, or other optical data carrier.
55. A computer program product according to claim 53, wherein said computer readable medium is a magnetic or magneto optic disc.
56. A computer program product according to claim 53, wherein said computer readable medium is a propagated signal carrying information describing said computer program.
57. A browser application as herein described and illustrated.
58. A resource as herein described and illustrated.
59. Any novel and inventive feature or combination of features specifically disclosed herein within the meaning of Article 4H of the International Convention (Paris Convention).
PCT/NO2002/000233 2001-06-26 2002-06-25 A browser WO2003001411A2 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
US30046601P 2001-06-26 2001-06-26
NO20013212 2001-06-26
NO20013212A NO20013212L (en) 2001-06-26 2001-06-26 Browser
US60/300,466 2001-06-26

Publications (2)

Publication Number Publication Date
WO2003001411A2 true WO2003001411A2 (en) 2003-01-03
WO2003001411A3 WO2003001411A3 (en) 2003-10-02

Family

ID=26649313

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/NO2002/000233 WO2003001411A2 (en) 2001-06-26 2002-06-25 A browser

Country Status (1)

Country Link
WO (1) WO2003001411A2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9135227B2 (en) 2002-09-10 2015-09-15 SQGo, LLC Methods and systems for enabling the provisioning and execution of a platform-independent application

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1003101A2 (en) * 1998-11-18 2000-05-24 On-link technologies Inc. An apparatus and system for efficient delivery and deployment of an application

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1003101A2 (en) * 1998-11-18 2000-05-24 On-link technologies Inc. An apparatus and system for efficient delivery and deployment of an application

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9135227B2 (en) 2002-09-10 2015-09-15 SQGo, LLC Methods and systems for enabling the provisioning and execution of a platform-independent application
US9311284B2 (en) 2002-09-10 2016-04-12 SQGo, LLC Methods and systems for enabling the provisioning and execution of a platform-independent application
US9342492B1 (en) 2002-09-10 2016-05-17 SQGo, LLC Methods and systems for the provisioning and execution of a mobile software application
US9390191B2 (en) 2002-09-10 2016-07-12 SQGo, LLC Methods and systems for the provisioning and execution of a mobile software application
US10372796B2 (en) 2002-09-10 2019-08-06 Sqgo Innovations, Llc Methods and systems for the provisioning and execution of a mobile software application
US10552520B2 (en) 2002-09-10 2020-02-04 Sqgo Innovations, Llc System and method for provisioning a mobile software application to a mobile device
US10810359B2 (en) 2002-09-10 2020-10-20 Sqgo Innovations, Llc System and method for provisioning a mobile software application to a mobile device
US10831987B2 (en) 2002-09-10 2020-11-10 Sqgo Innovations, Llc Computer program product provisioned to non-transitory computer storage of a wireless mobile device

Also Published As

Publication number Publication date
WO2003001411A3 (en) 2003-10-02

Similar Documents

Publication Publication Date Title
US5848424A (en) Data navigator interface with navigation as a function of draggable elements and drop targets
US5877765A (en) Method and system for displaying internet shortcut icons on the desktop
US6101510A (en) Web browser control for incorporating web browser functionality into application programs
US5870552A (en) Method and apparatus for publishing hypermedia documents over wide area networks
US6460058B2 (en) Object-oriented framework for hyperlink navigation
US5913033A (en) Apparatus and method for retrieving information using standard objects
US6549217B1 (en) System and method for computer system management using bookmarks
KR100900743B1 (en) Data sharing system, method and software tool
JP4861611B2 (en) Framework for creating modular web applications
EP0798635B1 (en) Internet-enabled portfolio manager system, method and computer program product
US7725560B2 (en) Web service-enabled portlet wizard
US7873668B2 (en) Application data binding
US20040010598A1 (en) Portal setup wizard
US20050172262A1 (en) Site menu - browser toolbar-based user interface for navigating web site pages
US20020152283A1 (en) Active ALT tag in HTML documents to increase the accessibility to users with visual, audio impairment
JPH11514769A (en) Embedded web server
EP0918424A2 (en) Automatic association of predefined user data with query entry fields
JPH1091447A (en) Catalogue device for promoting reusage of distributed object in distribution object system
Parihar ASP. Net Bible
WO2003001411A2 (en) A browser
US7668929B1 (en) Abstracting links to electronic resources in a network environment
JP2002540529A (en) Dynamic application system for distributed computer environment
Green Component-based software development: implications for documentation
Duthie et al. ASP. NET in a Nutshell
bin Uzayr et al. Knockout

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A2

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ OM PH PL PT RO RU SD SE SG SI SK SL TJ TM TN TR TT TZ UA UG US UZ VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A2

Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
REG Reference to national code

Ref country code: DE

Ref legal event code: 8642

122 Ep: pct application non-entry in european phase
NENP Non-entry into the national phase in:

Ref country code: JP

WWW Wipo information: withdrawn in national office

Country of ref document: JP