Get jspx at SourceForge.net. Fast, secure and Free Open Source software downloads home | download | demo project | contact us
jspx

Rate this article:

email
comment
Average Rate= 0.0

Messages

Messages are a Growl like notifications that are controlled from server side code.

Demo





			<page contoller="org.bay.jspx.demo.live.HelloJspxController" >
				<html>
					<body>
						<form>
							<ajaxPanel>
								<input type="text" id="statement" />
								<input type="button"  value="say it"  onserverclick="sayIt"/>
								<br/>
								<br/>
								<input type="button"  value="Info" class="btn btn-success" onserverclick="saySucess"/>
								<input type="button"  value="Info" class="btn btn-info" onserverclick="sayInfo"/>
								<input type="button"  value="Warning" class="btn btn-warning"  onserverclick="sayWarning"/>
								<input type="button"  value="Error"  class="btn btn-danger" onserverclick="sayError"/>
							</ajaxPanel>
						</form>
					</body>
				</html>
			</page>
			

package org.bay.jspx.demo.live;

import eg.java.net.web.jspx.engine.annotation.JspxWebControl;
import eg.java.net.web.jspx.engine.message.JspxMessage;
import eg.java.net.web.jspx.engine.util.StringUtility;
import eg.java.net.web.jspx.ui.controls.WebControl;
import eg.java.net.web.jspx.ui.controls.html.elements.inputs.TextBox;
import eg.java.net.web.jspx.ui.pages.ContentPage;

/**
 * @author Amr.ElAdawy
 * Apr 3, 2012 12:01:19 PM
 */
public class Messages extends ContentPage
{
	@JspxWebControl
	TextBox statement;

	public void sayIt(WebControl sender, String args)
	{
		if (StringUtility.isNullOrEmpty(statement.getValue()))
			messages.add(new JspxMessage("Hello Jspx"));
		messages.add(new JspxMessage(statement.getValue()));
	}
	
	public void sayInfo(WebControl sender, String args)
	{
		messages.add(new JspxMessage("Hello Jspx", "Info", JspxMessage.INFO));
	}

	public void sayWarning(WebControl sender, String args)
	{
		messages.add(new JspxMessage("Hello Jspx", "Warning", JspxMessage.WARNING));
	}

	public void sayError(WebControl sender, String args)
	{
		messages.add(new JspxMessage("Hello Jspx", "Error", JspxMessage.ERROR));
	}
	
	public void saySucess(WebControl sender, String args)
	{
		messages.add(new JspxMessage("Hello Jspx", "Success", JspxMessage.SUCCESS));
	}
}