Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Probably simple -- need to add links to page
Probably simple -- need to add links to page [message #885867] Wed, 13 June 2012 18:47 Go to next message
Sean Gilley is currently offline Sean GilleyFriend
Messages: 14
Registered: April 2012
Junior Member
This is probably extremely simple, and I'm just not finding the reference I need.

I've got a working RAP application. I need to add two links to the page, one of which will open a new window/tab, the other of which will just replace the current page.

Ideally, I'd like to add the links as buttons, but if not, I'll take simply placing them at the upper left of the display area as links. Either way is fine, as long as it works. (If buttons, they can go with the existing set of buttons at the upper right.)

(As I've said before, I haven't done OO programming for about ten years, so rusty only begins to describe those skills. So the simpler and more complete the answer the better.)

Thanks,

Sean.
Re: Probably simple -- need to add links to page [message #886091 is a reply to message #885867] Thu, 14 June 2012 08:19 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1291
Registered: July 2009
Senior Member

Hi Sean,

There are two different ways to add a link to a RAP UI. The first (and
simplest) is to use the new Markup support to add a plain HTML link to a
Label:

Label label = new Label( page, SWT.NONE );
label.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
label.setText( "<a href=\"http://xkcd.com/\"
target=\"_blank\">Plain Link</a>" );

The other is to open an external browser window programmatically, e.g.
on a button click. This method involves an additional request and the
new window/tab will be suppressed by pop-up blockers:

Button button = new Button( page, SWT.PUSH );
button.setText( "External Browser" );
button.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e ) {
int browserStyle = ExternalBrowser.LOCATION_BAR |
ExternalBrowser.NAVIGATION_BAR;
ExternalBrowser.open( "google", "http://xkcd.com/", browserStyle );
}
} );

HTH, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Probably simple -- need to add links to page [message #886364 is a reply to message #886091] Thu, 14 June 2012 19:50 Go to previous messageGo to next message
Sean Gilley is currently offline Sean GilleyFriend
Messages: 14
Registered: April 2012
Junior Member
I'm using 3.7. Do I need to upgrade to 3.7.2?

Thanks,

Sean.
Re: Probably simple -- need to add links to page [message #886590 is a reply to message #886364] Fri, 15 June 2012 08:36 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1291
Registered: July 2009
Senior Member

For markup support, you need to upgrade to RAP 1.5 (Juno), which will be
released on June 27. The external browser method already works with 1.4
(Eclipse 3.7). But it's always a good idea to upgrade to the last
service release.

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Probably simple -- need to add links to page [message #886722 is a reply to message #886590] Fri, 15 June 2012 14:22 Go to previous message
Sean Gilley is currently offline Sean GilleyFriend
Messages: 14
Registered: April 2012
Junior Member
Ralf,

Thanks very much. While the external browser solution isn't workable for one of the two things I wanted, it's fine for the other, and the first isn't that important.

I really appreciate your help.

Sean.
Previous Topic:Offline capabilities with local storage
Next Topic:Setting different initial perspective possible?
Goto Forum:
  


Current Time: Wed Nov 26 06:50:28 GMT 2014

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

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