java - Open link in a new window using MenuBar.Command -
Text after "
I have a menu bar in my VAADIN application, in this menubar I have a link for my wiki:
wiki = new link (); Wiki.setCaption ("wiki"); Wiki.setStyleName ("mypicto"); Wiki.setImmediate (true); Wiki.setSizeUndefined (); Wiki.setIcon (iconWiki);
with command :.
MenuBar.Command wikiLink = new MenuBar.Command () {public void menuSelected (MenuItem SelectedItem) {getUI () getPage () .Open ( "url_to_wiki", "_ blank"); }};
Then I add links and commands to my menu
menu bar = new menubar (); MenuBar.addItem ("wiki", iconic, wiki link);
The problem is, I can not open the link in a new tab, it is only open in a pop-up, which is blocked by default in almost all web browsers.
>Is there any way to open my link in other links rather than pop-ups in my menubar?
I think this might be what you want ... this addon me Allows to open a page in a new tab. I tested it out using Vaadin 7 cookbook using this code. & amp;
@SuppressWarnings ( "serial") public class DemoActiveLink extends UI {@WebServlet (value = "/ *", asyncSupported = true) @VaadinServletConfiguration (productionMode = false, ui = DemoActiveLink.class) public static class servlet extends VaadinServlet {} @Override public void init (VaadinRequest request) {ActiveLink link = new ActiveLink ( "Vaadin", new ExternalResource ( "http: // vaadin .com")); Link.setTargetName ("_ blank"); Link.addListener (New Link Active Listener) {Public Zero Link Active (LinkEctive Event Event) {Notification.Show ("The link was opened in a new window."}}}}); SetContent (link); }}
@SuppressWarnings ( "serial") public class DemoButtonLink extends UI @Override {public void init (VaadinRequest request) {button = new Button ( "Wadin"); Button.addClickListener (New ClickListener) {@Override Public Zero buttonClick (ClickEvent Event) {getPage () open ("http://vaadin.com", "Vaadin");}}}); Button.setStyleName (Reindeer.BUTTON_LINK); SetContent (button); }}
Comments
Post a Comment