Java Doc for Browser.java in  » Template-Engine » ostermillerutils » com » Ostermiller » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » ostermillerutils » com.Ostermiller.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.Ostermiller.util.Browser

Browser
public class Browser (Code)
Allows URLs to be opened in the system browser on Windows and Unix. More information about this class is available from ostermiller.org.
author:
   Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities
since:
   ostermillerutils 1.00.00


Field Summary
protected static  BrowserDialogdialog
     The dialog that allows user configuration of the options for this class.
public static  String[]exec
     A list of commands to try in order to display the url.
protected static  ResourceBundlelabels
     Locale specific strings displayed to the user.


Method Summary
public static  String[]defaultCommands()
     Retrieve the default commands to open a browser for this system.
public static  booleandialogConfiguration(Frame owner)
     Show a dialog that allows the user to configure the command lines used for starting a browser on their system.
Parameters:
  owner - The frame that owns the dialog.
public static  booleandialogConfiguration(Frame owner, Properties props)
     Show a dialog that allows the user to configure the command lines used for starting a browser on their system. String used in the dialog are taken from the given properties.
public static  voiddisplayURL(String url)
     Display a URL in the system browser. Browser.init() should be called before calling this function or Browser.exec should be set explicitly. For security reasons, the URL will may not be passed directly to the browser as it is passed to this method.
public static  voiddisplayURL(String url, String namedWindow)
     Display the URL in the named window.
public static  voiddisplayURLinNew(String url)
     Display the URL in a new window. Uses javascript to check history.length to determine if the browser opened a new window already.
public static  voiddisplayURLs(String[] urls)
     Display the URLs, each in their own window, in the system browser.
public static  voiddisplayURLs(String[] urls, String[] namedWindows)
     Display the URLs in the named windows. If the browser opens a new window by default, this will likely cause a duplicate window to be opened.
public static  voiddisplayURLs(String[] urls, String namedWindow)
     Display the URLs the first in the given named window. If the browser opens a new window by default, this will likely cause a duplicate window to be opened.
public static  voiddisplayURLsinNew(String[] urls)
     Display the URLs, each in their own window, in the system browser and the first in the named window.
public static  JPanelgetDialogPanel(Window parent)
     If you wish to add to your own dialog box rather than have a separate one just for the browser, use this method to get a JPanel that can be added to your own dialog. mydialog.add(Browser.getDialogPanel(mydialog)); Browser.initPanel(); mydialog.show(); if (ok_pressed){   Browser.userOKedPanelChanges(); }
Parameters:
  parent - window into which panel with eventually be placed.
public static  voidinit()
     Determine appropriate commands to start a browser on the current operating system.
public static  voidinitPanel()
     If you are using the getDialogPanel() method to create your own dialog, this method should be called every time before you display the dialog.
public static  voidload(Properties props)
     Load the options for this class from the given properties file. This method is designed to work with the save(props) method.
public static  voidmain(String[] args)
     Open the url(s) specified on the command line in your browser.
public static  voidsave(Properties props)
     Save the options used to the given properties file.
public static  voidsetLocale(Locale locale)
     Set the locale used for getting localized strings.
public static  voiduserOKedPanelChanges()
     If you are using the getDialogPanel() method to create your own dialog, this method should be called after you display the dialog if the user pressed ok.

Field Detail
dialog
protected static BrowserDialog dialog(Code)
The dialog that allows user configuration of the options for this class.
since:
   ostermillerutils 1.00.00



exec
public static String[] exec(Code)
A list of commands to try in order to display the url. The url is put into the command using MessageFormat, so the URL will be specified as {0} in the command. Some examples of commands to try might be:
rundll32 url.dll,FileProtocolHandler {0}
netscape {0}
These commands are passed in order to exec until something works when displayURL is used.
since:
   ostermillerutils 1.00.00



labels
protected static ResourceBundle labels(Code)
Locale specific strings displayed to the user.
since:
   ostermillerutils 1.00.00





Method Detail
defaultCommands
public static String[] defaultCommands()(Code)
Retrieve the default commands to open a browser for this system. list of commands
since:
   ostermillerutils 1.00.00



dialogConfiguration
public static boolean dialogConfiguration(Frame owner)(Code)
Show a dialog that allows the user to configure the command lines used for starting a browser on their system.
Parameters:
  owner - The frame that owns the dialog. whether or not the dialog has changed
since:
   ostermillerutils 1.00.00



dialogConfiguration
public static boolean dialogConfiguration(Frame owner, Properties props)(Code)
Show a dialog that allows the user to configure the command lines used for starting a browser on their system. String used in the dialog are taken from the given properties. This dialog can be customized or displayed in multiple languages.

Properties that are used: com.Ostermiller.util.BrowserDialog.title
com.Ostermiller.util.BrowserDialog.description
com.Ostermiller.util.BrowserDialog.label
com.Ostermiller.util.BrowserDialog.defaults
com.Ostermiller.util.BrowserDialog.browse
com.Ostermiller.util.BrowserDialog.ok
com.Ostermiller.util.BrowserDialog.cancel

Parameters:
  owner - The frame that owns this dialog.
Parameters:
  props - contains the strings used in the dialog. whether or not the dialog has changed
since:
   ostermillerutils 1.00.00




displayURL
public static void displayURL(String url) throws IOException(Code)
Display a URL in the system browser. Browser.init() should be called before calling this function or Browser.exec should be set explicitly. For security reasons, the URL will may not be passed directly to the browser as it is passed to this method. The URL may be made safe for the exec command by URLEncoding the URL before passing it.
Parameters:
  url - the url to display
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



displayURL
public static void displayURL(String url, String namedWindow) throws IOException(Code)
Display the URL in the named window. If the browser opens a new window by default, this will likely cause a duplicate window to be opened. Browser.init() should be called before calling this function or Browser.exec should be set explicitly.
Parameters:
  url - the url to display
Parameters:
  namedWindow - the name of the desired window.
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



displayURLinNew
public static void displayURLinNew(String url) throws IOException(Code)
Display the URL in a new window. Uses javascript to check history.length to determine if the browser opened a new window already. If it did, the url is shown in that window, if not, it is shown in new window. Some browsers do not allow the length of history to be viewed by a web page. In that case, the url will be displayed in the current window. Browser.init() should be called before calling this function or Browser.exec should be set explicitly.
Parameters:
  url - the url to display in a new window.
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



displayURLs
public static void displayURLs(String[] urls) throws IOException(Code)
Display the URLs, each in their own window, in the system browser. Browser.init() should be called before calling this function or Browser.exec should be set explicitly. If more than one URL is given an HTML page containing JavaScript will be written to the local drive, that page will be opened, and it will open the rest of the URLs.
Parameters:
  urls - the list of urls to display
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



displayURLs
public static void displayURLs(String[] urls, String[] namedWindows) throws IOException(Code)
Display the URLs in the named windows. If the browser opens a new window by default, this will likely cause a duplicate window to be opened. This method relies on the browser to support javascript. Browser.init() should be called before calling this function or Browser.exec should be set explicitly. Extra names for windows will be ignored, and if there are too few names, the remaining windows will be named "_blank".
Parameters:
  urls - the list of urls to display
Parameters:
  namedWindows - the list of names for the windows.
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



displayURLs
public static void displayURLs(String[] urls, String namedWindow) throws IOException(Code)
Display the URLs the first in the given named window. If the browser opens a new window by default, this will likely cause a duplicate window to be opened. This method relies on the browser to support javascript. Browser.init() should be called before calling this function or Browser.exec should be set explicitly.
Parameters:
  urls - the list of urls to display
Parameters:
  namedWindow - the name of the first window to use.
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



displayURLsinNew
public static void displayURLsinNew(String[] urls) throws IOException(Code)
Display the URLs, each in their own window, in the system browser and the first in the named window. The first URL will only be opened in the named window if the browser did no open it in a new window to begin with. Browser.init() should be called before calling this function or Browser.exec should be set explicitly. An html page containing javascript will be written to the local drive, that page will be opened, and it will open all the urls.
Parameters:
  urls - the list of urls to display
throws:
  IOException - if the url is not valid or the browser fails to star
since:
   ostermillerutils 1.00.00



getDialogPanel
public static JPanel getDialogPanel(Window parent)(Code)
If you wish to add to your own dialog box rather than have a separate one just for the browser, use this method to get a JPanel that can be added to your own dialog. mydialog.add(Browser.getDialogPanel(mydialog)); Browser.initPanel(); mydialog.show(); if (ok_pressed){   Browser.userOKedPanelChanges(); }
Parameters:
  parent - window into which panel with eventually be placed. the dialog
since:
   ostermillerutils 1.02.22



init
public static void init()(Code)
Determine appropriate commands to start a browser on the current operating system. On windows:
rundll32 url.dll,FileProtocolHandler {0}
On other operating systems, the "which" command is used to test if Mozilla, netscape, and lynx(xterm) are available (in that order).
since:
   ostermillerutils 1.00.00



initPanel
public static void initPanel()(Code)
If you are using the getDialogPanel() method to create your own dialog, this method should be called every time before you display the dialog. mydialog.add(Browser.getDialogPanel(mydialog)); Browser.initPanel(); mydialog.show(); if (ok_pressed){   Browser.userOKedPanelChanges(); }
since:
   ostermillerutils 1.02.22



load
public static void load(Properties props)(Code)
Load the options for this class from the given properties file. This method is designed to work with the save(props) method. All properties used will start with com.Ostermiller.util.Browser. If no configuration is found, the default configuration will be used. If this method is used, a call to Browser.init(); is not needed.
Parameters:
  props - properties file from which configuration is loaded.
since:
   ostermillerutils 1.00.00



main
public static void main(String[] args)(Code)
Open the url(s) specified on the command line in your browser.
Parameters:
  args - Command line arguments (URLs)



save
public static void save(Properties props)(Code)
Save the options used to the given properties file. Property names used will all start with com.Ostermiller.util.Browser Properties are saved in such a way that a call to load(props); will restore the state of this class. If the default commands to open a browser are being used then they are not saved in the properties file, assuming that the user will want to use the defaults next time even if the defaults change.
Parameters:
  props - properties file to which configuration is saved.
since:
   ostermillerutils 1.00.00



setLocale
public static void setLocale(Locale locale)(Code)
Set the locale used for getting localized strings.
Parameters:
  locale - Locale used to for i18n.
since:
   ostermillerutils 1.00.00



userOKedPanelChanges
public static void userOKedPanelChanges()(Code)
If you are using the getDialogPanel() method to create your own dialog, this method should be called after you display the dialog if the user pressed ok. mydialog.add(Browser.getDialogPanel(mydialog)); Browser.initPanel(); mydialog.show(); if (ok_pressed){   Browser.userOKedPanelChanges(); }
since:
   ostermillerutils 1.02.22



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.