open popup through Link in Vaadin - vaadin

I am Using Vaadin Framework in my application. I want to open a popup screen using Vaadin Link. I know to open popup thrugh button but I need to open popup through Link. Can anybody help, this is my code:
Link link1 = new Link(String.valueOf(rs.getInt(1)), new ExternalResource("#"));
_reportTable.getItem(dashboardDataRowId)
.getItemProperty("todo").setValue(link1);

As explained in in Book of Vaadin - Components - Link, Link should be used only for hyperlinks to external resources, as it is nothing more than a wrapper for a anchor html tag and as such it does not fire any server side events. As a result you cannot react on server side to open a popup window or do some other logic.
The Link is a regular HTML hyperlink, that is, an anchor
element that is handled natively by the browser. Unlike when clicking
a Button, clicking a Link does not cause an event on the server-side.
What you really want is vaadin button styled as a hyperlink. You can do it by creating a regular button (which supoorts server side events and can open your popup) and then adding an appropriate style.
Button linkButton = new Button();
linkButton .setStyleName(BaseTheme.BUTTON_LINK);
Always be sure to call addStyleName() instead of setStyleName() as it only adds your new style to the list of other styles already present and it does not override that list with your only new style.

Related

set programmatically focus when new content is loaded on iOS

I'm trying to set up automatically focus on first loaded article. (f.e. user clicks on the button "load more" and new articles are loaded).
My react implementation:
I'm using ref attribute in <Link> component, which is from react-router library and then I'm calling focus() method in lifecycle method componentDidMount().
It works on all devices except iOS. If I turn on voiceover on iphone and then on webpage I click on the button, it doesn't automatically focus on first loaded article). It works just with html anchor tag.
I read some articles before and it looks that it's not possible to do this in this way but only with firing some event f.e. click event.
Can someone confirm that it's not possible to solve it in this way or there is any workaround without using jquery ?

Programatically open a dialog as popup with jQuery Mobile

So I have a page and a dialog. When the user click the page button, one AJAX request will open the dialog with the results. Something like that simple example without AJAX: http://jsfiddle.net/rBBpx/
It works. The dialog opens programatically. But it hides the page content, showing the dialog as if it's another page. I know that popup's can open dialogs in-page with links, but I didn't get the point in how I can do that programatically.
I tried to change $.mobile.changePage() call to that, but it didn't worked as I expected:
$('#dialog').popup();
$('#dialog').popup('open');
How can I show that dialog in-page, as a popup? Is it ever possible? Thank you in advance!
In case you use phonegap, there is an alert plugin: http://docs.phonegap.com/en/edge/cordova_notification_notification.md.html
navigator.notification.alert("your AJAX result here");

how to set action url and change css

I have a button that when pressed opens a window on the screen
Is there a way I can get the window to open automatically with a URL?
An example of this site http://karevn.com/ have the button FEEDBEACK
I want the window will open only with a command URL
The site you mentioned is using this plugin -> http://wordpress.org/extend/plugins/usernoise/
However the plugin is not upto date so just test it before using it on yours taking a back up copy of the files/database.
karevn use a jquery plugin like the FancyBox ( see the ajax part or iframe in this page http://fancybox.net )
Open a window with a hyperlink
How to open a new window when clicking a hyperlink?
If you want the feedback button then
http://www.script-tutorials.com/css3-modal-popups/
Goodluck

Chrome extension jump to URL

I would like to make a google chrome extension. I want to add a function, so when i click on it's icon, it will open a new tab with a specific URL. How can I do that?
Sorry for bad english, I'm just learning that language ;)
If you want to open a link in a new tab when you click on a page action icon you can use the onClicked method of the pageAction: http://code.google.com/chrome/extensions/pageAction.html#event-onClicked
So, in the background page or script add the following lines:
chrome.pageAction.onClicked.addListener(function(tab) {
windowObjectReference = window.open("http://google.com/", "DescriptiveWindowName", "resizable=yes,scrollbars=yes,status=yes");
});
Note, that onClicked event is NOT fired when page action has a popup page that is displayed when page action is clicked. So in order to use onCLicked event you should NOT have a page action popup page

How to open a html page as a popup with in the page (no new window opens) using Jquery

I am having the link button and when i clicked on the link button the popup will be open (with in the page itself like a modalpopup. now i have to get the popup feel using jquery and inside the div text should come from database.
How is it possible for getting the message from the backend.
means open a div in a modal popup feel using jquery
or opens the html page in a popup in the same window using jquery
Thanks and Regards
Vara Prasad.M
Take a look at the Facebox jQuery plugin. It does pretty much exactly what you're asking for. For example you can have a link like this to some remote page like so
text
then just call the facebox plugin when your content is loaded like so
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox()
});
and your content will render in a modal window. You can also take a look at Fancybox or ThickBox which provide very similar functionality.
There are two steps to your problem:
Open a modal popup using jQuery
Fetch server side content and display it in the modal dialog
Use jQuery Dialog (http://docs.jquery.com/UI/Dialog) for popping open a modal dialog, and then use jQuery load (http://api.jquery.com/load/) for loading the content from the server.
The server page you call will make the database query and output the contents to the response buffer.

Resources