Posts

Showing posts from March, 2011

Featured Post

Spring Bean Life Cycle

I would like to explain about Spring Bean Life Cycle As soon as you define all beans and its injections in your XML that will be loaded using XmlBeanFactory class the code snippet will be look like as followes XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("/context.xml")); System.out.println(factory.getBean("Mybean")); Now the Life Cycle of Spring Bean starts 1)If the Bean is instance of BeanNameAware setBeanName method will be called with necessary params 2)If Bean is instance of BeanClassLoaderAware setBeanClassLoader() method will be called with necessary params 3)if it is BeanFactoryAware so setBeanFactory() method will be called with necessary params 4)If beans implements BeanPostProcessor then postProcessBeforeInitialization() and postProcessAfterInitialization() methods will be called so you need to add your postProcessor here to your xmlBeanFactory 5)If Bean Implements InitializingBean then afterProp...

Inheritance Using JavaScript classes

Image
I am just trying to explain inheritance using Javascript Object . Step 1: //Below is Normal animal class delaration which takes name and stuff as params function Animal(name,stuff){ this.name =name; this.stuff=stuff; } Step 2: //Adding Methods to the Animal Class using prototype Animal.prototype.eat=function(){ alert(" Animal Eats :---->"+this.stuff); } Step 3: //Instantiating Animal Object var a=new Animal("Horse","Grass"); a.eat(); Output : (Embedded image moved to file: pic04886.jpg) Step 4: //Inheriting properties of Animal to Cat Cat.prototype=new Animal(); //pointing constructor to your Cat Constructor otherwise it goes to Animal Constructor Cat.prototype.constructor=Cat; function Cat(name,stuff,size) { this.name =name; this.stuff=stuff; this.size=size; } //Overriding Animal Eat method in Cat class Cat.prototype.eat=function(){ Animal.prototype.eat.call(this); //calling super class eat method as well alert("Cat Eats:---->...

Three ways of defining JavaScript classes

First Way: function Apple(name,color) { this.name =name; this.color=color; this.getData=function(){ alert( this.name +":"+this.color); } } var a=new Apple("Hey","red"); a.getData(); Advantage: This way is normal way of defining objects . this is really useful and can give onstructor option to the end user Second Way: var apple={ name:'heyyyyy', color:'blue', getData:function(){ alert(this.color+":"+ this.name ); } } apple.getData(); Advantage: This is direct way of defining object , here is no constructor option and If you want to limit the class to singleton then go for this Third Way: var apple1= new function(name,color){ this.type=name; this.color=color, this.getData=function(){ alert(this.color+":"+this.type); } } apple1.type="MMMM"; apple1.color="Red"; apple1.getData(); Advantage: This is mixed way ...

JSF Portlets with JBOSS Portal Server (JSR 286)

I am going to discusss about JSF+PORTAL (JSR 286) integration with JBOSS PORTAL prerequisite is as followes How JBOSS IPC is working with JSF 1.2 and Jboss portals When you define publiching event and processing event in portlet.xml portlets are tightly coupled with events in JSR 286 here two ways are there to achieve IPC - Public Render Parameters - Events - PortalNodeEventListener Prerequisite - Basic Knowledge of Portal - Basic Knowldge of JBOSS Appserver -Basic Understanding of JSF Jars Required : antlr.jar asm.jar bsh.jar cglib.jar commons-beanutils-1.7.0.jar commons-codec-1.3.jar commons-codec.jar commons-collections-3.1.jar commons-collections.jar commons-digester.jar commons-discovery-0.2.jar commons-fileupload-1.1.jar commons-fileupload-1.2.jar commons-httpclient.jar commons-io-1.1.jar commons-lang-2.1.jar commons-logging.jar dom4j.jar hibernate3.jar hsqldb.jar mail.jar portletbridge-api-2.0.0.BETA.jar portletbridge-impl-2.0.0.BETA.jar Environment : - JBOSS AS BUNDLE 4.3 +...

Writing your own JSF custom component

Image
Here Are the steps to write your own JSF1.2 custom components Step1 : First You need to write your Renderer Class which will be looking like below . this is responsible for Rendering the component at the client side package org.extjsf.component.helloworld; import java.io.IOException; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; import javax.faces.render.Renderer; public class HelloWorldRenderer extends Renderer { @Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", component); writer.writeAttribute("style", "color: red", null); writer.startElement("input", component); writer.writeAttribute("value", component.getAttributes().get( "onmouseup"), null); writer.endEleme...

Writing Ext-JS Plugin Procedure

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml " > <head> <title></title> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <script type="text/javascript" src="ext3/ext-base.js"></script> <script type="text/javascript" src="ext3/ext-all-debug.js"></script> <script type="text/javascript"> Ext.BLANK_IMAGE_URL = 'ext3/images/default/s.gif'; Ext.QuickTips.init(); Ext.ns('Plugins'); Ext.onReady(function() { Plugins.CharsLeftReminder = (function() { return { init: function(field) { var thisXType = field.getXType(); if (f...

Ext-JS Scheduler

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml " > <head> <title>Scheduler Demo</title> <!-- Ext includes --> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <script type="text/javascript" src="ext3/ext-base-debug.js"></script> <script type="text/javascript" src="ext3/ext-all-debug.js"></script> <!-- Scheduler includes --> <link href="ext-sch/css/sch.schedulerpanel.css" rel="stylesheet" type="text/css" /> <link href="ext-sch/css/sch.plugins.resize.css" rel="stylesheet" type="text/css" /> <link href="ext-sch/css/sch.plugins.common.css" rel="stylesheet...

Ext-JS Column Renderer 3

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title></title> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <style type="text/css"> .trend-down { background:url(img/trend-down.png) right no-repeat !important; } .trend-neutral { background:url(img/trend-neutral.png) right no-repeat !important; } .trend-up { background:url(img/trend-up.png) right no-repeat !important; } .padding-img { width:18px;height:0px; } </style> <script type="text/javascript" src="ext3/ext-base.js"></script> <script type...

Ext JS Column Renderer 2

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title></title> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <style type="text/css"> .trend-down { background:url(img/trend-down.png) right no-repeat !important; } .trend-neutral { background:url(img/trend-neutral.png) right no-repeat !important; } .trend-up { background:url(img/trend-up.png) right no-repeat !important; } .padding-img { width:18px;height:0px; } </style> <script type="text/javascript" src="ext3/ext-base.js"></script> <script ty...

Ext-JS Grid Panel Column Renderer

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title></title> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <style type="text/css"> .trend-down { background:url(img/trend-down.png) 20px no-repeat !important; } .trend-neutral { background:url(img/trend-neutral.png) 20px no-repeat !important; } .trend-up { background:url(img/trend-up.png) 20px no-repeat !important; } </style> <script type="text/javascript" src="ext3/ext-base.js"></script> <script type="text/javascript" src="ext3/ext-all-debug.js"></script...

Ext Tree Node with PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml " > <head> <title></title> <style type="text/css"> .report { background:url(img/pie-chart.png) 0 no-repeat !important; } .dataset { background:url(img/table.png) 0 no-repeat !important; } .datasource { background:url(img/data.png) 0 no-repeat !important; } </style> <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" /> <script type="text/javascript" src="adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext-all-debug.js"></script> <script type="text/javascript...

Ext JS layout

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title>ExtJsLayout</title> <link rel="stylesheet" type="text/css" href="../../extjs/resources/css/ext-all.css" /> <script type="text/javascript" src="../../extjs/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="../../extjs/ext-all-debug.js"></script> <script type="text/javascript"> var eastPanelHidden = false; var westPanelHidden = false; var westPanelBtn; var eastPanelBtn; var eastPanel; var westPanel; var containerPanel; var viewport; var tab1; var tab2; var detail2; var invDetailPanel; var mainTabPanel; var detailsPanel; var centerPanel; var action1 = new Ext.Action({ text: 'Action 1...

Ext JS Dyna Control

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title>Dynamic Controls</title> <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" /> <style> #loading { position: absolute; background: white; left: 40%; top: 40%; padding: 5px; z-index: 20001; height: auto; border: 1px solid #C0C0C0; } #loading .loading-indicator { background: white; padding: 5px; margin: 0; height: auto; } #loading-msg { font: normal 9pt arial, tahoma, sans-serif; vertical-align: middle; font-weight: bold; ...

Ext JS Messenger Sample

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title></title> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <style type="text/css"> .icon-user { background:url(img/user.png) 0 no-repeat !important; } .tree-body { background:transparent; } .ico-fav { background:url(img/star_yellow.png) 0 no-repeat !important; } .ico-grp-offline { background:url(img/businessman2.png) 0 no-repeat !important; } .ico-grp-available { background:url(img/businessman.png) 0 no-repeat !important; } .ico-contact-offline { background:url(img/businessman2.png) 0 no-repeat !important; } .ico-sts-available { background...

Ext-JS Custom charts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <title></title> <link rel="stylesheet" type="text/css" href="ext3/css/ext-all.css" /> <script type="text/javascript" src="ext3/ext-base.js"></script> <script type="text/javascript" src="ext3/ext-all-debug.js"></script> <script type="text/javascript"> Ext.BLANK_IMAGE_URL = 'ext3/images/default/s.gif'; Ext.chart.Chart.CHART_URL = 'ext3/resources/charts.swf'; Ext.onReady(function() { var store = new Ext.data.JsonStore({ fields:['name', 'games', 'movies','music'], data: [ {name:'Jul 07', games: 245, movies: 300, music:700}, ...