Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Issues using swt browser component(Issues using swt browser component)
icon1.gif  Issues using swt browser component [message #1670555] Fri, 13 March 2015 08:39
Christian Hubrich is currently offline Christian HubrichFriend
Messages: 3
Registered: March 2015
Junior Member
Hi,

currently i am faceing some problems using the swt browser component in combination with a CTabFolder. I whould like to create a tab supported browser shell. Currently my code looks like the following:


package mcss.test;

import org.eclipse.swt.SWT;

public class AgileBrowser extends Shell {

	public CTabFolder tabFolder;

	public static void main(String args[]) {
		try {
			Display display = Display.getDefault();
			AgileBrowser shell = new AgileBrowser(display);
			shell.open();
			shell.layout();
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
					display.sleep();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public AgileBrowser(Display display) {
		super(display, SWT.SHELL_TRIM);
		setLayout(new FillLayout(SWT.HORIZONTAL));

		tabFolder = new CTabFolder(this, SWT.BORDER);
		tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));

		CTabItem tbtmBrowser = new CTabItem(tabFolder, SWT.NONE);

		tbtmBrowser.setText("Url");

		Composite composite = new Composite(tabFolder, SWT.NONE);
		tbtmBrowser.setControl(composite);
		composite.setLayout(new FillLayout(SWT.HORIZONTAL));
		Browser browser = new Browser(composite, SWT.NONE);
		addBrowserEvents(browser);

		browser.setUrl("www.someurl.de");


		CTabItem tbtmNewItem = new CTabItem(tabFolder, SWT.NONE);
		tbtmNewItem.setText("New Item");

		createContents();
	}

	/**
	 * Create contents of the shell.
	 */
	protected void createContents() {
		setText("SWT Application");
		setSize(450, 300);

	}

	public void addBrowserEvents(Browser pBrowser) {

		pBrowser.addLocationListener(new LocationListener() {
			public void changed(LocationEvent event) {

			}

			public void changing(LocationEvent event) {
			}
		});

		pBrowser.addVisibilityWindowListener(new VisibilityWindowListener() {
			public void hide(WindowEvent e) {
			}

			public void show(WindowEvent e) {

			}
		});
		pBrowser.addCloseWindowListener(new CloseWindowListener() {
			public void close(WindowEvent event) {
			}
		});

		pBrowser.addOpenWindowListener(new OpenWindowListener() {
			public void open(WindowEvent e) {
				
				final WindowEvent ev = e;
				e.display.asyncExec(new Runnable() {
					@Override
					public void run() {
						// TODO Auto-generated method stub
						CTabItem tbtmBrowser2 = new CTabItem(tabFolder, SWT.NONE);
						tbtmBrowser2.setText("Agile 9");

						Composite composite = new Composite(tabFolder, SWT.NONE);
						composite.setLayout(new FillLayout(SWT.HORIZONTAL));
						Browser b = new Browser(composite, SWT.NONE);
						addBrowserEvents(b);
						tbtmBrowser2.setControl(composite);
						ev.browser = b;
					}
				});
			}
		});
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

}


The code works fine for "normal" websites. Now my problem :

-I open an url to a login jsp servlet.
-I can login using my mormal user ans password (everything fine)
-During the login process the jsp opens a new window (also a new session) . Within this window the webapplication should be displayed.
-My browser application opens a new tab, loades the web application, but the hole fomatiing of the web application is corrupt. It seems that the new created browser swt component starts to load the webapp, but not completly. Also all button within the webapplication are not clickable. The browser component seems frozen.

Any Idea?

Thanks
Previous Topic:Download images in an SWT Mozilla browser
Next Topic:Building JNI libraries
Goto Forum:
  


Current Time: Tue Mar 19 05:06:25 GMT 2024

Powered by FUDForum. Page generated in 0.01894 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top