View Javadoc

1   /***
2    * 
3    */
4   package org.telscenter.pas.ui.browser.jdic;
5   
6   import org.jdesktop.jdic.browser.BrowserEngineManager;
7   import org.jdesktop.jdic.browser.IWebBrowser;
8   import org.jdesktop.jdic.browser.WebBrowser;
9   import org.telscenter.pas.ui.browser.BrowserFactory;
10  import org.telscenter.pas.ui.browser.IBrowser;
11  
12  /***
13   * @author aperritano
14   * 
15   */
16  public class JDICBrowserFactory extends BrowserFactory {
17  
18  	private IWebBrowser webBrowser;
19  	private String browserType;
20  	
21  	public IBrowser getBrowser() {
22  		
23  		String osName = System.getProperty("os.name");
24          if(osName != null && osName.startsWith("Mac OS X")) {
25              try {
26  				webBrowser = (IWebBrowser)Class.forName("org.jdesktop.jdic.browser.WebKitWebBrowser").newInstance();
27  			} catch (InstantiationException e) {
28  				// TODO Auto-generated catch block
29  				e.printStackTrace();
30  			} catch (IllegalAccessException e) {
31  				// TODO Auto-generated catch block
32  				e.printStackTrace();
33  			} catch (ClassNotFoundException e) {
34  				// TODO Auto-generated catch block
35  				e.printStackTrace();
36  			}        	
37  			browserType = IBrowser.SAFARI;
38          } else {
39          	if(osName != null && osName.startsWith("Win")) {
40                  BrowserEngineManager.instance().setActiveEngine(BrowserEngineManager.IE);
41                  browserType = IBrowser.IE;
42          	} else {
43                  BrowserEngineManager.instance().setActiveEngine(BrowserEngineManager.MOZILLA);        		
44      			browserType = IBrowser.MOZILLA;        		
45          	}
46          	
47          	webBrowser = new WebBrowser();  
48          }
49  
50  		IBrowser jdicBrowser = new JDICBrowser(webBrowser,browserType);
51  		return jdicBrowser;
52  	}
53  
54  	/***
55  	 * @param args
56  	 */
57  	public static void main(String[] args) {
58  		// TODO Auto-generated method stub
59  
60  	}
61  
62  }