Suggested case list:
Using timer to refresh a grid
383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlinkuser model to move item to another listbox
120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlinkDisabled list item row passed to VM-1981
296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlinkDisabled list item row passed to VM-1981
295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlinkDisabled list item row passed to VM-1981
294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlinkgrid sample with ListModel/RowRenderer
816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlinkgrid sample with ListModel/RowRenderer
809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlinkgrid sample with ListModel/RowRenderer
196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlinkgrid sample with ListModel/RowRenderer
195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlinkgrid sample with ListModel/RowRenderer
194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlinkgrid sample with ListModel/RowRenderer
193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlinkgrid sample with ListModel/RowRenderer
192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlinkgrid sample with ListModel/RowRenderer
191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlinkHierarchy table without using ZK PE/EE
1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlinkgrid sample with ListModel/RowRenderer
128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlinkuser model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkLatest 10 Fiddles :
constraint binding textbox
3guest172.68.151.16220peldaDec 5, 2025 5:08:19 PMlinkAnother new ZK fiddle
2guest172.68.151.16320peldaDec 5, 2025 5:07:51 PMlinkAnother new ZK fiddle
1guest172.68.151.16220peldaDec 5, 2025 5:07:32 PMlinkAnother new ZK fiddle
1peggypeng172.71.154.99364f4neDec 5, 2025 9:24:31 AMlinktooltip example
2guest104.22.23.13rc1ntoDec 4, 2025 2:23:45 PMlinkAnother new ZK fiddle
1guest172.69.134.2277t7602Dec 4, 2025 1:40:46 PMlinkAnother new ZK fiddle
1peggypeng104.22.17.1802df6e3oDec 4, 2025 8:41:29 AMlinkonClose
1peggypeng172.68.87.248j8kd8aDec 3, 2025 4:10:26 AMlinkAnother new ZK fiddle
1peggypeng172.69.134.2271rm7f4eNov 26, 2025 3:31:24 AMlinkZK-5912-Suggestion
2rebeccalai104.22.20.1442qrmiiuNov 26, 2025 2:07:15 AMlinkAnother new ZK fiddle
7guest172.69.135.642sksupcOct 2, 2020 8:30:17 PMlinkresources
index.zulzul<?page id=" pmain" title="ExpressClear - CTS" contentType="text/html;charset=UTF-8"?>
<zk>
<?script type="text/javascript" src="/js/jquery-1.9.1.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/autoNumeric.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/jquery.maskedinput.min.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/clipboard.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/clipboard1.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/copy.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/paste.js" charset="UTF-8"?>
<?script type="text/javascript" src="/js/cut.js" charset="UTF-8"?>
<window id="wmain" width="98%" height="98%" apply="TestComposer"
sclass="expstyle1" closable="false" maximizable="false" minimizable="false" draggable="false" sizable="false" droppable="false">
<timer id="timer" running="true" delay="60000" repeats="true"></timer>
<timer id="eod_timer" running="false" delay="60000" repeats="true"></timer>
<timer id="priority_timer" running="false" delay="10000" repeats="true"></timer>
<timer id="user_relogin" running="false" delay="30000" repeats="true"></timer>
<style>
.expstyle1 .z-window-modal-tl, .expstyle1
.z-window-modal-tr, .expstyle1 .z-window-modal-tm,
.expstyle1 .z-window-modal-cl, .expstyle1
.z-window-modal-cr, .expstyle1 .z-window-modal-cm,
.expstyle1 .z-window-modal-bl, .expstyle1
.z-window-modal-br, .expstyle1 .z-window-modal-bm,
.expstyle1 .z-window-modal-hl, .expstyle1
.z-window-modal-hr, .expstyle1 .z-window-modal-hm
{
background: #007DC8;
}
.expstyle1 .z-window-modal-header
{
background: #007DC8;
}
.tree_item_m
{
margin-left: 5px;
margin-top: 3px;
margin-bottom: 3px;
}
.tree_item_a
{
margin-left: 5px;
margin-top: 3px;
margin-bottom: 3px;
}
.tree_item_f
{
margin-left: 5px;
margin-top: 2px;
margin-bottom: 2px;
}
span.z-tree-line, span.z-tree-ico { display:block; float:left; width:18px; }
.z-tab-seld .z-tab-text {color: #007DC8;}
.expstyle1 .z-textbox
{
text-transform:uppercase;
}
</style>
<caption id="wmain_caption">
<toolbarbutton id="logout" src="/images/logout.png">
</toolbarbutton>
</caption>
<div align="center" height="6%">
<borderlayout height="100%" width="100%">
<east border="0" width="14%">
<image align="right" id="banklogo"/>
</east>
<center border="0">
<div align="center" width="100%" height="100%">
<div height="5%"></div>
<hbox pack="center" height="95%" width="100%">
<label id="headermsg0" width="100%" style="color: black; font-size: 12px; font-weight: bold" multiline="true" />
<space bar="false" spacing="30px"></space>
<label id="headermsg1" width="100%" style="color: black; font-size: 12px; font-weight: bold" multiline="true" />
<space bar="false" spacing="30px"></space>
<label id="headermsg2" width="100%" style="color: black; font-size: 12px; font-weight: bold" multiline="true" />
<space bar="false" spacing="30px"></space>
<label id="headermsg3" width="100%" style="color: black; font-size: 12px; font-weight: bold" multiline="true" />
</hbox>
</div>
</center >
<west width="10%" border="0">
<image align="left" src="/images/officelogo.jpg"></image>
</west>
</borderlayout>
</div>
<borderlayout height="96%">
<west id="west" title="Menu" width="30%" flex="true" splittable="false" collapsible="true" style="color: blue;">
<borderlayout>
<north height="40px">
<div height="100%">
<div height="5%"></div>
<hbox align="center" height="90%">
<space bar="false" spacing="2px"></space>
<label value="Fast Access : " style="font-weight:bold"></label>
<space bar="false" spacing="1px"></space>
<textbox id="fa_tb" maxlength="3" constraint="/^$|^[0-9]{3}$/ : Please enter 3 digit form number" ></textbox>
</hbox>
<div height="5%"></div>
</div>
</north>
<center>
<tree id="maintree" width="100%" vflex="true">
</tree>
</center>
</borderlayout>
</west>
<center id="center" flex="false">
<tabbox id="main_tab_box">
<tabs id="main_tabs">
</tabs>
<tabpanels id="main_tab_panels">
</tabpanels>
</tabbox>
</center>
<south id="south" title="Messages and Alerts" height="30%" flex="true" maxsize="250" splittable="true" collapsible="true" >
<div id="divSouth" align="left" style="float:left;padding:0px" width="100%" height="90%">
<grid id="msg_grid" mold="paging" pageSize="3" fixedLayout="true" visible="true">
<columns>
<column width="72%" align="center" label="Message" context="msgPopup" style="color: blue; background-color: white;"></column>
<column width="3%" align="center" label="" context="msgPopup"></column>
<column width="10%" align="center" label="From" context="msgPopup" style="color: blue; background-color: white;"></column>
<column width="15%" align="center" label="Time" context="msgPopup" style="color: blue; background-color: white;"></column>
</columns>
<rows id="msg_rows">
</rows>
</grid>
<menupopup id="msgPopup">
<menuitem id="msgItem" label="Compose"></menuitem>
</menupopup>
</div>
</south>
</borderlayout>
</window>
</zk>
TestComposer.javajava//package com.imageinfo.eclear.v2.webapp.ajax.controller;
import java.io.File;
import java.io.RandomAccessFile;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import javax.naming.InitialContext;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
import org.zkoss.lang.Library;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.ComponentNotFoundException;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
import org.zkoss.zul.East;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Image;
import org.zkoss.zul.Label;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Row;
import org.zkoss.zul.Rows;
import org.zkoss.zul.South;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabbox;
import org.zkoss.zul.Tabpanel;
import org.zkoss.zul.Tabpanels;
import org.zkoss.zul.Tabs;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Timer;
import org.zkoss.zul.Toolbarbutton;
import org.zkoss.zul.Tree;
import org.zkoss.zul.Treecell;
import org.zkoss.zul.Treechildren;
import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow;
import org.zkoss.zul.West;
import org.zkoss.zul.Window;
import com.imageinfo.eclear.v2.utils.Globals;
@SuppressWarnings("unchecked")
public class TestComposer extends GenericForwardComposer
{
private static final long serialVersionUID = 1L;
Window wmain;
Toolbarbutton logout;
Label headermsg0;
Label headermsg1;
Label headermsg2;
Label headermsg3;
Tree maintree;
East east;
Center center;
West west;
South south;
Tabbox main_tab_box;
Tabs main_tabs;
Tabpanels main_tab_panels;
Div tabp1;
String str_menuid;
String str_formid;
String str_actionid;
int cnt_tab=0;
int cnt_tab_panel=0;
Tab tab[] = new Tab[2];
Tabpanel[] panel = new Tabpanel[2];
Div divSouth;
Grid msg_grid;
Rows msg_rows;
Row row;
Label lb1;
Label lb2;
Label lb3;
Label lb4;
String subject = "";
String message = "";
String priority = "";
String msg_id;
String file_name ="";
String id ="";
String msg_disp;
String d2=null;
int formid = 0;
Timer timer;
Timer eod_timer;
Timer priority_timer;
Timer user_relogin;
Menuitem msgItem;
boolean home_flag;
Treechildren tchildoftreewhole;
boolean prev_flag=false;
boolean next_flag=false;
Image banklogo;
HttpSession s ;
public static String eod_msg_id = "";
public static String userrelogin_msg_id = "";
String priority_message="";
Textbox fa_tb;
LinkedHashMap<String, String> fastaccessmap = new LinkedHashMap<String, String>();
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
Clients.confirmClose("Please Logout and don't close the Browser. This will lock you out!!!");
s = (HttpSession)Sessions.getCurrent().getNativeSession();
try{s.getAttribute("svalid").toString().toUpperCase();}catch (NullPointerException npe){Clients.confirmClose(null);Executions.sendRedirect("/invalid.zul");return;}
wmain.setTitle("ExpressClear - CTS "+Library.getProperty("Application.Version").toString()+" : Main");
wmain.setBorder("normal");
wmain.setMode("modal");
wmain.setPosition("center");
wmain.setSizable(false);
wmain.setDraggable("false");
//Changed : AN - 17052013
headermsg0.setValue(" "+s.getAttribute("usern").toString().toUpperCase()+" ");
//headermsg0.setValue(" "+s.getAttribute("userfullname").toString().toUpperCase()+" ");
//headermsg1.setValue(" Last logged in on : "+s.getAttribute("user_lastloggedin")+" ");
headermsg2.setValue(" Last logged in on : "+s.getAttribute("user_lastloggedin")+" ");
//added 11-09-2012
//wmain.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12#home@w@x");
wmain.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f9#f10#f11#f12#home@w@x@q");
south.setOpen(false);
wmain.doEmbedded();
//
Connection conn = null;
try
{
String gname = "";
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
ResultSet rs=null;
conn = ds.getConnection();
/*String q1 = "select group_name from tbl_group where group_id=?";
PreparedStatement pstmt1 = conn.prepareStatement(q1);
pstmt1.setString(1, (String)s.getAttribute("groupid"));
rs = pstmt1.executeQuery();
if(rs.next())
{
gname = rs.getString("group_name");
}
rs.close();
pstmt1.close();*/
String q1 = "select chi_name from tbl_chi where substr(micr_code,0,3)=?";
PreparedStatement pstmt1 = conn.prepareStatement(q1);
pstmt1.setString(1, (String)s.getAttribute("chicity"));
rs = pstmt1.executeQuery();
if(rs.next())
{
gname = rs.getString("chi_name");
}
rs.close();
pstmt1.close();
//headermsg2.setValue(" Current Clearing Date : "+s.getAttribute("currentdate")+" ");
headermsg1.setValue(" Current Clearing Date : "+s.getAttribute("currentdate")+" ");
//String gnamef = ("".equalsIgnoreCase(gname))?"- No Group Assigned -":gname;
//headermsg3.setValue("Grid : "+gnamef);
if(gname.equalsIgnoreCase("DELHI"))
{
headermsg3.setValue("Grid : "+"Northern");
}
else if(gname.equalsIgnoreCase("MUMBAI"))
{
headermsg3.setValue("Grid : "+"Western");
}
else
{
headermsg3.setValue("Grid : "+"Southern");
}
s.setMaxInactiveInterval(Integer.valueOf(Globals.getAttribute("SESSION_TIMEOUT", "0", 1)));
}
catch (Exception e)
{
e.printStackTrace();
}
tchildoftreewhole = new Treechildren();
tchildoftreewhole.setParent(maintree);
Treeitem titem_menu[] = new Treeitem[15];
Treerow trow_menu[] = new Treerow[15];
Treecell tcell_menu[] = new Treecell[15];
Treeitem titem_action[] = new Treeitem[15];
Treerow trow_action[] = new Treerow[15];
Treecell tcell_action[] = new Treecell[15];
Treeitem titem_form[] = new Treeitem[200];
Treerow trow_form[] = new Treerow[200];
Treecell tcell_form[] = new Treecell[200];
try
{
banklogo.setSrc("/images/bnpp_logo.jpg");
banklogo.setWidth(null);
banklogo.setHeight(null);
banklogo.setVisible(true);
Treechildren tchildren_menu = null;
Treechildren tchildren_action = null;
String q2 = "select a.id as menuid, b.id as actionid, c.id as formid, a.name as menuname, b.name as actionname, c.name as formname, c.display_name as formdisplayname from tbl_menu a join tbl_action b on a.id = b.menu_id join tbl_form c on b.id = c.action_id where c.id in (select column_value from (select ','||allowed_forms||',' as newids from tbl_user where upper(tbl_user.id)= ?), TABLE(cast (multiset(select trim( '''' from substr(newids, instr (newids, ',',1, level ) + 1, instr (newids, ',',1, level+1) - instr (newids, ',',1, level) -1 ) ) from dual connect by level <= length(newids)-length(replace(newids,',',''))-1) as sys.odcivarchar2list ) )) order by a.display_order, b.display_order, c.display_order";
PreparedStatement pstmt2 = conn.prepareStatement(q2);
pstmt2.setString(1, ((String)s.getAttribute("usern")).toUpperCase());
ResultSet rs1 = pstmt2.executeQuery();
int lastmenuid = 0;
int lastactionid = 0;
int i = 0;
int j = 0;
int k = 0;
boolean firstmenu = true;
boolean firstaction = true;
while (rs1.next())
{
int curmenuid = rs1.getInt("menuid");
int curactionid = rs1.getInt("actionid");
int curformid = rs1.getInt("formid");
if(rs1.getString("formid").length()==1)
{
fastaccessmap.put("00"+rs1.getString("formid"),rs1.getString("formid")+"|"+rs1.getString("formname")+"|"+rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
}
else if(rs1.getString("formid").length()==2)
{
fastaccessmap.put("0"+rs1.getString("formid"),rs1.getString("formid")+"|"+rs1.getString("formname")+"|"+rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
}
else
{
fastaccessmap.put(rs1.getString("formid"),rs1.getString("formid")+"|"+rs1.getString("formname")+"|"+rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
}
if (lastmenuid==curmenuid & lastactionid==curactionid)
{
titem_form[i] = new Treeitem();
trow_form[i] = new Treerow();
tcell_form[i] = new Treecell();
Div df = new Div();
df.setClass("z-label tree_item_f");
Label lf = new Label();
lf.setValue(rs1.getString("formdisplayname"));
lf.setStyle("font-size: 8pt; color:blue;");
df.appendChild(lf);
tcell_form[i].appendChild(df);
tcell_form[i].setId(rs1.getString("formname")+":"+curformid);
tcell_form[i].setAttribute("DISPLAY_NAME", rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
tcell_form[i].addEventListener("onClick", displayevent);
trow_form[i].appendChild(tcell_form[i]);
titem_form[i].appendChild(trow_form[i]);
//added 11-09-2012
titem_form[i].setId("row_"+rs1.getString("formname")+":"+curformid);
titem_form[i].setAttribute("DISPLAY_NAME", rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
titem_form[i].addEventListener("onOK", displayevent1);
//
tchildren_action.appendChild(titem_form[i]);
titem_action[j].appendChild(tchildren_action);
titem_action[j].setOpen(false);
i++;
}
else if (lastmenuid==curmenuid)
{
i=0;
if (!firstaction)
j++;
titem_action[j] = new Treeitem();
trow_action[j] = new Treerow();
tcell_action[j] = new Treecell();
Div da = new Div();
da.setClass("z-label tree_item_a");
Label la = new Label();
la.setValue(rs1.getString("actionname"));
la.setStyle("font-size: 9pt; font-weight: normal;");
da.appendChild(la);
tcell_action[j].appendChild(da);
titem_action[j].appendChild(trow_action[j]);
trow_action[j].appendChild(tcell_action[j]);
tchildren_menu.appendChild(titem_action[j]);
titem_menu[k].appendChild(tchildren_menu);
tchildren_action = new Treechildren();
titem_action[j].appendChild(tchildren_action);
lastactionid = curactionid;
firstaction = false;
titem_form[i] = new Treeitem();
trow_form[i] = new Treerow();
tcell_form[i] = new Treecell();
Div df = new Div();
df.setClass("z-label tree_item_f");
Label lf = new Label();
lf.setValue(rs1.getString("formdisplayname"));
lf.setStyle("font-size: 8pt; color:blue;");
df.appendChild(lf);
tcell_form[i].appendChild(df);
tcell_form[i].setId(rs1.getString("formname")+":"+curformid);
tcell_form[i].setAttribute("DISPLAY_NAME", rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
tcell_form[i].addEventListener("onClick", displayevent);
trow_form[i].appendChild(tcell_form[i]);
titem_form[i].appendChild(trow_form[i]);
//added 11-09-2012
titem_form[i].setId("row_"+rs1.getString("formname")+":"+curformid);
titem_form[i].setAttribute("DISPLAY_NAME", rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
titem_form[i].addEventListener("onOK", displayevent1);
//
tchildren_action.appendChild(titem_form[i]);
titem_action[j].appendChild(tchildren_action);
titem_action[j].setOpen(false);
i++;
}
else
{
j=0;
if (!firstmenu)
{
k++;
}
titem_menu[k] = new Treeitem();
trow_menu[k] = new Treerow();
tcell_menu[k] = new Treecell();
Div dm = new Div();
dm.setClass("z-label tree_item_m");
Label lm = new Label();
lm.setValue(rs1.getString("menuname"));
lm.setStyle("font-size: 10pt; font-weight: bold; color:blue");
dm.appendChild(lm);
tcell_menu[k].appendChild(dm);
trow_menu[k].appendChild(tcell_menu[k]);
titem_menu[k].appendChild(trow_menu[k]);
tchildren_menu = new Treechildren();
titem_menu[k].appendChild(tchildren_menu);
tchildoftreewhole.appendChild(titem_menu[k]);
lastmenuid = curmenuid;
firstmenu = false;
i=0;
if (!firstaction)
{
j++;
}
titem_action[j] = new Treeitem();
trow_action[j] = new Treerow();
tcell_action[j] = new Treecell();
Div da = new Div();
da.setClass("z-label tree_item_a");
Label la = new Label();
la.setValue(rs1.getString("actionname"));
la.setStyle("font-size: 9pt; font-weight: normal;");
da.appendChild(la);
tcell_action[j].appendChild(da);
titem_action[j].appendChild(trow_action[j]);
trow_action[j].appendChild(tcell_action[j]);
tchildren_menu.appendChild(titem_action[j]);
titem_menu[k].appendChild(tchildren_menu);
tchildren_action = new Treechildren();
titem_action[j].appendChild(tchildren_action);
lastactionid = curactionid;
firstaction = false;
titem_form[i] = new Treeitem();
trow_form[i] = new Treerow();
tcell_form[i] = new Treecell();
Div df = new Div();
df.setClass("z-label tree_item_f");
Label lf = new Label();
lf.setValue(rs1.getString("formdisplayname"));
lf.setStyle("font-size: 8pt; color:blue ;");;
df.appendChild(lf);
tcell_form[i].appendChild(df);
tcell_form[i].setId(rs1.getString("formname")+":"+curformid);
tcell_form[i].setAttribute("DISPLAY_NAME", rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
tcell_form[i].addEventListener("onClick", displayevent);
trow_form[i].appendChild(tcell_form[i]);
titem_form[i].appendChild(trow_form[i]);
//added 11-09-2012
titem_form[i].setId("row_"+rs1.getString("formname")+":"+curformid);
titem_form[i].setAttribute("DISPLAY_NAME", rs1.getString("actionname")+" - "+rs1.getString("formdisplayname"));
titem_form[i].addEventListener("onOK", displayevent1);
//
tchildren_action.appendChild(titem_form[i]);
titem_action[j].appendChild(tchildren_action);
titem_action[j].setOpen(false);
i++;
}
}
rs1.close();
pstmt2.close();
main_tabs.setParent(main_tab_box);
logout.addEventListener("onClick", logoutlistener);
show_msg_grid();
timer.start();
timer.addEventListener("onTimer", mssg_event);
fa_tb.addEventListener("onOK", fastAccessViewer);
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
if (conn!=null)
{
try
{
conn.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
//added 11-09-2012
wmain.setFocus(true);
try
{
Treeitem ti = (Treeitem)tchildoftreewhole.getFirstChild();
Treerow tr = (Treerow) ti.getFirstChild();
Treecell tc = (Treecell) tr.getFirstChild();
ti.setSelected(true);
tc.setFocus(true);
}
catch(Exception e){e.printStackTrace();}
}
EventListener fastAccessViewer = new EventListener()
{
public void onEvent(Event event) throws Exception
{
home_flag = true;
Textbox tb = (Textbox) event.getTarget();
String id = tb.getValue();
String val = fastaccessmap.get(id);
if(event.getName().equalsIgnoreCase("onOK"))
{
if("".equalsIgnoreCase(val) || val == null)
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Not a Valid Form Number!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
}
fa_tb.setValue("");
fa_tb.setFocus(true);
return;
}
else
{
String str[] = val.split("\\|");
String formid = str[0];
String target_id = str[1];
String target_label = str[2];
Tabs exTabs = (Tabs) center.getFellow("main_tab_box").getFellow("main_tabs");
Tab checkTab = null;
try
{
checkTab = (Tab) exTabs.getFellow("tab_"+target_id.toUpperCase());
checkTab.setSelected(true);
}
catch (ComponentNotFoundException cnfe)
{
// Ignore if can not get tab.
cnt_tab++;
cnt_tab_panel++;
try
{
tab[cnt_tab] = new Tab();
}
catch (ArrayIndexOutOfBoundsException aiobe)
{
//int newsize = tab.length + 5;
int newsize = tab.length + 1;
Tab[] temptab = new Tab[newsize];
System.arraycopy(tab, 0, temptab, 0, tab.length);
tab = temptab;
Tabpanel[] temppanel = new Tabpanel[newsize];
System.arraycopy(panel, 0, temppanel, 0, panel.length);
panel = temppanel;
tab[cnt_tab] = new Tab();
}
tab[cnt_tab].setClosable(true);
tab[cnt_tab].setLabel(target_label);
tab[cnt_tab].setId("tab_"+target_id.toUpperCase());
tab[cnt_tab].setParent(main_tabs);
tab[cnt_tab].addEventListener("onClose", wcloseEvent);
/*main_tab_box.setCtrlKeys("@x");
main_tab_box.addEventListener("onCtrlKey", wcloseEvent);*/
panel[cnt_tab_panel] = new Tabpanel();
panel[cnt_tab_panel].setParent(main_tab_panels);
HashMap<String, String> params = new HashMap<String, String>();
params.put("formid",formid);
fa_tb.setValue("");
Executions.createComponents("/"+target_id, panel[cnt_tab_panel], params);
tab[cnt_tab].setSelected(true);
west.setCollapsible(true);
west.setOpen(false);
//west.setFlex(true);
south.setCollapsible(true);
south.setOpen(false);
}
}
}
}
};
//added 11-09-2012
public void onCtrlKey$wmain(KeyEvent e)
{
if(e.getKeyCode() == 36)
{
home_flag=true;
Treeitem ti = (Treeitem)tchildoftreewhole.getFirstChild();
Treerow tr = (Treerow) ti.getFirstChild();
Treecell tc = (Treecell) tr.getFirstChild();
wmain.setFocus(true);
ti.setSelected(true);
tc.setFocus(true);
west.setOpen(true);
}
else if(e.getKeyCode() == 88)
{
home_flag = true;
Tabbox tb = (Tabbox) center.getFellow("main_tab_box");
Tabpanel tp = null;
Tab tp1 = null;
boolean tp_flag=false;
boolean tp1_flag=false;
List<Component> l1 = tb.getTabpanels().getChildren();
Iterator<Component> i1 = l1.iterator();
while(i1.hasNext())
{
tp = (Tabpanel) i1.next();
if(tp.isSelected())
{
tp_flag = true;
break;
}
}
List<Component> l2 = tb.getTabs().getChildren();
Iterator<Component> i2 = l2.iterator();
while(i2.hasNext())
{
tp1 = (Tab) i2.next();
if(tp1.isSelected())
{
tp1_flag = true;
break;
}
}
if(tp_flag && tp1_flag)
{
Tabs exTabs = (Tabs) tb.getFellow("main_tabs");
Collection <Component> c = exTabs.getFellows();
synchronized(c)
{
Iterator<Component> it = c.iterator();
while (it.hasNext())
{
Component c1 = it.next();
if (c1 instanceof Tab)
{
Tab t = (Tab) c1;
if(!t.isSelected())
{
t.setSelected(true);
home_flag = false;
break;
}
}
}
}
tp.detach();
tp1.detach();
}
wmain.setFocus(true);
Treeitem ti = (Treeitem)tchildoftreewhole.getFirstChild();
Treerow tr = (Treerow) ti.getFirstChild();
Treecell tc = (Treecell) tr.getFirstChild();
ti.setSelected(true);
tc.setFocus(true);
if(home_flag)
west.setOpen(true);
}
else if(e.getKeyCode() == 81)
{
Clients.confirmClose(null);
HttpSession s = (HttpSession)Sessions.getCurrent().getNativeSession();
Connection conn = null;
try
{
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String updq1 = "update tbl_user set logged_status = ?, locked_status = ?,CURRENT_ATTEMPTS = ? where upper(id) = ?";
PreparedStatement updstmt1 = conn.prepareStatement(updq1);
updstmt1.setString(1, "0");
updstmt1.setString(2, "0");
updstmt1.setString(3, "0");
updstmt1.setString(4, ((String) s.getAttribute("usern")).toUpperCase());
updstmt1.executeUpdate();
updstmt1.close();
s.invalidate();
HttpServletResponse hresponse = (HttpServletResponse)Executions.getCurrent().getNativeResponse();
Cookie killMyCookie = new Cookie("JSESSIONID", "");
killMyCookie.setMaxAge(0);
killMyCookie.setPath("/");
hresponse.addCookie(killMyCookie);
}
catch (Exception ex){ex.printStackTrace();}finally{try{conn.close();conn=null; }catch (Exception fe){fe.printStackTrace();}}
Executions.sendRedirect("/index.zul");
}
else if(e.getKeyCode() == 87)
{
if(home_flag)
{
Tabs exTabs = (Tabs) center.getFellow("main_tab_box").getFellow("main_tabs");
Collection <Component> c = exTabs.getFellows();
west.setOpen(false);
synchronized(c)
{
Iterator<Component> it = c.iterator();
while (it.hasNext())
{
Component c1 = it.next();
if (c1 instanceof Tab)
{
Tab t = (Tab) c1;
if(!t.isSelected())
{
t.setSelected(true);
home_flag = false;
break;
}
}
}
}
}
else
{
Tabs exTabs = (Tabs) center.getFellow("main_tab_box").getFellow("main_tabs");
Collection <Component> c = exTabs.getFellows();
synchronized(c)
{
Iterator<Component> it = c.iterator();
while (it.hasNext())
{
Component c1 = it.next();
Component c2 = c1.getNextSibling();
Component c3 = c1.getPreviousSibling();
if (c1 instanceof Tab)
{
Tab t = (Tab) c1;
if(t.isSelected())
{
if(prev_flag)
{
if(c3 != null)
{
next_flag = false;
Tab t1 = (Tab) c3;
t1.setSelected(true);
break;
}
else
{
prev_flag = false;
Tab t2 = (Tab) c2;
t2.setSelected(true);
break;
}
}
else
{
if(c2==null)
{
if(c3==null)
{
break;
}
else
{
if(!prev_flag)
{
Tab t1 = (Tab) c3;
t1.setSelected(true);
prev_flag = true;
break;
}
}
}
else
{
if(!next_flag)
{
Tab t1 = (Tab) c2;
t1.setSelected(true);
prev_flag = false;
break;
}
}
}
}
}
}
}
}
}
else
{
wmain.setClosable(false);
}
}
private void show_msg_grid()
{
List l = msg_rows.getChildren();
while(l.iterator().hasNext())
{
Row _child = (Row)l.iterator().next();
msg_rows.removeChild(_child);
}
Connection conn = null;
try
{
HttpSession s = (HttpSession)Sessions.getCurrent().getNativeSession();
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String q3 = "select id, from_user_id, coalesce(subject,' ') as subject, coalesce(message,' ') as message,to_char(time,'DD-MON-YYYY HH24:MI:SS') as time, read_flag,msg_priority from tbl_msg_alert where upper(to_user_id) = ? and status <> ? and read_flag = ? and to_char(time,'DD-MON-YYYY') = (select cur_date from tbl_eod_bod_stat) order by id desc";
PreparedStatement pstmt3 = conn.prepareStatement(q3);
pstmt3.setString(1, ((String)s.getAttribute("usern")).toUpperCase());
pstmt3.setInt(2, 10);
pstmt3.setString(3, "1");
ResultSet rs = pstmt3.executeQuery();
int d=1;
boolean showsouth = false;
while(rs.next())
{
showsouth = true;
row = new Row();
row.setId(rs.getString("id"));
lb1 = new Label();
lb2 = new Label();
lb3 = new Label();
lb4 = new Label();
subject = rs.getString("subject");
message = rs.getString("message") ;
priority = rs.getString("msg_priority") ;
if ("high".equalsIgnoreCase(priority))
{
priority_message = message;
msg_id = rs.getString("id") ;
priority_timer.start();
priority_timer.addEventListener("onTimer", priority_event);
}
if(!subject.equalsIgnoreCase("EOD") && !"High".equalsIgnoreCase(priority))
{
String m1 = message.startsWith("PR:")?message.substring(25):message;
msg_disp = subject + " - " + m1;
lb1.setWidth(null);
lb1.setMaxlength(130);
lb1.addEventListener("onClick", show_mssg_event);
lb1.setValue(msg_disp);
lb1.setStyle("text-align: center; cursor:pointer");
if(rs.getInt("read_flag")==1)
{
lb1.setStyle("font-weight:bold; text-align: center; cursor:pointer");
}
lb1.setParent(row);
if (message.startsWith("PR:"))
{
message = message.replace("PR:","");
Button b1 = new Button();
b1.setLabel("Receipt");
b1.setWidth("80%");
b1.setId(message.substring(0, 21));
b1.addEventListener("onClick", rpbtn);
b1.setParent(row);
}
else
{
lb4.setWidth(null);
lb4.setValue("");
lb4.setStyle("text-align: center; cursor:pointer");
lb4.setParent(row);
}
lb2.setWidth(null);
lb2.addEventListener("onClick", show_mssg_event);
lb2.setValue(rs.getString("from_user_id"));
lb2.setStyle("text-align: center; cursor:pointer");
if(rs.getInt("read_flag")==1)
{
lb2.setStyle("font-weight:bold; text-align: center; cursor:pointer");
}
lb2.setParent(row);
lb3.setWidth(null);
lb3.addEventListener("onClick", show_mssg_event);
//lb3.setValue(rs.getTimestamp("time").toString());
lb3.setValue(rs.getString("time").toString());
lb3.setStyle("text-align: center; cursor:pointer");
if(rs.getInt("read_flag")==1)
{
lb3.setStyle("font-weight:bold;text-align: center; cursor:pointer");
}
lb3.setParent(row);
row.setHeight("10px");
row.setAlign("center");
row.setParent(msg_rows);
d++;
}
else
{
}
}
msg_rows.setVisible(true);
rs.close();
pstmt3.close();
if(showsouth && !south.isOpen())
{
south.setOpen(true);
}
String q4 = "select id, from_user_id, coalesce(subject,' ') as subject, coalesce(message,' ') as message, to_char(time,'DD-MON-YYYY HH24:MI:SS') as time, read_flag, status from tbl_msg_alert where lower(to_user_id) = ? and status = ? and to_char(time,'DD-MON-YYYY') = (select cur_date from tbl_eod_bod_stat) order by id desc";
PreparedStatement pstmt4 = conn.prepareStatement(q4);
pstmt4.setString(1, "all");
pstmt4.setInt(2, 11);
rs = pstmt4.executeQuery();
if(rs.next())
{
row = new Row();
row.setId(rs.getString("id"));
lb1 = new Label();
lb2 = new Label();
lb3 = new Label();
lb4 = new Label();
if(!rs.getString("from_user_id").equalsIgnoreCase(s.getAttribute("usern").toString()))
{
eod_msg_id = rs.getString("id");
subject = rs.getString("subject");
message = rs.getString("message");
msg_disp = subject + " - " + message;
lb1.setWidth(null);
lb1.setMaxlength(130);
lb1.setValue(msg_disp);
lb1.setStyle("text-align: center; cursor:pointer");
lb1.setParent(row);
lb4.setWidth(null);
lb4.setValue("");
lb4.setStyle("text-align: center; cursor:pointer");
lb4.setParent(row);
lb2.setWidth(null);
lb2.setValue(rs.getString("from_user_id"));
lb2.setStyle("text-align: center; cursor:pointer");
lb2.setParent(row);
lb3.setWidth(null);
//lb3.setValue(rs.getTimestamp("time").toString());
lb3.setValue(rs.getString("time").toString());
lb3.setStyle("text-align: center; cursor:pointer");
lb3.setParent(row);
lb1.setStyle("font-weight:bold;color:red; text-align: center; cursor:pointer");
lb2.setStyle("font-weight:bold;color:red; text-align: center; cursor:pointer");
lb3.setStyle("font-weight:bold;color:red; text-align: center; cursor:pointer");
if(!south.isOpen())
{
south.setOpen(true);
}
timer.stop();
eod_timer.start();
eod_timer.addEventListener("onTimer", eod_event);
msg_rows.getChildren().clear();
row.setHeight("10px");
row.setAlign("center");
row.setParent(msg_rows);
}
}
rs.close();
pstmt4.close();
String q5 = "select id, from_user_id, coalesce(subject,' ') as subject, coalesce(message,' ') as message, to_char(time,'DD-MON-YYYY HH24:MI:SS') as time, read_flag, status from tbl_msg_alert where upper(to_user_id) = ? and status = ? and read_flag <> ? and to_char(time,'DD-MON-YYYY') = (select cur_date from tbl_eod_bod_stat) order by id desc";
PreparedStatement pstmt5 = conn.prepareStatement(q5);
pstmt5.setString(1, ((String)s.getAttribute("usern")).toUpperCase());
pstmt5.setInt(2, 9);
pstmt5.setInt(3, 0);
rs = pstmt5.executeQuery();
if(rs.next())
{
row = new Row();
row.setId(rs.getString("id"));
lb1 = new Label();
lb2 = new Label();
lb3 = new Label();
lb4 = new Label();
if(!rs.getString("from_user_id").equalsIgnoreCase(s.getAttribute("usern").toString()))
{
userrelogin_msg_id = rs.getString("id");
subject = rs.getString("subject");
message = rs.getString("message");
msg_disp = subject + " - " + message;
lb1.setWidth(null);
lb1.setMaxlength(130);
lb1.setValue(msg_disp);
lb1.setStyle("text-align: center; cursor:pointer");
lb1.setParent(row);
lb4.setWidth(null);
lb4.setValue("");
lb4.setStyle("text-align: center; cursor:pointer");
lb4.setParent(row);
lb2.setWidth(null);
lb2.setValue(rs.getString("from_user_id"));
lb2.setStyle("text-align: center; cursor:pointer");
lb2.setParent(row);
lb3.setWidth(null);
//lb3.setValue(rs.getTimestamp("time").toString());
lb3.setValue(rs.getString("time").toString());
lb3.setStyle("text-align: center; cursor:pointer");
lb3.setParent(row);
lb1.setStyle("font-weight:bold;color:red; text-align: center; cursor:pointer");
lb2.setStyle("font-weight:bold;color:red; text-align: center; cursor:pointer");
lb3.setStyle("font-weight:bold;color:red; text-align: center; cursor:pointer");
if(!south.isOpen())
{
south.setOpen(true);
}
timer.stop();
user_relogin.start();
user_relogin.addEventListener("onTimer", user_relogin_event);
msg_rows.getChildren().clear();
row.setHeight("10px");
row.setAlign("center");
row.setParent(msg_rows);
}
}
rs.close();
pstmt5.close();
}
catch (Exception e){e.printStackTrace();}finally{try{conn.close();}catch (Exception fe){fe.printStackTrace();}}
}
EventListener mssg_event = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onTimer"))
{
show_msg_grid();
}
}
};
EventListener priority_event = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onTimer"))
{
priority_timer.stop();
Connection conn = null;
try
{
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String updq2 = "update tbl_msg_alert set read_flag = ?,status = ? where id = ?";
PreparedStatement updpstmt2 = conn.prepareStatement(updq2);
updpstmt2.setInt(1, 1);
updpstmt2.setInt(2, 10);
updpstmt2.setString(3, msg_id);
updpstmt2.executeQuery();
updpstmt2.close();
}
catch (Exception e){e.printStackTrace();}finally{try{conn.close();conn=null; }catch (Exception fe){fe.printStackTrace();}}
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", priority_message);
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
e.printStackTrace();
}
return;
}
}
};
EventListener eod_event = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onTimer"))
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "EOD going on. Session Terminated!!!");
Window win = (Window) Executions.createComponents("/Eod_Alert.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
}
}
}
};
EventListener user_relogin_event = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onTimer"))
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "System Admin initiated change! Please Re-Login.");
msgparams.put("force_msg_id", userrelogin_msg_id);
Window win = (Window) Executions.createComponents("/User_Relogin_Alert.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
}
}
}
};
EventListener logoutlistener = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onclick"))
{
Clients.confirmClose(null);
HttpSession s = (HttpSession)Sessions.getCurrent().getNativeSession();
Connection conn = null;
try
{
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String updq3 ="update tbl_user set logged_status = ?, current_attempts = ?, locked_status = ?, logout_date = (select systimestamp from dual) where upper(id) = ?";
PreparedStatement updpstmt3 = conn.prepareStatement(updq3);
updpstmt3.setString(1, "0");
updpstmt3.setInt(2, 0);
updpstmt3.setString(3, "0");
updpstmt3.setString(4, ((String) s.getAttribute("usern")).toUpperCase());
updpstmt3.executeUpdate();
updpstmt3.close();
String updq4 = "update tbl_session_info set end_time = (select systimestamp from dual) where id = ? ";
PreparedStatement updpstmt4 = conn.prepareStatement(updq4);
updpstmt4.setString(1, ((String)s.getId()).replace(".undefined",""));
updpstmt4.executeUpdate();
updpstmt4.close();
String updq5 = "update tbl_session_info set elapsed_time = (select extract (day from diff) * 24*60*60 + extract (hour from diff) * 60*60 + extract (minute from diff) * 60 + round(extract (second from diff)) elapsedtime from ( select (end_time-start_time) diff from tbl_session_info where id = ? )) where id = ?";
PreparedStatement updpstmt5 = conn.prepareStatement(updq5);
updpstmt5.setString(1, ((String)s.getId()).replace(".undefined",""));
updpstmt5.setString(2, ((String)s.getId()).replace(".undefined",""));
updpstmt5.executeUpdate();
updpstmt5.close();
Globals.auditlogit_security(wmain.getId(),"Logout Success");
s.invalidate();
HttpServletResponse hresponse = (HttpServletResponse)Executions.getCurrent().getNativeResponse();
Cookie killMyCookie = new Cookie("JSESSIONID", "");
killMyCookie.setMaxAge(0);
killMyCookie.setPath("/");
hresponse.addCookie(killMyCookie);
}
catch (Exception e){e.printStackTrace();}finally{try{conn.close();conn=null; }catch (Exception fe){fe.printStackTrace();}}
Executions.sendRedirect("/index.zul");
}
}
};
EventListener show_mssg_event = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onClick"))
{
Connection conn = null;
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
HttpSession s = (HttpSession)Sessions.getCurrent().getNativeSession();
String q6 = "select id , from_user_id, coalesce(subject,' ') as subject, coalesce(message,' ') as message, time, nvl(file_name,'0')as file_name from tbl_msg_alert where upper(to_user_id) = ? and id = ? order by time";
PreparedStatement pstmt6 = conn.prepareStatement(q6);
pstmt6.setString(1, ((String)s.getAttribute("usern")).toUpperCase());
pstmt6.setString(2, event.getTarget().getParent().getId());
ResultSet rs = pstmt6.executeQuery();
if(rs.next())
{
subject = rs.getString("subject");
message = rs.getString("message");
file_name = rs.getString("file_name");
id = rs.getString("id");
}
rs.close();
pstmt6.close();
LinkedHashMap<String, String> h = new LinkedHashMap<String, String>();
h.put("subject", subject);
h.put("message", message);
h.put("file_name", file_name);
h.put("id", id);
h.put("messageid", event.getTarget().getParent().getId());
String updq6 = "update tbl_msg_alert set read_flag = ? where id = ?";
PreparedStatement updpstmt6 = conn.prepareStatement(updq6);
updpstmt6.setInt(1, 0);
updpstmt6.setString(2, event.getTarget().getParent().getId());
updpstmt6.executeQuery();
updpstmt6.close();
try
{
@SuppressWarnings("unused")
Window w_mssg = (Window)execution.createComponents("mssg_show.zul", wmain, h);
}
catch(Exception e)
{
e.printStackTrace();
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Another message already open!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception ex)
{
}
}
conn.close();conn=null;
}
}
};
public void onClick$msgItem()
{
@SuppressWarnings("unused")
Window w_new_msg = (Window)execution.createComponents("new_mssg.zul", wmain,null);
}
EventListener displayevent = new EventListener()
{
public void onEvent(Event arg0) throws Exception
{
//added 11-09-2012
home_flag = true;
//
@SuppressWarnings("unused")
boolean createtab=false;
String target_id = arg0.getTarget().getId().substring(0,arg0.getTarget().getId().indexOf(":"));
String formid = arg0.getTarget().getId().substring(arg0.getTarget().getId().indexOf(":")+1);
String target_label = (String) arg0.getTarget().getAttribute("DISPLAY_NAME");
if(arg0.getName().equalsIgnoreCase("onClick"))
{
Tabs exTabs = (Tabs) center.getFellow("main_tab_box").getFellow("main_tabs");
Tab checkTab = null;
try
{
checkTab = (Tab) exTabs.getFellow("tab_"+target_id.toUpperCase());
checkTab.setSelected(true);
}
catch (ComponentNotFoundException cnfe)
{
// Ignore if can not get tab.
cnt_tab++;
cnt_tab_panel++;
try
{
tab[cnt_tab] = new Tab();
}
catch (ArrayIndexOutOfBoundsException aiobe)
{
//int newsize = tab.length + 5;
int newsize = tab.length + 1;
Tab[] temptab = new Tab[newsize];
System.arraycopy(tab, 0, temptab, 0, tab.length);
tab = temptab;
Tabpanel[] temppanel = new Tabpanel[newsize];
System.arraycopy(panel, 0, temppanel, 0, panel.length);
panel = temppanel;
tab[cnt_tab] = new Tab();
}
tab[cnt_tab].setClosable(true);
tab[cnt_tab].setLabel(target_label);
tab[cnt_tab].setId("tab_"+target_id.toUpperCase());
tab[cnt_tab].setParent(main_tabs);
tab[cnt_tab].addEventListener("onClose", wcloseEvent);
panel[cnt_tab_panel] = new Tabpanel();
panel[cnt_tab_panel].setParent(main_tab_panels);
panel[cnt_tab_panel].setId("tabpanel_"+target_id.toUpperCase());
HashMap<String, String> params = new HashMap<String, String>();
params.put("formid",formid);
Executions.createComponents("/"+target_id, panel[cnt_tab_panel], params);
tab[cnt_tab].setSelected(true);
west.setCollapsible(true);
west.setOpen(false);
south.setCollapsible(true);
south.setOpen(false);
}
}
}
};
//added 11-09-2012
EventListener displayevent1 = new EventListener()
{
public void onEvent(Event arg0) throws Exception
{
home_flag = true;
String target_id = arg0.getTarget().getId().substring(4).substring(0,arg0.getTarget().getId().substring(4).indexOf(":"));
String formid = arg0.getTarget().getId().substring(4).substring(arg0.getTarget().getId().substring(4).indexOf(":")+1);
String target_label = (String) arg0.getTarget().getAttribute("DISPLAY_NAME");
if(arg0.getName().equalsIgnoreCase("onOK"))
{
Tabs exTabs = (Tabs) center.getFellow("main_tab_box").getFellow("main_tabs");
Tab checkTab = null;
try
{
checkTab = (Tab) exTabs.getFellow("tab_"+target_id.toUpperCase());
checkTab.setSelected(true);
}
catch (ComponentNotFoundException cnfe)
{
// Ignore if can not get tab.
cnt_tab++;
cnt_tab_panel++;
try
{
tab[cnt_tab] = new Tab();
}
catch (ArrayIndexOutOfBoundsException aiobe)
{
//int newsize = tab.length + 5;
int newsize = tab.length + 1;
Tab[] temptab = new Tab[newsize];
System.arraycopy(tab, 0, temptab, 0, tab.length);
tab = temptab;
Tabpanel[] temppanel = new Tabpanel[newsize];
System.arraycopy(panel, 0, temppanel, 0, panel.length);
panel = temppanel;
tab[cnt_tab] = new Tab();
}
tab[cnt_tab].setClosable(true);
tab[cnt_tab].setLabel(target_label);
tab[cnt_tab].setId("tab_"+target_id.toUpperCase());
tab[cnt_tab].setParent(main_tabs);
tab[cnt_tab].addEventListener("onClose", wcloseEvent);
/*main_tab_box.setCtrlKeys("@x");
main_tab_box.addEventListener("onCtrlKey", wcloseEvent);*/
panel[cnt_tab_panel] = new Tabpanel();
panel[cnt_tab_panel].setParent(main_tab_panels);
HashMap<String, String> params = new HashMap<String, String>();
params.put("formid",formid);
Executions.createComponents("/"+target_id, panel[cnt_tab_panel], params);
tab[cnt_tab].setSelected(true);
west.setCollapsible(true);
west.setOpen(false);
//west.setFlex(true);
south.setCollapsible(true);
south.setOpen(false);
}
}
}
};
EventListener wcloseEvent = new EventListener()
{
public void onEvent(Event event)
{
if(event.getName().equalsIgnoreCase("onClose"))
{
if(cnt_tab==1)
{
west.setOpen(true);
south.setOpen(true);
}
cnt_tab--;
cnt_tab_panel--;
}
}
};
EventListener rpbtn = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if (event.getName().equalsIgnoreCase("onclick"))
{
/*
* Generate Receipt based on a specific message alert received
* Message for Receipt Printing should start with PR:XXXXXXXXXXXXXXXXXXXXX
*/
HashMap<String, String> reportparams = new HashMap<String, String>();
reportparams.put("instids", "('"+event.getTarget().getId()+"')");
reportparams.put("reporttitle", "Cash Withdrawal Receipt");
reportparams.put("jrxmlname", "Deposit_Receipt.jrxml");
try
{
Window win = (Window) Executions.createComponents("receipt_printing.zul", wmain, reportparams);
win.doModal();
}
catch (Exception e)
{
((Window)wmain.getFellow("wreceipt")).detach();
Window win = (Window) Executions.createComponents("receipt_printing.zul", wmain, reportparams);
win.doModal();
}
}
}
};
public byte[] genChequeFile(String srcFile, String dirPath)
{
byte retb[] = null;
RandomAccessFile rafr=null;
try
{
try
{
String path=dirPath + srcFile;
File fdSrc = new File(path);
rafr = new RandomAccessFile(fdSrc, "r");
byte b[] = new byte[(int) rafr.length()] ;
rafr.read(b);
rafr.close();
retb = b;
}
catch (Exception e)
{
String path=dirPath + "000.jpg";
File fdSrc = new File(path);
rafr = new RandomAccessFile(fdSrc, "r");
byte b[] = new byte[(int) rafr.length()] ;
rafr.read(b);
rafr.close();
retb = b;
}
}
catch(Exception e)
{
e.printStackTrace();
}
return retb;
}
}