I need to provide context sensitive help in my GWT application. For this every GWT view will have many help links each of which will open a dialog box with appropriate help text (different for each link). The problem is I cannot have so many ui:field elements each with unique name and click listener in my view classes as the number of help links may be very large. What I need is to have many Anchor elements in my UI binder xml file and all the anchors should have the same click listener. The click listener will decide based on some parameter which help text to display in the dialog box.
I tried to use Hyperlink element with different history tokens for all links, but it changes the history which is not desirable. I just want to show a dialog box with appropriate help message without modifying history.
Is it possible in GWT?
Thanks for your help.
You can obviously use <g:Anchor href="javascript:;"> in your UiBinder and later add handler in your code.
But, since you have a lot of this all around your app I'd use gwtQuery:
$(".help-link").click(new Function(){
public void f(Element element) {
// do something here
// `element` tells you which element triggered the event
});
then I'd just add css class .help-link to all relevant anchors.
Related
I want to move a google map into an activity Android without using the fingers but only using four buttons (objects) with the directions: left, right, top and bottom.
Any idea on how to do this?
Based on the documentation, you can use draggable:false in preventing maps from being dragged.
You can use this link for more information.
Also, here is a related article that you can refer to:
How can I disable scrolling on the Google Maps mobile layout?
Regarding the controls, I think you can actually add custom controls aside from the existing and default controls. Note that few rules are necessary to be followed:
Define appropriate CSS for the control element(s) to display.
Handle interaction with the user or the map through event handlers for either map property changes or user events (for example, 'click' events).
Create a <div> element to hold the control and add this element to the Map's controls property.
Please see this link for more information and examples.
Hope this one will help.
I use GWT 2.4.
I have a log of widgets on my web page, there are a huge tab panel with 13 elements, each element of tab has a panel. I use GWT framework. I have to make some logic when one of those elements is visible for user, how to implement it ???
I use Timer for "some logic" and to check whether the panel is visible or not.
I check :
if (somePanel.isVisible()) { do smth}
but it's not working because I also have other links and another elements and when I switch to another element it works but if I click on link - does not.
Thank you in advance :)
I suppose you're using MVP,
You should do the display logic on page load through a model that you write to the place url. links change place so your views are reinitialized (if you don't have a clientFactory)
Anyway, you don't give any details on why it doesn't work with links and what means
when I switch to another element it works
I intended to give user a chance to confirm their action by adding JavascriptEventConfirmation as the example from this tutorial :
https://cwiki.apache.org/WICKET/getting-user-confirmation.html
However, I want to be able to check first if there is at least one checkbox (out of mulitple) is being checked before displaying the confirmation dialog.
How can I achieve this?
Note that the confirmation is implemented via a simple javascript snippet that is added to the button tag's onclick attribute.
To add the verification, just change the generated snippet to fit your needs.
Ok so I have an rss reader that links to articles. One of the sites it links to doesn't have a mobile view. I was wondering if anyone knew if it was possible to set the "zoom" and position of the view once the page is loaded? So for instance if the following link were my article... http://www.neworleanssaints.com/news-and-events/article-1/Saints-agree-to-terms-with-7th-round-pick-Sean-Canfield/cce6a9ca-eaee-4878-ad40-0b98609f7fe7
Then how could I have the view focus on the article without the user having to zoom in and scroll the the top of the article. Thanks.
I think, you have to use an anchor, which are based on the ids of the HTML code. Then, you have to pass the Id you want to stick to after the url and a #.
With your example, it would give something like that :
http://www.neworleanssaints.com/news-and-events/article-1/Saints-agree-to-terms-with-7th-round-pick-Sean-Canfield/cce6a9ca-eaee-4878-ad40-0b98609f7fe7#c1256209263986
As the div you are looking for has an id (lucky you cause they don't have all the time)
<div id="c1256209263986" class="iw_component"><div xmlns:esi="http://www.edge-delivery.org
Hope this will help you (Try to click on the link I put, this should open the page at the start of the article.)
I never tried that but have a go a this, and come back to tell me if it worked.
I have a requirement where clicking each errors should focus input box. I am trying different ways but could not succeed. I got some answers in the past but that did not work like i wanted.
I was using tag with onclick event but I had to do this for each input boxes which is not so relevant if I have 20 fields. So I was looking some thing dynamic .for eg: .
Its has been a long I am looking for this solution. Any kind of help or suggestions would be highly appreciated.
Can you consider this -> Instead of showing all the error messages on top, you can show the error message along with the input box which is related to this input box. The h:message have a attribute for which you can use.
Other option would be developing custom renderer which will output onclick event for each error message. The error message have the component id so you can use that id to set the focus in javascript. This will be all dynamic.
Here is some information about implementing custom renderer http://java.sun.com/javaee/javaserverfaces/reference/docs/customRenderKit.html