0

ZK Notification window in the bottom right corner

asked 2012-10-17 06:44:47 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Hi

I would like to know whether we can show auto close small notification window at the bottom right corner like whenever we receive email from gmail, or hotmail, it will show that message arrived.

delete flag offensive retag edit

22 Replies

Sort by » oldest newest

answered 2012-10-17 19:06:52 +0800

twiegand gravatar image twiegand
1807 3

updated 2012-10-17 19:07:36 +0800

Senthilchettyin,

We use a jQuery library that mimics the Growl notification from Apple products.  You can customize the look and feel as well as positioning on the screen, how long it stays visible before disappearing, etc.

It is easy to use with ZK.  There are several versions out there - one of them is here.

Regards,

Todd

link publish delete flag offensive edit

answered 2012-10-17 20:04:09 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Thank you very much. I got the same from this post

Now i am in the second challenge. Actually i want to show "Operation success" after save button is clicked. In my current project. some of them are in the modal
window and some of them in non modal window.

And also save operation handled in the controller java class. So now i am trying to call this jquery from the java after the successful database operation.
Do you have any idea ?

link publish delete flag offensive edit

answered 2012-10-17 20:12:11 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2012-10-17 20:14:30 +0800

only a basic skeleton:
1. ZkEventQueue --> Publish/Subscribe
1.1 onEvent{( Clients.evalJavaScript("showOperationSucess()"}
1.2 zul { <![CDATA[ function showOperationSucess() { jgrowl stuff here(); } ]]> }

Please show us the code if ready. :-)

thanks
Stephan

PS: It's possible to overhand the shown notification text?

link publish delete flag offensive edit

answered 2012-10-18 06:40:00 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Thanks stephan. I will give a try.

link publish delete flag offensive edit

answered 2012-10-18 12:20:54 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Hi Senthil,

now added for demonstration a timer based notification demo in Zksample2.
I have used gekkios ZK-Gritter implementation. Codes are commited and app is online. Look at the IndexCtrl.java. :-)

best
Stephan

link publish delete flag offensive edit

answered 2012-10-18 21:33:01 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

OK, i have modified the code. Now the notifications are called from an 'application' scoped EventQueue.
All codes are commited in Zksample2 and are online.

new: ApplicationMessageQueue.java
changed IndexCtrl.java

have fun and best
Stephan

link publish delete flag offensive edit

answered 2012-10-19 03:41:59 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Thank you. let me try out

link publish delete flag offensive edit

answered 2012-10-19 09:32:58 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Hi
Thank you. I got example from this post also

As i said earlier, my objective is to show "Success" Message after save is clicked in the model or in non model window. So i need to write the jquery stuff in every zul
file. ? that is bad idea ? . Can i write this java script function in mail.zul which has been designed using border layout, so all the pages will be load only in
center area. From any other zul file, can i call this java script inside mail.zul ?

This way, the code is not duplicated. Tomorrow i can simply change in the main.zul without going to each zul file
That is possible ?

link publish delete flag offensive edit

answered 2012-10-19 16:22:53 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2012-10-19 16:23:43 +0800

Hmmmmmmmmm, there is no code in the zul-files!

Seems the jquery.jgrow.js is added automatically to the headers. You can check this by looking in the generated code by the browser.
and the Gritter class calls the Clients.evalJavaScript("jq.gritter.add(" + notification.toJSONString() + ")"); that is reached by the headers.

Give it a try.

best
Stephan

link publish delete flag offensive edit

answered 2012-10-21 18:38:07 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

I tried the following.

1. Copied two jar file in the lib folder jawwa-zk-gritter-0.4.1.jar and lombok.jar.
2. Created the class ApplicationMessageQueue.
3. In the Init method of class (MVVM), created the application queue and also try to show small notification as follows

@Init
	public void initSetup() {
		customerList = new CustomerData().getAllCustomers();
		new ApplicationMessageQueue();
		Map<String, Object> map = new HashMap<String, Object>(0);

		// notification with title + message + selfClosing
		map.put("title", "Zksample2 Notification");
		map.put("message", "<br>Hello i'm a notification based on ZK-Gritter.<br><br>Many thanks to gekkio for writting the implementation.");
		map.put("autoClosing", false);
		EventQueue eq;
		eq = EventQueues.lookup("ApplicationEventQueue", EventQueues.APPLICATION, false);
		eq.publish(new Event("APPLICATION_NOTIFICATION", null, map));
		
	}


When i run the project, it show me the following error

Oct 21, 2012 11:57:02 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_21\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\MySQL\MySQL Server 5.0\bin;;C:\Program Files\Java\jdk1.6.0_21\bin;D:\Java\apache-maven-2.2.1\bin;%CIRAMED_HOME%;C:\Program Files\Windows Live\Shared;C:\Program Files\OpenVPN\bin
Oct 21, 2012 11:57:03 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: {Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MVVM_CRUD_WITHOUT_DB' did not find a matching property.
Oct 21, 2012 11:57:03 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: {Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Sample1' did not find a matching property.
Oct 21, 2012 11:57:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Oct 21, 2012 11:57:05 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Oct 21, 2012 11:57:05 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 4159 ms
Oct 21, 2012 11:57:05 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Oct 21, 2012 11:57:05 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
Oct 21, 2012 11:57:06 PM org.zkoss.zk.ui.http.WebManager <init>:115
INFO: Starting ZK 6.0.1 CE (build: 2012050214)
Oct 21, 2012 11:57:06 PM org.zkoss.zk.ui.sys.ConfigParser parseConfigXml:160
INFO: Loading system default
Oct 21, 2012 11:57:06 PM org.zkoss.zk.ui.sys.ConfigParser parse:267
INFO: Parsing jndi:/localhost/Sample1/WEB-INF/zk.xml
Oct 21, 2012 11:57:10 PM org.zkoss.zk.ui.http.WebManager <init>:115
INFO: Starting ZK 6.0.1 CE (build: 2012050214)
Oct 21, 2012 11:57:10 PM org.zkoss.zk.ui.sys.ConfigParser parseConfigXml:160
INFO: Loading system default
Oct 21, 2012 11:57:10 PM org.zkoss.zk.ui.sys.ConfigParser parse:267
INFO: Parsing jndi:/localhost/MVVM_CRUD_WITHOUT_DB/WEB-INF/zk.xml
Oct 21, 2012 11:57:11 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Oct 21, 2012 11:57:11 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Oct 21, 2012 11:57:11 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6061 ms
ApplicationEventQueue onEvent
Oct 21, 2012 11:57:21 PM org.zkoss.zk.ui.impl.UiEngineImpl handleError:1351
SEVERE: >>java.lang.NoClassDefFoundError: com/google/common/base/Preconditions
>>java.lang.ClassNotFoundException: com.google.common.base.Preconditions
>>	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
>>	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
>>	at fi.jawsy.jawwa.zk.gritter.Gritter$NotificationBuilder.withTitle(Gritter.java:122)
>>	at Utilities.ApplicationMessageQueue.showNotification(ApplicationMessageQueue.java:138)
>>	at Utilities.ApplicationMessageQueue.access$0(ApplicationMessageQueue.java:115)
>>	at Utilities.ApplicationMessageQueue$1.onEvent(ApplicationMessageQueue.java:78)
>>	at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145)
>>	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2736)
>>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2707)
>>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2648)
>>	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1702)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1487)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:463)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316)
>>	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
>>	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135)
>>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
>>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
>>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
>>	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>>	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>>	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
>>	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
>>	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
>>	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>	at java.lang.Thread.run(Thread.java:619)

Oct 21, 2012 11:57:22 PM org.zkoss.util.resource.impl.LabelLoader loadLabels:232
INFO: Loading labels for en_US
Oct 21, 2012 11:57:22 PM org.zkoss.util.resource.impl.LabelLoader loadLabels:232
INFO: Loading labels for en


Is there any other jar file i need to copy ?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-10-17 06:44:47 +0800

Seen: 604 times

Last updated: Sep 18 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More