Skip to main content



      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 14:47 Go to next message
Eclipse UserFriend
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 04:19 Go to previous messageGo to next message
Eclipse UserFriend
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 15:50 Go to previous messageGo to next message
Eclipse UserFriend
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 04:36 Go to previous messageGo to next message
Eclipse UserFriend
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 10:22 Go to previous message
Eclipse UserFriend
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:How to read a external file after deployment?
Next Topic:Combo Drop Down Arrow
Goto Forum:
  


Current Time: Mon Jun 23 21:17:06 EDT 2025

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

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

Back to the top