Wednesday, December 15, 2010

Wizardzzzzz





Wizards are mainly used for flexibility and act as a wizard for navigating pages which goes in a flow.

I will be throwing some light on how its done.
mAIN page script

function Form_InitDone(eventObject)
{
//this is the main wizard page where we are cloning the XML document shown in the figure
var wizreq = cordys.cloneXMLDocument(wizardXMLPages.XMLDocument);
ordersWizardLib.setWizardData(wizreq);//we are setting request to the wizard id=orderswizardlib
var ordersData = {}; //taking an empty array ordersdata to fill the page ids in xml
ordersData.wizardPagesArray = [];
ordersWizardLib.ordersData = ordersData; //wizardid.ordersdata(custom) will take the ordersdata it has
ordersWizardLib.start(); //wizard functionality starts Initializes the wizard. This method also pops up the wizard window //showing the first step of the wizard if the wizard is not already running. If the wizard is running, the focus is set to the //already running wizard.

}

//code snippet in div tags for wizard is shown and also a wizard.htm file is loaded for the functionality of wizard


empdetails:PAGE 1 SCRIPT

function Form_InitDone(eventObject)
{
//creating variable appwindow which shows the application window
/**The container object is automatically created by the framework when a new application has to be started. It offers a collection of methods that can be operated from it, which helps handling the container of the application as such. The container can be accessed through the application by the following format:
application.container. is READ-ONLY. Object that denotes the window object of the container which displays the application.**/

var appwindow = application.container.applicationWindow;
//childwizardlib is calling the appwindow of parent that is frame which is a child of grandparent that wizard UI which loads der.
var childordersWizardLib = appWindow.parent.parent.ordersWizardLib;
var childordersData = ordersWizardLib.ordersData;//getting this ordersData info from main claimwizard UI
if(ordersWizardLib) //if its present hiding and showing the button functionalities
{
childordersData.wizardPagesArray[application.container.applicationId] = appWindow; //matching the id of that application
childordersWizardLib.getWizardWindow().document.getElementById("btnFinish").style.visibility = "visible";
childordersWizardLib.getWizardWindow().document.getElementById("btnBack").style.visibility = "hidden";
childordersWizardLib.getWizardWindow().document.getElementById("btnNext").style.visibility = "visible";
}
window.parent.parent.document.getElementById("loading").style.display = "none";
}
//other functions can also be written
function btnNextShow()
{
var appWindow = application.container.applicationWindow;
var ordersWizardLib = appWindow.parent.parent.ordersWizardLib;
ordersWizardLib.getWizardWindow().document.getElementById("btnNext").style.visibility = "visible";
}
function btnNextHide()
{
var appWindow = application.container.applicationWindow;
var ordersWizardLib = appWindow.parent.parent.ordersWizardLib;
ordersWizardLib.getWizardWindow().document.getElementById("btnNext").style.visibility = "hidden";
}


PAGE 2 is also written in the same way.remind that steps given in the main page xml should be taken care of since these go in the same way as given in xml

function Form_InitDone(eventObject)
{
var appwindow = application.container.applicationWindow;
var childordersWizardLib = appWindow.parent.parent.ordersWizardLib;
var childclaimData = ordersWizardLib.ordersData;
if(ordersWizardLib)
{
childclaimData .wizardPagesArray[application.container.applicationId] = appWindow;
childordersWizardLib.getWizardWindow().document.getElementById("btnFinish").style.visibility = "visible";
childordersWizardLib.getWizardWindow().document.getElementById("btnBack").style.visibility = "visible";
childordersWizardLib.getWizardWindow().document.getElementById("btnNext").style.visibility = "visible";
}
window.parent.parent.document.getElementById("loading").style.display = "none";
}

function btnNextShow()
{
var appWindow = application.container.applicationWindow;
var ordersWizardLib = appWindow.parent.parent.ordersWizardLib;
ordersWizardLib.getWizardWindow().document.getElementById("btnNext").style.visibility = "visible";
}
function btnNextHide()
{
var appWindow = application.container.applicationWindow;
var ordersWizardLib = appWindow.parent.parent.ordersWizardLib;
ordersWizardLib.getWizardWindow().document.getElementById("btnNext").style.visibility = "hidden";
}
function onFinish(){
btnNextHide();
alert("Finished");
}

No comments:

Post a Comment