Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » link to external page
link to external page [message #56876] Sat, 03 November 2007 18:18 Go to next message
Eclipse UserFriend
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 21:28 Go to previous messageGo to next message
Eclipse UserFriend
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 23:07 Go to previous message
Eclipse UserFriend
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.
Previous Topic:CalendarWidget
Next Topic:GridLayout
Goto Forum:
  


Current Time: Wed Jul 17 06:30:25 GMT 2024

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

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

Back to the top