/*******************************************************************************
 * Copyright (c) 2010 Oak Ridge National Laboratory.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/
package org.csstudio.opibuilder.widgets.figures;


import org.csstudio.opibuilder.editparts.AbstractBaseEditPart;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;

/**Figure for a web browser widget.
 * @author Xihui Chen
 *
 */
public class WebBrowserFigure extends AbstractWebBrowserFigure {
	
	private Browser browser;

	
	public WebBrowserFigure(AbstractBaseEditPart editPart) {
		super(editPart);				
		browser = new Browser(getParentComposite(), SWT.None);		
	}

	public void setUrl(String url){
		if(runmode && url.trim().length() > 0){
			if(!url.startsWith("http") && !url.contains("://")) //$NON-NLS-1$ //$NON-NLS-2$
				url = "http://" + url; //$NON-NLS-1$
			browser.setUrl(url);
		}
	}
	
	
	@Override
	public Composite getSWTWidget() {
		return browser;
	}	
		
	public Browser getBrowser() {
		return browser;
	}
	
}

@@ -806,19 +806,28 @@
 erFigure
+%3CBrowser%3E
  %7B%0A
-
 %09%0A%09priva
@@ -927,59 +927,8 @@
 Part
-);%09%09%09%09%0A%09%09browser = new Browser(getParentComposite()
 , SW
@@ -937,16 +937,18 @@
 None);%09%09
+%09%09
 %0A%09%7D%0A%0A%09pu
@@ -1176,18 +1176,16 @@
 %09%7D%0A%09%7D%0A%09%0A
-%09%0A
 %09@Overri
@@ -1193,40 +1193,114 @@
 e%0A%09p
-ublic Composite getSWTWidget() %7B
+rotected Browser createSWTWidget(Composite parent, int style) %7B%0A%09%09browser = new Browser(parent, SWT.None);
 %0A%09%09r
@@ -1314,18 +1314,19 @@
 rowser;%0A
-
 %09%7D
+%0A
 %09%0A%09%09%0A%09pu

make corresponding changes with optimization on AbstractSWTWidgetFigure