link to external page [message #56876] |
Sat, 03 November 2007 14:18  |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
Hi,
I'd like to create a link to separate external page, eg.
"http://www.eclipse.org/" in my RAP app.
What's the best way to do it?
I tried Link widget, but it seems to be just a widget, that still needs
some SelectionListener to really do the action.
I also tried RWT.getResponse() setHeader("Location", ...),
setRedirect(...) things but without success...
Maybe there is some simple way to just render some html like <a
href="http://..."> but I can't find it...
thanks,
Jacek
|
|
|
Re: link to external page [message #56958 is a reply to message #56876] |
Sat, 03 November 2007 17:28   |
Eclipse User |
|
|
|
Originally posted by: rsternberg.innoopract.com
Hi Jacek,
Jacek Pospychala schrieb:
> I'd like to create a link to separate external page, eg.
> "http://www.eclipse.org/" in my RAP app.
> What's the best way to do it?
RWT provides the ExternalBrowser widget for this:
Link link = new Link( parent, SWT.NONE );
link.setText( "<a>Open URL in external browser window</a>" );
link.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
int style = ExternalBrowser.LOCATION_BAR
| ExternalBrowser.NAVIGATION_BAR
| ExternalBrowser.STATUS;
String url = "http://www.eclipse.org/rap";
ExternalBrowser.open( "someId", url, style );
};
} );
> I tried Link widget, but it seems to be just a widget, that still needs
> some SelectionListener to really do the action.
> I also tried RWT.getResponse() setHeader("Location", ...),
> setRedirect(...) things but without success...
Right, the Link widget is an SWT widget and must also work in a desktop
application, where it is not always clear which program to use to for
URLs of a certain type.
> Maybe there is some simple way to just render some html like <a
> href="http://..."> but I can't find it...
RAP doesn't allow to smuggle HTTP code through the SWT API, also for
security reasons. If you use this pattern more often, you could easily
wrap the above code in a utility method.
Regards,
Ralf
|
|
|
Re: link to external page [message #57130 is a reply to message #56958] |
Sat, 03 November 2007 19:07  |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
Ralf Sternberg wrote:
> RWT provides the ExternalBrowser widget for this:
>
> Link link = new Link( parent, SWT.NONE );
> link.setText( "<a>Open URL in external browser window</a>" );
> link.addSelectionListener( new SelectionAdapter() {
> public void widgetSelected( SelectionEvent e ) {
> int style = ExternalBrowser.LOCATION_BAR
> | ExternalBrowser.NAVIGATION_BAR
> | ExternalBrowser.STATUS;
> String url = "http://www.eclipse.org/rap";
> ExternalBrowser.open( "someId", url, style );
> };
> } );
ahh excelent, that's what I needed! Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.03571 seconds