Example
For Seamless Integration of ElanBeans
You can see in the page the seamless integration in
Action. Each "item" in the 'pullout-memu' can be an ElanBean. All the ElanBeans
can be set to a Table cell. This Table can be a cell in a larger Component and so-on.
Imagin greate web applications one can build using
this kind of integration, where each component may be build on remote servers and
assembled like building blocks with 'Virtual Web server' that is discussed later.
/***********************Code for Pullout
Menu*********************************/
//Assume that these mini-servlet components can generate
HTML-code using run-time Stock-data.
StockCB s1= new StockCB("SUNW"); //generates stock
quotes of Sun
StockCB s2= new StockCB("INTC"); //generates stock quotes of Intel
StockCB s3= new StockCB("ORCL"); //generates stock quotes of Oracle
StockCB s4= new StockCB("IBM"); //generates stock quotes of IBM
StockCB s5= new StockCB("MSFT"); //generates stock quotes of Micro Soft
//set Menu names on the left side of Pulloutmenu
String items[] =
{"Sun","Intel","Oracle","IBM","MicroSoft"};
// This method changes Default colors.
String colors[]=
{"#A5FED8","white","#FFC8A4","#A8BBFB"};
Object contents[] = { s1,s2,s3,s4,s5};
//Create Pulloutmenu object with the above defined properties
PulloutCB po = new PulloutCB(5,items,contents,colors );
po.setSize(585,380);
/*************************************************************************/
/*************************Code for Hirarchical Menu ***************************/
String
Items[]={"Index","Contents","Samples","Excercises"};
String Items1[]={"Index1","Index2","Index3"};
String Items11[]={"Index11","Index12","Index13"};
String Items113[]={"Index131","Index132","Index133"};
String Items2[]={"Experts","Contents"};
String Items3[]={ "Java","Servlets"};
String
Items32[]={"Features","Forum","How-to","New","HotSites"};
String Items4[]={"JSP","EJB"};
String Items41[]={"Entity","Session"};
HierMenuCB hm = new HierMenuCB( );
// set main menu and submenu items
hm.addMMItems(Items);
hm.addSMItems(Items1, 1, Items11,3,Items113);
hm.addSMItems(Items2);
hm.addSMItems(Items3, 2, Items32);
hm.addSMItems(Items4,1,Items41);
/**********************************************************************/
/*************************Code for Multiple Object Scroller *******************/
// Assume that you have created ElanBeans item1,item2,item3 and
you like to scroll them.
String scitems1[] = {item1,item2,item3 };
//Create Scroller table by passing above array in the constructor
ScrollCB sb = new ScrollCB(scitems1);
sb.setScrollerWidth(200);
sb.setScrollerHeight(200);
// Optional parameter for the Scroller.
sb.setBgColor("white");
sb.setScrollerWait(3000);
sb.setScrollerSpeed(100);
sb.setScrollerJump(100);
/**********************************************************************/
/*********************************Code for Scroll Table********************/
scrollTableCB scb = new scrollTableCB();
Object s_scbitems[] = {tab};
scb.setItems(s_scbitems); //pass the table to the scroller
/**********************************************************************/
/********************************Code for Main Table**********************/
//Create a main table that contains all the above ElanBeans in the
page
TableCB tb = new TableCB(3,3);
maintab.setCellValue(0,0,"elanbeans.gif");
maintab.setCellValue(0,1,hm);
maintab.setCellValue(0,2,"elanlogo.gif");
maintab.setCellStyle(1,0,"<TD COLSPAN=\"2\" ROWSPAN=\"2\"
VALIGN=\"TOP\">");
maintab.setCellValue(1,0,po);
maintab.setCellStyle(1,2,"<TD VALIGN=\"TOP\"");
maintab.setCellValue(1,2,sb);
maintab.setCellStyle(2,1,"<TD VALIGN=\"TOP\"");
maintab.setCellValue(2,1,stb);
//build the table that in turn builds all the above ElanBeans
maintab.buildWC(req,out);
|