I'll make this short:
Is there a way / library in Wicket to show an activity indicator? You know, the spinning thing that moves while the user is waiting for something, or is it just a javascript thing?
Thanks for your help.
If this is an ajax operation then you can look at the implementations of IAjaxIndicatorAware. These implementations will show a 'spinner' while the operation is processing.
e.g. IndicatingAjaxButton and IndicatingAjaxLink
You could also look at AjaxIndicatorAppender and alter it your own needs for non ajax things ?
Check here to generate your own 'activity indicator'.
Simply show it when busy & hide it afterwards.
I think this will help
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=87917
The Javascript and Css must be add in the renderHEad-Method
Related
I would like to track clicks to JButtons, log page views, see time spent on a specific page, etc...
Ideally, I would just like to add a one liner in the constructor or something along the lines of Analytics.startTracking()
Is there such a framework that already does this?
If not, how would you go about implementing one?
I don't know of any framework that does this. You can use Toolkit.addAWTEventListener to capture all AWT events and use that information.
I have created a web form. On Click of button, database query would be fired. The Problem is that when user clicks on button twice, query would be fired 2 times. I want to prevent that. Any help?
Take a look here
Struts2 has a built in mechanism for stopping double form submission that works on the server side instead of the client. You may need to add the TokenInterceptor if its not on the defaultStack you're using.
Here is a quick tutorial
If you are happy to use jQuery you could consider using
http://jquery.malsup.com/block/
onclick or onsubmit call $.blockUI();
Some Demos for your reference
http://jquery.malsup.com/block/#demos
The belt and braces approach is to set a JavaScript flag variable when the button is clicked and block subsequent submits "onclick". Then, on the server, implement the "synchronizer token pattern" (you can just Google that term to find out about it).
I have java applet with JTable. Due to lots of data and poor network bandwidth it takes lots of time to perform any operation like load the table or change it.
I'm thinking about adding sort of activity indicator to let user know that his request is processing.
Before i use JProgressBar, I'd like to know whether there are other options like ajax activity flower.
The easiest way would be setting a (not animated) WAIT_CURSOR
// Setting cursor for any Component:
component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
doProcessing();
component.setCursor(Cursor.getDefaultCursor());
see http://www.catalysoft.com/articles/busyCursor.html
For an animated cursor see:
http://book.javanb.com/swing-hacks/swinghacks-chp-12-sect-2.html
SwingWorker was designed for this, as suggested in this example. In particular, "Note that it safe to mutate the tableModel from inside the process method because it is invoked on the Event Dispatch Thread."—publish()
You can use JBusyComponent for this. Just wrap your Table or the Scrollpane in the JBusyComponent. But remember to load the data outside the event dispatch thread. For this you can use the SwingWorker as suggested in the other answer. JBusyComponent already provides a BusySwingWorker for this.
Is there a quite easy way to implement progress bars in JSP. Basically I have a JSP page that goes to a servlet that calls up a method, now this process is going to run for a long time and I want to indicate the status of the progress just like the progress bar that shows up in the eclipse taskbar when we execute any java program.
I have found a nice tutorial here http://onjava.com/pub/a/onjava/2003/06/11/jsp_progressbars.html but it seems little outdated.
Are there any new and easy ways to implement this?
Determining the progress of a particular task is a surprisingly complicated thing once you get into the details. How do you determine for example that you are 50% done? And what happens if the last 10% of your task takes 1/2 the total time?
Usually for a web app, if you do want progress bars, then going the AJAX route is best, as some of the posters mentioned above.
I find, however, that on the web, it is suitable to indicate to the user the something is happening. Just have a spinner of some sort made visible when the page is submitted, and then hidden again when it is rendered (see here). This is very easy to do, causes no additional performance hit, and is indicative of some sort of progress
There is a lot of solutions for example jQuery.
You can use Jquery with Ajax to update progress bar:
http://jqueryui.com/demos/progressbar/
In my opinion, when you call your jsp, it should return to the user immediately but also indicate that some complex task is being dealt with in the background (with a loading spinner, for example). If you want to know the task's progress, you should use either Ajax polling, or Comet push in order to retrieve it from your server. For just getting and displaying progress, I think Ajax is sufficient and Comet might be a bit of an overkill. Here is more on the Ajax approach:
http://en.wikipedia.org/wiki/Ajax_(programming)
More on your question, a servlet(and also a jsp) work according to the HTTP protocol, which is based on the request->response model. In today's world, there are rarely sites where you go to a jsp to do a complex task and then you have to sit around doing nothing while your request is complete. You might want to give your user the freedom to still interact with your web-application/website while his request is being dealt with in the background.
HI
Currently into my application I perform a normal action for every drop down. For instance I have a page which has 5 drop down so it takes time for every consecutive action. So I am thinking to incorporate AJAX methodology for achieving it. Pls help me in doing so with an example.
Regards
Rj`
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/CascadingDropDown/CascadingDropDown.aspx
Here's an example using jQuery:
http://jsfiddle.net/sje397/sadtA/
This fills in the second drop-down with data from the server based on the selection in the first drop-down. There are comments to explain some of the jsFiddle specifics.