package ibase.e12ria.e12widgets.client;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.google.code.gwt.storage.client.Storage;
import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.event.logical.shared.AttachEvent.Handler;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.XMLParser;

import ibase.e12ria.client.DummyResponse;
import ibase.e12ria.client.E12AppInfo;
import ibase.e12ria.client.E12CheckBox;
import ibase.e12ria.client.E12CommonUtils;
import ibase.e12ria.client.E12Constants;
import ibase.e12ria.client.E12CustomPlugin;
import ibase.e12ria.client.E12CustomPlugin.CallBack;
import ibase.e12ria.client.E12Global;
import ibase.e12ria.client.E12Global.ConnectionMode;
import ibase.e12ria.client.E12Global.LoginMethod;
import ibase.e12ria.client.E12Global.Orientation;
import ibase.e12ria.client.E12HeaderFooter;
import ibase.e12ria.client.E12HeaderFooter.FooterType;
import ibase.e12ria.client.E12MessageHandler;
import ibase.e12ria.client.E12RIA;
import ibase.e12ria.client.E12RequestBuilder;
import ibase.e12ria.client.MELogin;
import ibase.e12ria.client.OTPLogin;
import ibase.e12ria.client.resources.Resources;
import ibase.e12ria.client.resources_Android.Resources_Android;
import ibase.e12ria.client.resources_iOS7.Resources_iOS7;
import ibase.e12ria.dcdet.client.CollabContents;
//import ibase.e12ria.dcdet.client.CollabContents;
import ibase.e12ria.e12widgets.shared.E12CommonUtils.DeviceMajorVersion;
import ibase.e12ria.e12widgets.shared.E12CommonUtils.DeviceOS;
import ibase.e12ria.e12widgets.shared.E12CommonUtils.DeviceType;
import ibase.e12ria.e12widgets.shared.E12Storage;
import ibase.e12ria.e12widgets.shared.SHA256;
import ibase.e12ria.social.client.plugins.PhoneGapUtil;
import ibase.e12ria.social.client.util.E12PluginUtils;
import ibase.e12ria.social.client.util.E12PluginUtils.LogLevel;
import ibase.e12ria.utility.client.CommonPhoneGapUtil;
import ibase.e12ria.e12widgets.client.handlers.CallbackHandler;
import ibase.e12ria.e12widgets.shared.E12LocalStorage;
import ibase.e12ria.client.E12RequestBuilder.RequestDataKeys;
import ibase.e12ria.client.E12UserInfo;
/**
 * @author Harshada
 * Gets the available connections from localStorage if supported by the browser
 */
public class E12ApplicationsPanel extends WallToWallPanel implements PageComponent{

	String redirectTo = "";
	//public static String hostUrl = "";
	//ArrayList<PanelLabel> panelLst;
	E12OptionsPanel e12OptionsPanel ;
	VerticalPanel vpnl;
	boolean isShown = false;
	//public static boolean serverStatus = true;

	String selectedApp;
	String appDescription;
	String connOption;
	PanelLabel panelLabel = null;
	public static String storedServerIP;
	public static String storedHostUrl;
	public static String connectionId;
	public static String storedUserName;
	//Added By Suraj to Store UserName
	public static String currentUserName;
	private ArrayList<String> connectionKey;

	protected Request requestStatus = null;

	//Added by Dnyaneshwar chavan on 15-APR-14 [ Draw the no. of sites ] Start
	private String selectedSiteCode;
	private String selectedSiteDescr;
	private String selectedSiteProfileId;
	//Added by Dnyaneshwar chavan on 15-APR-14 [ Draw the no. of sites ] End

	//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17
	public static boolean isNotification = false;
	public static boolean isAuthenticated = false;

	//Added by sunny soni on 17-NOV-16 for get & set forgot pin value start
	//Added By Nilesh Start :: 17-12-18
	private String setTitle="+";
	//Added By Nilesh eND :: 17-12-18
	private String forgotPin = "";
	public String getForgotPin()
	{
		return forgotPin;
	}
	public void setForgotPin(String forgotPin)
	{
		this.forgotPin = forgotPin;
	}
    //Added by sunny soni on 17-NOV-16 for get & set forgot pin value end
    //Added by sunny soni for re-login from setting option while have single connection on 30-Aug-21 [Start]
    public static boolean isLoginFromSettingOptions = false;
    //Added by sunny soni for re-login from setting option while have single connection  on 30-Aug-21 [End]
	public String version = "";
	public String apkVersion = "";
	E12HeaderFooter e12WizardFooter;
	private static ImageResource USER_IMG ;
	// Added by Pankaj R on 08-Jan-18 to store current application name[START]
	public String appName = "";
	// Added by Pankaj R on 08-Jan-18 to store current application name[END]
	public String path ="";
	//added by vishal pathare on 7.8.18 for[update app related changes if version incompatible]
	private String appId = "ibase.android.Proteus";

	public E12ApplicationsPanel(String title,ArrayList<String> connectionKey, WallToWallPanel parent)
	{
		super(title, parent);
		this.connectionKey = connectionKey;
		try
		{
			clear();
			//Added by Harshada on 29-Jan-2013 [Modified user connections setting based on hosted mode]
			if(connectionKey==null || connectionKey.isEmpty()){
				Label errLabel = new Label(E12Constants.constants.setNoConnAvailableLbl());
				errLabel.setStyleName("errlabel");
				//Added by Pankaj on 05/APR/16- Req[S15JBAS002] [Start]
				this.addAttachHandler(new Handler() {
					@Override
					public void onAttachOrDetach(AttachEvent event)
					{
						if(event.isAttached())
						{
							resizeComponent();
						}
					}
				});
				//Added by Pankaj on 05/APR/16- Req[S15JBAS002] [Start]
				super.enter();
				add(errLabel);
				//Window.alert("No connection available, Please create new connection");
			}else{
				enter();
			}
			getLabel().setText(title);

			setEditCommand("+", "Add New", new Command() {

				@Override
				public void execute() {
					MELogin.loginFlag = true;

					if( MELogin.isLoginHostedStr.equalsIgnoreCase("Login:True") && MELogin.serverStatus==true)
					{
						new MELogin( "Login:True:#New");
					}
					else{
						new MELogin( "Login:False:#New");
					}
				}
			});

		} catch (Exception e) {
			Window.alert("Exception in E12ApplicationsPanel ["+e.getMessage() +"]");
			e.printStackTrace();
		}
	}


	public void clear()
	{
		super.clear();
	}

	@Override
	protected String getShortTitle() {

		//Added By Nilesh GUnjal Start :: 14-12-18
		//return "+";
		return setTitle;
		//Added By Nilesh GUnjal End :: 14-12-18
	}
	//Added By Nilesh GUnjal End :: 14-12-18
	public void setShortTitle(String setTitle)
	{
		this.setTitle = setTitle;
	}
		//Added By Nilesh GUnjal End :: 14-12-18
	@Override
	public void enter()
	{
		try
		{
			if ( isAttached() )
			{
				return;
			}
			else
			{
				//Added by Pankaj on 05/APR/16- Req[S15JBAS002] [Start]
				this.addAttachHandler(new Handler() {
					@Override
					public void onAttachOrDetach(AttachEvent event)
					{
						if(event.isAttached())
						{
							resizeComponent();
						}
					}
				});
				//Added by Pankaj on 05/APR/16- Req[S15JBAS002] [End]
				super.enter();
				generateAppPanel();
			}
			/*if (!getLoadingStarted())
			{
				refresh();
			}*/
		}
		catch (Exception e) {
			Window.alert("Exception:E12ApplicationsPanel:enter()"+e.toString());
			throw new RuntimeException(e);
		}

	}

	/**
	 * Gets application details previously stored on login by user
	 */
	//Changed on 2nd JAN 2013 [Created unique connections map]
	private void generateAppPanel()
	{
		try
		{
			final ArrayList<String> applName=new ArrayList<String>();
			final ArrayList<String> displayDesc=new ArrayList<String>();
			final ArrayList<String> applDesc=new ArrayList<String>();
			final ArrayList<String> keyId=new ArrayList<String>();
			final ArrayList<String> userId = new ArrayList<String>();
			final ArrayList<String> serverIP = new ArrayList<String>();
			final ArrayList<String> applConnOpt =new ArrayList<String>();

			String conMap="";
			final int connectionSize = connectionKey.size();
			//Changed by Sandeep S. on 18-05-17 [To implement touch authentication in android] Start
			if( connectionSize == 1 && !MELogin.cancelClick )
			{
				flowPanel.getElement().getStyle().setDisplay(Display.NONE);
			}
			else
			{
				flowPanel.getElement().getStyle().clearDisplay();
			}
			//Changed by Sandeep S. on 18-05-17 [To implement touch authentication in android] End
			//Added and Commented by Dnyaneshwar Chavan on 21-AUG-13 [Implement WebSQL] START
			if( Storage.isSupported() )
			{
				for (int i = 0; i < connectionSize; i++)
				{
					final int currentCount = 1 + i;
					String key = connectionKey.get(i);
					//Added by Sandeep S. on 24-OCT-17 [User can change application by tapping app icon inside menu/left panel]
					//if(key.contains("connection."))
					if( key.startsWith("h:") )
					{
						keyId.add(key);
						E12Storage.getItem(key, new Callback<String, String>() {
							@Override
							public void onSuccess(String result) {
								E12CommonUtils.printOnConsole( "In generateAppPanel()" );
								Map<String, String> curMap = retrieveMap( E12CommonUtils.checkNull( result ) );
								applName.add( curMap.get("selectedAppName") );
								displayDesc.add( curMap.get("curDescrLable") );
								applDesc.add( curMap.get("curAppDesc") );
								userId.add( curMap.get( "curUser" ) );
								serverIP.add( curMap.get( "curServerIP" ) );
								applConnOpt.add( curMap.get( "appConnOpt" ) );
								E12CommonUtils.printOnConsole( "In generateAppPanel() method :: currentCount["+currentCount+"] connectionSize["+connectionSize+"]" );
								if( currentCount == connectionSize )
								{
									generateAppPanel(applName, displayDesc, applDesc, keyId, userId, serverIP , applConnOpt, connectionSize);
								}

								// Added by Sandesh on 29.02.2016 [Reqest Id:S15KBAS001] Start
								//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
								String storedUser = E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("userName"));
								String passwdStore = E12CommonUtils.checkNull(E12Storage.getItemLocalStorage(storedUser + "_isPasswordStore"));
								//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End
								E12CommonUtils.printOnConsole("E12ApplicationsPanel :: generateAppPanel() : connectionKey.size() " + connectionKey.size() + " E12Constants.isPasswordStore[" + passwdStore + "]" +" storedUser["+storedUser+"]");
								if (connectionKey.size() == 1 && "1".equalsIgnoreCase(passwdStore))
								{

									E12CommonUtils.printOnConsole("E12ApplicationsPanel :: generateAppPanel() connectionKey.size()" + connectionKey.size());

									E12CommonUtils.printOnConsole(" Panel Label :" + panelLabel);
									if (panelLabel != null)
									{
										E12CommonUtils.printOnConsole(" inside Panel Label :" + panelLabel);
										E12CommonUtils.printOnConsole("E12ApplicationsPanel :: generateAppPanel() connectionKey.size()" + connectionKey.size());
										panelLabel.getCommand().execute();
									}
								}
								// Added by Sandesh on 29.02.2016 [Reqest Id:S15KBAS001] End

								//Added by sunny soni on 17-NOV-16 for getting popup for on launch application start
								if( E12Constants.onApplaunch == 0 || ( connectionKey.size() == 1 && !MELogin.cancelClick ) )
								{
									E12CommonUtils.printOnConsole("Panel start to call");
									if (panelLabel != null)
									{
										E12CommonUtils.printOnConsole("Panel start to call");
										panelLabel.getCommand().execute();
									}
									E12Constants.onApplaunch++;
								}
								//Added by sunny soni on 17-NOV-16 for getting popup for on launch application end
								MELogin.cancelClick = false;
							}

							@Override
							public void onFailure(String reason) {
								Window.alert( "Exception in generateAppPanel method when getting value from websql  ["+reason+"]" );

							}
						});
					}
				}
			}
			else
			{
				generateAppPanel(applName, displayDesc, applDesc, keyId, userId, serverIP, applConnOpt, connectionSize);
			}

			/*if(Storage.isSupported())
			{
					int connectionSize = connectionKey.size();
					for (int i = 0; i < connectionSize; i++)
					{
						String key = connectionKey.get(i);
						if(key.contains("connection."))
						{
							keyId.add(key);
							conMap = E12Storage.getItem(key);
							//Commented and Added by Dnyaneshwar Chavan on 5-JUL-13 [] Start
							applName.add(getStoredValues(retrieveMap(conMap),"selectedAppName"));
							displayDesc.add(getStoredValues(retrieveMap(conMap),"curDescrLable"));
							applDesc.add(getStoredValues(retrieveMap(conMap),"curAppDesc"));
							Map<String, String> curMap = retrieveMap(conMap);
							applName.add( curMap.get("selectedAppName") );
							displayDesc.add( curMap.get("curDescrLable") );
							applDesc.add( curMap.get("curAppDesc") );
							userId.add( curMap.get( "curUser" ) );
							serverIP.add( curMap.get( "curServerIP" ) );
							//Commented and Added by Dnyaneshwar Chavan on 5-JUL-13 [] End
						}
					}
					E12Global.getInstance().getExistConnectionMap().put( "userId", ( ArrayList<String> ) userId );
					E12Global.getInstance().getExistConnectionMap().put( "serverIP", ( ArrayList<String> ) serverIP );
					E12Global.getInstance().getExistConnectionMap().put( "selectedAppName",  ( ArrayList<String> ) applName );

			}

			//********CONNECTION MAP*********
			panelLst =new ArrayList<PanelLabel>();

			// Add Dnyaneshwar on 17/12/12 [DC2ISUN001 || Login page set a Logo and
			// Background texture ] Start
			//Image logo = new Image("images/ClientLogoTablet.png");
			Image logo = new Image(  );

			if (E12Global.getInstance().isHostedMode())
			{
				logo.setUrl( "/ibase/images/ClientLogo.png" );

			}
			else
			{
				logo.setUrl(E12Global.getInstance().getClientLogoPath());

			}

			if(E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
			{

				HorizontalPanel hortPanel = new HorizontalPanel();
				//Commented Dnyaneshwar on 28-JUN-13 [ Remove the background image as per KB Sir] Start
				//hortPanel.addStyleName("backgroundTexture");
				//Commented Dnyaneshwar on 28-JUN-13 [ Remove the background image as per KB Sir] End
				hortPanel.setSize( "100%", "100%" );

				VerticalPanel vertPanel = new VerticalPanel();
				vertPanel.setWidth( "100%" );

				for (int i = 0; i <  applName.size(); i++)
				{
					PanelLabel panelLbl = getLabel(displayDesc.get(i),applDesc.get(i),applName.get(i),keyId.get(i));
					panelLst.add( panelLbl );
					vertPanel.add( panelLbl );
				}

				hortPanel.add( vertPanel );
				hortPanel.add(logo);
				logo.setSize("100%","100%");

				hortPanel.setCellWidth(vertPanel, "30%");
				hortPanel.setCellHorizontalAlignment(logo, HasHorizontalAlignment.ALIGN_CENTER);
				hortPanel.setCellVerticalAlignment(logo, HasVerticalAlignment.ALIGN_MIDDLE);

				add( hortPanel );
			}
			else
			{
				for (int i = 0; i < applName.size(); i++)
				{
					add(getLabel(displayDesc.get(i),applDesc.get(i),applName.get(i),keyId.get(i)));
					panelLst.add(getLabel(displayDesc.get(i),applDesc.get(i),applName.get(i),keyId.get(i)));
				}

			}
			//Commented by Dnyaneshwar on 29-JUN-13 [ Remove the footer bar as per KB Sir] Start
			setFooter(new Label());
			//Commented by Dnyaneshwar on 29-JUN-13 [ Remove the footer bar as per KB Sir] Start
*/
			//Added and Commented by Dnyaneshwar Chavan on 21-AUG-13 [Implement WebSQL] END
		}
		catch (Exception e)
		{
			Window.alert("Exception in generateAppPanel() : " +e.getMessage());
			e.printStackTrace();
		}
	}

	//Added and Commented by Dnyaneshwar Chavan on 21-AUG-13 [Implement WebSQL] START
	private void generateAppPanel(ArrayList<String> applName, ArrayList<String> displayDesc, ArrayList<String> applDesc,
			ArrayList<String> keyId, ArrayList<String> userId, ArrayList<String> serverIP, ArrayList<String> applConnOpt, int noOfConnections)
	{
		E12Global.getInstance().getExistConnectionMap().put( "userId", ( ArrayList<String> ) userId );
		E12Global.getInstance().getExistConnectionMap().put( "serverIP", ( ArrayList<String> ) serverIP );
		E12Global.getInstance().getExistConnectionMap().put( "selectedAppName",  ( ArrayList<String> ) applName );

		//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17
		PanelLabel openAppPanel = new PanelLabel("");
		//********CONNECTION MAP*********
		//panelLst =new ArrayList<PanelLabel>();

		// Add Dnyaneshwar on 17/12/12 [DC2ISUN001 || Login page set a Logo and
		// Background texture ] Start
		//Image logo = new Image("images/ClientLogoTablet.png");
		Image logo = new Image(  );

		logo.setUrl( E12Global.getHostUrl() + "/ibase/images/ClientLogo.png");
//		if (E12Global.getInstance().isHostedMode())
//		{
//			logo.setUrl( "/ibase/images/ClientLogo.png" );
//
//		}
//		else
//		{
//			logo.setUrl(E12Global.getInstance().getClientLogoPath());
//
//		}

		if(E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
		{

			HorizontalPanel hortPanel = new HorizontalPanel();
			//Commented Dnyaneshwar on 28-JUN-13 [ Remove the background image as per KB Sir] Start
			//hortPanel.addStyleName("backgroundTexture");
			//Commented Dnyaneshwar on 28-JUN-13 [ Remove the background image as per KB Sir] End
			hortPanel.setSize( "100%", "100%" );

			VerticalPanel vertPanel = new VerticalPanel();
			vertPanel.setWidth( "100%" );

			for (int i = 0; i <  applName.size(); i++)
			{
				PanelLabel panelLbl = getLabel(displayDesc.get(i),applDesc.get(i),applName.get(i),keyId.get(i), applConnOpt.get(i), noOfConnections);
				//panelLst.add( panelLbl );
				vertPanel.add( panelLbl );
				//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 Start
				if(i == 0)
				{
					openAppPanel = panelLbl;
				}
				//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 End
			}

			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 Start
			//Change by Sandeep S. on 28-Sep-17 [To resolve proteus vison application related issue of App resume redirect] Start
			//if (isNotification && openAppPanel != null)
			if ( (isNotification && openAppPanel != null) && ( noOfConnections != 1 ) )
			{
				isNotification = false;
				openAppPanel.getCommand().execute();
			}
			else
			{
				if ( (isNotification && noOfConnections == 1)  )
				{
					isNotification = false;
				}
			}
			//Change by Sandeep S. on 28-Sep-17 [To resolve proteus vison application related issue of App resume redirect] End
			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 End

			hortPanel.add( vertPanel );
			hortPanel.add(logo);
			logo.setSize("100%","100%");

			hortPanel.setCellWidth(vertPanel, "30%");
			hortPanel.setCellHorizontalAlignment(logo, HasHorizontalAlignment.ALIGN_CENTER);
			hortPanel.setCellVerticalAlignment(logo, HasVerticalAlignment.ALIGN_MIDDLE);

			add( hortPanel );
		}
		else
		{
			for (int i = 0; i < applName.size(); i++)
			{
				//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 Start
				PanelLabel panelLbl = getLabel(displayDesc.get(i),applDesc.get(i),applName.get(i),keyId.get(i),applConnOpt.get(i), noOfConnections);
				add(panelLbl);
				//panelLst.add(getLabel(displayDesc.get(i),applDesc.get(i),applName.get(i),keyId.get(i)));
				if(i == 0)
				{
					openAppPanel = panelLbl;
				}
				//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 End
			}

			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 Start
			//Change by Sandeep S. on 28-Sep-17 [To resolve proteus vison application related issue of App resume redirect] Start
			//if (isNotification && openAppPanel != null)
			if ( (isNotification && openAppPanel != null) && ( noOfConnections != 1 ) )
			{
				isNotification = false;
				openAppPanel.getCommand().execute();
			}
			else
			{
				if ( (isNotification && noOfConnections == 1)  )
				{
					isNotification = false;
				}
			}
			//Change by Sandeep S. on 28-Sep-17 [To resolve proteus vison application related issue of App resume redirect] End
			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 End

		}
		//Commented by Dnyaneshwar on 29-JUN-13 [ Remove the footer bar as per KB Sir] Start
		setFooter(new Label());
		//Commented by Dnyaneshwar on 29-JUN-13 [ Remove the footer bar as per KB Sir] Start

	}
	//Added and Commented by Dnyaneshwar Chavan on 21-AUG-13 [Implement WebSQL] END
/*
 * private void generateAppPanel()
	{
		ArrayList<String> availableApps = new ArrayList<String>();

		if(Storage.isSupported()==true){

			for (int i = 0; i < E12Storage.getLength(); i++) {
				String key = E12Storage.key(i);
				if(key!=null && key.contains("-AN-")){
					String appVal = E12Storage.getItem(key);
					int s1 = appVal.trim().lastIndexOf(":")+1;
					int s2 = appVal.trim().length();
					String applicationNm = appVal.substring(s1,s2);
					availableApps.add(applicationNm);
				}
			}
		}


		panelLst =new ArrayList<PanelLabel>();


		// Add Dnyaneshwar on 17/12/12 [DC2ISUN001 || Login page set a Logo and
				// Background texture ] Start
		if( Window.Navigator.getPlatform().indexOf("iPad") != -1 ||
		   ( Window.Navigator.getUserAgent().indexOf("Android") != -1 && Window.Navigator.getUserAgent().indexOf("Mobile") == -1 ) )
		{
			Image logo = new Image("images/ClientLogoTablet.png");

			HorizontalPanel hortPanel = new HorizontalPanel();
			hortPanel.addStyleName("backgroundTexture");
			hortPanel.setSize( "100%", "100%" );

			VerticalPanel vertPanel = new VerticalPanel();

			for (int i = 0; i < availableApps.size(); i++)
			{
				PanelLabel panelLbl = getLabel( availableApps.get( i ) );
				panelLst.add( panelLbl );
				vertPanel.add( panelLbl );
			}

			hortPanel.add( vertPanel );
			hortPanel.add(logo);
			hortPanel.setCellWidth(vertPanel, "50%");
			hortPanel.setCellWidth(logo, "50%");
			hortPanel.setCellHorizontalAlignment(logo, HasHorizontalAlignment.ALIGN_CENTER);
			hortPanel.setCellVerticalAlignment(logo, HasVerticalAlignment.ALIGN_MIDDLE);

			add( hortPanel );

		}
		else
		{
			for (int i = 0; i < availableApps.size(); i++)
			{
				add(getLabel(availableApps.get(i)));
				panelLst.add(getLabel(availableApps.get(i)));
			}
		}
		// Add Dnyaneshwar on 17/12/12 [DC2ISUN001 || Login page set a Logo and

	}
*/
	/*private void refresh() {

	}*/

	/*public PanelLabel getLabel(final String applDetails){*/
	public PanelLabel getLabel(final String displayDesc,final String applDesc,final String applName,final String conId, final String connOpt, final int noOfConnections)
	{
		E12CommonUtils.printOnConsole("E12ApplicationPanel :: getLabel() 676:");	
		try{
			//Added by Pankaj R on 21-Dec-2017 to set Current App Version[Start]
			if( !E12Global.getInstance().isHostedMode())
			{
				MELogin.checkApkVersion(new Callback<String, String>() {

					@Override
					public void onFailure(String reason)
					{

					}

					@Override
					public void onSuccess(String result) {

						apkVersion = result;
						apkVersion = E12Global.checkNull( apkVersion.substring(apkVersion.indexOf("v") + 1 ) );
						if( !"".equalsIgnoreCase(apkVersion) )
						{
							apkVersion = apkVersion.replace(".", "-");
							version = apkVersion;
						}
					}
				});
				// Added by Pankaj R on 08-Jan-18 to store current application name[START]
				MELogin.getAppName(new Callback<String, String>() {

					@Override
					public void onSuccess(String result)
					{
						appName = result;
					}

					@Override
					public void onFailure(String reason) {}
				});
				// Added by Pankaj R on 08-Jan-18 to store current application name[END]
			}
			//Added by Pankaj R on 21-Dec-2017 to set Current App Version[End]
			final FlowPanel flowPanel = new FlowPanel();

			flowPanel.add(clickablePanel(displayDesc,applDesc,applName,conId)); //CONNECTION MAP
			panelLabel = new PanelLabel(flowPanel, new Command() {

				@Override
				public void execute()
				{
					//Added by Dnyaneshwar chavan on 20-AUG-13 [ Implement Web SQL ] Start
					E12Storage.getItem( conId, new Callback<String, String>()
					{
						@Override
						public void onFailure(String reason) {
						}
						@Override
						public void onSuccess(String result)
						{
							E12CommonUtils.printOnConsole("E12ApplicationPanel :: CommandExceute() Result:"+result);
							String conDetails = E12CommonUtils.checkNull( result );
							connectionId = conId;
							selectedApp = applName;
							appDescription = applDesc;
							connOption = connOpt;
							//Added by Dnyaneshwar chavan on 15-APR-14 [ Draw the no. of sites ] Start
//							storedHostUrl = getStoredValues(retrieveMap(conDetails),"currhostUrl");
//							storedServerIP = getStoredValues(retrieveMap(conDetails),"curServerIP");
//							storedUserName = getStoredValues(retrieveMap(conDetails),"curUser");
							Map<String, String> connectionInfoMap =  retrieveMap(conDetails);
							E12CommonUtils.printOnConsole("E12ApplicationPanel ::connectionInfoMap:"+connectionInfoMap);
							storedHostUrl = getStoredValues(connectionInfoMap,"currhostUrl");
							storedServerIP = getStoredValues(connectionInfoMap,"curServerIP");
							storedUserName = getStoredValues(connectionInfoMap,"curUser");
							E12CommonUtils.printOnConsole("E12ApplicationPanel ::storedHostUrl:"+storedHostUrl);
							//Added By Suraj to Store UserName
							currentUserName = getStoredValues(connectionInfoMap,"curUserName");
							//Added By Suraj on 23-June-2016 [ To set applDate when user login with existing connection ]
							//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
							E12Constants.applDate = E12Storage.getItemLocalStorage("APPL_DATE_FORMAT");
							E12Constants.applDateTime = E12Storage.getItemLocalStorage("APPL_DATETIME_FORMAT");
							//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End

							selectedSiteCode = E12Global.checkNull( getStoredValues(connectionInfoMap,"selectedSiteCode") );
							selectedSiteDescr = E12Global.checkNull( getStoredValues(connectionInfoMap,"selectedSiteDescr") );
							selectedSiteProfileId = E12Global.checkNull( getStoredValues(connectionInfoMap,"selectedSiteProfileId") );

							String selectedDeviceType = getStoredValues(connectionInfoMap,"selectedDeviceType");
							//Added by Dnyaneshwar chavan on 15-APR-14 [ Draw the no. of sites ] End
							if( "Mobile".equals(selectedDeviceType) )
							{
								E12Global.getInstance().setDeviceType( DeviceType.Mobile );
							}
							else if( "Tablet".equals(selectedDeviceType) )
							{
								E12Global.getInstance().setDeviceType( DeviceType.Tablet );
							}
							//Added by Dnyaneshwar Chavan on 18-OCT-13 [MF3CSUN007][ Store device type in Local storage ] END

							E12Storage.setItem( "curConnection", "/" + conId + "./" );
							E12Global.getInstance().setCurConnectionId ( "/" + conId +"./" );

							E12Global.setGlobalHostUrl(E12Global.getHostUrl()); //Added by Harshada on 4-APR-2014[Integrate Image capture component with EBMR]
							try {
									// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] Start
								//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
									String cntConnection = E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("counter"));
									E12Constants.isPasswordStore =  E12CommonUtils.checkNull(E12Storage.getItemLocalStorage(storedUserName + "_isPasswordStore"));
									//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End

									if ( "1".equalsIgnoreCase(cntConnection) && "1".equalsIgnoreCase(E12Constants.isPasswordStore))
									{
										authenticateUser();
									}
                                    // Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] End
                                    //Added by sunny soni for authenticating from setting options to single connection 30-Aug-21[Start]
									else if (!E12Global.getInstance().isHostedMode() && "1".equalsIgnoreCase(cntConnection) && isLoginFromSettingOptions)
									{
										isLoginFromSettingOptions = false;
										authenticateUser();
									}
									//Added by sunny soni for authenticating from setting options to single connection 30-Aug-21[End]
									//Added by Sandeep Shelar on 08-FEB-2016 [For TouchID Authentication custom plugin in IOS] Start
									//Changed by Sandeep S. on 18-05-17 [To implement touch authentication in android] Start
									else if( !E12Global.getInstance().isHostedMode() /*&& E12Global.getInstance().getDeviceOS() != DeviceOS.Android*/ )
									{
										//Change by Sandeep S. on25-SEP-17 [To resolve Proteus vision related issue of relogin] Start
										if( MELogin.isLogOut && noOfConnections == 1 )
										{
											E12CommonUtils.printOnConsole("E12ApplicationPanel ::803");
											//Added by trushant for testing START
											exitApp();
											//Added by trushant for testing END
											drawNewConLoginScreen();
										}
										//Added by sunny soni for redirect to login page when userId or serverURL is getting blank while open login page on 03-DEC-21 [Start]
										else if ( (E12CommonUtils.checkNull(storedUserName).length() == 0) ||  (E12CommonUtils.checkNull(storedServerIP).length() == 0)) 
							            {
											Window.alert("Invalid Credentials.");
							                E12Storage.setItem("userName", storedUserName);							                
							                new MELogin( "Login:False:#New");							                
							            }
										//Added by sunny soni for redirect to login page when userId or serverURL is getting blank while open login page on 03-DEC-21 [End]
										else
										{
											//Changed by Sandeep S. on 28-SEP-17 [Resolve issue Blank white screen while no connectivity after touch authentication ]Start
											if( ! CommonPhoneGapUtil.checkNetwork() && noOfConnections == 1 )
											{
												//drawPinLoginScreen(noOfConnections);
												// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [START]
												if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
												{
													if(!CommonPhoneGapUtil.checkNetwork())
													{
														E12Global.getInstance().setConnectionMode(ConnectionMode.AUTO);
													}
													drawFingerTouchScreen(noOfConnections);
												}
												else
												{
													E12CommonUtils.printOnConsole("E12ApplicationPanel ::834");
													//Added by trushant for testing START
													exitApp();
													//Added by trushant for testing END
													drawNewConLoginScreen();
												}
												// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [END]
											}
											else
											{
												try
												{
													//Added by Pankaj R on 21-Dec-2017 to set Current App Name[Start]
													String oldApkVersion = "";
													//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
													oldApkVersion = E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("apkVersion"));
													apkVersion = E12CommonUtils.checkNull(apkVersion);
													if(! oldApkVersion.equalsIgnoreCase(apkVersion))
													{
														E12CommonUtils.printOnConsole("E12ApplicationPanel ::853");
														//Added by trushant for testing START
														exitApp();
														//Added by trushant for testing END
														drawNewConLoginScreen();
													}
													//Added by Pankaj R on 21-Dec-2017 to set Current App Name[End]
													else
													{
														// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [START]
														drawFingerTouchScreen(noOfConnections);
														// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [END]
													}
												}
												catch (Exception e)
												{
													Window.alert("Exception in upgrade version :: "+e);
												}
											}
										}
										MELogin.isLogOut = false;
										MELogin.isNew=false;
										//Changed by Sandeep S. on 28-SEP-17 [Resolve issue Blank white screen while no connectivity after touch authentication ]End
									}
									//Added by sunny soni on 17-NOV-16 for native calling from android start
									//Commented unwanted code by Sandeep S. on 28-SEP-17
									/*else if( !E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() != DeviceOS.Android)
									{
										if( MELogin.isLogOut && noOfConnections == 1 )
										{
											drawNewConLoginScreen();
										}
										else
										{
											E12CustomPlugin.isTouchIdSupported(new E12CustomPlugin.CallBack() {

												@Override
												public void onSuccess(String result)						{


													if( E12Global.checkNull(result).equals("true") )
													{
														// Change by Sandip
														String touchIdSupport = "Authenticate for " + storedUserName;   // result;
														E12CustomPlugin.isTouchIdAuthenticated(new CallBack()
														{
															@Override
															public void onSuccess(String result)														{
																if( E12Global.checkNull(result).equals("true") )
																{
																	// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] Start
																	authenticateUser();
																	// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] End
																}
																else if( E12Global.checkNull(result).equals("ShowPassword") )
																{
																	//displayPwd().center();
																	if( !MELogin.cancelClick )
																	{
																		drawNewConLoginScreen();
																	}
																}
																else if( E12Global.checkNull(result).equalsIgnoreCase("UsePin") )
																{
																	//displayPwd().center();
																	if( E12Storage.getItem("iPin_"+storedUserName) != null)
																	{
																		displayPopPanel(noOfConnections).center();
																	}
																	else
																	{
																		if( !MELogin.cancelClick )
																		{
																			drawNewConLoginScreen();
																		}
																	}
																}
																else if( E12Global.checkNull(result).equalsIgnoreCase("cancel") )
																{
																	//if( !MELogin.cancelClick )
																	{
																		drawNewConLoginScreen();
																	}
																	if( E12Storage.getItem("iPin_"+storedUserName) != null)
																	{
																		displayPopPanel(noOfConnections).center();
																	}
																	else
																	{
																		if( !MELogin.cancelClick )
																		{
																			drawNewConLoginScreen();
																		}
																	}
																}
																else
																{
																	//Added by sunny soni on 02-nov-16 start
																	if( E12Storage.getItem("iPin_"+storedUserName) != null)
																	{
																		displayPopPanel(noOfConnections).center();
																	}
																	else
																	{
																		//displayPwd().center();
																		if( !MELogin.cancelClick )
																		{
																			drawNewConLoginScreen();
																		}
																	}
																}
															}

															@Override
															public void onError(String error)
															{
																E12CommonUtils.printOnConsole("Exception while isTouchIdAuthenticated : "+error);
																if( E12Storage.getItem("iPin_"+storedUserName) != null)
																{
																	displayPopPanel(noOfConnections).center();
																}
																else
																{
																	drawNewConLoginScreen();
																}
																//Changed by Sandeep S. on 23-05-17 End
															}
														}, touchIdSupport);
													}
													else
													{
														//displayPwd().center();
														if( E12Storage.getItem("iPin_"+storedUserName) != null)
														{
															displayPopPanel(noOfConnections).center();
														}
														else
														{
															if( !MELogin.cancelClick )
															{
																drawNewConLoginScreen();
															}
														}
													}
												}

												@Override
												public void onError(String error)
												{
													E12CommonUtils.printOnConsole("Exception while isTouchIdSupported : "+error);
													//displayPwd().center();
													if( E12Storage.getItem("iPin_"+storedUserName) != null)
													{
														displayPopPanel(noOfConnections).center();
													}
													else
													{
														if( !MELogin.cancelClick )
														{
															drawNewConLoginScreen();
														}
													}
													//Changed by Sandeep S. on 18-05-17 [To implement touch authentication in android] End
													//Changed by Sandeep S. on 21-03-17 End
												}
											});
										}
										MELogin.isLogOut = false;
										MELogin.isNew=false;
									}*/
									//Added by sunny soni on 17-NOV-16 for native calling from android end

									else
									{
										if( MELogin.isLogOut && noOfConnections == 1 )
										{
											E12CommonUtils.printOnConsole("E12ApplicationPanel ::1029");
											//Added by trushant for testing START
											exitApp();
											//Added by trushant for testing END
											drawNewConLoginScreen();
										}
										else
										{
											if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
											{
												//displayPopPanel(noOfConnections).center();
												drawPinLoginScreen(noOfConnections);
											}
											else
											{
												/*Window.alert("callin displayPwd");
											if( noOfConnections > 1 && !MELogin.cancelClick )
											{
												displayPwd().center();
											}
											else*/
												if( !MELogin.cancelClick )
												{
													E12CommonUtils.printOnConsole("E12ApplicationPanel ::1052");
													//Added by trushant for testing START
													exitApp();
													//Added by trushant for testing END
													drawNewConLoginScreen();
												}
											}
											//displayPwd().center();
										}
										MELogin.isLogOut = false;
										//Change by Sandeep S. on25-SEP-17 [To resolve Proteus vision related issue of relogin] End
										MELogin.isNew=false;
									}
							//Added by Sandeep Shelar on 08-FEB-2016 [For TouchID Authentication custom plugin in IOS] End
							} catch (Exception e) {
								Window.alert("Exception in showing popup : "+e.getMessage());
								e.printStackTrace();
							}
						}
					});
					//Added by Dnyaneshwar chavan on 20-AUG-13 [ Implement Web SQL ] End
				}
			});
			panelLabel.setStyleName("appPanelLabel");
		}catch (Exception e) {
			Window.alert("Exception caught is E12ApplicationsPanel: [" + e.getMessage()+"]");
		}

		return panelLabel;

	}

	/**
	 * Generates PopUpPanel to allow user authentication
	 * @return password popup panel
	 */
	private PopupPanel displayPwd()
	{
		//Added By Ajinkya Gopalkar on 6-Jan-16[For checking gps after defined interval]
		final PopupPanel showPwdPnl = new PopupPanel();
		//Added By Ajinkya Gopalkar on 6-Jan-16[For checking gps after defined interval]
		//if( "true".equalsIgnoreCase( E12Storage.getItem("GPS_ENABLED") ))
		//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
		if( !"0".equalsIgnoreCase( E12Storage.getItemLocalStorage("GEO_POS_OPTION") ))
		{
			//E12CommonUtils.getInstance().checkGPSStatus();
			//E12CustomPlugin.setGPSEnforcedVal( E12Constants.GPS_ENFORCED );
			//E12CustomPlugin.setGPSEnforcedVal( E12Constants.GEO_POS_OPTION );
			E12CustomPlugin.setGPSEnforcedVal( E12Storage.getItemLocalStorage("GEO_POS_OPTION") );
		}
		try
		{
			//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] start
		    //Changed and Added by Pankaj R on 08-Jan-18 to store current application name[START]
			if( !E12Global.getInstance().isHostedMode())
			{
				MELogin.checkApkVersion(new Callback<String, String>() {

					@Override
					public void onFailure(String reason)
					{

					}

					@Override
					public void onSuccess(String result) {

						apkVersion = result;
						apkVersion = E12Global.checkNull( apkVersion.substring(apkVersion.indexOf("v") + 1 ) );
						if( !"".equalsIgnoreCase(apkVersion) )
						{
							apkVersion = apkVersion.replace(".", "-");
							version = apkVersion;
						}
					}
				});

				MELogin.getAppName(new Callback<String, String>() {

					@Override
					public void onSuccess(String result)
					{
						appName = result;
					}

					@Override
					public void onFailure(String reason) {}
				});
				//Changed and Added by Pankaj R on 08-Jan-18 to store current application name[END]
			}
			showPwdPnl.setStyleName("poupPanel");
			showPwdPnl.getElement().getFirstChildElement().getStyle().setPaddingLeft( 13, Unit.PX );
			showPwdPnl.getElement().getStyle().setZIndex( 1 );
			//Changed by Sandeep S. on 07-11-16 To resolve issue in handheld scanner device
			if( Window.Navigator.getUserAgent().indexOf("Zetakey") != -1 || ( E12Global.getInstance().hostedMode && Window.getClientWidth() < 300 ))
			{
				showPwdPnl.getElement().setAttribute("style", "top: 125px !important; left: 50px !important; z-index: 1 !important;");
			}
			HorizontalPanel captionPanel = new HorizontalPanel();
			captionPanel.setSize("100%", "100%");
			Label captionlbl = new Label(appDescription);

			showPwdPnl.setAnimationEnabled( false );
			//final Button editButton = new Button();
			//editButton.setTitle("Edit Connection");
			//editButton.setStyleName("editButton");
			captionlbl.setStyleName("userHtmlData");
			captionPanel.add(captionlbl);
			//captionPanel.add(editButton);
			//captionPanel.setCellHorizontalAlignment(editButton, HasHorizontalAlignment.ALIGN_RIGHT);

			vpnl = new VerticalPanel();
			vpnl.setSpacing(4);
			//final PasswordTextBox passText = new PasswordTextBox();
			final E12TextBox passText = new E12TextBox("password");
			//Added by Dnyaneshwar Chavan on 12-FEB-13 [ Change text 'password' to 'Enter the password for' + user id as per KB Sir ] Start
			Label passLbl = new Label( E12Constants.constants.setEnterPasswordLbl() + " " + storedUserName );
			//Added by Dnyaneshwar Chavan on 12-FEB-13 [ Change text 'password' to 'Enter the password for' + user id as per KB Sir ] End
			passLbl.setStyleName( "userHtmlData" );
			//passText.setStyleName( "loginText" );
			passText.setStyleName( "loginPopupText" );//Changed by ashutosh on 13 feb [ for popup textbox ]

			final Button loginBtn = new Button(E12Constants.constants.setLoginBtn());
			final Button editButton = new Button(E12Constants.constants.setSettingBtn());
			Label cancel = new Label("x");
			cancel.setStyleName("close");
			TouchWidget loginBtnTouchWidget = new TouchWidget( loginBtn );
			TouchWidget editButtonTouchWidget = new TouchWidget( editButton );
			TouchWidget cancelTouchWidget = new TouchWidget( cancel );

			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] Start
			//Add style of login button
			loginBtn.addStyleName("loginBtn");
			editButton.addStyleName("editBtn");
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] End

			final Label horizontalLine = new Label();
			horizontalLine.setStyleName("horizontalLine");

			final Label verticalLine = new Label();
			verticalLine.setStyleName("verticalLine");

			VerticalPanel pwdPnl = new VerticalPanel();
			pwdPnl.setSpacing(5);
			pwdPnl.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LOCALE_END);
			pwdPnl.add(passLbl);
			pwdPnl.add(passText);
			pwdPnl.setCellHorizontalAlignment(passLbl, HasHorizontalAlignment.ALIGN_LEFT);

			//Changes by Ajinkya Gopalkar on 28-Apr-15[for Login Window UI] Start
			Label connModelbl = new Label( E12Constants.constants.setConnectionMode() );
			connModelbl.setWidth( "100px" );

			final E12ListBox connModeLst = new E12ListBox();
			//Added By Ajinkya Gopalkar [ Setting login mode on basis of conn_opt from appl_mst table ]
			//Changed by Sandeep S. on 07-06-16 [To set 'online' bydefault in ConnectionMode List] Start
			connModeLst.addItem( E12Constants.constants.setOnlineMode() );
			//Changed By Suraj to set Auto mode on 2nd place and remove offline mode
			/*if(!"0".equalsIgnoreCase(connOption) && !"".equalsIgnoreCase(connOption))
			{
				connModeLst.addItem( E12Constants.constants.setOfflineMode() );
				if(!"1".equalsIgnoreCase(connOption))
				{
					connModeLst.addItem( E12Constants.constants.setAutoMode() );
				}
			}*/
			if(!"0".equalsIgnoreCase(connOption) && !"".equalsIgnoreCase(connOption))
			{
				connModeLst.addItem( E12Constants.constants.setAutoMode() );
			}
			// Change by Abhishek for set "Online" as default option.
			connModeLst.setSelectedIndex(0);
			connModeLst.setVisibleItemCount(1);
			//Changes by Ajinkya Gopalkar on 28-Apr-15[for Login Window UI] End
			//If no network then Auto is By default selection
			if( ! CommonPhoneGapUtil.checkNetwork() )
			{
				connModeLst.setSelectedIndex(1);
			}

			HorizontalPanel hWrkOffPnl = new HorizontalPanel();
			hWrkOffPnl.setSpacing( 5 );
			hWrkOffPnl.add( connModelbl );
			hWrkOffPnl.add( connModeLst );
			hWrkOffPnl.setCellHorizontalAlignment(connModeLst, HasHorizontalAlignment.ALIGN_RIGHT);
			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
			{
				hWrkOffPnl.setCellVerticalAlignment(connModelbl, HasVerticalAlignment.ALIGN_MIDDLE);
			}

			hWrkOffPnl.getElement().setAttribute( "style", "display:none;" );//Changed by ashutosh on 13 feb 2017
			connModelbl.setStyleName( "userHtmlData" );

			if( Storage.isSupported() == false )
			{
				connModeLst.setSelectedIndex(0);
				//Changed by Sandeep S. on 07-06-16 [To set 'online' bydefault in ConnectionMode List] End
				connModeLst.setEnabled(false);
			}
			HorizontalPanel naviPnl = new HorizontalPanel();

			naviPnl.add(cancelTouchWidget);
			naviPnl.add(editButtonTouchWidget);
			naviPnl.add(loginBtnTouchWidget);
			naviPnl.setSize("100%", "100%");
			naviPnl.setCellHorizontalAlignment(loginBtnTouchWidget, HasHorizontalAlignment.ALIGN_RIGHT);

			vpnl.add(captionPanel);
			vpnl.add(pwdPnl);
			vpnl.add(hWrkOffPnl);
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] Start
			vpnl.add(verticalLine);
			vpnl.add(horizontalLine);
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] End
			vpnl.add(naviPnl);


			final HorizontalPanel hPnl = new HorizontalPanel();
			hPnl.setSize("100%", "100%");
			hPnl.add(vpnl);
			hPnl.setStyleName("passwordBubbleBox");
			hPnl.addStyleName( "top" );
			cancel.addClickHandler(new ClickHandler() {

				@Override
				public void onClick(ClickEvent event) {
					if( requestStatus != null )
					{
						if( requestStatus.isPending() )
						{
							requestStatus.cancel();
						}
					}
					//Added by sunny soni on 17-NOV-16 for handling forgot pin start
					setForgotPin("");
					//Added by sunny soni on 17-NOV-16 for handling forgot pin end
					showPwdPnl.hide(true);
				}
			});

			editButton.addClickHandler(new ClickHandler() {

				@Override
				public void onClick(ClickEvent event)
				{
					showPwdPnl.hide(true);
                    loginBtn.setEnabled( false );

					if( MELogin.isLoginHostedStr.equalsIgnoreCase("Login:True") && MELogin.serverStatus==true)
					{
						new MELogin( "Login:True:#Edit");
					}
					else
					{
						new MELogin( "Login:False:#Edit");
					}

				}
			});

			passText.addKeyUpHandler( new KeyUpHandler()
			{
				@Override
				public void onKeyUp( KeyUpEvent event )
				{
					if( event.getNativeKeyCode() == 13 )
					{
						loginBtn.click();
					}
				}
			});

			loginBtn.addClickHandler(new ClickHandler() {

				@Override
				public void onClick(ClickEvent event) {

					//Added By Ajinkya Gopalkar on 6-Jan-16[For checking gps after defined interval]
					E12CommonUtils.printOnConsole("In E12ApplicationPanel 1383 loginBtn click GEOPOS_STATUS["+E12Constants.GEOPOS_STATUS+"]");
					//if( "true".equalsIgnoreCase( E12Storage.getItem("GPS_ENABLED") ) && E12Constants.GEOPOS_STATUS == false)
					//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
					//Commented unnecessary code Sagar B.[07-Feb-2020]START
//					if( !"0".equalsIgnoreCase( E12Storage.getItemLocalStorage("GEO_POS_OPTION") ) && E12Constants.GEOPOS_STATUS == false)
//					{
//						Window.alert("Device GPS is OFF - This app requires GPS location. \nPlease turn ON GPS and Try Again.");
////						showPwdPnl.hide();
//						E12Constants.GEOPOS_STATUS = true;
//						return;
//					}
					//Commented unnecessary code Sagar B.[07-Feb-2020]END
					loginBtn.setEnabled( false );
					editButton.setEnabled( false );

					E12Global.getInstance().resetSessionExpired();
					//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk]
					E12Global.getInstance().setRedirectToLoginPage(false);
					final String passwordTxt= passText.getText();
					if ( "".equals( passwordTxt ) || passwordTxt.trim().isEmpty())
					{
						Window.alert( E12Constants.constants.setMsgInvalidPassword() );
//						E12CustomMessageBox.alertMessage( "Error" , E12Constants.constants.setMsgInvalidPassword() );
						loginBtn.setEnabled( true );
						editButton.setEnabled( true );
						displayPwd().hide(false);
						return;
					}
					else
					{

						E12Constants.conApplNm = selectedApp;
						E12Constants.hostUrl = storedHostUrl;
						E12Storage.setItem("hostUrl", storedHostUrl);
						final String passwordSha256 = SHA256.toSha256( passwordTxt );
						final String e12StorageKeyUser = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName +"&conApplNm=" + E12Constants.conApplNm ;
						final String e12StorageKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;
						final String e12offlinePwdKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER="+ storedUserName + "&PASSWORD="+ passwordSha256;

						//Changed By Mahesh Patidar on 28/DEC/12
						HashMap<String, String> paramMap = new HashMap<String, String>();

						paramMap.put("USER", storedUserName);
						paramMap.put("PASSWORD", passwordSha256);
						paramMap.put("action", "MELOGIN");
						paramMap.put("isSHA256Appld", "true");
						paramMap.put("conApplNm", E12Constants.conApplNm);
						//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] START
						paramMap.put("DEVICETYPE", E12CommonUtils.getInstance().getPlatFormAndDeviceType() );
						paramMap.put("DEVICEUUID", CommonPhoneGapUtil.getInstance().getDeviceUuid() );
						paramMap.put("DEVICEID", E12AppInfo.getInstance().getRegisterIdOrDeviceToken() );
						//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] END
						//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[START]
						if( !E12Global.getInstance().isHostedMode())
						{
							paramMap.put("CURRENTAPKVERSION", version);
							paramMap.put("APP_NAME", appName);
							paramMap.put("BATTERY_STATUS", E12Global.getInstance().getBatteryStatus());
							paramMap.put("IMEI_NO", E12Global.getInstance().getDeviceIMEINo());
						}
						//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[END]
                        E12Global.getInstance().setDataModelDownload("D"); //Added by Jatin M on 10-May-2022 - [To download only dirty data models on relogin]
                        E12CommonUtils.printOnConsole("E12ApplicationPanel-01 getDataModelDownload ::: ["+E12Global.getInstance().getDataModelDownload()+"]");
						//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -Start
						final String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
						String path ="";
						if(E12Global.getInstance().getDeviceOS()==DeviceOS.Android || E12Global.getInstance().getDeviceOS()==DeviceOS.iOS)
						{
//							path = storedHostUrl + "/ibase/AuthenticateServlet?" + paramString ;
							path = storedHostUrl + "/ibase/AuthenticateServlet?";
						}
						else{
//							path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?" + paramString ;
							path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?" ;
						}
						//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -End

						//Added by Sandeep Shelar on 26/02/16 [For onResume Event] Start
						E12Storage.localStorageVars.add(E12Global.getConnectionId()+"AuthenticateURL");
						//Added by Sainath T. on 20-Aug-19 [To add paramString to path and set it to E12Storage]
                        E12Storage.setItem(E12Global.getConnectionId()+"AuthenticateURL", path + paramString);
                        //Added by Sandeep Shelar on 26/02/16 [For onResume Event] End

						//Added by Prajyot [To send new request each time]
						//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
                        //path = path + "&dummyInt=" + Math.random();
						path = path + "dummyInt=" + Math.random();

//						String path = MELogin.hostUrl + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;

						//Ended By Mahesh Patidar

						StorageKeys.setUsername( storedUserName );
						DataSyncCache.setUsername( storedUserName );

						//Commented by Suraj to remove offline connection mode
						//E12Global.getInstance().setOffline(false);
						if( E12Constants.constants.setAutoMode().equalsIgnoreCase(connModeLst.getSelectedValue()) )
						{
							//Commented by Suraj to remove offline connection mode
							//E12Global.getInstance().setOffline(false);
							E12Global.getInstance().setConnectionMode(ConnectionMode.AUTO);
						}
						else if( E12Constants.constants.setOnlineMode().equalsIgnoreCase(connModeLst.getSelectedValue()) )
						{
							//Commented by Suraj to remove offline connection mode
							//E12Global.getInstance().setOffline(false);
							E12Global.getInstance().setConnectionMode(ConnectionMode.ONLINE);
						}
						//Commented by Suraj to remove offline connection mode
						/*else if( E12Constants.constants.setOfflineMode().equalsIgnoreCase(connModeLst.getSelectedValue()) )
						{
							//Commented by Suraj to remove offline connection mode
							//E12Global.getInstance().setOffline(true);
							E12Global.getInstance().setConnectionMode(ConnectionMode.OFFLINE);
						}*/

						if( E12Global.getInstance().isOffline() )
						{
							//Added by Dnyaneshwar Chavan on 21-AUG-13 [Implement WebSQL] Start
							E12Storage.getItem(e12StorageKeyUser, new Callback<String, String>()
							{
								@Override
								public void onFailure(String reason) {
									Window.alert( "Exception when click on login button, getting value from websql  ["+reason+"]" );
								}
								@Override
								public void onSuccess(String serverResponse) {
									if( serverResponse == null )
									{
										Window.alert( E12Constants.constants.setNoofflinedataavailLbl() +storedUserName);
										loginBtn.setEnabled( true );
										editButton.setEnabled( true );
										showPwdPnl.hide(false);
										return;
									}
									E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {
//									E12Storage.getItem(e12StorageKey, new Callback<String, String>() {
										@Override
										public void onSuccess(String serverResponse )
										{
											E12CommonUtils.printOnConsole( " serverResponse 1433 ["+serverResponse+"]" );
											if( serverResponse == null || "".equalsIgnoreCase(serverResponse) )
											{
												Window.alert( E12Constants.constants.setPwdNotMatched() ); //Changes by Raju 19-02-14 for I18N
												loginBtn.setEnabled( true );
												editButton.setEnabled( true );
												showPwdPnl.hide(false);
												return;
											}
											String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginBtn, passwordTxt, passwordSha256, new DummyResponse(serverResponse), e12StorageKey, editButton);
											if(result.equals("Yes")){
												loginBtn.setEnabled( false );
												editButton.setEnabled( false );
												showPwdPnl.hide(true);
											}
											else
											{
												showPwdPnl.hide(false);
												return;
											}

										}
										@Override
										public void onFailure(String reason){
										}
									});

								}
							});

							/*String serverResponse = E12Storage.getItem( e12StorageKeyUser );
								if( serverResponse == null )
								{
									Window.alert( E12Constants.constants.setMsgNoOffLineData() +storedUserName);
									loginBtn.setEnabled( true );
									editButton.setEnabled( true );
									showPwdPnl.hide(false);
									return;
								}
								serverResponse = E12Storage.getItem( e12StorageKey );
								if( serverResponse == null )
								{
									Window.alert( "Password did not match" );
									loginBtn.setEnabled( true );
									editButton.setEnabled( true );
									showPwdPnl.hide(false);
									return;
								}
								String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginBtn, passwordTxt, passwordSha256, new DummyResponse(serverResponse), e12StorageKey);
								if(result.equals("Yes")){
									loginBtn.setEnabled( false );
									editButton.setEnabled( false );
									showPwdPnl.hide(true);
								}
								else
								{
									showPwdPnl.hide(false);
									return;
								}*/
							//Added by Dnyaneshwar Chavan on 21-AUG-13 [Implement WebSQL] End
						}
						else
						{
							//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] Start
							/*if( ! CommonPhoneGapUtil.checkNetworkAndMode() )
							{
								Window.alert( E12Constants.constants.setNoNetWork() ); //Changes by Raju 19-02-14 for I18N
								showPwdPnl.hide(false);
							}
							else*/
							{
								//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
								//RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, path);
								RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, path);
								requestBuilder.setHeader("Content-Type","application/x-www-form-urlencode");
								//added by vishal p. on 06/10/17 [for showing alert msg on login if user enetered wrong url or server is not started]
								//E12Global.getInstance().checkIsNetworkActiveFirst(path, loginBtn);
								E12Global.getInstance().checkIsNetworkActiveFirst( loginBtn , true );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
								try
								{
									//requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
									requestStatus = requestBuilder.sendRequest( paramString, new RequestCallback()
									{
										public void onResponseReceived( Request request, final Response response )
										{

											String responseStr = response.getText();
											String displayMessage = "";
											if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
											{
												if( !"".equalsIgnoreCase(responseStr) )
												{
													Document dom = XMLParser.parse(responseStr);
													XMLParser.removeWhitespace(dom);
													if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
													{
														Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
														if( upgradeMessageNode.getFirstChild() != null )
														{
															displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
															//added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]
															//Window.alert(displayMessage);
															createCustomPopup( displayMessage);

															//E12Storage.clear();
															passText.setText("");
															loginBtn.setEnabled( true );
															editButton.setEnabled( true );
															displayPwd().hide(false);
															return;
														}
													}

													if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
													{
														Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
														if( recommendedMessageNode.getFirstChild() != null )
														{
															displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
															//Change by Sandeep S. on 05/12/16 [[S16HBAS012]  Check for latest apk version ]
															//Window.alert(displayMessage);
															showPwdPnl.hide(true);
															final PopupPanel msgPopPanel = new PopupPanel();
															VerticalPanel vertMsgPanel = new VerticalPanel();
															HorizontalPanel hzpanel  = new HorizontalPanel();
															//Label msg = new Label(displayMessage);
															HTML msg = new HTML(displayMessage);
															Button okButton = new Button("Ok");
															Button laterButton = new Button("Later");

															okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
															okButton.getElement().getStyle().setWidth(47, Unit.PX);

															laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
															laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
															laterButton.getElement().getStyle().setWidth(63, Unit.PX);
															hzpanel.add(okButton);
															hzpanel.add(laterButton);

															vertMsgPanel.add(msg);
															vertMsgPanel.add(hzpanel);
															vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);

															msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
															msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
															msgPopPanel.add(vertMsgPanel);
															msgPopPanel.setGlassEnabled(true);
															msgPopPanel.getElement().getStyle().setZIndex(2);
															msgPopPanel.center();

															okButton.addClickHandler(new ClickHandler() {

																@Override
																public void onClick(ClickEvent event)
																{
																	msgPopPanel.hide();
																	passText.setText("");
																	loginBtn.setEnabled( true );
																	editButton.setEnabled( true );
																	displayPwd().hide(false);
																	return;
																}
															});

															laterButton.addClickHandler(new ClickHandler() {
																@Override
																public void onClick(ClickEvent event)
																{
																	msgPopPanel.hide();
																	E12Storage.setItem( e12StorageKeyUser, "" );
																	loginBtn.setEnabled( false );
																	editButton.setEnabled( false );
																	PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																	loadingPanel.show();
																	//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																	String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginBtn, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																	E12CommonUtils.printOnConsole( " result ["+result+"]" );
																	if(result=="Yes")
																	{
																		/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																			if user enters wrong password from Login screen.*/
																		//setShaPasswordForConnectionURL(passwordSha256);
																		showPwdPnl.hide(true);
																		setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																		loadingPanel.hide();
																	}
																	else
																	{
																		displayPwd().hide(false);
																		loadingPanel.hide();
																		return;
																	}
																}
															});
														}
													}
													else
													{
														E12Storage.setItem( e12StorageKeyUser, "" );
														loginBtn.setEnabled( false );
														editButton.setEnabled( false );
														PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
														loadingPanel.show();
														//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
														String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginBtn, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
														E12CommonUtils.printOnConsole( " result ["+result+"]" );
														if(result=="Yes"){
															/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																if user enters wrong password from Login screen.*/
															//setShaPasswordForConnectionURL(passwordSha256);
															showPwdPnl.hide(true);
															setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
															loadingPanel.hide();
														}
														else{
															displayPwd().hide(false);
															loadingPanel.hide();
															return;
														}
													}

												}
											}
											//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
											else
											{
												E12Storage.setItem( e12StorageKeyUser, "" );
												loginBtn.setEnabled( false );
												editButton.setEnabled( false );
												PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
												loadingPanel.show();
												//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
												String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginBtn, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
												E12CommonUtils.printOnConsole( " result ["+result+"]" );
												if(result=="Yes"){
													/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
														if user enters wrong password from Login screen.*/
													// setShaPasswordForConnectionURL(passwordSha256);
													showPwdPnl.hide(true);
													setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
													loadingPanel.hide();
												}
												else{
													displayPwd().hide(false);
													loadingPanel.hide();
													return;
												}
											}
										}
										//Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
										public void onError( Request request, Throwable exception )
										{
											loginBtn.setEnabled(true);
											editButton.setEnabled( true );
											showPwdPnl.hide(false);
											Window.alert( "Error in getting response E12Applications " );
											return;
										}
									});

								}
								catch( RequestException re )
								{
									loginBtn.setEnabled(true);
									editButton.setEnabled( true );
									displayPwd().hide(false);
									System.out.println( "Exception login failed: " + re );
									return;
								}
							}
							//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] End

						}
					}
				}
			});

			showPwdPnl.setAnimationEnabled(false);
			showPwdPnl.setGlassEnabled(true);
			showPwdPnl.setGlassStyleName("bgGlass");
			showPwdPnl.add(hPnl);

			//Added By Pratheek[to set Focus on all device] 15-6-17
//			if(E12Global.getInstance().getDeviceOS() != DeviceOS.iOS )
//			{
				//Added by Harshada on 25 MAR 2013 [Set focus to password textBox]
				Scheduler.get().scheduleDeferred(new ScheduledCommand() {
					@Override
					public void execute() {
						passText.setFocus(true);
					}
				});
			//}

		} catch (Exception e)
		{
			//displayPwd().hide(false);
			Window.alert("Exception in showing Popup : E12ApplicationsPanel :["+e.getMessage()+"]");
			e.printStackTrace();
		}
		return showPwdPnl;
	}


	protected String loginButtonClickedOnResponseReceived(final String storedUserName,
			final String storedServerName, final Button loginBtn, final String passwordTxt,
			final String passwordSha256, final Response response,
			final String e12StorageKey, final Button editButton)
	{
		//Added By Suraj to prepare data model log on view clear
		//E12Global.getInstance().getDataModelMap();
		E12Global.getInstance().createDataModelMap( new Callback<String, String>() {

			@Override
			public void onSuccess(String result) {}

			@Override
			public void onFailure(String reason) {}
		});

		//Added By Suraj to load expired data models
		if( ! E12Global.getInstance().isHostedMode() )
		{
			//Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
			E12Global.getInstance().setLoadingInfo( "Checking Bandwidth" );

			E12CustomPlugin.checkBandwidth( new CallBack() {

				@Override
				public void onSuccess(String result)
				{
					//Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
					E12Global.getInstance().setLoadingInfo( result + " Bandwidth" );

					E12CommonUtils.printOnConsole("Result of custom plugin inside E12ApplicationPanel ["+result+"]");
					//if( "POOR".indexOf( result ) == -1 )
					if( result != null && ( result.indexOf("POOR") == -1 ) )		//Changed code by Sagar B. for offline related changes [9-Feb-19]
					{
						//Code added inside bandwidth condition by Sagar B. to avoid unnecessary call[26-Feb-19]START
						final E12DataModelHandler e12DataModelHandler = new E12DataModelHandler();
						//Added by Sandeep S. on 23-AUG-18 [Delete cache functionality]
						e12DataModelHandler.loadDataModels();
						//Code added inside bandwidth conditiologinButtonClickedOnResponseReceivedn by Sagar B. to avoid unnecessary call[26-Feb-19]END
						//e12DataModelHandler.getImportantNotifications();		//Temporary commented by Sagar B.
					}
				}

				@Override
				public void onError(String error) 
				{
					//Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
					E12Global.getInstance().setLoadingInfo( "Checking bandwidth getting error ("+ error +")" );
					
					//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue Start
					E12CommonUtils.printOnConsole("In E12Application checkBandwidth onError"+error);
					error = E12Global.checkNull( error );
					//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Changed code by Sagar B. for offline related changes [9-Feb-19]
					loginBtn.setEnabled( true );
					if( /*E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO &&*/ E12Global.getInstance().isOffline() && "0".equals( E12Constants.NETWORK_OPTION ) )		//Changed code by Sagar B. for offline related changes [9-Feb-19]
					{
					}
					else
					{
						loginButtonClickedOnResponseReceived( storedUserName, storedServerName ,  loginBtn , passwordTxt , passwordSha256, response, e12StorageKey, editButton );
					}
					//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue End
				}
			});
		}
		//E12Global.getInstance().getDataModelsList();
		//E12DataModelHandler e12DataModelHandler = new E12DataModelHandler();
		//e12DataModelHandler.updateInvalidDatamodels();

		try 
		{
			E12MessageHandler.handleExceptionIfPresent(response, new Command() {
				@Override
				public void execute() {
					loginBtn.setEnabled(true);
					editButton.setEnabled( true );
				}
			});

			//Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
			E12Global.getInstance().setLoadingInfo( "Processing response" );
			
			if(response.getText().indexOf("false") != -1 || response.getText().indexOf("NullPointerException") != -1)
			{
				loginBtn.setEnabled( true );
				editButton.setEnabled( true );
				/*Window.alert( E12Constants.constants.setMsgIncorrectPassword() );*/
				// Added By Nilesh For display Release status_code Start::14-01-2020
				// Window.alert(E12Constants.constants.setMsgIncorrectPassword());
				Document dom = null;
				String statusCodeValue = "";
				if( !"".equalsIgnoreCase(response.getText()))
				{
					dom = XMLParser.parse(response.getText());
					XMLParser.removeWhitespace(dom);
					E12CommonUtils.printOnConsole("dom ["+dom+"]");
					if( dom.getElementsByTagName("STATUS_CODE").item(0) != null )
					{
						E12CommonUtils.printOnConsole("STATUS_CODE not null ["+dom+"]");
						Node statusCode = dom.getElementsByTagName("STATUS_CODE").item(0);
						E12CommonUtils.printOnConsole("STATUS_CODE not statusCode ["+statusCode+"]");
						if( statusCode.getFirstChild() != null )
						{
							statusCodeValue = statusCode.getFirstChild().getNodeValue();
							statusCodeValue = E12CommonUtils.checkNull(statusCodeValue);
							E12CommonUtils.printOnConsole("statusCodeValue ["+statusCodeValue+"]");

						}
					}
				}
				if(statusCodeValue.equalsIgnoreCase("RELEASE"))
				{
					E12CommonUtils.printOnConsole("inside the user release");
					Window.alert(E12Constants.constants.setUserRelease());
				}
				else if(statusCodeValue.equalsIgnoreCase("JOINDATE"))
				{
					E12CommonUtils.printOnConsole("inside the user JOINDATE");
					Window.alert(E12Constants.constants.setJoinDate());
				}
				//Added By Pankaj T. on 18-11--2020 for removing weak account lock vulnerability - if user wrongly enter password more than 5 times then lock the account and send new password on email/mobile and unlock account using new password - start
				else if(statusCodeValue.equalsIgnoreCase("ACCOUNT_LOCKED"))
				{
					Window.alert(E12Constants.constants.setMsgAccountLocked() + " " + E12Constants.wrongLoginCount + " times." + E12Constants.constants.setMsgNewPasswordIsSent() + " " + E12Constants.constants.setMsgAccountUnlocked() );
				}
				else if(statusCodeValue.equalsIgnoreCase("WRONG_LOGIN_COUNT_EXCEED"))
				{
					Window.alert(E12Constants.constants.setMsgPasswordBlocked() + " " + E12Constants.wrongLoginCount + " " + E12Constants.constants.setMsgNewPasswordSent() );
				}
				//Added By Pankaj T. on 18-11--2020 for removing weak account lock vulnerability - if user wrongly enter password more than 5 times then lock the account and send new password on email/mobile and unlock account using new password - end
				else
				{
					Window.alert( E12Constants.constants.setMsgIncorrectPassword() );
				}
				// Added By Nilesh For display Release status_code End::14-01-2020
				//displayPwd().hide(false);
				return "No";
			}
			else
			{
				// Added by Dnyaneshwar chavan on 21/DEC/2012 Start
				E12CommonUtils.getInstance().setE12Constants( response.getText() );
				com.google.gwt.storage.client.Storage storage = com.google.gwt.storage.client.Storage.getLocalStorageIfSupported();
				if(storage != null)
				{
					storage.setItem("itemSer", E12Constants.itemSer);
				}
				E12Storage.setItem("itemSer", E12Constants.itemSer);

				//	E12Constants.conApplNm = selectedApp;
				if( "true".equals( E12Constants.authenticateStatus ) )
				{
					//Added By Vikas Lagad on 30-08-19[To download user image]Start
					ibase.e12ria.e12widgets.shared.E12CommonUtils.downloadUserImage(new Callback<Boolean, Boolean>() {
						@Override
						public void onSuccess(Boolean result) {
						}

						@Override
						public void onFailure(Boolean reason) {
						}
					});
					//Added By Vikas Lagad on 30-08-19[To download user image]End
					//Added by Sagar B. on [07-feb-18]START
					if( ! E12Global.getInstance().isHostedMode() &&
							! E12Global.getInstance().isOffline() &&
							//E12Global.getInstance().getDeviceOS() != DeviceOS.iOS &&
							("1".equals(E12Constants.GEO_FENCE_ENABLED)) /* "1" for enable, "0" for disable */
							)
					{
						//Window.alert("before plugin call when login response received to enable geoFence tag");
						E12CustomPlugin.checkBandwidth(new CallBack()
						{
							@Override
							public void onSuccess(String result)
							{
								E12CommonUtils.printOnConsole("In E12ApplicationPanel in checkBandwidth on Success"+result);
								//Window.alert("responce plugin call when login response received to enable geoFence tag result ["+result+"]");
								if( result.indexOf("POOR") == -1 )
								{
									E12CommonUtils.getInstance().enableGeoTag(E12Global.getConnectionId(), E12Constants.userID, "1" );
								}
							}

							@Override
							public void onError(String error) {
								//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue Start
								E12CommonUtils.printOnConsole("In E12ApplicationPanel checkBandwidth onError"+error);
								error = E12Global.checkNull( error );
								//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Commented code by Sagar B. for offline related changes [9-Feb-19]
								loginButtonClickedOnResponseReceived( storedUserName, storedServerName ,  loginBtn , passwordTxt , passwordSha256, response, e12StorageKey, editButton );
								//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue End
							}
						});
					}
					//Added by Sagar B. on [07-feb-18]END
					//Added By Nilesh get reporting to data Start :: 10-01-19
					E12CommonUtils.printOnConsole("E12Global.getInstance().getConnectionMode():::::"+E12Global.getInstance().getConnectionMode());
					//Added checkbandwidth by Sagar B. for offline related changes [9-Feb-19]
					E12CustomPlugin.checkBandwidth(new CallBack()
					{
						@Override
						public void onSuccess(String result)
						{
							E12CommonUtils.printOnConsole("In E12ApplicationPanel in GET_VISITED_WITH checkBandwidth on Success"+result);
							if( result.indexOf("POOR") == -1 )
							{
								//if(E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO  )
								{
									final E12LocalStorage e12LocalStorage = new E12LocalStorage();
									String storageKey = "";
									String paramString = "";
									HashMap<String, String> paramMap = new HashMap<String, String>();
									paramMap.put("ACTION", "GET_VISITED_WITH");
									paramMap.put("USER_ID", E12Constants.userID);
									paramMap.put("EMP_CODE", E12Constants.empCode);
									paramMap.put("CURRENT_GEO_POS", E12Constants.currentGeoPos);
									HashMap<String, String> requestDataMap = new HashMap<String, String>();

									if ( "MOBILE".equalsIgnoreCase( E12UserInfo.getCallerInterface() ) )
									{
										storageKey = E12Constants.empCode.trim()+"_GET_VISITED_WITH";
									}

									final String e12StorageKeyAction = storageKey;
									E12CommonUtils.printOnConsole("E12ApplicationsPanel in E12APPLICATION PANEL on Success E12Constants.empCode "+E12Constants.empCode);
									E12CommonUtils.printOnConsole("E12ApplicationsPanel in E12APPLICATION PANEL on Success E12Constants.userID "+E12Constants.userID);
									E12CommonUtils.printOnConsole("E12ApplicationsPanel in E12APPLICATION PANEL on Success E12Constants.CURRENT_GEO_POS "+E12Storage.getItem("CURRENT_GEO_POS"));
									E12CommonUtils.printOnConsole("E12ApplicationsPanel in E12APPLICATION PANEL on Success E12Constants.currentGeoPos "+E12Constants.currentGeoPos);
									requestDataMap.put(RequestDataKeys.LOCAL_STORAGE_KEY, e12StorageKeyAction);
									paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);

									String path = E12Global.getHostUrl() + "/ibase/RIAWizardHandlerServlet?"+ paramString;
									E12RequestBuilder requestBuilder = new E12RequestBuilder( E12RequestBuilder.POST, path );
									try
									{
										requestBuilder.setLoadingRequired( false );		//Added by Sagar B. on[16-Aug-19]
										requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");
										requestBuilder.sendRequest( requestDataMap, new RequestCallback()
										{
											public void onError( Request request, Throwable exception )
											{

											}
											public void onResponseReceived( Request request, Response response )
											{
												String responseStr  = response.getText();
												E12CommonUtils.printOnConsole("E12ApplicationsPanel in E12APPLICATION PANEL on Success E12Constants.responseStr "+responseStr);
												if( !"false".equalsIgnoreCase( responseStr ) )
												{
													e12LocalStorage.getE12LocalStorage().setItem(e12StorageKeyAction, responseStr);
												}

											}
										});
									}
									catch ( RequestException ex )
									{
										E12CommonUtils.printOnConsole("loginButtonClickedOnResponseReceived :"+ex.getMessage());
									}
									catch(Exception e)
									{
										E12CommonUtils.printOnConsole("loginButtonClickedOnResponseReceived :"+e.getMessage());
									}

								}
								//Added By Nilesh get reporting to data End :: 10-01-19
							}
						}

						@Override
						public void onError(String error)
						{
						}
					});
					
					//Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
					E12Global.getInstance().setLoadingInfo( "Redirecting to application" );
					
					//Added by sunny soni for redirection on kill state [start]
					E12RIA e12ria = new E12RIA();
					//e12ria.getAppResumeRedirect(e12ria);
					//Added by sunny soni for resolving redirection after logout and then relogin but not for redirection [26-Aug-20][Start] 
					e12ria.getAppResumeRedirect(null);
					//Added by sunny soni for resolving redirection after logout and then relogin but not for redirection [26-Aug-20][End]  
					//Added by sunny soni for redirection on kill state [end]
					//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17
					isAuthenticated = true;
					E12Constants.passwordSha256 = passwordSha256;
					flowPanel.insert(outerHeaderPanel, 0);
					contents.getElement().getStyle().clearPaddingTop();
					contents.getElement().getStyle().clearHeight();
					contents.addStyleName( "contents" );
					//added by sandip on 8.5.17 for exit button issue
					outerFooterPanel.addStyleName("outerFooter");
					if( Storage.isSupported() == true )
					{
						//E12Storage.setItem( ( storedUserName + "IP" ).toString(), storedServerName );
						E12Storage.setItem( "/" + connectionId + "./" + e12StorageKey, response.getText() );
						// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] Start
						E12Storage.localStorageVars.add(storedUserName + "_isPasswordStore");
						E12Storage.setItem(storedUserName + "_isPasswordStore", E12Constants.isPasswordStore);
						// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] End
						//Added by Sandeep S. on 20-JUL-18
						E12Storage.setItem("userName", storedUserName);
						E12Storage.setItem("itemSer", E12Constants.itemSer);
						//Added by sunny soni on 17-NOV-16 for getting forgot pin start
						if(getForgotPin().equalsIgnoreCase("forgotPIN"))
						{
							setForgotPin("");
							getPINPopup().center();
						}
						//Added by sunny soni on 17-NOV-16 for getting forgot pin end
					}
					if( E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
					{
						//To set left menu panel width
						E12Global.getInstance().setLeftPanelWidth();
						//RootPanel.get().add( E12ParentSplitPanel.getInstance(), 0, 0 );
						E12ParentSimplePanel.getInstance().clear();
						E12ParentSimplePanel.getInstance().add( E12ParentSplitPanel.getInstance() );

						try
						{
							ME12Dashboard dashboard = new ME12Dashboard( null );
							dashboard.enter();
						}
						catch( Exception e )
						{
							String msg = "ERROR: Error while creating dashboard: " + e.toString();
							Window.alert( msg );
							throw new RuntimeException( msg );
						}
					}
					displayPwd().hide(true);
					//if( !E12Global.getInstance().isOffline() && DataSyncCache.isSyncRequired() && E12Global.getInstance().getConnectionMode() != ConnectionMode.OFFLINE)
					//if( !offline && DataSyncCache.isSyncRequired() )
					//{
						//Sync to server is called from schedular from E12OptionPanel
						//							DataSyncCache.sync(null);
						/*
							boolean sync = Window.confirm( E12Constants.constants.setMsgOffLineDataPresent() );
							if( sync )
							{
								final PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
								loadingPanel.show();
								DataSyncCache.sync(new Command() {
									@Override
									public void execute() {
										loadingPanel.hide();
									}
								});
							}
						 */
					//}
					if( "Login:True".equals( MELogin.isLoginHostedStr ) )
					{
						E12Global.getInstance().setUserImgPath( E12Global.getHostUrl() + "/ibase/images/userImages/"+ E12Constants.userID + ".png" ); //Added by Ajinkya Gopalkar on 17-Feb-15 [Change profile image ]
						//E12Global.getInstance().setUserImgPath( E12Global.getHostUrl() + "/ibase/images/"+ E12Constants.userID + ".png" );
						proceedToNextPanel();
					}
					else
					{
						CollabContents.downloadClientLogo( new Callback<String, String>()
						{
							@Override
							public void onSuccess(String result)
							{
								if( "".equalsIgnoreCase( E12Global.checkNull( result ) ) )
								{
									E12Storage.setItem( "clientLogoPath", "Not Available" );
								}
								else
								{
									E12Storage.setItem( "clientLogoPath", result );
								}
							}
							@Override
							public void onFailure(String reason)
							{
								E12Storage.setItem("clientLogoPath", "Not Available");
							}
						});
						CollabContents.downloadUserImg( new Callback<String, String>()
						{
							@Override
							public void onSuccess(String result)
							{
								if( "".equalsIgnoreCase( E12Global.checkNull( result ) ) )
								{
									//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
									E12Storage.localStorageVars.add(E12Global.getInstance().getCurConnectionId()+"UserImgPath");
									E12Storage.setItem( E12Global.getInstance().getCurConnectionId()+"UserImgPath", "Not Available"  );
								}
								else
								{
									E12Storage.localStorageVars.add(E12Global.getInstance().getCurConnectionId()+"UserImgPath");
									E12Storage.setItem( E12Global.getInstance().getCurConnectionId()+"UserImgPath", result  );
								}
							}

							@Override
							public void onFailure(String reason)
							{
								E12Storage.localStorageVars.add(E12Global.getInstance().getCurConnectionId()+"UserImgPath");
								//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End
								E12Storage.setItem( E12Global.getInstance().getCurConnectionId()+"UserImgPath", "Not Available"  );
							}
						});
						//proceedToNextPanel();
						//Added By Nilesh Start ::6-12-18
						final HashMap<String, String> getRedirectData = E12Global.getInstance().getRedirectDataMap();
						String objName=getRedirectData.get("obj_name");
						E12CommonUtils.printOnConsole("****** E12Application panel objName:::::"+objName);
						E12CommonUtils.printOnConsole("******* E12Application panel getRedirectData:::::"+getRedirectData.size());
						E12RIA e12Ria=new E12RIA();
						if(getRedirectData.size() > 0)
						{
							if(E12Global.checkNull(objName).trim().length() >  0 )
							{
								setShortTitle("Abort");
								e12Ria.openGWTTransaction(objName,"");
							}
							else
							{
								proceedToNextPanel();
							}
						}
						else
						{
							proceedToNextPanel();

						}
						//Added By Nilesh End ::6-12-18
					}

					loginBtn.setEnabled( false );
					editButton.setEnabled( false );

					// Added by Abhishek T on 22-Sep-2017 [For calling watch plugin] START
					String hostUrl = E12Global.getHostUrl();
					ibase.e12ria.e12widgets.shared.E12CommonUtils.getInstance().callNativeWatchPlugin (
							E12Constants.userID, E12Constants.passwordSha256, hostUrl
							);
					// Added by Abhishek T on 22-Sep-2017 [For calling watch plugin] END

					return "Yes";
				}
				else
				{
					loginBtn.setEnabled( true );
					editButton.setEnabled( true );
					// Changed by Abhishek T on 08-Dec-18 [For showing proper message when login from PIN failed, when using OTP login] START
					LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
					if (loginMethod == LoginMethod.OTP) {
						Window.alert(E12Constants.constants.getPINLoginFailedMessage());
					} else {
						Window.alert(E12Constants.constants.setMsgAuthenticationFailed());
					}
					// Changed by Abhishek T on 08-Dec-18 [For showing proper message when login from PIN failed, when using OTP login] END
					return "No";
				}
			}
		}
		catch (Exception e) 
		{
			loginBtn.setEnabled( true );
			editButton.setEnabled( true );
			e.printStackTrace();
			return "No";
		}
	}

	private void proceedToNextPanel()
	{
		try
		{
			//Added By Suraj to load expired data models
			if( !E12Global.getInstance().isHostedMode() )
			{
				E12CustomPlugin.checkBandwidth( new CallBack() {

					@Override
					public void onSuccess(String result)
					{
						E12CommonUtils.printOnConsole("Result of custom plugin inside E12ApplicationPanel ["+result+"]");
						//if( "POOR".indexOf( result ) == -1 )
						if( result != null && ( result.indexOf("POOR") == -1 ) )		//Changed code by Sagar B. for offline related changes [9-Feb-19]
						{
							E12DataModelHandler e12DataModelHandler = new E12DataModelHandler();
							e12DataModelHandler.updateInvalidDatamodels();
						}
					}

					@Override
					public void onError(String error) {
						//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue Start
						E12CommonUtils.printOnConsole("In E12Application ProcessNxtPanel checkBandwidth onError"+error);
						error = E12Global.checkNull( error );
						//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Commented code by Sagar B. for offline related changes [9-Feb-19]
						if( E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO && E12Global.getInstance().isOffline() && "0".equals( E12Constants.NETWORK_OPTION ) )		//Added code by Sagar B. for offline related changes [9-Feb-19]
						{
						}
						else
						{
							proceedToNextPanel();
						}
						//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue End
					}
				});
			}
			// Added by Sandeshs 21-Jun-2016 [Req:W15BSUN011] START
			String redirectMenu = E12Constants.defaultMenu;
			// Added by Sandeshs 21-Jun-2016 [Req:W15BSUN011] END
			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17
			String redirectPath = E12Global.getInstance().getRedirectPath();
			E12CommonUtils.printOnConsole("proceedToNextPanel method..1223 method ");
			displayPwd().hide(true);
			WallToWallPanel redirectPanel = (WallToWallPanel) E12Global.getInstance().historyMap.get(redirectTo);
			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 Start
			if (E12CommonUtils.checkNull(redirectPath).length() > 0)
			{
				E12Global.getInstance().resetRedirectPath();
				E12CommonUtils.getInstance().redirect(redirectPath, "");
			}
			//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17 End
			else if ( redirectTo != null && redirectTo.length() != 0 && redirectPanel != null )
			{
				redirectPanel.enter();
			}
			else if (redirectTo != null && redirectTo.equalsIgnoreCase("M_flow"))
			{
				E12WorkflowPanel wfPanel = new E12WorkflowPanel(E12Constants.constants.setWorkflowLbl(), null);
			}
			else if (redirectTo != null && redirectTo.equalsIgnoreCase("M_Favourite"))
			{
				E12CommonUtils.printOnConsole("redirectTo M_favourite");
				FavouritePanel fvPanel = new FavouritePanel(E12Constants.constants.setFavouriteLbl(), null);

			}
			else if (redirectTo != null && redirectTo.equalsIgnoreCase("M_E12Explorer"))
			{
				E12CommonUtils.printOnConsole("redirectTo M_E12Explorer");
				E12ExplorerPanel e12ExploerePanel = new E12ExplorerPanel(E12Constants.constants.setE12ExplorerLbl(), this);

			}
			// Added by Sandeshs 21-Jun-2016 [Req:W15BSUN011] START
			else if (E12CommonUtils.checkNull(redirectMenu).length() > 0)
			{
				if(appDescription.contains("No description")){
					E12Global.getInstance().setCurrentApplicationName(selectedApp);
				}else{
					E12Global.getInstance().setCurrentApplicationName(appDescription);
				}

				E12CommonUtils.getInstance().redirect(redirectMenu, "");
			}
			// Added by Sandeshs 21-Jun-2016 [Req:W15BSUN011] END
			else
			{
				if(appDescription.contains("No description")){
					e12OptionsPanel = new E12OptionsPanel(selectedApp, null);
				}else{
					e12OptionsPanel = new E12OptionsPanel(appDescription, null);
				}
			}
		    // Added by Saiprasad G.on 11-Sep-18 [For creating web socket connection] START
			String hostUrl = getHostUrl();
			WebSocketConnection.openConnection(hostUrl, E12Constants.userID);
			// Added by Saiprasad G on 31-Aug-18 [For creating web socket connection] END
		}
		catch (Exception e)
		{
			//Window.alert("Exception in E12ApplicationsPanel proceedToNextPanel ["+e.getMessage()+"]");
			E12CommonUtils.printOnConsole("Exception in E12ApplicationsPanel proceedToNextPanel ["+e.getMessage()+"]");
			e.printStackTrace();
		}
	}

	/**
	 * Generates clickable feed panel of available connections
	 * @return dockPanel
	 */
	//private DockPanel expandablePanel(final String applDetails)
	private HorizontalPanel clickablePanel(String displayDesc,String applDesc,String applName,String conId)
	{
		HorizontalPanel hortPanel = new HorizontalPanel();
		try
		{
			String appLabelText = "("+applDesc+")";
			if(applDesc.contains("No description available")){
				appLabelText = applName+"("+applDesc+")";
			}
			String imgName = E12Global.checkNull( applName ).trim() +".png";
			//Changed by Sandeep S. on 16-03-17 Start
			//String clientImgPath  = E12Global.getInstance().getCurDevicePath() + "/" + imgName ;
			String clientImgPath  =  E12Global.getHostUrl()  + "/ibase/images/" + imgName ;
			String serverURL = E12Global.getHostUrl() +"/ibase/images/apps/" + imgName ;
			E12CommonUtils.printOnConsole( " serverURL["+serverURL+"] \n clientImgPath["+clientImgPath+"]" );
			/*if ( ! E12Global.getInstance().isHostedMode() && ! E12Global.getInstance().isOffline() )
			{
				E12CommonUtils.getInstance().downloadMenuImage( imgName, "", serverURL, new Callback<Boolean, Boolean>()
				{
					@Override
					public void onSuccess(Boolean isDownload ){
					}
					@Override
					public void onFailure(Boolean reason){
					}
				} );
			}
			else
			{
				clientImgPath = serverURL;
			}*/
			final Image appsImg = new Image();
			appsImg.setStyleName("appsImg");
			appsImg.setUrl(clientImgPath);
			appsImg.addErrorHandler( new ErrorHandler()
			{
				@Override
				public void onError(ErrorEvent event)
				{
					//appsImg.setResource( Resources.INSTANCE.e12Icon() );
					appsImg.setResource( Resources.INSTANCE.proteusIcon() );
				}
			});
			//Changed by Sandeep S. on 16-03-17 End
			SimplePanel favIconTextHtml1 = new SimplePanel( appsImg );
			favIconTextHtml1.setStyleName( "feedImgCntr" );
			//HTML favIconTextHtml1 = new HTML( "<HTML><TABLE><TR><TD > <img onerror=\""+onErrorFun+"\" class='menuImg' src='"+clientImgPath+"'/></TD></TR></TABLE></HTML>" );
			HTML favIconTextHtml2 = new HTML( "<HTML><TABLE><TR><TD VALIGN='bottom' ><span class='descriptionLbl' id=E12Application_"+E12Global.checkNull(displayDesc)+">" + E12Global.checkNull(displayDesc)+ "</span></TD> </TR> <TR> <TD VALIGN='top'><span class='applicationDescLabel'>" + E12Global.checkNull(appLabelText) + "</span></TD> </TR></TABLE></HTML>" );//Change by sanket on 29/Nov/16 for checking null condition
			hortPanel.add( favIconTextHtml1 );
			hortPanel.add( favIconTextHtml2 );

			/*docPanel.setSize("100%", "100%");
			Label defaultImg = new Label();

			//Changes by Prajyot
			//defaultImg.setStyleName("e12explorerImg");
			defaultImg.setStyleName("e12ConnImg");

			final FlexTable mainPnl = new FlexTable();
			mainPnl.setSize("100%", "100%");
			FlexTable completeHPanel = new FlexTable();
			completeHPanel.setSize("100%", "100%");
			Label descLebl = new Label(displayDesc);

			descLebl.setStyleName("descriptionLbl");
			completeHPanel.setWidget(0, 0, descLebl);

			FlexTable headerPnl = new FlexTable();

			headerPnl.setSize("100%", "100%");

			headerPnl.setStyleName("applicationPanel");


			//****CONNECTION MAP********
			String appLabelText = "("+applDesc+")";
			if(applDesc.contains("No description available")){
				appLabelText = applName+"("+applDesc+")";
			}

			final Label appDescLbl = new Label(appLabelText);
			appDescLbl.setStyleName("applicationDescLabel");
			headerPnl.setWidget(0, 0, appDescLbl);

			mainPnl.setWidget(0, 0, completeHPanel);
			mainPnl.setWidget(1, 0, headerPnl);

			docPanel.add(defaultImg, DockPanel.WEST);
			docPanel.add(mainPnl,DockPanel.EAST);
			docPanel.setCellWidth(defaultImg, "5%");*/
		} catch (Exception e) {
			Window.alert("Exception in adding clickablePanel : E12ApplictionsPanel ["+e.getMessage()+"]");
			e.printStackTrace();
		}

		//Added by Dnyaneshwar Chavan on 23-JUN-14 [ Change the menu level icon and wizard button name ] Start

		return hortPanel;
	}

	//Added on 2nd Jan 2013 [Created unique connections Map]
	private String getStoredValues( Map<String, String> retrieveMap, String userInfoKey )
	{
		String userInfoVal="";
		try {
			if(retrieveMap.containsKey(userInfoKey)){
				return userInfoVal = retrieveMap.get(userInfoKey);
			}

		} catch (Exception e) {
			Window.alert("Exception in getStoredValues E12ApplicationsPanel ["+e.getMessage()+"]");
			e.printStackTrace();
		}
		return userInfoVal;
	}

	public static Map<String, String> retrieveMap(String conMap) {

		Map<String,String> storedMap = new HashMap<String, String>();
		try {
			conMap = conMap.substring(1, conMap.indexOf("}"));

			String arr[] = conMap.split(",");

			for (int i = 0; i < arr.length; i++) {
				String vals = arr[i];
				storedMap.put(vals.substring(0,vals.indexOf("=")).trim().toString(), vals.substring(vals.indexOf("=")+1).trim().toString());
			}
		} catch (Exception e) {
			Window.alert("Exception in retrieveMap E12ApplicationsPanel ["+e.getMessage()+"]");
			e.printStackTrace();
		}

		return storedMap;
	}

	// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] Start
	private void authenticateUser()
	{
		String getPassword = "";
		for(int i = 0; i < E12Storage.getLength(); i++ )
		{
			if(E12Storage.key(i).startsWith(storedUserName) && (E12Storage.key(i).contains(storedUserName) && E12Storage.key(i).contains("PASSWORD")))
			{
				getPassword = E12Storage.key(i);
				break;
			}
		}

		String[] tokensString1 = getPassword.split("&");
		String[] tokensString2 = new String[2];
		for(int i = 0; i < tokensString1.length; i++ )
		{
			if( tokensString1[i].contains("PASSWORD") )
			{
				tokensString2 = tokensString1[i].split("=");
			}
		}

		// Added by Abhishek T on 03-Sep-18 [For setting application name in case of OTP login] START
		LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
		if ("".equals(E12Global.checkNull(selectedApp)) && loginMethod == LoginMethod.OTP) {
			selectedApp = getApplicationName();
			E12PluginUtils.log("E12ApplicationPanel :: authenticateUser : selectedApp [" + selectedApp + "]", LogLevel.LOG);
		}
		// Added by Abhishek T on 03-Sep-18 [For setting application name in case of OTP login] END

		E12Constants.conApplNm = selectedApp;
		E12PluginUtils.log("E12ApplicationPanel :: authenticateUser : E12Constants.conApplNm [" + E12Constants.conApplNm + "]", LogLevel.LOG);

		E12Constants.hostUrl = storedHostUrl;
		E12Storage.setItem("hostUrl", storedHostUrl);
		//final String passwordSha256 = SHA256.toSha256( passwordTxt );
		final String passwordSha256 = tokensString2[1];
		final String e12StorageKeyUser = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName +"&conApplNm=" + E12Constants.conApplNm ;
		final String e12StorageKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;
		final String e12offlinePwdKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER="+ storedUserName + "&PASSWORD="+ passwordSha256;
		HashMap<String, String> paramMap = new HashMap<String, String>();

		paramMap.put("USER", storedUserName);
		paramMap.put("PASSWORD", passwordSha256);
		paramMap.put("action", "MELOGIN");
		paramMap.put("isSHA256Appld", "true");
		paramMap.put("conApplNm", E12Constants.conApplNm);
		paramMap.put("DEVICETYPE", E12CommonUtils.getInstance().getPlatFormAndDeviceType() );
		paramMap.put("DEVICEUUID", CommonPhoneGapUtil.getInstance().getDeviceUuid() );
		paramMap.put("DEVICEID", E12AppInfo.getInstance().getRegisterIdOrDeviceToken() );
		// Added by Abhishek T on 12-July-18 [For sending active flag as 'Y' when relogin from app] START
		paramMap.put("ACTIVE", "Y");
		// Added by Abhishek T on 12-July-18 [For sending active flag as 'Y' when relogin from app] END

		//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[START]
		if( !E12Global.getInstance().isHostedMode())
		{
			paramMap.put("CURRENTAPKVERSION", version);
			paramMap.put("APP_NAME", appName);
			paramMap.put("BATTERY_STATUS", E12Global.getInstance().getBatteryStatus());
			paramMap.put("IMEI_NO", E12Global.getInstance().getDeviceIMEINo());
		}
		//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[END]
		//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -Start
		//String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
        final String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
        E12Global.getInstance().setDataModelDownload("D"); //Added by Jatin M on 10-May-2022 - [To download only dirty data models on relogin]
        E12CommonUtils.printOnConsole("E12ApplicationPanel-02 getDataModelDownload ::: ["+E12Global.getInstance().getDataModelDownload()+"]");
		String path ="";
		if(E12Global.getInstance().getDeviceOS()==DeviceOS.Android || E12Global.getInstance().getDeviceOS()==DeviceOS.iOS)
		{
//			path = storedHostUrl + "/ibase/AuthenticateServlet?" + paramString ;
			path = storedHostUrl + "/ibase/AuthenticateServlet?";
		}
		else
		{
//			path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?" + paramString ;
			path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?";
		}
		//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -End
		//Added by Sandeep Shelar on 26/02/16 [For onResume Event] Start
		E12Storage.localStorageVars.add(E12Global.getConnectionId()+"AuthenticateURL");
		//Added by Sainath T. on 20-Aug-19 [To add paramString to path and set it to E12Storage]
		E12Storage.setItem(E12Global.getConnectionId()+"AuthenticateURL", path + paramString);
        //Added by Sandeep Shelar on 26/02/16 [For onResume Event] End
        //Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
        //path = path + "&dummyInt=" + Math.random();
        path = path + "dummyInt=" + Math.random();

		//String path = MELogin.hostUrl + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;

		StorageKeys.setUsername( storedUserName );
		DataSyncCache.setUsername( storedUserName );
		//Commented BY Suraj to remove offline mode
		//E12Global.getInstance().setOffline(false);

		/*----------------------------------------------------------------*/

		/*if( ! CommonPhoneGapUtil.checkNetworkAndMode() )
		{
			Window.alert( E12Constants.constants.setNoNetWork() );
			//showPwdPnl.hide(false);
		}
		else*/
		// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [START]		
		if(E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO)
		{
            //Added by sunny soni for redirect to login page while not getting usercode, password and servername on 26-Aug-21 [Start]
            if ((!E12Global.getInstance().isHostedMode()) && ((E12CommonUtils.checkNull(storedUserName).length() == 0) || (E12CommonUtils.checkNull(passwordSha256).length() == 0) ||  (E12CommonUtils.checkNull(storedServerIP).length() == 0))) 
            { 
            	Window.alert("Invalid Credentials.");
                E12Storage.setItem("userName", storedUserName);                
                new MELogin( "Login:False:#New");
            }
            //Added by sunny soni for redirect to login page while not getting usercode, password and servername on 26-Aug-21[End]
            else 
            {
                E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {

                    @Override
                    public void onSuccess(String responseString)
                    {
                        E12CommonUtils.printOnConsole("e12offlinePwdKey responseString : "+responseString);
                        E12Storage.setItem( e12StorageKeyUser, "" );
                        String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, new DummyResponse(responseString), e12StorageKey, new Button());
                        E12Global.getInstance().setLoading(false);
                        if(result.equalsIgnoreCase("No"))
                        {
                            LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                            if (loginMethod == LoginMethod.OTP) {
                                clearPINFields();
                            } else {
                                drawNewConLoginScreen();
                            }
                        }
                    }

                    @Override
                    public void onFailure(String reason) {
                        System.out.println("E12ApplicationsPanel.authenticateUser().new Callback() {...}.onFailure() e12offlinePwdKey : "+reason);
                    }
                });
            }
            
		}
		else
		// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [END]
		{
            //Added by sunny soni for redirect to login page while not getting usercode, password and servername on 26-Aug-21 [Start]
            if ((!E12Global.getInstance().isHostedMode()) && ((E12CommonUtils.checkNull(storedUserName).length() == 0) || (E12CommonUtils.checkNull(passwordSha256).length() == 0) ||  (E12CommonUtils.checkNull(storedServerIP).length() == 0))) 
            {
            	Window.alert("Invalid Credentials.");
                E12Storage.setItem("userName", storedUserName);
                new MELogin( "Login:False:#New");
            }
            //Added by sunny soni for redirect to login page while not getting usercode, password and servername on 26-Aug-21[End]
            else 
            {
                //Added By Nilesh In case of Pin and Finguler print check the network Start :: 22-04-2021
                final String authPath = path;
                E12CustomPlugin.checkBandwidth( new CallBack() 
                {
                    
                    @Override
                    public void onSuccess(String result) {
                        E12CommonUtils.printOnConsole("E12AppPanel 2594 result ["+result+"]");
                        E12CommonUtils.printOnConsole("E12AppPanel 2594 authPath ["+authPath+"]");
                        E12CommonUtils.printOnConsole("E12AppPanel 2594 E12Global.getInstance().isHostedMode() ["+E12Global.getInstance().isHostedMode()+"]");
                        if( result.indexOf( "POOR" ) == -1   ) //means network is good
                        {
                            //E12Global.getInstance().setLoading(true);
                            E12Global.getInstance().setLoadingInfo("Authenticating user");
                            //Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
                            //RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, path );
                            E12RequestBuilder requestBuilder = new E12RequestBuilder( RequestBuilder.POST, authPath );
                            requestBuilder.setHeader("Content-Type","application/x-www-form-urlencoded");
                            try
                            {
                                //E12Global.getInstance().checkIsNetworkActiveFirst( null , false );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
    //            				requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
                                requestStatus = requestBuilder.sendRequest( paramString, new RequestCallback()
                                {
                                    public void onResponseReceived( Request request, final Response response )
                                    {
                                        E12CommonUtils.printOnConsole("Inside E12ApplicationPanel 2562 responseStr!!!!!"+response.getText());
                                        //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                        E12Global.getInstance().setLoadingInfo( "Authenticating user response received" );
                                        //Added by Sandeep S. on 21-JUL-17 [To implement cache handling in mobile] Start
                                        final String responseStr = response.getText();
                                        boolean deleteCacheReqd = false;
                                        String buildVersion = "";
                                        //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-Start
                                        String messageIdVal = "";
                                        //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-End
                                        Document dom = null;
                                        if( !"".equalsIgnoreCase(responseStr) )
                                        {
                                            dom = XMLParser.parse(responseStr);
                                            XMLParser.removeWhitespace(dom);
                                            //Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] Start
                                            String typeNodeValue = "";
                                            String message = "";
                                            String messageId = "";
                                
                                            if( dom.getElementsByTagName("Message").item(0) != null )
                                            {
                                                Node msg = dom.getElementsByTagName("Message").item(0);
                                                if( msg != null )
                                                {
                                                    Node type = msg.getAttributes().getNamedItem("type");
                                                    if( type != null )
                                                    {
                                                        typeNodeValue = E12Global.checkNull( type.getNodeValue() );
                                                    }
                                                    Node msgId = msg.getAttributes().getNamedItem("id");
                                                    if( msgId != null )
                                                    {
                                                        messageId = E12Global.checkNull( msgId.getNodeValue() );
                                                    }
                                                }
                                            }
                                            //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-Start
                                            messageIdVal = messageId.trim();
                                            //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-End
                                            //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                            E12Global.getInstance().setLoadingInfo( "Processing authentication response" );
                                            E12CommonUtils.printOnConsole("Inside E12ApplicationPanel 2562 messageId!!!!!"+messageId);
                                            if( "SESSEXIST".equalsIgnoreCase(messageId.trim()) )
                                            {
                                                E12CommonUtils.printOnConsole("Inside E12ApplicationPanel 2562!!!!!");
                                                if( dom.getElementsByTagName("message").item(0) != null )
                                                {
                                                    String sessionIdToRemove = "";
                                                    if( dom.getElementsByTagName("mobileSessionIdToRemove").item(0) != null )
                                                    {
                                                        Node mobileSessionIdToRemove = dom.getElementsByTagName("mobileSessionIdToRemove").item(0);
                                                        sessionIdToRemove = mobileSessionIdToRemove.getFirstChild().getNodeValue();
                                                    }
                                                    //Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-Start
                                                    final String sessionIdToRemoveVal = sessionIdToRemove;
                                                    //Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-End
                                                    Node msg = dom.getElementsByTagName("message").item(0);
                                                    message = msg.getFirstChild().getNodeValue();
                                                    String messageDescription = "";
                                                    if( dom.getElementsByTagName("description").item(0) != null )
                                                    {
                                                        Node description = dom.getElementsByTagName("description").item(0);
                                                        messageDescription = E12CommonUtils.checkNull( description.getFirstChild().getNodeValue() );
                                                    }
                                                    String displayMessage = message + "\n\n" + messageDescription;
                                                    if( "W".equalsIgnoreCase(typeNodeValue) )
                                                    {
                                                        //Changes made by Pratheek on 30-10-19[ to call the custom alert in mobile same as browser]-Start
                                                        /*if( Window.confirm(displayMessage) )
                                                        {
                                                            if( sessionIdToRemove != null && sessionIdToRemove.length() > 0 )
                                                            {
                                                                HashMap<String, String> newParamMap = new HashMap<String, String>();
                                                                newParamMap.put("mobileSessionId", sessionIdToRemove);
                                                                newParamMap.put("action", "REMOVE_MOBILE_SESSION");
                                                                String newParamString = E12CommonUtils.getInstance().getEncodedParamString(newParamMap);
                                                                String url = storedHostUrl + "/ibase/AuthenticateServlet?" + newParamString ;
                                                                E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, url);
                                                                try
                                                                {
                                                                    requestBuilder.sendRequest("", new RequestCallback() {

                                                                        @Override
                                                                        public void onResponseReceived(Request request, Response response) {
                                                                            String responseString = response.getText();
                                                                            if( !"".equalsIgnoreCase(responseString) )
                                                                            {
                                                                                E12CommonUtils.printOnConsole("response for action REMOVE_MOBILE_SESSION ==> "+responseString);
                                                                            }
                                                                        }

                                                                        @Override
                                                                        public void onError(Request request, Throwable exception) {
                                                                            // TODO Auto-generated method stub

                                                                        }
                                                                    });
                                                                } catch (RequestException e)
                                                                {
                                                                    E12CommonUtils.printOnConsole("Exception while login ===> "+e.toString());
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            E12Global.getInstance().setLoading(false);
                                                            logoutUser();
                                                            return;
                                                        }*/
                                                        
                                                        final Document domData = dom;
                                                        E12AlertBox.getInstance().confirm( "Message : " +message + "\nDescription: " +messageDescription, "Warning", new CallbackHandler() {		
                                                            @Override
                                                            public void onCallback(boolean callbackVal) {
                                                                
                                                                if( callbackVal )
                                                                {
                                                                    if( sessionIdToRemoveVal != null && sessionIdToRemoveVal.length() > 0 )
                                                                    {
                                                                        //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                                                        E12Global.getInstance().setLoadingInfo( "Removing mobile session" );
                                                                        
                                                                        HashMap<String, String> newParamMap = new HashMap<String, String>();
                                                                        newParamMap.put("mobileSessionId", sessionIdToRemoveVal);
                                                                        newParamMap.put("action", "REMOVE_MOBILE_SESSION");
                                                                        String newParamString = E12CommonUtils.getInstance().getEncodedParamString(newParamMap);
                                                                        String url = storedHostUrl + "/ibase/AuthenticateServlet?" + newParamString ;
                                                                        E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, url);
                                                                        try
                                                                        {
                                                                            requestBuilder.sendRequest("", new RequestCallback() {

                                                                                @Override
                                                                                public void onResponseReceived(Request request, Response response) {
                                                                                    String responseString = response.getText();
                                                                                    if( !"".equalsIgnoreCase(responseString) )
                                                                                    {
                                                                                        E12CommonUtils.printOnConsole("response for action REMOVE_MOBILE_SESSION ==> "+responseString);
                                                                                    }
                                                                                }

                                                                                @Override
                                                                                public void onError(Request request, Throwable exception) {
                                                                                    // TODO Auto-generated method stub

                                                                                }
                                                                            });
                                                                        }
                                                                        catch (RequestException e)
                                                                        {
                                                                            E12CommonUtils.printOnConsole("Exception while login ===> "+e.toString());
                                                                        }
                                                                    }
                                                                    boolean deleteCacheReqdVal = false;
                                                                    //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                                                    E12Global.getInstance().setLoadingInfo( "Checking build no" );
                                                                    String buildVersionVal = "";
                                                                    if( domData.getElementsByTagName("buildNo").item(0) != null )
                                                                    {
                                                                        Node buildNode = domData.getElementsByTagName("buildNo").item(0);
                                                                        if( buildNode.getFirstChild() != null )
                                                                        {
                                                                            buildVersionVal = E12CommonUtils.checkNull(buildNode.getFirstChild().getNodeValue());

                                                                            String storedBuildVersion = "";
                                                                            String key = E12Global.getInstance().getCurConnectionId() + "BUILD_NO";
                                                                            storedBuildVersion = E12Storage.getItemLocalStorage(key);
                                                                            storedBuildVersion = E12CommonUtils.checkNull(storedBuildVersion);
                                                                            E12CommonUtils.printOnConsole("buildVersion ["+buildVersionVal+"] storedBuildVersion ["+storedBuildVersion+"]");
                                                                            if( !"".equalsIgnoreCase(buildVersionVal) && !"".equalsIgnoreCase(storedBuildVersion) )
                                                                            {
                                                                                if( ! buildVersionVal.equalsIgnoreCase(storedBuildVersion) )
                                                                                {
                                                                                    deleteCacheReqdVal = true;
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    //Added by Bhupendra on 06-08-18 [Start] for Pagination Implementation.
                                                                    if( domData.getElementsByTagName("pageSize").item(0) != null )
                                                                    {
                                                                        Node pageSizeNode = domData.getElementsByTagName("pageSize").item(0);
                                                                        if( pageSizeNode.getFirstChild() != null )
                                                                        {
                                                                            String homePageFeedSize = "";
                                                                            homePageFeedSize = pageSizeNode.getFirstChild().getNodeValue();
                                                                            homePageFeedSize = E12CommonUtils.checkNull(homePageFeedSize);
                                                                            if( !"".equalsIgnoreCase(homePageFeedSize) && homePageFeedSize.length() > 0  )
                                                                            {
                                                                                E12Constants.PAGE_SIZE  = Integer.parseInt(homePageFeedSize);
                                                                            }
                                                                            E12CommonUtils.printOnConsole("Bhudroid E12ApplicationPanel 5955 pageSize Value ["+homePageFeedSize+"]");
                                                                        }
                                                                    }
                                                                    
                                                                    //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                                                    E12Global.getInstance().setLoadingInfo( "Deleting cache" );
                                                                    deleteCache(deleteCacheReqdVal, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersionVal, new Callback<Boolean, Boolean>() {

                                                                        @Override
                                                                        public void onFailure(Boolean reason) {
                                                                            // TODO Auto-generated method stub

                                                                        }

                                                                        @Override
                                                                        public void onSuccess(Boolean rspResult)
                                                                        {
                                                                            if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
                                                                            {
                                                                                if( !"".equalsIgnoreCase(responseStr) )
                                                                                {
                                                                                    Document dom = XMLParser.parse(responseStr);
                                                                                    XMLParser.removeWhitespace(dom);
                                                                                    if( dom != null )
                                                                                    {
                                                                                        String displayMessage = "";
                                                                                        if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
                                                                                        {
                                                                                            Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
                                                                                            if( upgradeMessageNode.getFirstChild() != null )
                                                                                            {
                                                                                                //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                                                                                E12Global.getInstance().setLoadingInfo( "Displaying update now message" );
                                                                                                
                                                                                                displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
                                                                                                //added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]
                                                                                                //Window.alert(displayMessage);
                                                                                                //createCustomPopup( displayMessage,null,null,null );
                                                                                                createCustomPopup( displayMessage);

                                                                                                E12Global.getInstance().setLoading(false);
                                                                                                //E12Storage.clear();
                                                                                                return;
                                                                                            }
                                                                                        }

                                                                                        if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
                                                                                        {
                                                                                            Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
                                                                                            if( recommendedMessageNode.getFirstChild() != null )
                                                                                            {
                                                                                                //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                                                                                E12Global.getInstance().setLoadingInfo( "Displaying upgrade message" );
                                                                                                
                                                                                                displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
                                                                                                //Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
                                                                                                //Window.alert(displayMessage);
                                                                                                final PopupPanel msgPopPanel = new PopupPanel();
                                                                                                VerticalPanel vertMsgPanel = new VerticalPanel();
                                                                                                HorizontalPanel hzpanel  = new HorizontalPanel();
                                                                                                //Label msg = new Label(displayMessage);
                                                                                                HTML msg = new HTML(displayMessage);
                                                                                                Button okButton = new Button("Ok");
                                                                                                Button laterButton = new Button("Later");

                                                                                                okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
                                                                                                okButton.getElement().getStyle().setWidth(47, Unit.PX);

                                                                                                laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
                                                                                                laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
                                                                                                laterButton.getElement().getStyle().setWidth(63, Unit.PX);
                                                                                                hzpanel.add(okButton);
                                                                                                hzpanel.add(laterButton);

                                                                                                vertMsgPanel.add(msg);
                                                                                                vertMsgPanel.add(hzpanel);
                                                                                                vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);

                                                                                                msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
                                                                                                msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
                                                                                                msgPopPanel.add(vertMsgPanel);
                                                                                                msgPopPanel.setGlassEnabled(true);
                                                                                                msgPopPanel.getElement().getStyle().setZIndex(2);
                                                                                                msgPopPanel.center();

                                                                                                okButton.addClickHandler(new ClickHandler() {

                                                                                                    @Override
                                                                                                    public void onClick(ClickEvent event)
                                                                                                    {
                                                                                                        msgPopPanel.hide();
                                                                                                        E12Global.getInstance().setLoading(false);
                                                                                                        return;
                                                                                                    }
                                                                                                });

                                                                                                laterButton.addClickHandler(new ClickHandler() {
                                                                                                    @Override
                                                                                                    public void onClick(ClickEvent event)
                                                                                                    {
                                                                                                        msgPopPanel.hide();
                                                                                                        E12Storage.setItem( e12StorageKeyUser, "" );
                                                                                                        //Added by Amey W. [ Add response message to user on loading at each step ] on 18-12-2020
                                                                                                        E12Global.getInstance().setLoadingInfo( "Processing for Login" );
                                                                                                        
                                                                                                        String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, response, e12StorageKey, new Button());
                                                                                                        E12CommonUtils.printOnConsole( " result in laterButton click["+result+"]" );
                                                                                                        E12Global.getInstance().setLoading(false);
                                                                                                        //Added by sunny soni for white screen issue after change password[start]
                                                                                                        if(result.equalsIgnoreCase("No"))
                                                                                                        {
                                                                                                            // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] START
                                                                                                            LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                                                                                                            if (loginMethod == LoginMethod.OTP) {
                                                                                                                clearPINFields();
                                                                                                            } else {
                                                                                                                drawNewConLoginScreen();
                                                                                                            }
                                                                                                            // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] END
                                                                                                        }
                                                                                                        //Added by sunny soni for white screen issue after change password[end]
                                                                                                    }
                                                                                                });

                                                                                            }
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            E12Storage.setItem( e12StorageKeyUser, "" );
                                                                                            String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, response, e12StorageKey, new Button());
                                                                                            E12CommonUtils.printOnConsole( " result in Android ["+result+"]" );
                                                                                            E12Global.getInstance().setLoading(false);
                                                                                            //Added by sunny soni for white screen issue after change password[start]
                                                                                            if(result.equalsIgnoreCase("No"))
                                                                                            {
                                                                                                // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] START
                                                                                                LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                                                                                                if (loginMethod == LoginMethod.OTP) {
                                                                                                    clearPINFields();
                                                                                                } else {
                                                                                                    drawNewConLoginScreen();
                                                                                                }
                                                                                                // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] END
                                                                                            }
                                                                                            //Added by sunny soni for white screen issue after change password[end]
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                            //Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
                                                                            else
                                                                            {
                                                                                E12Storage.setItem( e12StorageKeyUser, "" );
                                                                                String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, response, e12StorageKey, new Button());
                                                                                E12CommonUtils.printOnConsole( " result in Ios["+result+"]" );
                                                                                E12Global.getInstance().setLoading(false);
                                                                                //Added by sunny soni for white screen issue after change password[start]
                                                                                if(result.equalsIgnoreCase("No"))
                                                                                {
                                                                                    // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] START
                                                                                    LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                                                                                    if (loginMethod == LoginMethod.OTP) {
                                                                                        clearPINFields();
                                                                                    } else {
                                                                                        drawNewConLoginScreen();
                                                                                    }
                                                                                    // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] END
                                                                                }
                                                                                //Added by sunny soni for white screen issue after change password[end]
                                                                            }

                                                                        }
                                                                    });
                                                                }
                                                                else
                                                                {
                                                                    E12Global.getInstance().setLoading(false);
                                                                    logoutUser();
                                                                    return;
                                                                }
                                                            }
                                                        });
                                                        //Changes made by Pratheek on 30-10-19[ to call the custom alert in mobile same as browser]-End
                                                    }

                                                }
                                            }
                                            //Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] End
                                            //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-Start
                                            if( ! "SESSEXIST".equalsIgnoreCase(messageId.trim()) )
                                            {
                                                if( dom.getElementsByTagName("buildNo").item(0) != null )
                                                {
                                                    Node buildNode = dom.getElementsByTagName("buildNo").item(0);
                                                    if( buildNode.getFirstChild() != null )
                                                    {
                                                        buildVersion = buildNode.getFirstChild().getNodeValue();
                                                        buildVersion = E12CommonUtils.checkNull(buildVersion);
                                                        
                                                        String storedBuildVersion = "";
                                                        String key = E12Global.getInstance().getCurConnectionId() + "BUILD_NO";
                                                        storedBuildVersion = E12Storage.getItemLocalStorage(key);
                                                        storedBuildVersion = E12CommonUtils.checkNull(storedBuildVersion);
                                                        E12CommonUtils.printOnConsole("buildVersion ["+buildVersion+"] storedBuildVersion ["+storedBuildVersion+"]");
                                                        if( !"".equalsIgnoreCase(buildVersion) && !"".equalsIgnoreCase(storedBuildVersion) )
                                                        {
                                                            if( ! buildVersion.equalsIgnoreCase(storedBuildVersion) )
                                                            {
                                                                deleteCacheReqd = true;
                                                            }
                                                        }
                                                    }
                                                }
                                                //Added by Bhupendra on 06-08-18 [Start] for Pagination Implementation.
                                                if( dom.getElementsByTagName("pageSize").item(0) != null )
                                                {
                                                    Node pageSizeNode = dom.getElementsByTagName("pageSize").item(0);
                                                    if( pageSizeNode.getFirstChild() != null )
                                                    {
                                                        String homePageFeedSize = "";
                                                        homePageFeedSize = pageSizeNode.getFirstChild().getNodeValue();
                                                        homePageFeedSize = E12CommonUtils.checkNull(homePageFeedSize);
                                                        if( !"".equalsIgnoreCase(homePageFeedSize) && homePageFeedSize.length() > 0  )
                                                        {
                                                            E12Constants.PAGE_SIZE  = Integer.parseInt(homePageFeedSize);
                                                        }
                                                        E12CommonUtils.printOnConsole("Bhudroid E12ApplicationPanel 5955 pageSize Value ["+homePageFeedSize+"]");
                                                    }
                                                }
                                                //Added by Bhupendra on 06-08-18 [End] for Pagination Implementation.
                                            }
                                            //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-End
                                        }
                                        //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-Start
                                        if( ! "SESSEXIST".equalsIgnoreCase(messageIdVal.trim()) )
                                        {
                                            deleteCache(deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, new Callback<Boolean, Boolean>() {
                                                
                                                @Override
                                                public void onFailure(Boolean reason) {
                                                    // TODO Auto-generated method stub
                                                    
                                                }
                                                
                                                @Override
                                                public void onSuccess(Boolean rspResult)
                                                {
                                                    if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
                                                    {
                                                        if( !"".equalsIgnoreCase(responseStr) )
                                                        {
                                                            Document dom = XMLParser.parse(responseStr);
                                                            XMLParser.removeWhitespace(dom);
                                                            if( dom != null )
                                                            {
                                                                String displayMessage = "";
                                                                if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
                                                                {
                                                                    Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
                                                                    if( upgradeMessageNode.getFirstChild() != null )
                                                                    {
                                                                        displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
                                                                        //added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]
                                                                        //Window.alert(displayMessage);
                                                                        //createCustomPopup( displayMessage,null,null,null );
                                                                        createCustomPopup( displayMessage);
                                                                        
                                                                        E12Global.getInstance().setLoading(false);
                                                                        //E12Storage.clear();
                                                                        return;
                                                                    }
                                                                }
                                                                
                                                                if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
                                                                {
                                                                    Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
                                                                    if( recommendedMessageNode.getFirstChild() != null )
                                                                    {
                                                                        displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
                                                                        //Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
                                                                        //Window.alert(displayMessage);
                                                                        final PopupPanel msgPopPanel = new PopupPanel();
                                                                        VerticalPanel vertMsgPanel = new VerticalPanel();
                                                                        HorizontalPanel hzpanel  = new HorizontalPanel();
                                                                        //Label msg = new Label(displayMessage);
                                                                        HTML msg = new HTML(displayMessage);
                                                                        Button okButton = new Button("Ok");
                                                                        Button laterButton = new Button("Later");
                                                                        
                                                                        okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
                                                                        okButton.getElement().getStyle().setWidth(47, Unit.PX);
                                                                        
                                                                        laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
                                                                        laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
                                                                        laterButton.getElement().getStyle().setWidth(63, Unit.PX);
                                                                        hzpanel.add(okButton);
                                                                        hzpanel.add(laterButton);
                                                                        
                                                                        vertMsgPanel.add(msg);
                                                                        vertMsgPanel.add(hzpanel);
                                                                        vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);
                                                                        
                                                                        msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
                                                                        msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
                                                                        msgPopPanel.add(vertMsgPanel);
                                                                        msgPopPanel.setGlassEnabled(true);
                                                                        msgPopPanel.getElement().getStyle().setZIndex(2);
                                                                        msgPopPanel.center();
                                                                        
                                                                        okButton.addClickHandler(new ClickHandler() {
                                                                            
                                                                            @Override
                                                                            public void onClick(ClickEvent event)
                                                                            {
                                                                                msgPopPanel.hide();
                                                                                E12Global.getInstance().setLoading(false);
                                                                                return;
                                                                            }
                                                                        });
                                                                        
                                                                        laterButton.addClickHandler(new ClickHandler() {
                                                                            @Override
                                                                            public void onClick(ClickEvent event)
                                                                            {
                                                                                msgPopPanel.hide();
                                                                                E12Storage.setItem( e12StorageKeyUser, "" );
                                                                                String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, response, e12StorageKey, new Button());
                                                                                E12CommonUtils.printOnConsole( " result in laterButton click["+result+"]" );
                                                                                E12Global.getInstance().setLoading(false);
                                                                                //Added by sunny soni for white screen issue after change password[start]
                                                                                if(result.equalsIgnoreCase("No"))
                                                                                {
                                                                                    // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] START
                                                                                    LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                                                                                    if (loginMethod == LoginMethod.OTP) {
                                                                                        clearPINFields();
                                                                                    } else {
                                                                                        drawNewConLoginScreen();
                                                                                    }
                                                                                    // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] END
                                                                                }
                                                                                //Added by sunny soni for white screen issue after change password[end]
                                                                            }
                                                                        });
                                                                        
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    E12Storage.setItem( e12StorageKeyUser, "" );
                                                                    String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, response, e12StorageKey, new Button());
                                                                    E12CommonUtils.printOnConsole( " result in Android ["+result+"]" );
                                                                    E12Global.getInstance().setLoading(false);
                                                                    //Added by sunny soni for white screen issue after change password[start]
                                                                    if(result.equalsIgnoreCase("No"))
                                                                    {
                                                                        // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] START
                                                                        LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                                                                        if (loginMethod == LoginMethod.OTP) {
                                                                            clearPINFields();
                                                                        } else {
                                                                            drawNewConLoginScreen();
                                                                        }
                                                                        // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] END
                                                                    }
                                                                    //Added by sunny soni for white screen issue after change password[end]
                                                                }
                                                            }
                                                        }
                                                    }
                                                    //Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
                                                    else
                                                    {
                                                        E12Storage.setItem( e12StorageKeyUser, "" );
                                                        String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  new Button(), "", passwordSha256, response, e12StorageKey, new Button());
                                                        E12CommonUtils.printOnConsole( " result in Ios["+result+"]" );
                                                        E12Global.getInstance().setLoading(false);
                                                        //Added by sunny soni for white screen issue after change password[start]
                                                        if(result.equalsIgnoreCase("No"))
                                                        {
                                                            // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] START
                                                            LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
                                                            if (loginMethod == LoginMethod.OTP) {
                                                                clearPINFields();
                                                            } else {
                                                                drawNewConLoginScreen();
                                                            }
                                                            // Changed by Abhishek T on 08-Dec-18 [OTP relogin failed issue] END
                                                        }
                                                        //Added by sunny soni for white screen issue after change password[end]
                                                    }
                                                    
                                                }
                                            });
                                        }
                                        //CHanges made by Pratheek on 04-11-19[ to show custom Alert in mobile same as in browser]-End
                                    }
                                    //Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
                                    public void onError( Request request, Throwable exception )
                                    {
                                        E12Global.getInstance().setLoading(false);
                                        Window.alert( "Error in getting response E12Applications " );
                                        return;
                                    }
                                });

                            }
                            catch( RequestException re )
                            {
                                E12Global.getInstance().setLoading(false);
                                System.out.println( "Exception login failed: " + re );
                                return;
                            }
                        }
                        else
                        {
                            E12Global.getInstance().setLoading( false );
                            Window.alert(  E12Constants.constants.setNoNetWorkPoor()  );
                            //callback.onError(null, null);
                        }
                    }
                    
                    @Override
                    public void onError(String error) {
                        
                        E12CommonUtils.printOnConsole("E12Application Panel 383 loadingtInfo = "+error);
                        E12Global.getInstance().setLoadingInfo( "Network Bandwidth slow" );
                        E12Global.getInstance().setLoading( false );
                        
                    }
                });
                //Added By Nilesh In case of Pin and Finguler print check the network End :: 22-04-2021
            }			
		}
	}
	// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] End

	//Added by Pankaj on 05/APR/16- Req[S15JBAS002] [Start]
	// This method is overriden because the original header width should not change
	@Override
	public void resizeComponent() {
		Element pageComponentHeader = DOM.getElementById("PageComponentHeader");
		if (pageComponentHeader != null)
		{
			pageComponentHeader.getStyle().setWidth(100,Unit.PCT);
		}
		Element pageComponentFooter = DOM.getElementById("PageComponentFooter");
		if (pageComponentFooter != null)
		{
			pageComponentFooter.getStyle().setWidth(100, Unit.PCT);
		}

		int width = 100;
		outerHeaderPanel.setWidth(width + "%");
		outerFooterPanel.setWidth(width + "%");


	}
	//Added by Pankaj on 05/APR/16- Req[S15JBAS002] [Start]

	//Added by Sandesh on 13/MAY/16- Req[W16BBAS002] [Start]
	/**
	 * This method is to replace old shaPassword with new shaPassword
	 * @param passwordSha256
	 */
	private void setShaPasswordForConnectionURL(final String passwordSha256)
	{
		String currentUser = "USER=" + E12Constants.userID;

		String getStroredConnectionKey = "";
		//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
		//String getStroredConnectionKeyValue = "";
		for(int i = 0; i < E12Storage.getLength(); i++ )
		{
			if(E12Storage.key(i).startsWith(E12Constants.userID) && (E12Storage.key(i).contains(E12Constants.userID) && E12Storage.key(i).contains("PASSWORD")))
			{
				getStroredConnectionKey = E12Storage.key(i);
				break;
			}
		}
		final String ConnectionKey = getStroredConnectionKey;
		if (getStroredConnectionKey != null && getStroredConnectionKey.length() > 0 && getStroredConnectionKey.contains(currentUser))
		{
			//getStroredConnectionKeyValue = E12Storage.getItem(getStroredConnectionKey);
			E12Storage.getItem(getStroredConnectionKey, new Callback<String, String>() {

				@Override
				public void onFailure(String reason) {
					// TODO Auto-generated method stub

				}

				@Override
				public void onSuccess(String result) {
					String getStroredConnectionKeyValue = result;

					String[] connectionUrlParamsSplit = ConnectionKey.split("\\?");
					HashMap <String, String> paramMap = new HashMap<String, String>();

					if (connectionUrlParamsSplit != null && connectionUrlParamsSplit.length > 0)
					{
						paramMap = E12CommonUtils.getUrlParamToMap(connectionUrlParamsSplit[1]);
						String updatedUrl = "";

						if (paramMap != null && paramMap.size() > 0 && paramMap.containsKey("PASSWORD"))
						{
							if (paramMap.get("PASSWORD").equalsIgnoreCase(passwordSha256))
							{
								return;
							}
							/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
							if user enters wrong password from Login screen.*/
							/*paramMap.put("PASSWORD", passwordSha256);
							updatedUrl =  connectionUrlParamsSplit[0] +"?"+ E12CommonUtils.getMapToParam(paramMap);
							E12Storage.removeItem(ConnectionKey);
							E12Storage.setItem(updatedUrl, getStroredConnectionKeyValue);*/
						}
					}
				}
			});
			//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End
		}
	}
	//Added by Sandesh on 13/MAY/16- Req[W16BBAS002] [End]

	//Added by Sandesh Shinde [App resume redirect and notification redirect] 16-Jun-16 Start
	@Override
	public void redirect(String toRedirectPath, String data)
	{

	}
	//Added by Sandesh Shinde [App resume redirect and notification redirect] 16-Jun-16 End

	public void setSelectedSiteInfo(String userName, String siteCode, String siteDescr, String profileId)
	{
		E12CommonUtils.printOnConsole("In setSelectedSiteInfo 1624.....!!");
		HashMap<String, String> paramMap = new HashMap<String, String>();
		paramMap.put("userId", userName);
		paramMap.put("ACTION", "SET_SELECTED_SITE_CODE");
		paramMap.put( "selectedSiteCode", siteCode );
		paramMap.put( "selectedSiteDescr", siteDescr );
		paramMap.put( "selectedProfileId", profileId );

		String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);

		String path = E12Global.getHostUrl() + "/ibase/WebITMAuthenticateServlet?" + paramString ;

		/*if( ! CommonPhoneGapUtil.checkNetworkAndMode() )
		{
			Window.alert( E12Constants.constants.setNoNetWork() );  //Changes by Raju 19-02-14 for I18N
		}
		else*/
		{
			E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, path);
			try
			{
				requestBuilder.setLoadingRequired( false );		//Added by Sagar B. on [16-Aug-19]
				requestBuilder.sendRequest("", new RequestCallback() {

					public void onResponseReceived(Request request, Response response)
					{
						E12CommonUtils.printOnConsole("In setSelectedSiteInfo method userInfo updated successfully.....!!!");
					}
					@Override
					public void onError(Request request, Throwable exception) {

					}
				});
			}
			catch (Exception e)
			{
				Window.alert( "Exception :: while set site code of current loging user ["+e.getMessage()+"]" );
			}
		}
	}
	//Added by sunny soni on 17-NOV-16 for adding popup panel start
	private PopupPanel displayPopPanel( final int noOfConnections )
	{

		//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] start
		if( !E12Global.getInstance().isHostedMode())
		{
			MELogin.checkApkVersion(new Callback<String, String>() {

				@Override
				public void onFailure(String reason)
				{

				}

				@Override
				public void onSuccess(String result) {

					apkVersion = result;
					apkVersion = E12Global.checkNull( apkVersion.substring(apkVersion.indexOf("v") + 1 ) );
					if( !"".equalsIgnoreCase(apkVersion) )
					{
						apkVersion = apkVersion.replace(".", "-");
						version = apkVersion;
					}
				}
			});
			//Changed and Added by Pankaj R on 08-Jan-18 to store current application name[START]
			MELogin.getAppName(new Callback<String, String>() {

				@Override
				public void onSuccess(String result)
				{
					appName = result;
				}

				@Override
				public void onFailure(String reason) {}
			});
			//Changed and Added by Pankaj R on 08-Jan-18 to store current application name[END]
		}

		final String iPin = E12Storage.getItemLocalStorage("iPin_"+storedUserName);
		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",true);

		HorizontalPanel oldPassPanel = new HorizontalPanel();
		oldPassPanel.setWidth("100%");
		oldPassPanel.getElement().getStyle().setMarginTop(5, Unit.PX);

		final Anchor forgotPin = new Anchor("Forgot PIN?");

		forgotPin.getElement().getStyle().setColor("#2087fc");

		forgotPin.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				setForgotPin("forgotPIN".trim());
				e12PopupPanel.hide();
				//displayPwd().center();
				drawNewConLoginScreen();
			}
		});
		//New Added by sunny soni showing error instead of pop panel[Start]
		final HorizontalPanel horzPinErrPanel = new HorizontalPanel();
		Label errspace= new Label();
		errspace.getElement().getStyle().setHeight(10, Unit.PX);
		final Label errorPinLbl = new Label();
		errorPinLbl.getElement().getStyle().setColor("red");
		errorPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		horzPinErrPanel.setVisible(false);
		horzPinErrPanel.add(errspace);
		horzPinErrPanel.add(errorPinLbl);
		//New Added by sunny soni showing error instead of pop panel[End]
		//Changed by Sandeep S. on 21-04-17 Start
		e12PopupPanel.getClose().addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				e12PopupPanel.hide();
				drawNewConLoginScreen();
			}
		});
		//Changed by Sandeep S. on 21-04-17 End
		E12PluginUtils.getInstance().addTouchHandlerToWidget(forgotPin);

		newPassImg = new Label();
		confirmPassImg = new Label();

		final VerticalPanel containerChangePasswordUI = new VerticalPanel();

		final Label changePasswordLbl = new Label( appDescription );
		changePasswordLbl.setStyleName( "changePasswordHeading" );

		Label oldPinLbl = new Label( "Enter the PIN For" + " " + storedUserName );

		final E12TextBox oldpinText = new E12TextBox("number");
		final E12TextBox oldpinText1 = new E12TextBox("number");
		final E12TextBox oldpinText2 = new E12TextBox("number");
		final E12TextBox oldpinText3 = new E12TextBox("number");

		oldpinText.getElement().setId("oldpinText_1");//new Added by sunny soni for focus

		oldpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		oldpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		oldpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		oldpinText.setStyleName( "pinTextstylecss loginTextcss" );
		oldpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		oldpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		oldpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		final Button changeLbl = new Button( "Login" );
		changeLbl.addStyleName("pinButton");
		changeLbl.getElement().setId("Change_Pin_Login_Button");
		final Button resetLbl = new Button( "Cancel" );
		resetLbl.addStyleName("pinButton");
		resetLbl.getElement().setId("Reset_Pin_Cancel_Button");
		HorizontalPanel btnContainer = new HorizontalPanel();
		btnContainer.setWidth( "100%" );
		btnContainer.add( resetLbl );
		btnContainer.add( changeLbl );
		btnContainer.setCellHorizontalAlignment( changeLbl, HasHorizontalAlignment.ALIGN_RIGHT );

		Label space1 = new Label();
		space1.setStyleName( "space1" );

		Label space2 = new Label();
		space2.setStyleName( "space" );

		Label oldLblSpace = new Label();
		oldLblSpace.setWidth("20px");

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		  @Override
		  public void execute()
		  {
		   //oldpinText.setFocus(true);
		   int width = e12PopupPanel.getOffsetWidth();
		   int lblwidth = width-28;
		   changePasswordLbl.setWidth(Integer.toString(lblwidth) +"px");
		   /*oldpinText.setFocus(true);*/
		  }
		});

		//Added by sunny soni for getting focus on textbox [Start]
		(new Timer() {
			   @Override
			   public void run() {
				   oldpinText.setFocus(true);
			   }
			}).schedule(500);
		//Added by sunny soni for getting focus on textbox [End]
		e12PopupPanel.addStyleName("adjustPopup");//Added by sunny soni for adjusting pin popup panel.
		e12PopupPanel.addStyleName("loginPinpanel");
		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("closeAdjust close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");

		/*forgotPin.getElement().getStyle().setMarginTop(7, Unit.PX);*/
		oldPassPanel.add(oldpinText);
		oldPassPanel.add(oldpinText1);
		oldPassPanel.add(oldpinText2);
		oldPassPanel.add(oldpinText3);

		resetLbl.addStyleName("redPinBtn");
		changeLbl.addStyleName("greenPinBtn");

		space1.setHeight("21px");
		containerChangePasswordUI.add( changePasswordLbl );
		containerChangePasswordUI.add( space1 );
		containerChangePasswordUI.add( oldPinLbl);
		containerChangePasswordUI.add( oldPassPanel);
		containerChangePasswordUI.add( forgotPin );

		containerChangePasswordUI.add(horzPinErrPanel);//New Added by sunny soni showing error instead of pop panel

		containerChangePasswordUI.add( space2 );
		containerChangePasswordUI.add( btnContainer );
		containerChangePasswordUI.setCellHorizontalAlignment(forgotPin, HasHorizontalAlignment.ALIGN_RIGHT);

		oldpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
				{
					//oldpinText.setText(oldpinText.getText().substring(0, 1));
					oldpinText.getElement().setPropertyString("type", "password");
					oldpinText.setText(oldpinText.getText().substring(oldpinText.getText().length()-1, oldpinText.getText().length()));
					horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.setFocus(true);
					}
					else
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setFocus(true);
					}
				}
				if( oldpinText.getText().length() == 0 )
				{
					oldpinText.setText("".trim());
					return;
				}
			}
		});
		oldpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
				{
					oldpinText1.getElement().setPropertyString("type", "password");
					//oldpinText1.setText(oldpinText1.getText().substring(0, 1));
					oldpinText1.setText(oldpinText1.getText().substring(oldpinText1.getText().length()-1, oldpinText1.getText().length()));
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.setFocus(true);
					}
					else
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setFocus(true);
					}
				}
				if( oldpinText1.getText().length() == 0 )
				{
					oldpinText1.setText("".trim());
					return;
				}
			}
		});

		oldpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				//Window.alert("Pin Value::: [ "+oldpinText2.getText()+" ]");
				if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
				{
					oldpinText2.getElement().setPropertyString("type", "password");
					//oldpinText2.setText(oldpinText2.getText().substring(0, 1));
					oldpinText2.setText(oldpinText2.getText().substring(oldpinText2.getText().length()-1, oldpinText2.getText().length()));
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.setFocus(true);
					}
					else
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setFocus(true);
					}
				}
				if( oldpinText2.getText().length() == 0 )
				{
					oldpinText2.setText("".trim());
					return;
				}
			}
		});

		oldpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
				{
					oldpinText3.getElement().setPropertyString("type", "password");
					oldpinText3.setText(oldpinText3.getText().substring(oldpinText3.getText().length()-1, oldpinText3.getText().length()));

					String pinValues = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();

					if(pinValues.length() == 4)
					{
						final String ipinVal = SHA256.toSha256(pinValues);

						/*if(!(iPin.equalsIgnoreCase(ipinVal)))
						{
							oldpinText3.getElement().setPropertyString("type", "number");
							oldpinText3.setFocus(false);
							final PopupPanel msgPopPanel = new PopupPanel();
							VerticalPanel vertMsgPanel = new VerticalPanel();
							vertMsgPanel.setWidth("100%");
							Label msg = new Label("Incorrect PIN.");

							final Button okBtn = new Button("OK");
							TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
							okBtn.setWidth("40%");
							okBtn.addStyleName("okpopButton");

							vertMsgPanel.add(msg);
							vertMsgPanel.add(nextBtnTouchWidget);

							vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
							vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

							//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
							if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
							{
								msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
							}
							else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
							{
								msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
							}
							msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
							msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
							msgPopPanel.addStyleName("errorMsgPanel");
							msgPopPanel.add(vertMsgPanel);
							msgPopPanel.setGlassEnabled(true);
							msgPopPanel.getElement().getStyle().setZIndex(2);
							msgPopPanel.center();

							okBtn.addClickHandler(new ClickHandler() {

								@Override
								public void onClick(ClickEvent event) {
									msgPopPanel.hide();
									oldpinText.getElement().setPropertyString("type", "number");
									oldpinText.setText("".trim());
									oldpinText1.setText("".trim());
									oldpinText2.setText("".trim());
									oldpinText3.setText("".trim());
									oldpinText.setFocus(true);
								}
							});

						}
						else
						{
							changeLbl.setFocus(true);
						}*/
						if(!(iPin.equalsIgnoreCase(ipinVal)))
						{
							changeLbl.setFocus(true);
						}
						else
						{
							e12PopupPanel.hide(true);
							authenticateUser();
						}
					}
					else
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setFocus(false);
						oldpinText.getElement().setPropertyString("type", "number");
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Please Enter 4-Digit PIN");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						oldpinText.setText("".trim());
						oldpinText1.setText("".trim());
						oldpinText2.setText("".trim());
						oldpinText3.setText("".trim());
						oldpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]
						/*final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Please Enter 4-Digit Pin.");
						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");

						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

						//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
						if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
						{
							msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
						}
						else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
						{
							msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
						}
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								oldpinText.getElement().setPropertyString("type", "number");
								oldpinText.setText("".trim());
								oldpinText1.setText("".trim());
								oldpinText2.setText("".trim());
								oldpinText3.setText("".trim());
								oldpinText.setFocus(true);
							}
						});*/
					}

				}
				if( oldpinText3.getText().length() == 0 )
				{
					oldpinText3.setText("".trim());
					return;
				}
			}
		});

		oldpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
					{
						oldpinText.setText(oldpinText.getText().substring(0, 1));
						oldpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		oldpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText1.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
					{
						oldpinText1.getElement().setPropertyString("type", "password");
						oldpinText1.setText(oldpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		oldpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText2.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
					{
						oldpinText2.getElement().setPropertyString("type", "password");
						oldpinText2.setText(oldpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		oldpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText3.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
					{
						oldpinText3.getElement().setPropertyString("type", "password");
						oldpinText3.setText(oldpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		oldpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText.getValue().isEmpty()))
				{
					oldpinText.getElement().setPropertyString("type", "number");
					oldpinText.setCursorPos(oldpinText.getValue().length());
					if(!(oldpinText.getValue().equalsIgnoreCase("")))
					{
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setText(oldpinText.getText().substring(0, 1));
						oldpinText.setFocus(true);
					}
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText1.getValue().isEmpty()))
				{
					oldpinText1.getElement().setPropertyString("type", "number");
					oldpinText1.setCursorPos(oldpinText1.getValue().length());
					if(!(oldpinText1.getValue().equalsIgnoreCase("")))
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setText(oldpinText1.getText().substring(0, 1));
						oldpinText1.setFocus(true);
					}
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText2.getValue().isEmpty()))
				{
					oldpinText2.getElement().setPropertyString("type", "number");
					oldpinText2.setCursorPos(oldpinText2.getValue().length());
					if(!(oldpinText2.getValue().equalsIgnoreCase("")))
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setText(oldpinText2.getText().substring(0, 1));
						oldpinText2.setFocus(true);
					}
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText3.getValue().isEmpty()))
				{
					oldpinText3.getElement().setPropertyString("type", "number");
					oldpinText3.setCursorPos(oldpinText3.getValue().length());
					if(!(oldpinText3.getValue().equalsIgnoreCase("")))
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setText(oldpinText3.getText().substring(0, 1));
						oldpinText3.setFocus(true);
					}
				}
			}
		});

		oldpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText1.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText2.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText3.getElement().setPropertyString("type", "number");
			}
		});

		changeLbl.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				String loginResult = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();

				if(loginResult.length() == 4)
				{
					final String ipinVal = SHA256.toSha256(loginResult);

					if(iPin.equalsIgnoreCase(ipinVal))
					{
						e12PopupPanel.hide(true);
						authenticateUser();
					}
					else
					{
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Please enter valid PIN.");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setText("".trim());
						oldpinText1.setText("".trim());
						oldpinText2.setText("".trim());
						oldpinText3.setText("".trim());
						oldpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]
						//Window.alert("Invalid pin.Please enter valid pin");
						/*final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Please enter valid PIN.");
						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");
						okBtn.getElement().getStyle().setTop(4, Unit.PX);//For Adjust ok button.
						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);
						msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								oldpinText.getElement().setPropertyString("type", "number");
								oldpinText.setText("".trim());
								oldpinText1.setText("".trim());
								oldpinText2.setText("".trim());
								oldpinText3.setText("".trim());
								oldpinText.setFocus(true);
							}
						});	*/
					}
				}
			}
		});

		resetLbl.addClickHandler( new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				/*if( noOfConnections > 1 )
				{
					displayPwd().center();
				}
				else*/
				{
					drawNewConLoginScreen();
				}
				e12PopupPanel.hide(true);

				newPassImg.removeStyleName("rightPass");
				newPassImg.removeStyleName("wrongPass");
				confirmPassImg.removeStyleName("confirmRightPass");
				confirmPassImg.removeStyleName("confirmWrongPass");
			}
		});
    	e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerChangePasswordUI );
		e12PopupPanel.setAnimationEnabled(false);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
        ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();
		return e12PopupPanel;
	}
	//Added by sunny soni on 17-NOV-16 for adding popup panel end

	//New Panel added by sunny soni for generating pin on 17-NOV-16 start
	Label newPassImg ;
	Label confirmPassImg ;
	private PopupPanel getPINPopup()
	{
		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",true);

		HorizontalPanel newPassPanel= new HorizontalPanel();
		HorizontalPanel confirmPassPanel = new HorizontalPanel();
		HorizontalPanel newLblPanel = new HorizontalPanel();
		HorizontalPanel confirmLblPanel = new HorizontalPanel();

		newLblPanel.setWidth("150px");
		confirmLblPanel.setWidth("150px");

		newPassImg = new Label();
		confirmPassImg = new Label();

		final VerticalPanel containerChangePasswordUI = new VerticalPanel();

		final Label changePasswordLbl = new Label( "Generate New PIN" );
		changePasswordLbl.setStyleName( "changePasswordHeading" );


		Label newPinLbl = new Label( "Enter PIN" );
		Label confirmPinLbl = new Label( "Confirm PIN" );

		final E12TextBox newpinText = new E12TextBox("number");
		final E12TextBox newpinText1 = new E12TextBox("number");
		final E12TextBox newpinText2 = new E12TextBox("number");
		final E12TextBox newpinText3 = new E12TextBox("number");

		newpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		newpinText.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		final E12TextBox confirmpinText = new E12TextBox("number");
		final E12TextBox confirmpinText1 = new E12TextBox("number");
		final E12TextBox confirmpinText2 = new E12TextBox("number");
		final E12TextBox confirmpinText3 = new E12TextBox("number");

		confirmpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText3.getElement().getStyle().setMarginLeft(14, Unit.PX);

		confirmpinText.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		confirmpinText.setEnabled(false);
		confirmpinText1.setEnabled(false);
		confirmpinText2.setEnabled(false);
		confirmpinText3.setEnabled(false);

		final Button changeLbl = new Button( "Submit" );
		changeLbl.addStyleName("pinButton");
		changeLbl.getElement().setId("E12Application_Change_Pin_Submit_Button");
		final Button resetLbl = new Button( E12Constants.constants.setresetLbl() );
		resetLbl.addStyleName("pinButton");
		resetLbl.getElement().setId("E12Application_Reset_Pin_Button");

		changeLbl.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				String newPin = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
				if(newPin.length() == 4)
				{
					e12PopupPanel.hide(true);
					showMessagePanel(newPin).center();
				}
			}
		});

		resetLbl.addClickHandler( new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				newpinText.getElement().setPropertyString("type", "number");
				newpinText.setText( "" );
				newpinText1.setText( "" );
				newpinText2.setText( "" );
				newpinText3.setText( "" );

				confirmpinText.setText( "" );
				confirmpinText1.setText( "" );
				confirmpinText2.setText( "" );
				confirmpinText3.setText( "" );

				newpinText.setFocus(true);

				confirmpinText.setEnabled(false);
				confirmpinText1.setEnabled(false);
				confirmpinText2.setEnabled(false);
				confirmpinText3.setEnabled(false);

				newPassImg.removeStyleName("rightPass");
				newPassImg.removeStyleName("wrongPass");
				confirmPassImg.removeStyleName("confirmRightPass");
				confirmPassImg.removeStyleName("confirmWrongPass");
			}
		});

		HorizontalPanel btnContainer = new HorizontalPanel();
		btnContainer.setWidth( "100%" );
		btnContainer.add( resetLbl );
		btnContainer.add( changeLbl );
		btnContainer.setCellHorizontalAlignment( changeLbl, HasHorizontalAlignment.ALIGN_RIGHT );

		Label space1 = new Label();

		space1.setStyleName( "space1" );
		Label space2 = new Label();
		space2.setStyleName( "space" );
		Label space3 = new Label();
		space3.setStyleName( "space" );
		Label space4 = new Label();
		space4.setStyleName( "changePasswordSpace" );

		Label oldLblSpace = new Label();
		oldLblSpace.setWidth("20px");
		Label newLblSpace = new Label();
		newLblSpace.setWidth("20px");
		Label confirmLblSpace = new Label();
		confirmLblSpace.setWidth("20px");
		Label space5= new Label();
		space5.setStyleName("buttonSpace");

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		  @Override
		  public void execute() {
		   int width = e12PopupPanel.getOffsetWidth();
		   int lblwidth = width-28;
		   changePasswordLbl.setWidth(Integer.toString(lblwidth) +"px");

		  }
		});
		e12PopupPanel.addStyleName("adjustPopup");//Added by sunny soni for adjusting pin popup panel.
		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("closeAdjust close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");

		resetLbl.addStyleName("redPinBtn");
		changeLbl.addStyleName("greenPinBtn");

		newPassPanel.add(newpinText);
		newPassPanel.add(newpinText1);
		newPassPanel.add(newpinText2);
		newPassPanel.add(newpinText3);
		confirmPassPanel.add(confirmpinText);
		confirmPassPanel.add(confirmpinText1);
		confirmPassPanel.add(confirmpinText2);
		confirmPassPanel.add(confirmpinText3);
		newPassPanel.add(newPassImg);
		confirmPassPanel.add(confirmPassImg);
		confirmPinLbl.getElement().getStyle().setMarginTop(7, Unit.PX);
		space1.setHeight("21px");
		containerChangePasswordUI.add( changePasswordLbl );
		containerChangePasswordUI.add( space1 );
		containerChangePasswordUI.add( newPinLbl );
		containerChangePasswordUI.add( newPassPanel );
		containerChangePasswordUI.add( space3 );
		containerChangePasswordUI.add( confirmPinLbl );
		containerChangePasswordUI.add( confirmPassPanel );
		containerChangePasswordUI.add( space4 );
		containerChangePasswordUI.add( btnContainer );

		newpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
				{
					//newpinText.setText(newpinText.getText().substring(0, 1));
					newpinText.getElement().setPropertyString("type", "password");
					newpinText.setText(newpinText.getText().substring(newpinText.getText().length()-1, newpinText.getText().length()));
					if(newpinText1.getValue().isEmpty())
					{
						newpinText1.setFocus(true);
					}
					else
					{
						newpinText1.getElement().setPropertyString("type", "number");
						newpinText1.setFocus(true);
					}
				}
				if( newpinText.getText().length() == 0 )
				{
					newpinText.setText("".trim());
					return;
				}
			}
		});
		newpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
				{
					newpinText1.getElement().setPropertyString("type", "password");
					//newpinText1.setText(newpinText1.getText().substring(0, 1));
					newpinText1.setText(newpinText1.getText().substring(newpinText1.getText().length()-1, newpinText1.getText().length()));
					if(newpinText2.getValue().isEmpty())
					{
						newpinText2.setFocus(true);
					}
					else
					{
						newpinText2.getElement().setPropertyString("type", "number");
						newpinText2.setFocus(true);
					}
				}
				if( newpinText1.getText().length() == 0 )
				{
					newpinText1.setText("".trim());
					return;
				}
			}
		});
		newpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
				{
					newpinText2.getElement().setPropertyString("type", "password");
					//newpinText2.setText(newpinText2.getText().substring(0, 1));
					newpinText2.setText(newpinText2.getText().substring(newpinText2.getText().length()-1, newpinText2.getText().length()));
					if(newpinText3.getValue().isEmpty())
					{
						newpinText3.setFocus(true);
					}
					else
					{
						newpinText3.getElement().setPropertyString("type", "number");
						newpinText3.setFocus(true);
					}
				}
				if( newpinText2.getText().length() == 0 )
				{
					newpinText2.setText("".trim());
					return;
				}
			}
		});
		newpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
				{
					newpinText3.getElement().setPropertyString("type", "password");
					//newpinText3.setText(newpinText3.getText().substring(0, 1));
					newpinText3.setText(newpinText3.getText().substring(newpinText3.getText().length()-1, newpinText3.getText().length()));

					String newPinval = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();

					if(newPinval.length() == 4)
					{
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setEnabled(true);
						confirmpinText1.setEnabled(true);
						confirmpinText2.setEnabled(true);
						confirmpinText3.setEnabled(true);
						confirmpinText.setFocus(true);
					}
					else
					{
						if(newpinText1.getValue().isEmpty())
						{
							newpinText.setFocus(true);
							newpinText.getElement().setPropertyString("type", "number");
						}
						if(newpinText1.getValue().isEmpty())
						{
							newpinText1.setFocus(true);
							newpinText1.getElement().setPropertyString("type", "number");
						}
						if(newpinText2.getValue().isEmpty())
						{
							newpinText2.setFocus(true);
							newpinText2.getElement().setPropertyString("type", "number");
						}
						if(newpinText3.getValue().isEmpty())
						{
							newpinText3.setFocus(true);
							newpinText3.getElement().setPropertyString("type", "number");
						}
					}
				}
				if( newpinText3.getText().length() == 0 )
				{
					newpinText3.setText("".trim());
					return;
				}
			}
		});

		newpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText.getValue().equalsIgnoreCase("")))
				{
					if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
					{
						newpinText.setText(newpinText.getText().substring(0, 1));
						newpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		newpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText1.getValue().equalsIgnoreCase("")))
				{
					if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
					{
						newpinText1.getElement().setPropertyString("type", "password");
						newpinText1.setText(newpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		newpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText2.getValue().equalsIgnoreCase("")))
				{
					if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
					{
						newpinText2.getElement().setPropertyString("type", "password");
						newpinText2.setText(newpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		newpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText3.getValue().equalsIgnoreCase("")))
				{
					if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
					{
						newpinText3.getElement().setPropertyString("type", "password");
						newpinText3.setText(newpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		newpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText.getValue().isEmpty()))
				{
					newpinText.getElement().setPropertyString("type", "number");
					newpinText.setCursorPos(newpinText.getValue().length());

					if(!(newpinText.getValue().equalsIgnoreCase("")))
					{
						newpinText.getElement().setPropertyString("type", "number");
						newpinText.setText(newpinText.getText().substring(0, 1));
						newpinText.setFocus(true);
					}
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText1.getValue().isEmpty()))
				{
					newpinText1.getElement().setPropertyString("type", "number");
					newpinText1.setCursorPos(newpinText1.getValue().length());
					if(!(newpinText1.getValue().equalsIgnoreCase("")))
					{
						newpinText1.getElement().setPropertyString("type", "number");
						newpinText1.setText(newpinText1.getText().substring(0, 1));
						newpinText1.setFocus(true);
					}
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText2.getValue().isEmpty()))
				{
					newpinText2.getElement().setPropertyString("type", "number");
					newpinText2.setCursorPos(newpinText2.getValue().length());
					if(!(newpinText2.getValue().equalsIgnoreCase("")))
					{
						newpinText2.getElement().setPropertyString("type", "number");
						newpinText2.setText(newpinText2.getText().substring(0, 1));
						newpinText2.setFocus(true);
					}
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText3.getValue().isEmpty()))
				{
					newpinText3.getElement().setPropertyString("type", "number");
					newpinText3.setCursorPos(newpinText3.getValue().length());
					if(!(newpinText3.getValue().equalsIgnoreCase("")))
					{
						newpinText3.getElement().setPropertyString("type", "number");
						newpinText3.setText(newpinText3.getText().substring(0, 1));
						newpinText3.setFocus(true);
					}
				}
			}
		});

		newpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText.getElement().setPropertyString("type", "number");
			}
		});
		newpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText1.getElement().setPropertyString("type", "number");
			}
		});
		newpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText2.getElement().setPropertyString("type", "number");
			}
		});
		newpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText3.getElement().setPropertyString("type", "number");
			}
		});

		confirmpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
				{
					confirmpinText.setText(confirmpinText.getText().substring(0, 1));
					confirmpinText.getElement().setPropertyString("type", "password");
					if(confirmpinText1.getValue().isEmpty())
					{
						confirmpinText1.setFocus(true);
					}
					else
					{
						confirmpinText1.getElement().setPropertyString("type", "number");
						confirmpinText1.setFocus(true);
					}
				}
				if( confirmpinText.getText().length() == 0 )
				{
					confirmpinText.setText("".trim());
					return;
				}
			}
		});
		confirmpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
				{
					confirmpinText1.getElement().setPropertyString("type", "password");
					confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					if(confirmpinText2.getValue().isEmpty())
					{
						confirmpinText2.setFocus(true);
					}
					else
					{
						confirmpinText2.getElement().setPropertyString("type", "number");
						confirmpinText2.setFocus(true);
					}
				}
				if( confirmpinText1.getText().length() == 0 )
				{
					confirmpinText1.setText("".trim());
					return;
				}
			}
		});
		confirmpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
				{
					confirmpinText2.getElement().setPropertyString("type", "password");
					confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					if(confirmpinText3.getValue().isEmpty())
					{
						confirmpinText3.setFocus(true);
					}
					else
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setFocus(true);
					}
				}
				if( confirmpinText2.getText().length() == 0 )
				{
					confirmpinText2.setText("".trim());
					return;
				}
			}
		});
		confirmpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
				{
					/*confirmpinText3.getElement().setPropertyString("type", "password");
					confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));*/
					String newPinvalue = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
					String confirmpinVal = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
					if(confirmpinVal.length() == 4)
					{
						if(newPinvalue.equalsIgnoreCase(confirmpinVal))
						{
							confirmpinText3.getElement().setPropertyString("type", "password");
							confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
							changeLbl.setFocus(true);
						}
						else
						{
							confirmpinText3.getElement().setPropertyString("type", "number");
							final PopupPanel msgPopPanel = new PopupPanel();
							VerticalPanel vertMsgPanel = new VerticalPanel();
							vertMsgPanel.setWidth("100%");
							Label msg = new Label("PIN not Matched.");
							msg.getElement().getStyle().setMarginLeft(6, Unit.PX);
							final Button okBtn = new Button("OK");
							TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
							okBtn.setWidth("40%");
							okBtn.addStyleName("okpopButton");

							vertMsgPanel.add(msg);
							vertMsgPanel.add(nextBtnTouchWidget);

							vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
							vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

							//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
							{
								msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							}
							else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
							{
								msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
							}
							msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
							msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
							msgPopPanel.add(vertMsgPanel);
							msgPopPanel.setGlassEnabled(true);
							msgPopPanel.getElement().getStyle().setZIndex(2);
							msgPopPanel.center();

							okBtn.addClickHandler(new ClickHandler() {

								@Override
								public void onClick(ClickEvent event) {
									msgPopPanel.hide();
									confirmpinText.getElement().setPropertyString("type", "number");
									confirmpinText.setText("".trim());
									confirmpinText1.setText("".trim());
									confirmpinText2.setText("".trim());
									confirmpinText3.setText("".trim());
									confirmpinText.setFocus(true);
								}
							});
						}
					}
					else
					{
						final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Please Enter 4-digit PIN.");
						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");

						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);
						//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
						{
							msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						}
						else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
						{
							msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
						}
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								confirmpinText.getElement().setPropertyString("type", "number");
								confirmpinText.setText("".trim());
								confirmpinText1.setText("".trim());
								confirmpinText2.setText("".trim());
								confirmpinText3.setText("".trim());
								confirmpinText.setFocus(true);
							}
						});
					}
				}
				if( confirmpinText3.getText().length() == 0 )
				{
					confirmpinText3.setText("".trim());
					return;
				}
			}
		});

		confirmpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
					{
						confirmpinText.setText(confirmpinText.getText().substring(0, 1));
						confirmpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		confirmpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
					{
						confirmpinText1.getElement().setPropertyString("type", "password");
						confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		confirmpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
					{
						confirmpinText2.getElement().setPropertyString("type", "password");
						confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		confirmpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
					{
						confirmpinText3.getElement().setPropertyString("type", "password");
						confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		confirmpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText.getValue().isEmpty()))
				{
					confirmpinText.getElement().setPropertyString("type", "number");
					confirmpinText.setCursorPos(confirmpinText.getValue().length());
					if(!(confirmpinText.getValue().equalsIgnoreCase("")))
					{
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setText(confirmpinText.getText().substring(0, 1));
						confirmpinText.setFocus(true);
					}
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText1.getValue().isEmpty()))
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
					confirmpinText1.setCursorPos(confirmpinText1.getValue().length());
					if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
					{
						confirmpinText1.getElement().setPropertyString("type", "number");
						confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
						confirmpinText1.setFocus(true);
					}
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText2.getValue().isEmpty()))
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
					confirmpinText2.setCursorPos(confirmpinText2.getValue().length());
					if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
					{
						confirmpinText2.getElement().setPropertyString("type", "number");
						confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
						confirmpinText2.setFocus(true);
					}
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText3.getValue().isEmpty()))
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
					confirmpinText3.setCursorPos(confirmpinText3.getValue().length());
					if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
						confirmpinText3.setFocus(true);
					}
				}
			}
		});

		confirmpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
		});

    	e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerChangePasswordUI );
		e12PopupPanel.setAnimationEnabled(false);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
        ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();
		return e12PopupPanel;
	}
	private PopupPanel showMessagePanel(final String pin)
	{
		final PopupPanel msgPopPanel = new PopupPanel();
		VerticalPanel vertMsgPanel = new VerticalPanel();
		vertMsgPanel.setWidth("100%");
		Label msg = new Label("New PIN Generated Successfully.");
		final Button okBtn = new Button("OK");
		TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
		okBtn.setWidth("40%");
		okBtn.addStyleName("okpopButton");

		vertMsgPanel.add(msg);
		vertMsgPanel.add(nextBtnTouchWidget);

		vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
		vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
		vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
		vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

		/*msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
		msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);*/
		msgPopPanel.add(vertMsgPanel);
		msgPopPanel.setGlassEnabled(true);
		msgPopPanel.getElement().getStyle().setZIndex(2);
		msgPopPanel.center();

		okBtn.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				msgPopPanel.hide();
				E12Storage.removeItem("iPin"+E12Constants.userID);
				final String newPinResult = SHA256.toSha256(pin);
				E12Storage.localStorageVars.add("iPin_"+E12Constants.userID);
				E12Storage.setItem("iPin_"+E12Constants.userID, newPinResult);
			}
		});
		return msgPopPanel;
	}
				//New Panel added by sunny soni for generating pin on 17-NOV-16 end

	// Added by Abhishek T on 03-Feb-17 [For getting host url] START
	/**
	 * Returns the host url ie <IP>:<PORT>
	 */
	public static String getHostUrl()
	{
		if (E12Global.getInstance().isHostedMode())
			return Window.Location.getHostName() + ":" + Window.Location.getPort();
		else
			return E12Global.getHostUrl();
	}
	// Added by Abhishek T on 03-Feb-17 [For getting host url] END
	@Override
	protected void createOptionsPanel(String labelText) {
	}

	//Changed by Sandeep S. on 16-03-17 Start
	public void drawNewConLoginScreen()
	{
		final VerticalPanel hortPanel = new VerticalPanel();
		try
		{
			//added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]
			setApplicationId();
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 1");
			//E12CommonUtils.getInstance().checkGPS();
			//if( "true".equalsIgnoreCase( E12Storage.getItem("GPS_ENABLED") ))
			if( !"0".equalsIgnoreCase( E12Storage.getItemLocalStorage("GEO_POS_OPTION") ))
			{
				//E12CommonUtils.getInstance().checkGPSStatus();
				//E12CustomPlugin.setGPSEnforcedVal( E12Constants.GPS_ENFORCED );
				//Added by Pratheek on 04-07-19[ not to call the gps and network plugin when login in mobile in browser]-Start
				E12CommonUtils.printOnConsole("IShOSTEDMODE 4702!!!["+E12Global.getInstance().isHostedMode()+"]");
				if( !E12Global.getInstance().isHostedMode())
				{
					//E12CustomPlugin.setGPSEnforcedVal( E12Constants.GEO_POS_OPTION );
					E12CustomPlugin.setGPSEnforcedVal( E12Storage.getItemLocalStorage("GEO_POS_OPTION") );
				}
				//Added by Pratheek on 04-07-19[ not to call the gps and network plugin when login in mobile in browser]-End
			}
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 2");
			clear();
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 3");
			super.enter();
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 4");
			//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] start
			if( !E12Global.getInstance().isHostedMode())
			{
				MELogin.checkApkVersion(new Callback<String, String>() {

					@Override
					public void onFailure(String reason)
					{

					}

					@Override
					public void onSuccess(String result) {

						apkVersion = result;
						apkVersion = E12Global.checkNull( apkVersion.substring(apkVersion.indexOf("v") + 1 ) );
						if( !"".equalsIgnoreCase(apkVersion) )
						{
							apkVersion = apkVersion.replace(".", "-");
							version = apkVersion;
							E12Storage.setItem("apkVersion", apkVersion);
						}
					}
				});
				//Changed and Added by Pankaj R on 08-Jan-18 to store current application name [START]
				MELogin.getAppName(new Callback<String, String>() {

					@Override
					public void onSuccess(String result)
					{
						appName = result;
					}

					@Override
					public void onFailure(String reason) {}
				});
				//Changed and Added by Pankaj R on 08-Jan-18 to store current application name[END]
			}
			final E12TextBox nameText = new E12TextBox();
			final E12TextBox serverNameText = new E12TextBox();
			serverNameText.getElement().setId("Server_Name");
			String cancelBtnDispName = "", loginBtnDispName = "", deleteBtnDispName = "" ;
			cancelBtnDispName = E12Constants.constants.setOptCancelLbl();
			loginBtnDispName = E12Constants.constants.setLoginLbl();
			deleteBtnDispName = E12Constants.constants.setDeleteConnLbl();
			final E12TextBox passText = new E12TextBox("password");
			passText.getElement().setId("Password");
			final Button cancelBtn = new Button( cancelBtnDispName );
			cancelBtn.setStyleName("cancelButtonIcon");
			cancelBtn.getElement().setId("Cancel_Button");
			cancelBtn.addStyleName( "icon-cancel" );
			/*if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
			{
				setStyle(cancelBtn, " margin-left: -8px; ");
			}
			else
			{
				setStyle(cancelBtn, " margin-left: -1px; ");
			}*/
			cancelBtn.setTitle(E12Constants.constants.setOptCancelLbl());  //Changes by Raju 19-02-14 for I18N
			/*final Button loginButton = new Button( loginBtnDispName );*/
			final Button loginButton = new Button( "LOGIN" );
			/*loginButton.setStyleName("nextButtonIcon");
			loginButton.addStyleName("nextButton");
			loginButton.addStyleName( "icon-next" );*/
			//Added BY Pratheek[for all devices width and height should be same]-start
			//change by shrutika on 09-04-18 for draw reloging screen according to the prototype.
		//	loginButton.getElement().getStyle().setWidth(240, Unit.PX );
			loginButton.getElement().getStyle().setWidth(250, Unit.PX );
			loginButton.getElement().getStyle().setHeight(35, Unit.PX );
			loginButton.getElement().setId("Login_Button");
			//Added BY Pratheek[for all devices width and height should be same]-End
			loginButton.addStyleName("logInBtn");
			loginButton.setTitle(E12Constants.constants.setNextLbl());  //Changes by Raju 19-02-14 for I18N

			final E12CheckBox rememberPassChk = new E12CheckBox();

			final E12ListBox protocolText = new E12ListBox();
			final E12ListBox loginModeText = new E12ListBox();
			final Label loginModeLable = new Label(E12Constants.constants.setDeviceLbl());

			Label authenLabel = new Label( E12Constants.constants.setCredentialLbl() );

			VerticalPanel vertPanel = new VerticalPanel();
			VerticalPanel vertPanel2 = new VerticalPanel();
			//add final keyword by shrutika on 05-04-18 for used vertPanel3 in on resize method.
			final VerticalPanel vertPanel3 = new VerticalPanel();

			VerticalPanel vertiPnlData = new VerticalPanel();

			Label name = new Label(E12Constants.constants.setUserIdLbl());
			Label pass = new Label(E12Constants.constants.setPasswordLbl());
			//Label workOffline = new Label( "Work Offline" );
			Label rememberPass = new Label(E12Constants.constants.setSavePasswordLbl());

			Label serverName = new Label(E12Constants.constants.setServerLbl());
			Label protocol = new Label(E12Constants.constants.setProtocolLbl());

			//hortPanel.setSize( "100%", "100%" );
			hortPanel.setWidth( "100%" );
			hortPanel.setHeight("100%");
			//hortPanel.getElement().getStyle().setMarginTop(18, Unit.PX);
			hortPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
			hortPanel.addStyleName("hortPanel");
			name.setStyleName("loginText");
			pass.setStyleName("loginText");
			//workOffline.setStyleName( "loginText" );
			rememberPass.setStyleName("loginText");

			serverName.setStyleName("loginText");
			protocol.setStyleName("loginText");
			nameText.setStyleName("loginText");
			passText.setStyleName("loginText");
			nameText.addStyleName("logInScreenTextField");
			passText.addStyleName("logInScreenTextField");
			//passText.addStyleName("passwordTextBox");
			passText.addStyleName("PasswordTextBox");
			loginModeLable.setStyleName("loginText");nameText.getElement().setPropertyString("placeholder", "UserId");
			//Added BY Pratheek[Commented for Custom Input]-Start 15-6-2017
		//	passText.getElement().setPropertyString("placeholder", "Password");
			//Added BY Pratheek[Commented for Custom Input]-End 15-6-2017

			// Added by Yogesh on 24-oct-11 [MO1FSUN001 | To set auth data in
			// browser] end

			protocolText.setStyleName("listText");
			serverNameText.setStyleName("loginText1");

			protocolText.addItem("http");
			protocolText.addItem("https");

			loginModeText.addItem("Mobile", "ME");
			loginModeText.addItem("Tablet", "TABPC");
			try
			{
				if (E12Global.getInstance().getDeviceType() == DeviceType.Tablet) {
					loginModeText.setItemSelected(1, true);
				}
				if( E12Global.getInstance().isMobileDevice() )
				{
					loginModeText.setEnabled( false );
				}
			} catch (Exception e1) {
				Window.alert("Exception : E12ApplicationsPanel: drawConLoginScreen() :" + e1.getMessage());
				e1.printStackTrace();
			}

			final Image img = new Image();
			//Added by Sagar M. to showing client logo as per enterprise[23-Oct-18]START
			E12CommonUtils.printOnConsole("Inside setEnterpriseLogo() : ["+E12Constants.enterprise+"]");
			final String enterprise = E12CommonUtils.checkNull(E12Constants.enterprise);
			//Added By Pratheek[new Login Image]-Start
			//String url = storedHostUrl + "/ibase/images/logInScreen.png";
			String url = storedHostUrl + "/ibase/images/"+enterprise+"_relogin.png";
			//Added By Pratheek[new Login Image]-End
			//Added by Sagar M. to showing client logo as per enterprise[23-Oct-18]END
			img.setUrl(url);
			img.addStyleName("reLogInScreen");
			//Added BY Pratheek[added style to image]-Start 15-6-17
			img.getElement().setAttribute("style", "width: 71%; float: left; padding-left: 14%;");
			//Added BY Pratheek[added style to image]-End 15-6-17
			img.addErrorHandler( new ErrorHandler()
			{
				@Override
				public void onError(ErrorEvent event)
				{
					img.setResource( Resources.INSTANCE.logInScreenIcon() );
					//Change by on 11-04-18 shrutika for img width issue on relogin screen.
					//img.getElement().setAttribute("style", "padding-left: 0px;");
					img.getElement().setAttribute("style", "width: 71%; float: left; padding-left: 14%;");

					//Added by shrutika on 17-04-18 [Start] for login image alignment issue in landscape mode.
					Orientation orientation = E12Global.getInstance().getOrientation();
					//E12CommonUtils.printOnConsole(" 666 E12Global.getInstance().getDeviceOS()....["+E12Global.getInstance().getDeviceOS()+"]\n option["+E12CommonUtils.getInstance().getPlatFormAndDeviceType()+"]");
					String orientationforMobile ="";
					if( E12Global.getInstance().getDeviceOS() != DeviceOS.iOS)
					{
						orientationforMobile =  orientationType();
					}
					if( !orientationforMobile.equalsIgnoreCase("undefined")  && orientationforMobile.contains("-") )
					{
						String orientationArry[] = orientationforMobile.split("-");
						orientationforMobile = orientationArry[0];
					}
					if(orientationforMobile.toString().equalsIgnoreCase("LANDSCAPE") && Window.getClientWidth() < 800)//for android mobile
					{
						img.getElement().setAttribute("style", "width: 45%; float: left; padding-left: 27%;");
					}
					else if(orientation.toString().equalsIgnoreCase("LANDSCAPE") && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )//for android TAB
					{
						vertPanel3.getElement().setAttribute("style", "padding-top: 40px;");
						img.addStyleName("LoginImgWidth");
					}
					//Added by shrutika on 17-04-18 [End] for login image alignment issue in landscape mode.
				}
			});

			VerticalPanel userInfoPanel = new VerticalPanel();
			Label userLabel = new Label();
			//Added By Suraj to Store UserName
			//userLabel.setText(storedUserName);
			E12CommonUtils.printOnConsole("4020 ---Suraj ---currentUserName ["+currentUserName+"] from storage ["+E12Storage.getItemLocalStorage("curUserName")+"] from Constant ["+E12Constants.empName+"]");
			userLabel.setText(  makeCamelCase(currentUserName) );
			//userLabel.addStyleName("userNameLabel");
			//changed by nikita to display username when relogin
			E12CommonUtils.printOnConsole("USERNAME 4014 :  "+E12Constants.empName);
		//	userLabel.setText(E12Constants.empName);
			String deviceType = "Other";
			if ( Window.Navigator.getPlatform().indexOf( "iPhone" ) != -1 )
			{
				 deviceType= "iPhone";
			}
			else if ( Window.Navigator.getPlatform().indexOf( "iPad" ) != -1 )
			{
				deviceType = "iPad";
			}
			else if ( Window.Navigator.getUserAgent().indexOf("Android") != -1 )
			{
				if( Window.Navigator.getUserAgent().indexOf("Mobile") != -1)
				{
					deviceType = "Mobile";
				}
				else
				{
					deviceType = "Tablet";
				}
			}
			final Image userImg = new Image();
			//userImg.setStyleName("logUserImage");
			//added by Nikita S on 4-05-17 [css changes for logo images when relogin in ipad ]start
			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS && "iPad".equalsIgnoreCase(deviceType) )
			{
				userLabel.addStyleName("userNameLabelTab");
			}
			else
			{
				userLabel.addStyleName("userNameLabel");
			}
			//final Image userImg = new Image();
//			userImg.setStyleName("logUserImage");

			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS && "iPad".equalsIgnoreCase(deviceType) )
			{
				userImg.setStyleName("logUserImageTab");
			}
			else
			{
				userImg.setStyleName("logUserImage");
			}
			//added by Nikita S on 4-05-17 [css changes for logo images when relogin in ipad ]End
			// Changed by Abhishek T [For force to download profile image] START
			String userImgPath =  storedHostUrl + "/ibase/resource/images/users/"+ storedUserName + ".png?" + Math.random();
			// Changed by Abhishek T [For force to download profile image] END
			userImg.setUrl(userImgPath);
			/*String path = E12Global.getHostUrl() + "/ibase/resource/images/users/"+ storedUserName;
			userImg.setUrl(E12Global.getHostUrl()+ "/ibase/CustomMenuImageServlet?action=userImage&path="+path+"&fldValue="+storedUserName+"&object=users");*/

			if ( E12Global.getInstance().getDeviceMajorVersion() == DeviceMajorVersion.iOS7 )
			{
				USER_IMG = Resources_iOS7.INSTANCE.userImage();
			}
			else
			{
				USER_IMG = Resources_Android.INSTANCE.userImage();
			}
			userImg.addErrorHandler(new ErrorHandler() {
				@Override
				public void onError(ErrorEvent event) {
					userImg.setResource( USER_IMG );
					String width = "24px" , height = "24px";
					if( E12Global.getInstance().getDeviceMajorVersion() == DeviceMajorVersion.iOS7 )
					{
						width = "38px";
						height = "38px";
					}
					else
					{
						width = "60px";
						height = "60px";
					}
					//CHANGED BY NIKITA ON 16/05/17 [to set image size when user not set image in relogin] start
					if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS && "iPad".equalsIgnoreCase(getDeviceTYpe()) )
					{
						userImg.setStyleName( "logUserImageTab" );
					}
					else
					{
						userImg.setStyleName( "logUserImage" );
					}
					//CHANGED BY NIKITA ON 16/05/17 [to set image size when user not set image in relogin] End.
					//userImg.setStyleName( "logUserImage" );
					userImg.setSize( width, height );
					String style = userImg.getElement().getAttribute( "style" );
					style = style + "; background-size: "+width+"  "+height+" ; border: 1px solid gray;" ;
					userImg.getElement().setAttribute( "style" , style );
				}
			});

			userInfoPanel.setHeight("25px");
			userInfoPanel.getElement().getStyle().setMarginTop(15, Unit.PX);
			userInfoPanel.add(userImg);
			userInfoPanel.add(userLabel);
			vertPanel2.setWidth("100%");
			vertPanel2.add(img);//Changed by ashutosh on 14-April-17[for relogin]
			vertPanel2.add(userInfoPanel);
			vertPanel2.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_CENTER);
			userInfoPanel.setCellHorizontalAlignment(userImg, HasHorizontalAlignment.ALIGN_CENTER);
			userInfoPanel.setCellHorizontalAlignment(userLabel, HasHorizontalAlignment.ALIGN_CENTER);
			vertPanel2.setCellHorizontalAlignment(userInfoPanel, HasHorizontalAlignment.ALIGN_CENTER);
			vertiPnlData.setSpacing(10);
			vertiPnlData.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 5");
			//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
			if ("true".equalsIgnoreCase(E12Storage.getItemLocalStorage("SAVEPASSWORD"))) {
				String uNameText = E12Storage.getItemLocalStorage("USERNAME");
				String uPasstext = E12Storage.getItemLocalStorage("PASSWORD");
				//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End
				nameText.setText(uNameText);
				passText.setText(uPasstext);
			}
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 6");
			//vertiPnlData.add(name);
			//vertiPnlData.add(nameText);
			//vertiPnlData.add(pass);
			//Added BY Pratheek[for all devices width and height should be same]-start
			//passText.getElement().setAttribute("style", "width:240px !important; background-position-y: 11px;");
			passText.getElement().setAttribute("style", "width:250px !important; background-position-y: 11px;");  //Added By B
			passText.getElement().getStyle().setHeight(38, Unit.PX );
			//Added BY Pratheek[for all devices width and height should be same]-End

			//Added by Pratheek[new Style to password for LOgin Page]-Start 15-6-17
			pass.getElement().setAttribute("style", " padding-right: 73px !important; position: relative; float: right;width: 100% !important;");
			//Added by Pratheek[new Style to password for CustomInput]-End 15-6-17

			//Added BY Pratheek[created new Custom Input for Login Page]Start 15-6-17
			E12CustomInput customInput = new E12CustomInput();
			customInput.addTextField(passText, pass, true);
			//vertiPnlData.add(passText);
			vertiPnlData.add(customInput);
			vertiPnlData.setCellHorizontalAlignment(nameText, HasHorizontalAlignment.ALIGN_CENTER);
			//vertiPnlData.setCellHorizontalAlignment(passText, HasHorizontalAlignment.ALIGN_CENTER);
			vertiPnlData.setCellHorizontalAlignment(customInput, HasHorizontalAlignment.ALIGN_CENTER);
			//Added BY Pratheek[created new Custom Input for Login Page]End 15-6-17

			HorizontalPanel horizPanel = new HorizontalPanel();
			final Button editButton = new Button(E12Constants.constants.setSettingBtn());
			TouchWidget editButtonTouchWidget = new TouchWidget( editButton );
			editButton.addStyleName("settingImg");
			editButton.addStyleName("settingBtn");
			//Added By Pratheek[to disbale setting Button]-Start 15-6-17
			editButton.getElement().setId("Setting_Button");
			editButtonTouchWidget.setVisible(true);
			//Added By Pratheek[to disbale setting Button]-End 15-6-17
			final E12ListBox connModeLst = new E12ListBox();
//			//Added By Pratheek[to set ConnectionList fixed Height and Width]-Start
			//commented by shrutika on 06-04-18 for alignment issue in relogin screen.
			//connModeLst.getElement().setAttribute("style", "width:68px !important;");
			connModeLst.getElement().getStyle().setHeight(25, Unit.PX );
			//connModeLst.addItem( E12Constants.constants.setOnlineMode() );
			connModeLst.addItem( E12Constants.constants.setAutoMode() );
			if(!"0".equalsIgnoreCase(connOption) && !"".equalsIgnoreCase(connOption))//Changed by ashutosh on 13 feb 2017 [For 0 and null options]
			{
				//connModeLst.addItem( E12Constants.constants.setOfflineMode() );
				//connModeLst.addItem( E12Constants.constants.setAutoMode() );
				connModeLst.addItem( E12Constants.constants.setOnlineMode() );
				/*if(!"1".equalsIgnoreCase(connOption))
				{
					connModeLst.addItem( E12Constants.constants.setAutoMode() );
				}*/
			}
			connModeLst.setSelectedIndex(0);
			connModeLst.setVisibleItemCount(1);
			connModeLst.addStyleName("logInConnMode");
			if( connModeLst.getItemCount() == 1 )
			{
				connModeLst.setVisible(false);
			}

			//Temperary commented by Sagar B [09-Feb-19]START
//			if( ! CommonPhoneGapUtil.checkNetwork() )
//			{
//				connModeLst.setSelectedIndex(1);
//			}
			//Temperary commented by Sagar B [09-Feb-19]END

			if( Storage.isSupported() == false )
			{
				connModeLst.setSelectedIndex(0);
				connModeLst.setEnabled(false);
			}
			horizPanel.setSpacing( 5 );
			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS && "iPad".equalsIgnoreCase(deviceType) )
			{
				horizPanel.getElement().setAttribute("style", "width: 35%; position: relative;");
			}
			else
			{
				//Added by shrutika on 06-04-18 for alignment issue in relogin screen.
				//horizPanel.addStyleName("logInHorizPanel");
				horizPanel.getElement().setAttribute("style", "position: relative;");
			}
//			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
//			{
//				connModeLst.getElement().setAttribute("style", "padding-left: 57%;float: left;");
//			}
//			else
//			{
//				connModeLst.getElement().setAttribute("style", "padding-left: 69%;float: left;");
//			}
			horizPanel.add( editButtonTouchWidget );
			horizPanel.add( connModeLst );
			horizPanel.setCellHorizontalAlignment(editButtonTouchWidget, HasHorizontalAlignment.ALIGN_LEFT);
			horizPanel.setCellHorizontalAlignment(connModeLst, HasHorizontalAlignment.ALIGN_RIGHT);
			//Added by shrutika on 05-04-18 for alignment issue in relogin screen.
			horizPanel.setCellWidth(editButtonTouchWidget, "30%");
			horizPanel.setCellWidth(connModeLst, "50%");

			//vertiPnlData.add(loginModeLable);
			//vertiPnlData.add(loginModeText);

			rememberPassChk.setValue("true".equalsIgnoreCase(E12Storage.getItemLocalStorage("SAVEPASSWORD")));
			HorizontalPanel hRemPassPnl = new HorizontalPanel();
			hRemPassPnl.add(rememberPass);
			hRemPassPnl.add(rememberPassChk);

			// Changes Dnyaneshwar on 18-12-12 [DC2ISUN001 || Save password check  box hide ] Start
			// vertiPnlData.add(hRemPassPnl);
			// Changes Dnyaneshwar on 18-12-12 [DC2ISUN001 || Save password check  box hide ] End

			//vertiPnlData.add(serverName);
			//vertiPnlData.add(serverNameText);

			/*vertiPnlData.add(protocol);
			vertiPnlData.add(protocolText);*/
			//Commented by Dnyneshwar chavan [remove the protocol as KBSir] 13-JUL-13 End

			//Add by Dnyaneshwar Chavan on 25-MAR-2011 [ Implement touch event only for mobile devices ] Start
			TouchWidget loginButtonTouchWidget = new TouchWidget( loginButton );
			vertiPnlData.add(loginButtonTouchWidget);
			vertiPnlData.setCellHorizontalAlignment(loginButtonTouchWidget, HasHorizontalAlignment.ALIGN_CENTER);
			vertiPnlData.add(horizPanel);
			vertiPnlData.setCellHorizontalAlignment(horizPanel, HasHorizontalAlignment.ALIGN_CENTER);
			//Add by Dnyaneshwar Chavan on 25-MAR-2011 [ Implement touch event only for mobile devices ] End
			//Added by Harshada on 5th Dec 2012 [creating user connections on login] START

			e12WizardFooter = new E12HeaderFooter();
			Widget footerNavWidget =  e12WizardFooter.createFooter(null, FooterType.FOOTERTYPE_TWO);

			//e12WizardFooter.addWidgetInFooter(loginButtonTouchWidget, 1);
			if( Window.Navigator.getUserAgent().indexOf("Zetakey") != -1 || ( E12Global.getInstance().hostedMode && Window.getClientWidth() < 300 ) )
			{
				loginButtonTouchWidget.addStyleName("lastWidgetButton");
			}
			/*HorizontalPanel navigationPnl = new HorizontalPanel();
			navigationPnl.setSize("100%", "100%");

			navigationPnl.add(cancelBtn);
			navigationPnl.add(loginButton);
			//navigationPnl.setCellHorizontalAlignment(backBtn, HasHorizontalAlignment.ALIGN_LEFT);
			navigationPnl.setCellHorizontalAlignment(loginButton, HasHorizontalAlignment.ALIGN_RIGHT);
			*/
			String storedUName = E12ApplicationsPanel.storedUserName;
			final String storedIp = E12ApplicationsPanel.storedServerIP;


			//vertiPnlData.add(navigationPnl);
			//outerHeaderPanel.setVisible(false);
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 7");
			flowPanel.remove(outerHeaderPanel);
			contents.getElement().getStyle().setPaddingTop(0, Unit.PX);
			contents.getElement().getStyle().setPaddingBottom(0, Unit.PX);
			//added by sandip on 8.5.17 for exit button issue
			outerFooterPanel.getElement().getStyle().setHeight(0, Unit.PX);
			double clientHt = Window.getClientHeight();
			contents.getElement().getStyle().setHeight(clientHt, Unit.PX);
			//setFooter(footerNavWidget);
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 8");
			setFooter(null);
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 9");
			editButton.addClickHandler(new ClickHandler() {

				@Override
				public void onClick(ClickEvent event)
				{
					//showPwdPnl.hide(true);
					loginButton.setEnabled( false );

					if( MELogin.isLoginHostedStr.equalsIgnoreCase("Login:True") && MELogin.serverStatus==true)
					{
						new MELogin( "Login:True:#Edit");
					}
					else
					{
                       //Added by sunny soni for set true to authenticating from setting options of a single connection 30-Aug-21[Start]
						if (!E12Global.getInstance().isHostedMode())
						{
							isLoginFromSettingOptions = true;
						}						
						//Added by sunny soni for set true to authenticating from setting options of a single connection 30-Aug-21[End] 
                        new MELogin( "Login:False:#Edit");
					}

				}
			});

			vertPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
			authenLabel.setStyleName("authenTitle");
			//vertPanel.add(authenLabel); //Commented by Dnyaneshwar Chavan on 27-Jul-15 [ Remove the 'Credential' text as per KB Sir.]
			//vertPanel.add(authenLabel);

			vertPanel.add(vertiPnlData);
			vertPanel.setWidth("100%");
			//vertPanel.getElement().getStyle().setPaddingTop(10, Unit.PX);//Commeted by ashutosh on 14-April-17[for relogin]
			vertiPnlData.setWidth("100%");

			final Label horizontalLine = new Label();
			horizontalLine.addStyleName("logInLine");
			int clientWidth =Window.getClientWidth();
			E12CommonUtils.printOnConsole("clientWidth "+clientWidth);
			horizontalLine.getElement().getStyle().setWidth(clientWidth, Unit.PX);
			Button exitBtn = new Button("Exit");
			exitBtn.getElement().setId("Exit_Button");
			TouchWidget exitBtnTouchWidget = new TouchWidget( exitBtn );
			exitBtnTouchWidget.addStyleName("exitImg");
			exitBtnTouchWidget.addStyleName("exitBtn");
			if( E12Global.getInstance().isHostedMode() )
			{
				exitBtn.setEnabled(false);
			}
			//Added BY Pratheek[to disable the exit BUtton in IOS]-Start 15-6-17
			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
			{
				horizontalLine.setVisible(false);
				exitBtnTouchWidget.setVisible(false);
			}
			//Added BY Pratheek[to disable the exit BUtton in IOS]-End 15-6-17
			vertPanel3.add(horizontalLine);
			vertPanel3.add(exitBtnTouchWidget);
			vertPanel3.setCellHorizontalAlignment(horizontalLine, HasHorizontalAlignment.ALIGN_CENTER);
			vertPanel3.setCellHorizontalAlignment(exitBtnTouchWidget, HasHorizontalAlignment.ALIGN_CENTER);
			hortPanel.add(vertPanel2);
			hortPanel.add(vertPanel);
			//Added by shrutika on 13-04-04 for cancel button alignment issue in IOS.
			vertPanel3.setWidth("100%");
			//changed by vishal on 8.5.17 for exit button issue
        	hortPanel.add(vertPanel3);
			hortPanel.setCellHeight(vertPanel2, "50%");
			hortPanel.setCellHeight(vertPanel, "40%");
			//contents.add(hortPanel);
			hortPanel.setCellVerticalAlignment( vertPanel2, HasVerticalAlignment.ALIGN_BOTTOM);//Changed by ashutosh on 14-April-17[for relogin]
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 10");
			add(hortPanel);
			flowPanel.getElement().getStyle().clearDisplay();
			E12CommonUtils.printOnConsole("inside drawNewConLoginScreen 11");
			// Add Dnyaneshwar on 17/12/12 [DC2ISUN001 || Login page set a Logo and Background texture ] Start
			if ( Window.Navigator.getPlatform().indexOf("iPad") != -1 ||
				( Window.Navigator.getUserAgent().indexOf("Android") != -1 && Window.Navigator.getUserAgent().indexOf("Mobile") == -1 ) )
			{
				final Image logo = new Image( E12Global.getInstance().getClientLogoPath() );
				removeStyleName(getStyleName().toString());
				//Commented Dnyaneshwar on 28-JUN-13 [ Remove the background image as per KB Sir] Start
				//contents.addStyleName("backgroundTexture");
				//Commented Dnyaneshwar on 28-JUN-13 [ Remove the background image as per KB Sir] End
				setStyleName("SliderPanelBackgroundTransparent");
				//Commented By Sandeep
//				hortPanel.add( logo );
//				hortPanel.setCellWidth( vertPanel, "35%" );
//				hortPanel.setCellWidth( logo, "65%" );
//				hortPanel.setCellVerticalAlignment( logo, HasVerticalAlignment.ALIGN_MIDDLE );
				//Added by Dnyaneshwar Chavan on 12-FEB-13 [ if client logo not present then set defauld image as per KB Sir ] Start
				logo.addErrorHandler(new ErrorHandler() {

					@Override
					public void onError(ErrorEvent event) {
						logo.setResource( Resources.INSTANCE.defaultClientLogo() );
					}
				});
				//Added by Dnyaneshwar Chavan on 12-FEB-13 [ if client logo not present then set defauld image as per KB Sir ] End

			}
			// Add Dnyaneshwar on 17/12/12 [DC2ISUN001 || Login page set a Logo and Background texture ] End

			//Added by shrutika on 12-04-18 [Start] for login image alignment issue.
			Orientation orientation = E12Global.getInstance().getOrientation();
			if(orientation.toString().equalsIgnoreCase("PORTRAIT") && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )//for android TAB
			{
				img.addStyleName("LoginImgWidth");
			}
			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
			{
				img.addStyleName("LoginImgWidth");

			}
			//Added by shrutika on 12-04-18 [Start] for login image alignment issue.
			exitBtn.addClickHandler(new ClickHandler() {

				@Override
				public void onClick(ClickEvent event) {
					E12CommonUtils.printOnConsole("E12ApplicationPanel ::5792");
						exitApp();
				}
			});

			nameText.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event) {
					if (event.getNativeKeyCode() == 13) {
						loginButton.click();
					}
				}
			});
			passText.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event) {
					if (event.getNativeKeyCode() == 13) {
						loginButton.click();
					}
				}
			});
			serverNameText.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event) {
					if (event.getNativeKeyCode() == 13) {
						loginButton.click();
					}
				}
			});

			rememberPassChk.addClickHandler(new ClickHandler()
			{
				public void onClick(ClickEvent event) {
					if (rememberPassChk.getValue()) {
						boolean value = Window
								.confirm(E12Constants.constants.setMsgSavePassword());
						E12Storage.setItem("SAVEPASSWORD", value + "");
						rememberPassChk.setValue(value);
					} else {
						E12Storage.setItem("USERNAME", "");
						E12Storage.setItem("PASSWORD", "");
						E12Storage.setItem("SAVEPASSWORD", "");
					}
				}
			});

			/**
			 * This method is for to know that whether browser supports Offline
			 * login ?
			 */
			if (Storage.isSupported() == true) {
				nameText.addBlurHandler(new BlurHandler() {
					public void onBlur(BlurEvent event) {
						serverNameText.setText(storedIp);
					}
				});
			}

			/**
			 * onClick of login it will authenticate user and Display the home page.
			 */
			loginButton.addClickHandler(new ClickHandler()
			{
				public void onClick(ClickEvent event)
				{
					E12CommonUtils.printOnConsole("E12ApplicationLogin Login button clicked hostedMode:["+E12Global.getInstance().isHostedMode()+"]");
					//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked] - Start
					if( !E12Global.getInstance().isHostedMode() )
					{
						E12CommonUtils.getInstance().getIMEINumber();
						E12CommonUtils.printOnConsole("In login@@ IMEI No:["+E12Global.getInstance().getDeviceIMEINo()+"]");
					}
					//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked] - End
					//Added By Ajinkya Gopalkar on 6-Jan-16[For checking gps after defined interval]
					E12CommonUtils.printOnConsole("In E12ApplicationPanel 4997loginBtn click GEOPOS_STATUS["+E12Constants.GEOPOS_STATUS+"] E12Global.getInstance().isOffline() ["+E12Global.getInstance().isOffline()+"]");
					//if( "true".equalsIgnoreCase( E12Storage.getItem("GPS_ENABLED") ) && E12Constants.GEOPOS_STATUS == false)
					//Commented unnecessary code Sagar B.[07-Feb-2020]START
//					if( !"0".equalsIgnoreCase( E12Storage.getItemLocalStorage("GEO_POS_OPTION") ) && E12Constants.GEOPOS_STATUS == false)
//					{
//						Window.alert("Device GPS is OFF - This app requires GPS location. \nPlease turn ON GPS and Try Again.");
//						//showPwdPnl.hide();
//						E12Constants.GEOPOS_STATUS = true;
//						return;
//					}
					//Commented unnecessary code Sagar B.[07-Feb-2020]END
					loginButton.setEnabled( false );
					editButton.setEnabled( false );
					E12Global.getInstance().resetSessionExpired();
					//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk]
					E12Global.getInstance().setRedirectToLoginPage(false);
					final String passwordTxt= passText.getText();
					if ( "".equals( passwordTxt ) || passwordTxt.trim().isEmpty())
					{
						Window.alert( E12Constants.constants.setMsgInvalidPassword() );
//						E12CustomMessageBox.alertMessage( "Error" , E12Constants.constants.setMsgInvalidPassword() );
						loginButton.setEnabled( true );
						editButton.setEnabled( true );
						displayPwd().hide(false);
						return;
					}
					else
					{

						E12Constants.conApplNm = selectedApp;
						E12Constants.hostUrl = storedHostUrl;
						E12Storage.setItem("hostUrl", storedHostUrl);
						final String passwordSha256 = SHA256.toSha256( passwordTxt );
						final String e12StorageKeyUser = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName +"&conApplNm=" + E12Constants.conApplNm ;
						final String e12StorageKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;
						final String e12offlinePwdKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER="+ storedUserName + "&PASSWORD="+ passwordSha256;

						//Changed By Mahesh Patidar on 28/DEC/12
						HashMap<String, String> paramMap = new HashMap<String, String>();

						paramMap.put("USER", storedUserName);
						paramMap.put("PASSWORD", passwordSha256);
						paramMap.put("action", "MELOGIN");
						paramMap.put("isSHA256Appld", "true");
						paramMap.put("conApplNm", E12Constants.conApplNm);
						//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] START
						paramMap.put("DEVICETYPE", E12CommonUtils.getInstance().getPlatFormAndDeviceType() );
						paramMap.put("DEVICEUUID", CommonPhoneGapUtil.getInstance().getDeviceUuid() );
						paramMap.put("DEVICEID", E12AppInfo.getInstance().getRegisterIdOrDeviceToken() );
						//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] END
						//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[START]
						if( !E12Global.getInstance().isHostedMode() )
						{
							paramMap.put("CURRENTAPKVERSION", version);
							paramMap.put("APP_NAME", appName);
							paramMap.put("BATTERY_STATUS", E12Global.getInstance().getBatteryStatus());
							paramMap.put("IMEI_NO", E12Global.getInstance().getDeviceIMEINo());
						}
						//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[END]
						paramMap.put("ACTIVE", "Y");
						//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -Start
						//String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
                        final String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
                        E12Global.getInstance().setDataModelDownload("D"); //Added by Jatin M on 10-May-2022 - [To download only dirty data models on relogin]
                        E12CommonUtils.printOnConsole("E12ApplicationPanel-03 getDataModelDownload ::: ["+E12Global.getInstance().getDataModelDownload()+"]");
						if(E12Global.getInstance().getDeviceOS()==DeviceOS.Android || E12Global.getInstance().getDeviceOS()==DeviceOS.iOS)
						{
							//path = storedHostUrl + "/ibase/AuthenticateServlet?" + paramString ;
							path = storedHostUrl + "/ibase/AuthenticateServlet?";
						}
						else{
							//path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?" + paramString ;
							path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?";
						}
						//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -End

						//Added by Sandeep Shelar on 26/02/16 [For onResume Event] Start
						E12Storage.localStorageVars.add(E12Global.getConnectionId()+"AuthenticateURL");
						//Added by Sainath T. on 20-Aug-19 [To add paramString to path and set it to E12Storage]
						E12Storage.setItem(E12Global.getConnectionId()+"AuthenticateURL", path + paramString);
                        //Added by Sandeep Shelar on 26/02/16 [For onResume Event] End

						//Added by Prajyot [To send new request each time]
						//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
                        //path = path + "&dummyInt=" + Math.random();
						path = path + "dummyInt=" + Math.random();
//						String path = MELogin.hostUrl + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;

						//Ended By Mahesh Patidar

						StorageKeys.setUsername( storedUserName );
						DataSyncCache.setUsername( storedUserName );
						//Commented by Suraj to remove offline mode
						//E12Global.getInstance().setOffline(false);
						if( E12Constants.constants.setAutoMode().equalsIgnoreCase(connModeLst.getSelectedValue()) )
						{
							//Commented by Suraj to remove offline mode
							//E12Global.getInstance().setOffline(false);
							E12Global.getInstance().setConnectionMode(ConnectionMode.AUTO);
						}
						else if( E12Constants.constants.setOnlineMode().equalsIgnoreCase(connModeLst.getSelectedValue()) )
						{
							//Commented by Suraj to remove offline mode
							//E12Global.getInstance().setOffline(false);
							E12Global.getInstance().setConnectionMode(ConnectionMode.ONLINE);
						}
						//Commented by Suraj to remove offline mode
						/*else if( E12Constants.constants.setOfflineMode().equalsIgnoreCase(connModeLst.getSelectedValue()) )
						{
							E12Global.getInstance().setOffline(true);
							E12Global.getInstance().setConnectionMode(ConnectionMode.OFFLINE);
						}*/
						//Changed by Prasad R on 06/03/19 [to resolve invalid password related login] START
						if(  E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO )
						{
							E12Storage.getItem(e12StorageKeyUser, new Callback<String, String>() {

								@Override
								public void onFailure(String reason)
								{
									Window.alert( "Exception when click on login button, getting value from websql  ["+reason+"]" );
								}

								@Override
								public void onSuccess(String serverResponse)
								{
									E12CommonUtils.printOnConsole("In E12ApplicationPanel serverResponse ["+serverResponse+"]");
									E12CommonUtils.printOnConsole("In E12ApplicationPanel e12offlinePwdKey ["+e12offlinePwdKey+"]");
									if( serverResponse != null )
									{
										E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {

											@Override
											public void onSuccess(String serverResponse )
											{
												E12CommonUtils.printOnConsole("In E12ApplicationPanel getItem serverResponse ["+serverResponse+"]");
												final String offlineKeyResponse = serverResponse;
												if( offlineKeyResponse == null || "".equalsIgnoreCase(offlineKeyResponse) )
												{
													Window.alert( E12Constants.constants.setPwdNotMatched() ); //Changes by Raju 19-02-14 for I18N
													loginButton.setEnabled( true );
													editButton.setEnabled( true );
													//showPwdPnl.hide(false);
													return;
												}

												E12CustomPlugin.checkBandwidth(new CallBack()
												{
													@Override
													public void onSuccess(String result)
													{
														E12CommonUtils.printOnConsole("In E12ApplicationPanel drawNewConLoginScreen checkBandwidth on Success"+result);
														if( result.indexOf("POOR") != -1 )
														{
															String loginResponse = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, new DummyResponse(offlineKeyResponse), e12StorageKey, editButton);
															E12CommonUtils.printOnConsole("In E12ApplicationPanel loginResponse ["+loginResponse+"]");
															if(loginResponse.equals("Yes"))
															{
																loginButton.setEnabled( false );
																editButton.setEnabled( false );
																//showPwdPnl.hide(true);
															}
															else
															{
																//showPwdPnl.hide(false);
																return;
															}
														}
														else
														{
															E12CommonUtils.printOnConsole("In E12ApplicationPanel Other Thane POOR");
															//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] Start
															//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
															//RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, path );
															RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.POST, path );
															requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");

															//added by vishal p. on 06/10/17 [for showing alert msg on login if user enetered wrong url or server is not started]
															//E12Global.getInstance().checkIsNetworkActiveFirst(path, loginButton);
															try
															{

																E12Global.getInstance().setLoading(true);
																E12Global.getInstance().checkIsNetworkActiveFirst( loginButton , false );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
																//requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
																requestStatus = requestBuilder.sendRequest( paramString, new RequestCallback()
																{
																	public void onResponseReceived( Request request, final Response response )
																	{
																		//Change by shrutika on 28-03-20 [Start] for max_session_allwd configuration not working in case of mobile for relogin screen.
																		E12Global.getInstance().checkErrorException(response, 0, new CallbackHandler() {
																			
																			@Override
																			public void onCallback(boolean result) {
																				E12CommonUtils.printOnConsole("E12eqBuilder 286 isValidationRequired ["+result+"]");
																				
																				if( result )
																				{
																					String buildVersion = "";
																					//Document dom = null;
																					boolean deleteCacheReqd = false;
																					//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked]
																					loginResponseToVerifyConn(loginButton, editButton, deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, passText, passwordTxt, passwordSha256, response);																				
																				}
																			}
																		});
																		//Change by shrutika on 28-03-20 [End] for max_session_allwd configuration not working in case of mobile for relogin screen.
																		
																		E12Global.getInstance().setLoading(false);
																		/*final String responseStr = response.getText();
																		String buildVersion = "";
																		//Document dom = null;
																		boolean deleteCacheReqd = false;
																		//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked]
																		loginResponseToVerifyConn(loginButton, editButton, deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, passText, passwordTxt, passwordSha256, response);*/
																	}
																	//Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
																	public void onError( Request request, Throwable exception )
																	{
																		E12Global.getInstance().setLoading(false);
																		loginButton.setEnabled(true);
																		editButton.setEnabled( true );
																		//showPwdPnl.hide(false);
																		Window.alert( "Error in getting response E12Applications " );
																		return;
																	}
																});

															}
															catch( RequestException re )
															{
																loginButton.setEnabled(true);
																editButton.setEnabled( true );
																//displayPwd().hide(false);
																E12CommonUtils.printOnConsole( "Exception login failed: " + re );
																return;
															}
															//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] End
														}
													}

													@Override
													public void onError(String error)
													{
														E12CommonUtils.printOnConsole("In E12ApplicationPanel drawNewConLoginScreen checkBandwidth onError"+error);
														error = E12Global.checkNull( error );
														//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Commented code by Sagar B. for offline related changes [9-Feb-19]
														loginButton.setEnabled( true );
														//Added by Sagar B. for offline related changes [9-Feb-19]START
														if( E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO && E12Global.getInstance().isOffline() /*&& "0".equals( E12Constants.NETWORK_OPTION )*/ )
														{
															E12Storage.getItem(e12StorageKeyUser, new Callback<String, String>()
															{
																@Override
																public void onFailure(String reason) {
																	Window.alert( "Exception when click on login button, getting value from websql  ["+reason+"]" );
																}
																@Override
																public void onSuccess(String serverResponse) {
																	E12CommonUtils.printOnConsole("In E12ApplicationPanel serverResponse ["+serverResponse+"]");
																	if( serverResponse == null )
																	{
																		Window.alert( E12Constants.constants.setNoofflinedataavailLbl() +storedUserName);
																		loginButton.setEnabled( true );
																		editButton.setEnabled( true );
																		//showPwdPnl.hide(false);
																		return;
																	}
																	E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {
																		//													E12Storage.getItem(e12StorageKey, new Callback<String, String>() {
																		@Override
																		public void onSuccess(String serverResponse )
																		{
																			E12CommonUtils.printOnConsole("In E12ApplicationPanel getItem serverResponse ["+serverResponse+"]");
																			if( serverResponse == null || "".equalsIgnoreCase(serverResponse) )
																			{
																				Window.alert( E12Constants.constants.setPwdNotMatched() ); //Changes by Raju 19-02-14 for I18N
																				loginButton.setEnabled( true );
																				editButton.setEnabled( true );
																				//showPwdPnl.hide(false);
																				return;
																			}
																			String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, new DummyResponse(serverResponse), e12StorageKey, editButton);
																			E12CommonUtils.printOnConsole("In E12ApplicationPanel result ["+result+"]");
																			if(result.equals("Yes")){
																				loginButton.setEnabled( false );
																				editButton.setEnabled( false );
																				//showPwdPnl.hide(true);
																			}
																			else
																			{
																				//showPwdPnl.hide(false);
																				return;
																			}
																		}
																		@Override
																		public void onFailure(String reason){
																		}
																	});
																}
															});
														}
														//Added code by Sagar B. for offline related changes [9-Feb-19]END
														else
														{
															loginButton.click();  //Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue
														}
													}
												});
											}

											@Override
											public void onFailure(String reason)
											{

											}
										});
									}
								}
							});

							/*E12CustomPlugin.checkBandwidth(new CallBack(){

								@Override
								public void onSuccess(String result)
								{
									E12CommonUtils.printOnConsole("In E12ApplicationPanel drawNewConLoginScreen checkBandwidth on Success"+result);
									if( result.indexOf("POOR") != -1 )
									{
										E12Storage.getItem(e12StorageKeyUser, new Callback<String, String>()
										{
											@Override
											public void onFailure(String reason) {
												Window.alert( "Exception when click on login button, getting value from websql  ["+reason+"]" );
											}
											@Override
											public void onSuccess(String serverResponse) {
												E12CommonUtils.printOnConsole("In E12ApplicationPanel serverResponse ["+serverResponse+"]");
												if( serverResponse == null )
												{
													Window.alert( E12Constants.constants.setNoofflinedataavailLbl() +storedUserName);
													loginButton.setEnabled( true );
													editButton.setEnabled( true );
													//showPwdPnl.hide(false);
													return;
												}
												E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {
													//													E12Storage.getItem(e12StorageKey, new Callback<String, String>() {
													@Override
													public void onSuccess(String serverResponse )
													{
														E12CommonUtils.printOnConsole("In E12ApplicationPanel getItem serverResponse ["+serverResponse+"]");
														if( serverResponse == null || "".equalsIgnoreCase(serverResponse) )
														{
															Window.alert( E12Constants.constants.setPwdNotMatched() ); //Changes by Raju 19-02-14 for I18N
															loginButton.setEnabled( true );
															editButton.setEnabled( true );
															//showPwdPnl.hide(false);
															return;
														}
														String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, new DummyResponse(serverResponse), e12StorageKey, editButton);
														E12CommonUtils.printOnConsole("In E12ApplicationPanel result ["+result+"]");
														if(result.equals("Yes")){
															loginButton.setEnabled( false );
															editButton.setEnabled( false );
															//showPwdPnl.hide(true);
														}
														else
														{
															//showPwdPnl.hide(false);
															return;
														}
													}
													@Override
													public void onFailure(String reason){
													}
												});
											}
										});
									}
									else
									{
										E12CommonUtils.printOnConsole("In E12ApplicationPanel Other Thane POOR");
										//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] Start
										{
											RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, path );
											//added by vishal p. on 06/10/17 [for showing alert msg on login if user enetered wrong url or server is not started]
											//E12Global.getInstance().checkIsNetworkActiveFirst(path, loginButton);
											try
											{

												E12Global.getInstance().setLoading(true);
												E12Global.getInstance().checkIsNetworkActiveFirst( loginButton , false );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
												requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
												{
													public void onResponseReceived( Request request, final Response response )
													{
														E12Global.getInstance().setLoading(false);
														final String responseStr = response.getText();
														String buildVersion = "";
														//Document dom = null;
														boolean deleteCacheReqd = false;
														//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked]
														loginResponseToVerifyConn(loginButton, editButton, deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, passText, passwordTxt, passwordSha256, response);
													}
													//Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
													public void onError( Request request, Throwable exception )
													{
														E12Global.getInstance().setLoading(false);
														loginButton.setEnabled(true);
														editButton.setEnabled( true );
														//showPwdPnl.hide(false);
														Window.alert( "Error in getting response E12Applications " );
														return;
													}
												});

											}
											catch( RequestException re )
											{
												loginButton.setEnabled(true);
												editButton.setEnabled( true );
												//displayPwd().hide(false);
												E12CommonUtils.printOnConsole( "Exception login failed: " + re );
												return;
											}
										}
										//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] End
									}
								}

								@Override
								public void onError(String error) {
									E12CommonUtils.printOnConsole("In E12ApplicationPanel drawNewConLoginScreen checkBandwidth onError"+error);
									error = E12Global.checkNull( error );
									//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Commented code by Sagar B. for offline related changes [9-Feb-19]
									loginButton.setEnabled( true );
									//Added by Sagar B. for offline related changes [9-Feb-19]START
									if( E12Global.getInstance().getConnectionMode() == ConnectionMode.AUTO && E12Global.getInstance().isOffline() && "0".equals( E12Constants.NETWORK_OPTION ) )
									{
										E12Storage.getItem(e12StorageKeyUser, new Callback<String, String>()
										{
											@Override
											public void onFailure(String reason) {
												Window.alert( "Exception when click on login button, getting value from websql  ["+reason+"]" );
											}
											@Override
											public void onSuccess(String serverResponse) {
												E12CommonUtils.printOnConsole("In E12ApplicationPanel serverResponse ["+serverResponse+"]");
												if( serverResponse == null )
												{
													Window.alert( E12Constants.constants.setNoofflinedataavailLbl() +storedUserName);
													loginButton.setEnabled( true );
													editButton.setEnabled( true );
													//showPwdPnl.hide(false);
													return;
												}
												E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {
													//													E12Storage.getItem(e12StorageKey, new Callback<String, String>() {
													@Override
													public void onSuccess(String serverResponse )
													{
														E12CommonUtils.printOnConsole("In E12ApplicationPanel getItem serverResponse ["+serverResponse+"]");
														if( serverResponse == null || "".equalsIgnoreCase(serverResponse) )
														{
															Window.alert( E12Constants.constants.setPwdNotMatched() ); //Changes by Raju 19-02-14 for I18N
															loginButton.setEnabled( true );
															editButton.setEnabled( true );
															//showPwdPnl.hide(false);
															return;
														}
														String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, new DummyResponse(serverResponse), e12StorageKey, editButton);
														E12CommonUtils.printOnConsole("In E12ApplicationPanel result ["+result+"]");
														if(result.equals("Yes")){
															loginButton.setEnabled( false );
															editButton.setEnabled( false );
															//showPwdPnl.hide(true);
														}
														else
														{
															//showPwdPnl.hide(false);
															return;
														}
													}
													@Override
													public void onFailure(String reason){
													}
												});
											}
										});
									}
									//Added code by Sagar B. for offline related changes [9-Feb-19]END
									else
									{
										loginButton.click();  //Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue
									}
								}
							});*/
							//Changed by Prasad R on 06/03/19 [to resolve invalid password related login] END
						}
						else if(  E12Global.getInstance().getConnectionMode() == ConnectionMode.ONLINE )
						{
							//Changed by Prasad R on 07/03/19 [to resolve invalid password related login] START
							E12Storage.getItem(e12StorageKeyUser, new Callback<String, String>() {

								@Override
								public void onFailure(String reason)
								{
									Window.alert( "Exception when click on login button, getting value from websql  ["+reason+"]" );
								}

								@Override
								public void onSuccess(String serverResponse)
								{
									E12CommonUtils.printOnConsole("In E12ApplicationPanel serverResponse ["+serverResponse+"]");
									E12CommonUtils.printOnConsole("In E12ApplicationPanel e12offlinePwdKey ["+e12offlinePwdKey+"]");
									if( serverResponse != null )
									{
										E12Storage.getItem(e12offlinePwdKey, new Callback<String, String>() {

											@Override
											public void onSuccess(String serverResponse )
											{
												E12CommonUtils.printOnConsole("In E12ApplicationPanel getItem serverResponse ["+serverResponse+"]");
												final String offlineKeyResponse = serverResponse;
												if( offlineKeyResponse == null || "".equalsIgnoreCase(offlineKeyResponse) )
												{
													Window.alert( E12Constants.constants.setPwdNotMatched() ); //Changes by Raju 19-02-14 for I18N
													loginButton.setEnabled( true );
													editButton.setEnabled( true );
													//showPwdPnl.hide(false);
													return;
												}

												E12CustomPlugin.checkBandwidth(new CallBack()
												{
													@Override
													public void onSuccess(String result) {

														if( result.indexOf("POOR") == -1 )
														{
															//RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, path );
															RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.POST, path );
															requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");
															//added by vishal p. on 06/10/17 [for showing alert msg on login if user enetered wrong url or server is not started]
															//E12Global.getInstance().checkIsNetworkActiveFirst(path, loginButton);
															try
															{
																E12Global.getInstance().setLoading(true);
																E12Global.getInstance().checkIsNetworkActiveFirst( loginButton , false );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
																//requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
																requestStatus = requestBuilder.sendRequest( paramString, new RequestCallback()
																{
																	public void onResponseReceived( Request request, final Response response )
																	{
																		E12Global.getInstance().setLoading(false);
																		final String responseStr = response.getText();
																		final String buildVersion = "";
																		//Document dom = null;
																		boolean deleteCacheReqd = false;
																		//Changes made by Pratheek on 04-11-19[ to show custom alert in mobile same as in browser]-Start
																		String messageIdVal = "";
																		//Changes made by Pratheek on 04-11-19[ to show custom alert in mobile same as in browser]-End
																		if( !"".equalsIgnoreCase(responseStr) )
																		{
																			Document dom = XMLParser.parse(responseStr);
																			XMLParser.removeWhitespace(dom);
																			//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] Start
																			String typeNodeValue = "";
																			String message = "";
																			String messageId = "";
																			if( dom.getElementsByTagName("Message").item(0) != null )
																			{
																				Node msg = dom.getElementsByTagName("Message").item(0);
																				if( msg != null )
																				{
																					Node type = msg.getAttributes().getNamedItem("type");
																					if( type != null )
																					{
																						typeNodeValue = E12Global.checkNull( type.getNodeValue() );
																					}
																					Node msgId = msg.getAttributes().getNamedItem("id");
																					if( msgId != null )
																					{
																						messageId = E12Global.checkNull( msgId.getNodeValue() );
																					}
																				}
																			}
																			messageIdVal = messageId.trim();
																			E12CommonUtils.printOnConsole("Inside E12ApplicationPanel messageIdVal "+messageIdVal);
																			if( "SESSEXIST".equalsIgnoreCase(messageId.trim()) )
																			{
																				E12CommonUtils.printOnConsole("Inside E12ApplicationPanel 6014!!!!!");
																				if( dom.getElementsByTagName("message").item(0) != null )
																				{
																					String sessionIdToRemove = "";
																					if( dom.getElementsByTagName("mobileSessionIdToRemove").item(0) != null )
																					{
																						Node mobileSessionIdToRemove = dom.getElementsByTagName("mobileSessionIdToRemove").item(0);
																						sessionIdToRemove = mobileSessionIdToRemove.getFirstChild().getNodeValue();
																					}
																					Node msg = dom.getElementsByTagName("message").item(0);
																					message = msg.getFirstChild().getNodeValue();
																					String messageDescription = "";
																					if( dom.getElementsByTagName("description").item(0) != null )
																					{
																						Node description = dom.getElementsByTagName("description").item(0);
																						messageDescription = E12CommonUtils.checkNull( description.getFirstChild().getNodeValue() );
																					}
																					String displayMessage = message + "\n\n" + messageDescription;
																					//Changes made by Pratheek on 30-10-19[ to call the custom alert in mobile same as browser]-Start
																					final String sessionId = sessionIdToRemove;
																					//Changes made by Pratheek on 30-10-19[ to call the custom alert in mobile same as browser]-End
																					if( "W".equalsIgnoreCase(typeNodeValue) )
																					{
																						//Changes made by Pratheek on 30-10-19[ to call the custom alert in mobile same as browser]-Start
																						/*if( Window.confirm(displayMessage) )
																						{
																							if( sessionIdToRemove != null && sessionIdToRemove.length() > 0 )
																							{
																								HashMap<String, String> newParamMap = new HashMap<String, String>();
																								newParamMap.put("mobileSessionId", sessionIdToRemove);
																								newParamMap.put("action", "REMOVE_MOBILE_SESSION");
																								String newParamString = E12CommonUtils.getInstance().getEncodedParamString(newParamMap);
																								String url = storedHostUrl + "/ibase/AuthenticateServlet?" + newParamString ;
																								E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, url);
																								try
																								{
																									requestBuilder.sendRequest("", new RequestCallback() {

																										@Override
																										public void onResponseReceived(Request request, Response response) {
																											String responseString = response.getText();
																											if( !"".equalsIgnoreCase(responseString) )
																											{
																												E12CommonUtils.printOnConsole("response for action REMOVE_MOBILE_SESSION ==> "+responseString);
																											}
																										}

																										@Override
																										public void onError(Request request, Throwable exception) {
																											// TODO Auto-generated method stub

																										}
																									});
																								} catch (RequestException e)
																								{
																									E12CommonUtils.printOnConsole("Exception while login ===> "+e.toString());
																								}
																							}
																						}
																						else
																						{
																							passText.setText("");
																							loginButton.setEnabled( true );
																							editButton.setEnabled( true );
																							//displayPwd().hide(false);
																							logoutUser();
																							return;
																						}*/
																						final Document domData = dom;
																						E12AlertBox.getInstance().confirm( "Message : " +message + "\nDescription: " +messageDescription, "Warning", new CallbackHandler() {		
																							@Override
																							public void onCallback(boolean callbackVal) {
																								if( callbackVal )
																								{
																									if( sessionId != null && sessionId.length() > 0 )
																									{
																										HashMap<String, String> newParamMap = new HashMap<String, String>();
																										newParamMap.put("mobileSessionId", sessionId);
																										newParamMap.put("action", "REMOVE_MOBILE_SESSION");
																										String newParamString = E12CommonUtils.getInstance().getEncodedParamString(newParamMap);
																										String url = storedHostUrl + "/ibase/AuthenticateServlet?" + newParamString ;
																										E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, url);
																										try
																										{
																											requestBuilder.sendRequest("", new RequestCallback() {

																												@Override
																												public void onResponseReceived(Request request, Response response) {
																													String responseString = response.getText();
																													if( !"".equalsIgnoreCase(responseString) )
																													{
																														E12CommonUtils.printOnConsole("response for action REMOVE_MOBILE_SESSION ==> "+responseString);
																													}
																												}

																												@Override
																												public void onError(Request request, Throwable exception) {
																													// TODO Auto-generated method stub

																												}
																											});
																										} catch (RequestException e)
																										{
																											E12CommonUtils.printOnConsole("Exception while login ===> "+e.toString());
																										}
																									}
																									final boolean deleteCacheReqdVal  = checkBuildVersion( domData );
																									//Added by Bhupendra on 06-08-18 [Start] for Pagination Implementation.
																									if( domData.getElementsByTagName("pageSize").item(0) != null )
																									{
																										Node pageSizeNode = domData.getElementsByTagName("pageSize").item(0);
																										if( pageSizeNode.getFirstChild() != null )
																										{
																											String homePageFeedSize = "";
																											homePageFeedSize = pageSizeNode.getFirstChild().getNodeValue();
																											homePageFeedSize = E12CommonUtils.checkNull(homePageFeedSize);
																											if( !"".equalsIgnoreCase(homePageFeedSize) && homePageFeedSize.length() > 0  )
																											{
																												E12Constants.PAGE_SIZE  = Integer.parseInt(homePageFeedSize);
																											}
																											E12CommonUtils.printOnConsole("Bhudroid E12ApplicationPanel 5955 pageSize Value ["+homePageFeedSize+"]");
																										}
																									}
																									
																									//deleteCache(e12StorageKeyUser, e12StorageKey, e12offlinePwdKey);
																									deleteCache(deleteCacheReqdVal, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, new Callback<Boolean, Boolean>() {
																										
																										@Override
																										public void onFailure(Boolean reason)
																										{
																											
																										}
																										
																										@Override
																										public void onSuccess(Boolean respResult)
																										{
																											String displayMessage = "";
																											if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
																											{
																												if( !"".equalsIgnoreCase(responseStr) )
																												{
																													Document dom = XMLParser.parse(responseStr);
																													XMLParser.removeWhitespace(dom);
																													if( dom != null )
																													{
																														if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
																														{
																															Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
																															if( upgradeMessageNode.getFirstChild() != null )
																															{
																																displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
																																//added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]
																																//Window.alert(displayMessage);
																																//createCustomPopup( displayMessage,passText,loginButton, editButton);
																																createCustomPopup( displayMessage);
																																
																																//E12Storage.clear();
																																passText.setText("");
																																loginButton.setEnabled( true );
																																editButton.setEnabled( true );
																																//displayPwd().hide(false);
																																return;
																															}
																														}
																														
																														if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
																														{
																															Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
																															if( recommendedMessageNode.getFirstChild() != null )
																															{
																																displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
																																//Change by Sandeep S. on 05/12/16 [[S16HBAS012]  Check for latest apk version ]
																																//Window.alert(displayMessage);
																																//showPwdPnl.hide(true);
																																final PopupPanel msgPopPanel = new PopupPanel();
																																VerticalPanel vertMsgPanel = new VerticalPanel();
																																HorizontalPanel hzpanel  = new HorizontalPanel();
																																//Label msg = new Label(displayMessage);
																																HTML msg = new HTML(displayMessage);
																																Button okButton = new Button("Ok");
																																Button laterButton = new Button("Later");
																																
																																okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
																																okButton.getElement().getStyle().setWidth(47, Unit.PX);
																																
																																laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
																																laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
																																laterButton.getElement().getStyle().setWidth(63, Unit.PX);
																																hzpanel.add(okButton);
																																hzpanel.add(laterButton);
																																
																																vertMsgPanel.add(msg);
																																vertMsgPanel.add(hzpanel);
																																vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);
																																
																																msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
																																msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
																																msgPopPanel.add(vertMsgPanel);
																																msgPopPanel.setGlassEnabled(true);
																																msgPopPanel.getElement().getStyle().setZIndex(2);
																																msgPopPanel.center();
																																
																																okButton.addClickHandler(new ClickHandler() {
																																	
																																	@Override
																																	public void onClick(ClickEvent event)
																																	{
																																		msgPopPanel.hide();
																																		passText.setText("");
																																		loginButton.setEnabled( true );
																																		editButton.setEnabled( true );
																																		//displayPwd().hide(false);
																																		return;
																																	}
																																});
																																
																																laterButton.addClickHandler(new ClickHandler() {
																																	@Override
																																	public void onClick(ClickEvent event)
																																	{
																																		msgPopPanel.hide();
																																		E12Storage.setItem( e12StorageKeyUser, "" );
																																		loginButton.setEnabled( false );
																																		editButton.setEnabled( false );
																																		PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																																		loadingPanel.show();
																																		//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																																		String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																																		E12CommonUtils.printOnConsole( " result ["+result+"]" );
																																		if(result=="Yes")
																																		{
																																			/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																																			if user enters wrong password from Login screen.*/
																																			//setShaPasswordForConnectionURL(passwordSha256);
																																			//showPwdPnl.hide(true);
																																			setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																																			loadingPanel.hide();
																																		}
																																		else
																																		{
																																			//displayPwd().hide(false);
																																			loadingPanel.hide();
																																			return;
																																		}
																																	}
																																});
																															}
																														}
																														else
																														{
																															E12Storage.setItem( e12StorageKeyUser, "" );
																															loginButton.setEnabled( false );
																															editButton.setEnabled( false );
																															PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																															loadingPanel.show();
																															//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																															String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																															E12CommonUtils.printOnConsole( " result ["+result+"]" );
																															if(result=="Yes"){
																																/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																																if user enters wrong password from Login screen.*/
																																//setShaPasswordForConnectionURL(passwordSha256);
																																//showPwdPnl.hide(true);
																																loadingPanel.hide();
																																setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																															}
																															else{
																																//displayPwd().hide(false);
																																loadingPanel.hide();
																																return;
																															}
																														}
																													}
																												}
																											}
																											//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
																											else
																											{
																												E12Storage.setItem( e12StorageKeyUser, "" );
																												loginButton.setEnabled( false );
																												editButton.setEnabled( false );
																												PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																												loadingPanel.show();
																												//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																												String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																												E12CommonUtils.printOnConsole( " result ["+result+"]" );
																												if(result=="Yes"){
																													/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																													if user enters wrong password from Login screen.*/
																													//setShaPasswordForConnectionURL(passwordSha256);
																													//showPwdPnl.hide(true);
																													setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																													loadingPanel.hide();
																												}
																												else{
																													//displayPwd().hide(false);
																													loadingPanel.hide();
																													return;
																												}
																											}
																										}
																									});
																								}
																								else
																								{
																									passText.setText("");
																									loginButton.setEnabled( true );
																									editButton.setEnabled( true );
																									//displayPwd().hide(false);
																									logoutUser();
																									return;
																								}
																							}
																						});
																						//Changes made by Pratheek on 30-10-19[ to call the custom alert in mobile same as browser]-End
																					}
																				}
																			}
																			//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] End
																			//Changes made by Pratheek on 04-11-19[ to show custom alert in mobile same as in browser]-Start
																			if( !"SESSEXIST".equalsIgnoreCase(messageId.trim()) )
																			{
																				deleteCacheReqd = checkBuildVersion( dom );
																				//Added by Bhupendra on 06-08-18 [Start] for Pagination Implementation.
																				if( dom.getElementsByTagName("pageSize").item(0) != null )
																				{
																					Node pageSizeNode = dom.getElementsByTagName("pageSize").item(0);
																					if( pageSizeNode.getFirstChild() != null )
																					{
																						String homePageFeedSize = "";
																						homePageFeedSize = pageSizeNode.getFirstChild().getNodeValue();
																						homePageFeedSize = E12CommonUtils.checkNull(homePageFeedSize);
																						if( !"".equalsIgnoreCase(homePageFeedSize) && homePageFeedSize.length() > 0  )
																						{
																							E12Constants.PAGE_SIZE  = Integer.parseInt(homePageFeedSize);
																						}
																						E12CommonUtils.printOnConsole("Bhudroid E12ApplicationPanel 5955 pageSize Value ["+homePageFeedSize+"]");
																					}
																				}
																				//Added by Bhupendra on 06-08-18 [End] for Pagination Implementation.
																			}
																			//Changes made by Pratheek on 04-11-19[ to show custom alert in mobile same as in browser]-End
																		}
																		//Changes made by Pratheek on 04-11-19[ to show custom alert in mobile same as in browser]-Start
																		if( !"SESSEXIST".equalsIgnoreCase(messageIdVal.trim()) )
																		{
																			E12CommonUtils.printOnConsole(" ! SESSEXIST  ["+e12offlinePwdKey+"]");
																			//deleteCache(e12StorageKeyUser, e12StorageKey, e12offlinePwdKey);
																			deleteCache(deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, new Callback<Boolean, Boolean>() {
																				
																				@Override
																				public void onFailure(Boolean reason)
																				{
																					
																				}
																				
																				@Override
																				public void onSuccess(Boolean respResult)
																				{
																					String displayMessage = "";
																					if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
																					{
																						if( !"".equalsIgnoreCase(responseStr) )
																						{
																							Document dom = XMLParser.parse(responseStr);
																							XMLParser.removeWhitespace(dom);
																							if( dom != null )
																							{
																								if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
																								{
																									Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
																									if( upgradeMessageNode.getFirstChild() != null )
																									{
																										displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
																										//added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]
																										//Window.alert(displayMessage);
																										//createCustomPopup( displayMessage,passText,loginButton, editButton);
																										createCustomPopup( displayMessage);
																										
																										//E12Storage.clear();
																										passText.setText("");
																										loginButton.setEnabled( true );
																										editButton.setEnabled( true );
																										//displayPwd().hide(false);
																										return;
																									}
																								}
																								
																								if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
																								{
																									Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
																									if( recommendedMessageNode.getFirstChild() != null )
																									{
																										displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
																										//Change by Sandeep S. on 05/12/16 [[S16HBAS012]  Check for latest apk version ]
																										//Window.alert(displayMessage);
																										//showPwdPnl.hide(true);
																										final PopupPanel msgPopPanel = new PopupPanel();
																										VerticalPanel vertMsgPanel = new VerticalPanel();
																										HorizontalPanel hzpanel  = new HorizontalPanel();
																										//Label msg = new Label(displayMessage);
																										HTML msg = new HTML(displayMessage);
																										Button okButton = new Button("Ok");
																										Button laterButton = new Button("Later");
																										
																										okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
																										okButton.getElement().getStyle().setWidth(47, Unit.PX);
																										
																										laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
																										laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
																										laterButton.getElement().getStyle().setWidth(63, Unit.PX);
																										hzpanel.add(okButton);
																										hzpanel.add(laterButton);
																										
																										vertMsgPanel.add(msg);
																										vertMsgPanel.add(hzpanel);
																										vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);
																										
																										msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
																										msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
																										msgPopPanel.add(vertMsgPanel);
																										msgPopPanel.setGlassEnabled(true);
																										msgPopPanel.getElement().getStyle().setZIndex(2);
																										msgPopPanel.center();
																										
																										okButton.addClickHandler(new ClickHandler() {
																											
																											@Override
																											public void onClick(ClickEvent event)
																											{
																												msgPopPanel.hide();
																												passText.setText("");
																												loginButton.setEnabled( true );
																												editButton.setEnabled( true );
																												//displayPwd().hide(false);
																												return;
																											}
																										});
																										
																										laterButton.addClickHandler(new ClickHandler() {
																											@Override
																											public void onClick(ClickEvent event)
																											{
																												msgPopPanel.hide();
																												E12Storage.setItem( e12StorageKeyUser, "" );
																												loginButton.setEnabled( false );
																												editButton.setEnabled( false );
																												PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																												loadingPanel.show();
																												//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																												String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																												E12CommonUtils.printOnConsole( " result ["+result+"]" );
																												if(result=="Yes")
																												{
																													/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																													if user enters wrong password from Login screen.*/
																													//setShaPasswordForConnectionURL(passwordSha256);
																													//showPwdPnl.hide(true);
																													setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																													loadingPanel.hide();
																												}
																												else
																												{
																													//displayPwd().hide(false);
																													loadingPanel.hide();
																													return;
																												}
																											}
																										});
																									}
																								}
																								else
																								{
																									E12Storage.setItem( e12StorageKeyUser, "" );
																									loginButton.setEnabled( false );
																									editButton.setEnabled( false );
																									PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																									loadingPanel.show();
																									//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																									String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																									E12CommonUtils.printOnConsole( " result ["+result+"]" );
																									if(result=="Yes"){
																										/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																										if user enters wrong password from Login screen.*/
																										//setShaPasswordForConnectionURL(passwordSha256);
																										//showPwdPnl.hide(true);
																										loadingPanel.hide();
																										setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																									}
																									else{
																										//displayPwd().hide(false);
																										loadingPanel.hide();
																										return;
																									}
																								}
																							}
																						}
																					}
																					//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
																					else
																					{
																						E12Storage.setItem( e12StorageKeyUser, "" );
																						loginButton.setEnabled( false );
																						editButton.setEnabled( false );
																						PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																						loadingPanel.show();
																						//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																						String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																						E12CommonUtils.printOnConsole( " result ["+result+"]" );
																						if(result=="Yes"){
																							/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																							if user enters wrong password from Login screen.*/
																							//setShaPasswordForConnectionURL(passwordSha256);
																							//showPwdPnl.hide(true);
																							setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																							loadingPanel.hide();
																						}
																						else{
																							//displayPwd().hide(false);
																							loadingPanel.hide();
																							return;
																						}
																					}
																				}
																			});
																		}
																		//Changes made by Pratheek on 04-11-19[ to show custom alert in mobile same as in browser]-End
																	}
																	//Change by Sandeep S. on 5/12/16 [[S16HBAS012]  Check for latest apk version ]
																	public void onError( Request request, Throwable exception )
																	{
																		E12Global.getInstance().setLoading(false);
																		loginButton.setEnabled(true);
																		editButton.setEnabled( true );
																		//showPwdPnl.hide(false);
																		Window.alert( "Error in getting response E12Applications " );
																		return;
																	}
																});

															}
															catch( RequestException re )
															{
																loginButton.setEnabled(true);
																editButton.setEnabled( true );
																//displayPwd().hide(false);
																E12CommonUtils.printOnConsole( "Exception login failed: " + re );
																return;
															}
														}
														else
														{
															Window.alert( E12Constants.constants.setNoNetWork() ); //Changes by Raju 19-02-14 for I18N
															//showPwdPnl.hide(false);
															//Changed by Sandeep S. on 28-SEP-17 [Disable login and setting button after no connectivity error ]Start
															loginButton.setEnabled(true);
															editButton.setEnabled( true );
															return;
															//Changed by Sandeep S. on 28-SEP-17 [Disable login and setting button after no connectivity error ]End
														}
													}

													@Override
													public void onError(String error) {
														E12CommonUtils.printOnConsole("In E12ApplicationPanel 5612 drawNewConLoginScreen checkBandwidth onError"+error);
														error = E12Global.checkNull( error );
														//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Commented code by Sagar B. for offline related changes [9-Feb-19]
														loginButton.setEnabled( true );
														loginButton.click(); //Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue
													}
												});
											}
											@Override
											public void onFailure(String reason)
											{

											}
										});
									}
								}
							});
							//Added By Suraj -  to check network bandwidth on login
							//Changed by Prasad R on 07/03/19 [to resolve invalid password related login] END

							E12CommonUtils.printOnConsole("Testing DrawNewConnection CommonPhoneGapUtil.checkNetworkAndMode() ["+CommonPhoneGapUtil.checkNetwork()+"]");
						}
					}
				}
			});

			//Added by shrutika on 12-04-18 [Start] for relogin screen alignment issue in LANDSCAPE and PORTRAIT mode.
			Window.addResizeHandler(new ResizeHandler()
			{
				@Override
				public void onResize(ResizeEvent event)
				{
					img.addStyleName("reLogInScreen");
					int clientWidth =Window.getClientWidth();
					String orientation ="";
					//Added by shrutika on 17-04-18 [Start] for exit button alignment issue when switch landscape to portrait mode.
					double clientHt = Window.getClientHeight();
					contents.getElement().getStyle().setHeight(clientHt, Unit.PX);
					//Added by shrutika on 17-04-18 [End] for exit button alignment issue when switch landscape to portrait mode.
					if( E12Global.getInstance().getDeviceOS() != DeviceOS.iOS)
					{
						 orientation =  orientationType();
					}
					if( !orientation.equalsIgnoreCase("undefined")  && orientation.contains("-") )
					{
						String orientationArry[] = orientation.split("-");
						orientation = orientationArry[0];
					}
					Orientation orientationforIos = E12Global.getInstance().getOrientation();
					E12CommonUtils.printOnConsole("inside drawNewConLoginScreen orientation["+orientation+"] orientationforIos["+orientationforIos+"]");
					if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS && orientationforIos.toString().equalsIgnoreCase("LANDSCAPE") )//for IOS tab
					{
						if( clientWidth >=767 )
						{
							connModeLst.getElement().setAttribute("style", "margin-right: 30px;");
							editButton.getElement().setAttribute("style", "margin-left: 40px;");
						}
						img.addStyleName("LoginImgWidth");
					}
					else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS && orientationforIos.toString().equalsIgnoreCase("PORTRAIT") )//for IOS tab
					{
						if( clientWidth >=767 )
						{
							connModeLst.getElement().setAttribute("style", "margin-right: -3px;");
							editButton.getElement().setAttribute("style", "margin-left: 0px;");
						}
						img.addStyleName("LoginImgWidth");
					}

					else if(orientation.toString().equalsIgnoreCase("LANDSCAPE") && clientWidth < 800)//for android mobile
					{
						img.getElement().setAttribute("style", "width: 45%; float: left; padding-left: 27%;");
					}
					else if(orientation.toString().equalsIgnoreCase("PORTRAIT") && clientWidth < 800)// for android normal case
					{
						img.getElement().setAttribute("style", "width: 71%; float: left; padding-left: 14%;");
					}


					else if(orientationforIos.toString().equalsIgnoreCase("LANDSCAPE") && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )//for android TAB
					{
						vertPanel3.getElement().setAttribute("style", "padding-top: 40px;");
						img.addStyleName("LoginImgWidth");

					}
					else if(orientationforIos.toString().equalsIgnoreCase("PORTRAIT") && E12Global.getInstance().getDeviceOS() == DeviceOS.Android)//for android TAB normat case.
					{
						vertPanel3.getElement().setAttribute("style", "padding-top: 40px;");
						img.addStyleName("LoginImgWidth");
					}
					horizontalLine.getElement().getStyle().setWidth(clientWidth, Unit.PX);

				}
			});
			//Added by shrutika on 12-04-18 [End] for relogin screen alignment issue in LANDSCAPE and PORTRAIT mode.

		}
		catch (Exception e)
		{
			Window.alert("Exception in drawNewConLoginScreen[" +e.toString()+ "]");//PRAJYOT 2JAN13
		}
		//return hortPanel;
	}

	private boolean checkBuildVersion( Document dom )
	{
		boolean deleteCacheReqd = false;
		try
		{
			if( dom.getElementsByTagName("buildNo").item(0) != null )
			{
				Node buildNode = dom.getElementsByTagName("buildNo").item(0);
				if( buildNode.getFirstChild() != null )
				{
					String buildVersion = buildNode.getFirstChild().getNodeValue();
					buildVersion = E12CommonUtils.checkNull(buildVersion);

					String storedBuildVersion = "";
					String key = E12Global.getInstance().getCurConnectionId() + "BUILD_NO";
					storedBuildVersion = E12Storage.getItemLocalStorage(key);
					storedBuildVersion = E12CommonUtils.checkNull(storedBuildVersion);
					E12CommonUtils.printOnConsole("buildVersion ["+buildVersion+"] storedBuildVersion ["+storedBuildVersion+"]");
					if( !"".equalsIgnoreCase(buildVersion) && !"".equalsIgnoreCase(storedBuildVersion) )
					{
						if( ! buildVersion.equalsIgnoreCase(storedBuildVersion) )
						{
							deleteCacheReqd = true;
						}
					}
					//deleteCacheReqd = true;
				}
			}
		}
		catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception in checkBuildVersion ["+ e.getMessage() +"]");
			e.printStackTrace();
		}
		E12CommonUtils.printOnConsole(" in checkBuildVersion deleteCacheReqd ["+ deleteCacheReqd +"]");
		return deleteCacheReqd;
	}

	public static native void exitApp()/*-{
		try
		{
			$wnd.customLog("in native js for exitApp");
			$wnd.exitApp();
		}
		catch(e)
		{
			$wnd.customLog("exception in `"+e);
		}
	}-*/;
//Changed by Sandeep S. on 16-03-17 End

	public native void exitAppWithFeedback()/*-{
		try
		{
			if ($wnd.plugins && $wnd.plugins.appExit && $wnd.plugins.appExit.openView) {
				var onSuccess = function(result) {
					$wnd.customLog("In exportNativeisAuthenticateMethod result" + result+" ]");
				};

				var onError = function(error) {
					$wnd.customLog("In exportNativeisAuthenticateMethod error::[ " + error+" ]");
				};

				$wnd.plugins.appExit.openView([false, '', ''], onSuccess, onError);
			} else {
				$wnd.customLog("$wnd.plugins.appExit.openView not found !");
			}
		}
		catch(ex)
		{
			$wnd.customLog("Exception in exitAppWithFeedback : " + ex);
		}
	}-*/;

	public String makeCamelCase( String str )
	{
		String outPutStr = "";
		if( !"".equals( E12Global.checkNull( str )))
		{
	        StringBuffer stringbf = new StringBuffer();
	        String [] words = str.split(" ");
	        for( String letter : words )
	        {
	        	String changed = letter.substring(0, 1).toUpperCase() + letter.substring(1).toLowerCase();
	        	stringbf.append( changed );
	        	stringbf.append( " " );
	        }

		    outPutStr = stringbf.toString().trim();
		}
		else
		{
			outPutStr = str;
		}

	    return outPutStr;
	}
	//changed by Nikita S on 16/05/17 start
	public static String getDeviceTYpe()
	{
		String currDevice = "Other";

		if ( Window.Navigator.getPlatform().indexOf( "iPhone" ) != -1 )
		{
			currDevice= "iPhone";
		}
		else if ( Window.Navigator.getPlatform().indexOf( "iPad" ) != -1 )
		{
			currDevice = "iPad";
		}
		else if ( Window.Navigator.getUserAgent().indexOf("Android") != -1 )
		{
			if( Window.Navigator.getUserAgent().indexOf("Mobile") != -1)
			{
				currDevice = "Mobile";
			}
			else
			{
				currDevice = "Tablet";
			}
		}

		return currDevice;
	}
	//changed by Nikita S on 16/05/17 End

	public void deleteCache( boolean deleteCacheReqd, String e12StorageKeyUser, String e12StorageKey, String e12offlinePwdKey, String buildVersion, final Callback<Boolean, Boolean> callback )
	{
		try
		{
			if( deleteCacheReqd )
			{
				E12Global.getInstance().setLoading(false);
				String curConnId = "";
				curConnId = E12CommonUtils.checkNull( E12Global.getInstance().getCurConnectionId() );
				curConnId = curConnId.substring(1, curConnId.length() - 2);
				/*String currConnectionInfo = E12Storage.getItem(curConnId);
				String connectionInfo[] =  currConnectionInfo.split(",");
				String currSiteCode = "";
				for( int i = 0; i < connectionInfo.length; i++ )
				{
					String s = E12CommonUtils.checkNull(connectionInfo[i]);
					if( s.contains("selectedSiteCode") )
					{
						currSiteCode = s;
						break;
					}
				}
				if( !"".equalsIgnoreCase(currSiteCode) && currSiteCode.indexOf("=") != -1 )
				{
					currSiteCode = currSiteCode.substring(currSiteCode.indexOf("=") + 1, currSiteCode.length());
				}*/
				//Window.alert("Build Version does not match for site code "+currSiteCode);
				final HashMap<String, String> storedConnInfo = getStoredConnectionData(e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion);

				//Added by Sandeep S. on 11-Aug-17 [To enable multiple connection and handle delete cache] Start
				/*E12Storage.clearIDBData(new Callback<String, String>() {

					@Override
					public void onFailure(String reason) {

					}

					@Override
					public void onSuccess(String result)
					{
						E12Storage.clear();
						E12SlideMenuPanel.getInstance("deleteCache");
						storedServerIP = "";
						if( !E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
						{
							deleteAndroidCache(new Callback<String, String>() {

								@Override
								public void onFailure(String reason) {

								}

								@Override
								public void onSuccess(String result)
								{
									setStoredConnectionData(storedConnInfo);
								}
							});
						}
						else
						{
							setStoredConnectionData(storedConnInfo);
						}
						callback.onSuccess(true);
					}
				});*/

				removeItemFormStorage(storedConnInfo, new Callback<Boolean, Boolean>() {

					@Override
					public void onFailure(Boolean reason)
					{
						setStoredConnectionData(storedConnInfo);
						callback.onSuccess(true);
					}

					@Override
					public void onSuccess(Boolean result)
					{
						if( !E12Global.getInstance().isHostedMode() )
						{
							deleteAndroidCache(new Callback<String, String>() {

								@Override
								public void onFailure(String reason) {
									setStoredConnectionData(storedConnInfo);
									//Added by Sandeep S. on 23-AUG-18 [Delete cache functionality]
									PhoneGapUtil.getInstance().deleteDirectory("base", new Callback<String, String>() {

										@Override
										public void onSuccess(String result) {
											E12CommonUtils.printOnConsole("DeleteDirectory onSuccess result ["+result+"]");
											callback.onSuccess(true);
										}

										@Override
										public void onFailure(String reason) {
											E12CommonUtils.printOnConsole("DeleteDirectory onFailure reason ["+reason+"]");
											callback.onSuccess(true);
										}
									});
								}

								@Override
								public void onSuccess(String result)
								{
									setStoredConnectionData(storedConnInfo);
									//Added by Sandeep S. on 23-AUG-18 [Delete cache functionality]
									PhoneGapUtil.getInstance().deleteDirectory("base", new Callback<String, String>() {

										@Override
										public void onSuccess(String result) {
											E12CommonUtils.printOnConsole("DeleteDirectory onSuccess result ["+result+"]");
											callback.onSuccess(true);
										}

										@Override
										public void onFailure(String reason) {
											E12CommonUtils.printOnConsole("DeleteDirectory onFailure reason ["+reason+"]");
											callback.onSuccess(true);
										}
									});
								}
							});
						}
						else
						{
							setStoredConnectionData(storedConnInfo);
							callback.onSuccess(true);
						}
						//callback.onSuccess(true);

					}
				});
				//Added by Sandeep S. on 11-Aug-17 [To enable multiple connection and handle delete cache] End
			}
			else
			{
				callback.onSuccess(true);
			}
		} catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception in deleteCache ===> "+e.toString());
		}
	}

	public HashMap<String, String> getStoredConnectionData( String e12StorageKeyUser, String e12StorageKey, String e12offlinePwdKey, String buildVersion )
	{
		HashMap<String, String> connectionMap = new HashMap<String, String>();
		try
		{
			String key = "";
			String value = "";
			key = "userName";
			//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] Start
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			key = "CURR_CONN_ID";
			value = E12Storage.getItemLocalStorage(key);
			String curConnId = value;
			connectionMap.put(key, value);
			key = curConnId + "AuthenticateURL";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			key = "curConnection";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			curConnId = curConnId.substring(1, curConnId.length() - 2);
			E12CommonUtils.printOnConsole("curConnId ["+curConnId+"]");
			key = curConnId;
			value = E12Storage.getItem(key);
			connectionMap.put(key, value);
			key = e12StorageKeyUser;
			value = E12Storage.getItem(key);
			connectionMap.put(key, value);
			//Commented by Pankaj R on 22-FEB-19
			key = e12StorageKey;
			value = E12Storage.getItem(key);
			connectionMap.put(key, value);
			key = e12offlinePwdKey;
			value = E12Storage.getItem(key);
			connectionMap.put(key, value);
			//Commented by Pankaj R on 22-FEB-19
//			key = "GPS_ENABLED";
//			value = E12Storage.getItem(key);
//			connectionMap.put(key, value);
//			key = "GPS_ENFORCED";
//			value = E12Storage.getItem(key);
//			connectionMap.put(key, value);
			key = "GEO_POS_OPTION";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			key = "APPL_DATE_FORMAT";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			key = "APPL_DATETIME_FORMAT";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			key = E12Global.getInstance().getCurConnectionId() + "BUILD_NO";
			connectionMap.put(key, buildVersion);
			key = "DESCDETAILS";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			key = "counter";
			value = E12Storage.getItemLocalStorage(key);
			connectionMap.put(key, value);
			//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] End
		} catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception inside getStoredConnectionData "+e.toString());
		}
		return connectionMap;
	}

	public void setStoredConnectionData(HashMap<String, String> connectionMap)
	{
		try
		{
			if (connectionMap != null && connectionMap.size() > 0)
			{
				Iterator ite = connectionMap.keySet().iterator();
				while ( ite.hasNext() )
				{
					String key = (String) ite.next();
					String value = connectionMap.get(key);
					E12Storage.setItem(key, value);
				}
			}
		} catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception inside setStoredConnectionData "+e.toString());
		}
	}

	public static native void deleteAndroidCache(Callback<String, String> callback)/*-{

		try
		{
			$wnd.customLog("in native js for deleteAndroidCache");
			var status = $wnd.deleteAndroidCache(function(status)
			{
				callback.@com.google.gwt.core.client.Callback::onSuccess(Ljava/lang/Object;)(status);
			});
		}
		catch(e)
		{
			$wnd.customLog("exception in deleteAndroidCache "+e);
			callback.@com.google.gwt.core.client.Callback::onSuccess(Ljava/lang/Object;)("");
		}
	}-*/;
//Added by Sandeep S. on 21-JUL-17 [To implement cache handling in mobile] End

	//Added by Sandeep S. on 09-08-17 [To implement delete cache in mobile] Start
	public void removeItemFormStorage(final HashMap<String, String> connectionMap, final Callback<Boolean, Boolean> callback )
	{
		try
		{
			final ArrayList<String> keyToRemove = new ArrayList<String>();
			final String curConnId = E12CommonUtils.checkNull( E12Global.getInstance().getCurConnectionId() );
			E12Storage.getKeys(new Callback<String, String>() {

				@Override
				public void onFailure(String reason) {
					E12CommonUtils.printOnConsole("inside onFailure 5513 "+reason);
					callback.onSuccess(true);
				}

				@Override
				public void onSuccess(String result) {
					E12CommonUtils.printOnConsole("inside onSuccess 5519 "+result);
					String[] removeKeys = result.split("~~~");
					E12CommonUtils.printOnConsole("inside onSuccess removeKeys lenght "+removeKeys.length);
					E12CommonUtils.printOnConsole("inside onSuccess removeKeys 7066 "+removeKeys);
					for( int i = 0; i < removeKeys.length; i++ )
					{
						String storagekey = E12CommonUtils.checkNull(removeKeys[i]);
						if( !"".equalsIgnoreCase(storagekey) )
						{
							if (connectionMap != null && connectionMap.size() > 0)
							{
								/*Iterator<String> ite = connectionMap.keySet().iterator();
								while ( ite.hasNext() )
								{
									String key = (String) ite.next();
									if( !key.equalsIgnoreCase(storagekey) && !storagekey.startsWith("h:") )
									{
										//E12Storage.removeItem(key);
										if( !keyToRemove.contains(key) )
										{
											keyToRemove.add(key);
										}
									}

									if( storagekey.contains(curConnId) )
									{
										//E12Storage.removeItem(storagekey);
										if( !keyToRemove.contains(storagekey) )
										{
											keyToRemove.add(storagekey);
										}
									}
									//Added by Sagar B. on[29-Aug-18]START
									if( storagekey.contains("ACTION_LINK_XML_") )
									{
										if( !keyToRemove.contains(storagekey) )
										{
											keyToRemove.add(storagekey);
										}
									}
									//Added by Sagar B. on[29-Aug-18]END
								}*/

								if( !(connectionMap.containsKey(storagekey)) && !storagekey.startsWith("h:") )
								{
									if( !keyToRemove.contains(storagekey) )
									{
										keyToRemove.add(storagekey);
									}
								}
								if( storagekey.contains("ACTION_LINK_XML_") )
								{
									if( !keyToRemove.contains(storagekey) )
									{
										Window.alert("storagekey::::["+storagekey+"]");
										keyToRemove.add(storagekey);
									}
								}
							}
						}
					}

					E12CommonUtils.printOnConsole("keyToRemove "+keyToRemove);
					if( keyToRemove.size() > 0 )
					{
						for( String key : keyToRemove)
						{
							E12Storage.removeItem(key);
						}
					}
					callback.onSuccess(true);
				}
			});

		} catch (Exception e)
		{
			callback.onSuccess(true);
			E12CommonUtils.printOnConsole("Exception inside removeItemFormStorage "+e.toString());
		}
	}
	//Added by Sandeep S. on 09-08-17 [To implement delete cache in mobile] End

	//Added by Sandeep S. on 11-Aug-17 [To enable multiple connection and handle delete cache] Start
	public void removeKeys(String strKey, final HashMap<String, String> connectionMap, String curConnId, ArrayList<String> keyToRemove)
	{
		try
		{
			E12CommonUtils.printOnConsole("inside removeKeys "+strKey);
			String storagekey = E12CommonUtils.checkNull(strKey);
			E12CommonUtils.printOnConsole("inside removeKeys after trim "+storagekey);
			if( !"".equalsIgnoreCase(storagekey) )
			{
				if (connectionMap != null && connectionMap.size() > 0)
				{
					Iterator ite = connectionMap.keySet().iterator();
					while ( ite.hasNext() )
					{
						String key = (String) ite.next();
						if( key.equalsIgnoreCase(storagekey) )
						{
							//E12Storage.removeItem(key);
							keyToRemove.add(key);
						}

						if( storagekey.contains(curConnId) )
						{
							//E12Storage.removeItem(storagekey);
							if( !keyToRemove.contains(storagekey) )
							{
								keyToRemove.add(storagekey);
							}
						}
					}
				}
			}
		} catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception inside removeKeys "+e.toString());
		}
	}
	//Added by Sandeep S. on 11-Aug-17 [To enable multiple connection and handle delete cache] End

	//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] Start
	public void logoutUser()
	{
		selectedSiteCode = "";
		selectedSiteDescr = "";
		String path = E12Global.getHostUrl() + "/ibase/InstanceRemoveServlet?ACTION=LOGOUT";
		// Added by Saiprasad G. on 11-Sep-18 [For closing WebSocket] START
		WebSocketConnection.closeConnection();
		// Added by Saiprasad G. on 11-Sep-18 [For closing WebSocket] END

		/*if( ! CommonPhoneGapUtil.checkNetworkAndMode() )
		{
			Window.alert( E12Constants.constants.setNoNetWork() );
		}
		else*/
		{
			E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, path);

			try
			{
				requestBuilder.sendRequest("", new RequestCallback()
				{
					@Override
					public void onResponseReceived(Request request, Response response)
					{
						//Added by trushant for testing START
						exitApp();
						//Added by trushant for testing END
						isAuthenticated = false;
					}
					@Override
					public void onError(Request request, Throwable exception)
					{

					}
				});
			 }catch (RequestException e)
			 {
				Window.alert(E12Constants.constants.setErrInLogoutProcess() + e.getMessage());
				e.printStackTrace();
			}
		}
	}
	//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] End
	//Added by sunny soni for showing login pin page [start]
	public void drawPinLoginScreen(final int noOfConnections)
	{
		E12CommonUtils.printOnConsole("getPinLoginScreen called===================== [ "+noOfConnections+" ]");
		final VerticalPanel pinScreenvertPanel = new VerticalPanel();
		try
		{
			final String iPin = E12Storage.getItemLocalStorage("iPin_"+storedUserName);
			E12CommonUtils.printOnConsole("inside getPinLoginScreen 1");
			clear();
			E12CommonUtils.printOnConsole("inside getPinLoginScreen 2");
			super.enter();//New Added by sunny soni
			//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] start
			if( !E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
			{
				MELogin.checkApkVersion(new Callback<String, String>() {

					@Override
					public void onFailure(String reason)
					{

					}

					@Override
					public void onSuccess(String result) {

						apkVersion = result;
						apkVersion = E12Global.checkNull( apkVersion.substring(apkVersion.indexOf("v") + 1 ) );
						if( !"".equalsIgnoreCase(apkVersion) )
						{
							apkVersion = apkVersion.replace(".", "-");
							version = apkVersion;
						}
					}
				});
			}
			E12CommonUtils.printOnConsole("inside getPinLoginScreen 3");
			//New Added by sunny soni on 03-OCT-17 [start]
			pinScreenvertPanel.setWidth( "100%" );
			pinScreenvertPanel.setHeight("100%");
			pinScreenvertPanel.addStyleName("hortPanel");
			//New Added by sunny soni on 03-OCT-17 [End]

			E12CommonUtils.printOnConsole("inside getPinLoginScreen 4");
			VerticalPanel verticalPanel = new VerticalPanel();

			HorizontalPanel horzPinPanel = new HorizontalPanel();
			HorizontalPanel horzPinBtnMainPanel = new HorizontalPanel();
			final HorizontalPanel horzPinErrPanel = new HorizontalPanel();
			VerticalPanel vertPinCanclBtnPanel = new VerticalPanel();
			VerticalPanel vertPinLoginBtnPanel = new VerticalPanel();

			final Label loginPinlabel = new Label("Enter your 4 digit PIN to login");
			//loginPinlabel.getElement().getStyle().setColor("#4285f4");
			loginPinlabel.getElement().getStyle().setFontSize(17, Unit.PX);

			Label errspace= new Label();
			errspace.getElement().getStyle().setHeight(40, Unit.PX);

			final Label errorPinLbl = new Label();
			errorPinLbl.getElement().getStyle().setColor("red");
			errorPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);

			horzPinErrPanel.setVisible(false);
			horzPinErrPanel.add(errspace);
			horzPinErrPanel.add(errorPinLbl);

			final E12TextBox oldpinText, oldpinText1, oldpinText2, oldpinText3;

			oldpinText = new E12TextBox("number");
			oldpinText1 = new E12TextBox("number");
			oldpinText2 = new E12TextBox("number");
			oldpinText3 = new E12TextBox("number");

			// Added by Abhishek T on 08-Dec-18 [For clearing PIN fields] START
			oldpinText.getElement().setAttribute("__pin_field__", "");
			oldpinText.getElement().setAttribute("__pin_field_first__", "");
			oldpinText1.getElement().setAttribute("__pin_field__", "");
			oldpinText2.getElement().setAttribute("__pin_field__", "");
			oldpinText3.getElement().setAttribute("__pin_field__", "");
			// Added by Abhishek T on 08-Dec-18 [For clearing PIN fields] END

			final Image lockimage = new Image();
			String url = E12Global.getHostUrl() +"/ibase/images/lock.png";
			lockimage.setWidth("150px");
			lockimage.setHeight("150px");
			lockimage.setUrl(url);

			lockimage.addErrorHandler(new ErrorHandler()
			{
				@Override
				public void onError(ErrorEvent event)
				{
					E12CommonUtils.printOnConsole("Error HAndle in E12Application 5813!!");
					lockimage.setResource( Resources.INSTANCE.lockIcon() );
					lockimage.setWidth("150px");
					lockimage.setHeight("150px");
				}
			});

			Scheduler.get().scheduleDeferred(new ScheduledCommand() {
				  @Override
				  public void execute() {
				   oldpinText.setFocus(true);
				  }
				});

			Label space = new Label();
			final Button loginBtton = new Button( "Login" );
			final Button cancelBtton = new Button( "Cancel" );
			E12CommonUtils.printOnConsole("inside getPinLoginScreen 5");
			loginBtton.addStyleName("pinloginBtnCss");

			E12CommonUtils.printOnConsole("inside getPinLoginScreen 6");
			if(E12Global.getInstance().getDeviceOS() == DeviceOS.Android)
			{
				if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Mobile") !=-1)
				{
					space.getElement().getStyle().setHeight(80, Unit.PX);
				}
				else if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Tablet") !=-1)
				{
					space.getElement().getStyle().setHeight(80, Unit.PX);
				}
				cancelBtton.addStyleName("pinCancelBtnCss");
			}
			else if(E12Global.getInstance().getDeviceOS() == DeviceOS.iOS)
			{
				if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Mobile") !=-1)
				{
					space.getElement().getStyle().setHeight(90, Unit.PX);
				}
				else if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Tablet") !=-1)
				{
					space.getElement().getStyle().setHeight(252, Unit.PX);
				}

				cancelBtton.addStyleName("pinCancelBtnCssFrTab");
			}

			Label lockspace = new Label();
			lockspace.getElement().getStyle().setHeight(26, Unit.PX);

			Label genrtSpace = new Label();
			genrtSpace.getElement().getStyle().setHeight(33, Unit.PX);


			Label space1 = new Label();
			space1.setStyleName("genpinSpace");

			Label space2 = new Label();
			space2.getElement().getStyle().setHeight(20, Unit.PX);

			Label space3 = new Label();
			space3.setStyleName("genpinSpace");

			oldpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
			oldpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
			oldpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

			oldpinText.setStyleName("pinTxtcss");
			oldpinText1.setStyleName("pinTxtcss");
			oldpinText2.setStyleName("pinTxtcss");
			oldpinText3.setStyleName("pinTxtcss");

			horzPinPanel.add(oldpinText);
			horzPinPanel.add(oldpinText1);
			horzPinPanel.add(oldpinText2);
			horzPinPanel.add(oldpinText3);

			TouchWidget loginBttonTouchWidget = new TouchWidget( loginBtton );
			TouchWidget cancelBttonTouchWidget = new TouchWidget( cancelBtton );

			vertPinCanclBtnPanel.add(cancelBttonTouchWidget);
			vertPinLoginBtnPanel.add(loginBttonTouchWidget);
			vertPinCanclBtnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
			horzPinBtnMainPanel.add(vertPinCanclBtnPanel);
			vertPinLoginBtnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
			horzPinBtnMainPanel.add(vertPinLoginBtnPanel);

			final Anchor forgotPin = new Anchor("Forgot 4 digit PIN");
			forgotPin.getElement().getStyle().setColor("#2087fc");
			forgotPin.addStyleName("forgotPinCss");

			forgotPin.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					// Changed by Abhishek T on 06-Dec-18 [For performing different action for OTP login] START
					onForgotPIN();
					// Changed by Abhishek T on 06-Dec-18 [For performing different action for OTP login] END
				}
			});


			verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
			verticalPanel.add(space);

			final HorizontalPanel imgHrzPanel = new HorizontalPanel();
			imgHrzPanel.addStyleName("pincircle");
			imgHrzPanel.add(lockimage);

			verticalPanel.add(imgHrzPanel);
			verticalPanel.add(lockspace);
			verticalPanel.add(loginPinlabel);
			verticalPanel.add(space1);
			verticalPanel.add(horzPinPanel);

			verticalPanel.add(genrtSpace);

			verticalPanel.add(horzPinErrPanel);

			verticalPanel.add(horzPinBtnMainPanel);
			verticalPanel.add(space2);
			verticalPanel.add(forgotPin);

			pinScreenvertPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
			pinScreenvertPanel.add(verticalPanel);

			flowPanel.remove(outerHeaderPanel);
			contents.getElement().getStyle().setPaddingTop(0, Unit.PX);
			contents.getElement().getStyle().setPaddingBottom(0, Unit.PX);
			outerFooterPanel.getElement().getStyle().setHeight(0, Unit.PX);
			double clientHt = Window.getClientHeight();
			contents.getElement().getStyle().setHeight(clientHt, Unit.PX);

			e12WizardFooter = new E12HeaderFooter();
			Widget footerNavWidget2 =  e12WizardFooter.createFooter(null, FooterType.FOOTERTYPE_TWO);

			E12CommonUtils.printOnConsole("inside getPinLoginScreen 8");

			setFooter(null);

			E12CommonUtils.printOnConsole("inside getPinLoginScreen 9");

			oldpinText.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event)
				{

					if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
					{
						oldpinText.getElement().setPropertyString("type", "password");
						oldpinText.setText(oldpinText.getText().substring(oldpinText.getText().length()-1, oldpinText.getText().length()));
						horzPinErrPanel.setVisible(false);
						if(oldpinText1.getValue().isEmpty())
						{
							oldpinText1.setFocus(true);
						}
						else
						{
							oldpinText1.getElement().setPropertyString("type", "number");
							oldpinText1.setFocus(true);
						}
					}
					if( oldpinText.getText().length() == 0 )
					{
						oldpinText.setText("".trim());
						return;
					}
				}
			});
			oldpinText1.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event)
				{
					if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
					{
						oldpinText1.getElement().setPropertyString("type", "password");
						oldpinText1.setText(oldpinText1.getText().substring(oldpinText1.getText().length()-1, oldpinText1.getText().length()));
						if(oldpinText2.getValue().isEmpty())
						{
							oldpinText2.setFocus(true);
						}
						else
						{
							oldpinText2.getElement().setPropertyString("type", "number");
							oldpinText2.setFocus(true);
						}
					}
					if( oldpinText1.getText().length() == 0 )
					{
						oldpinText1.setText("".trim());
						return;
					}
				}
			});

			oldpinText2.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event)
				{
					if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
					{
						oldpinText2.getElement().setPropertyString("type", "password");
						oldpinText2.setText(oldpinText2.getText().substring(oldpinText2.getText().length()-1, oldpinText2.getText().length()));
						if(oldpinText3.getValue().isEmpty())
						{
							oldpinText3.setFocus(true);
						}
						else
						{
							oldpinText3.getElement().setPropertyString("type", "number");
							oldpinText3.setFocus(true);
						}
					}
					if( oldpinText2.getText().length() == 0 )
					{
						oldpinText2.setText("".trim());
						return;
					}
				}
			});

			oldpinText3.addKeyUpHandler(new KeyUpHandler() {
				@Override
				public void onKeyUp(KeyUpEvent event)
				{
					if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
					{
						oldpinText3.getElement().setPropertyString("type", "password");
						oldpinText3.setText(oldpinText3.getText().substring(oldpinText3.getText().length()-1, oldpinText3.getText().length()));

						String pinValues = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();

						if(pinValues.length() == 4)
						{
							final String ipinVal = SHA256.toSha256(pinValues);

							if(!(iPin.equalsIgnoreCase(ipinVal)))
							{
								loginBtton.setFocus(true);
								/*oldpinText3.getElement().setPropertyString("type", "number");
								oldpinText3.setFocus(false);
								oldpinText.getElement().setPropertyString("type", "number");
								errorPinLbl.setText("Incorrect PIN");
								horzPinErrPanel.getElement().getStyle().setMarginTop(-21, Unit.PX);
								horzPinErrPanel.setVisible(true);
								oldpinText.setText("".trim());
								oldpinText1.setText("".trim());
								oldpinText2.setText("".trim());
								oldpinText3.setText("".trim());
								oldpinText.setFocus(true);
								//Added by sunny soni for showing error message [End]
*/							}
							else
							{
								//Added by Pooja S on 17-DEC-2020 [Login with pin issue Data or application error is coming while login with pin.]
								oldpinText3.setFocus(false);
								authenticateUser();
								/*loginBtton.setFocus(true);*/
							}
						}
						else
						{
							oldpinText3.getElement().setPropertyString("type", "number");
							oldpinText3.setFocus(false);
							oldpinText.getElement().setPropertyString("type", "number");
							errorPinLbl.setText("Please Enter 4-Digit PIN");
							horzPinErrPanel.getElement().getStyle().setMarginTop(-21, Unit.PX);
							horzPinErrPanel.setVisible(true);
							oldpinText.setText("".trim());
							oldpinText1.setText("".trim());
							oldpinText2.setText("".trim());
							oldpinText3.setText("".trim());
							oldpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]
						}

					}
					if( oldpinText3.getText().length() == 0 )
					{
						oldpinText3.setText("".trim());
						return;
					}
				}
			});

			oldpinText.addBlurHandler(new BlurHandler() {
				@Override
				public void onBlur(BlurEvent event) {
					if(!(oldpinText.getValue().equalsIgnoreCase("")))
					{
						if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
						{
							oldpinText.setText(oldpinText.getText().substring(0, 1));
							oldpinText.getElement().setPropertyString("type", "password");
						}
					}
				}
			});
			oldpinText1.addBlurHandler(new BlurHandler() {
				@Override
				public void onBlur(BlurEvent event) {
					if(!(oldpinText1.getValue().equalsIgnoreCase("")))
					{
						if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
						{
							oldpinText1.getElement().setPropertyString("type", "password");
							oldpinText1.setText(oldpinText1.getText().substring(0, 1));
						}
					}
				}
			});
			oldpinText2.addBlurHandler(new BlurHandler() {
				@Override
				public void onBlur(BlurEvent event) {
					if(!(oldpinText2.getValue().equalsIgnoreCase("")))
					{
						if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
						{
							oldpinText2.getElement().setPropertyString("type", "password");
							oldpinText2.setText(oldpinText2.getText().substring(0, 1));
						}
					}
				}
			});
			oldpinText3.addBlurHandler(new BlurHandler() {
				@Override
				public void onBlur(BlurEvent event) {
					if(!(oldpinText3.getValue().equalsIgnoreCase("")))
					{
						if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
						{
							oldpinText3.getElement().setPropertyString("type", "password");
							oldpinText3.setText(oldpinText3.getText().substring(0, 1));
						}
					}
				}
			});

			oldpinText.addFocusHandler(new FocusHandler() {
				@Override
				public void onFocus(FocusEvent event) {
					if(oldpinText.getValue().isEmpty())
					{
						oldpinText.getElement().setPropertyString("type", "number");
					}
					if( !(oldpinText.getValue().isEmpty()))
					{
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setCursorPos(oldpinText.getValue().length());
						if(!(oldpinText.getValue().equalsIgnoreCase("")))
						{
							oldpinText.getElement().setPropertyString("type", "number");
							oldpinText.setText(oldpinText.getText().substring(0, 1));
							oldpinText.setFocus(true);
						}
					}
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.getElement().setPropertyString("type", "number");
					}
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.getElement().setPropertyString("type", "number");
					}
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.getElement().setPropertyString("type", "number");
					}
				}
			});
			oldpinText1.addFocusHandler(new FocusHandler() {
				@Override
				public void onFocus(FocusEvent event) {
					if(oldpinText.getValue().isEmpty())
					{
						oldpinText.getElement().setPropertyString("type", "number");
					}
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.getElement().setPropertyString("type", "number");
					}
					if( !(oldpinText1.getValue().isEmpty()))
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setCursorPos(oldpinText1.getValue().length());
						if(!(oldpinText1.getValue().equalsIgnoreCase("")))
						{
							oldpinText1.getElement().setPropertyString("type", "number");
							oldpinText1.setText(oldpinText1.getText().substring(0, 1));
							oldpinText1.setFocus(true);
						}
					}
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.getElement().setPropertyString("type", "number");
					}
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.getElement().setPropertyString("type", "number");
					}
				}
			});
			oldpinText2.addFocusHandler(new FocusHandler() {
				@Override
				public void onFocus(FocusEvent event) {
					if(oldpinText.getValue().isEmpty())
					{
						oldpinText.getElement().setPropertyString("type", "number");
					}
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.getElement().setPropertyString("type", "number");
					}
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.getElement().setPropertyString("type", "number");
					}
					if( !(oldpinText2.getValue().isEmpty()))
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setCursorPos(oldpinText2.getValue().length());
						if(!(oldpinText2.getValue().equalsIgnoreCase("")))
						{
							oldpinText2.getElement().setPropertyString("type", "number");
							oldpinText2.setText(oldpinText2.getText().substring(0, 1));
							oldpinText2.setFocus(true);
						}
					}
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.getElement().setPropertyString("type", "number");
					}
				}
			});
			oldpinText3.addFocusHandler(new FocusHandler() {
				@Override
				public void onFocus(FocusEvent event) {
					if(oldpinText.getValue().isEmpty())
					{
						oldpinText.getElement().setPropertyString("type", "number");
					}
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.getElement().setPropertyString("type", "number");
					}
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.getElement().setPropertyString("type", "number");
					}
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.getElement().setPropertyString("type", "number");
					}
					if( !(oldpinText3.getValue().isEmpty()))
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setCursorPos(oldpinText3.getValue().length());
						if(!(oldpinText3.getValue().equalsIgnoreCase("")))
						{
							oldpinText3.getElement().setPropertyString("type", "number");
							oldpinText3.setText(oldpinText3.getText().substring(0, 1));
							oldpinText3.setFocus(true);
						}
					}
				}
			});

			oldpinText.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					oldpinText.getElement().setPropertyString("type", "number");
				}
			});
			oldpinText1.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					oldpinText1.getElement().setPropertyString("type", "number");
				}
			});
			oldpinText2.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					oldpinText2.getElement().setPropertyString("type", "number");
				}
			});
			oldpinText3.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			});

			cancelBtton.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
					if (loginMethod == LoginMethod.OTP)
					{
						exitAppWithFeedback();
					}
					else
					{
						drawNewConLoginScreen();
					}
				}
			});

			loginBtton.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event)
				{
					String loginResult = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();

					if(loginResult.length() == 4)
					{
						final String ipinVal = SHA256.toSha256(loginResult);

						if(!iPin.equalsIgnoreCase(ipinVal))
						{
							//authenticateUser();
							oldpinText3.getElement().setPropertyString("type", "number");
							oldpinText3.setFocus(false);
							oldpinText.getElement().setPropertyString("type", "number");
							errorPinLbl.setText("Incorrect PIN");
							horzPinErrPanel.getElement().getStyle().setMarginTop(-21, Unit.PX);
							horzPinErrPanel.setVisible(true);
							oldpinText.setText("".trim());
							oldpinText1.setText("".trim());
							oldpinText2.setText("".trim());
							oldpinText3.setText("".trim());
							oldpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]
						}
					}

				}
			});

			E12CommonUtils.printOnConsole("inside getPinLoginScreen 10");
			add(pinScreenvertPanel);
			flowPanel.getElement().getStyle().clearDisplay();
			E12CommonUtils.printOnConsole("inside getPinLoginScreen 11");
			//add(pinScreenHorzPanel);//Added to walltowallPanel

		}
		catch(Exception ae)
		{
			E12CommonUtils.printOnConsole("EXCEPTION getPinLoginScreen called===================== [ "+ae.getMessage()+" ]");
		}
	}
	//Added by sunny soni for showing generate pin page [end]
	//Added by shrutika on 12-04-18 [Start] for getting current screen orientation.
	private native String orientationType()
	/*-{
	     try
		 {
		 	var currentMode = screen.orientation.type;
		     $wnd.customLog("currentMode....["+currentMode);
		 }
		 catch(e)
		 {
		 	$wnd.customLog("Error msg in device mode:"+e);
		 }
		 return currentMode;

	}-*/;
	//Added by shrutika on 12-04-18 [End] for getting current screen orientation.

	//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked] - Start
	protected void loginResponseToVerifyConn(final Button loginButton, final Button editButton, final boolean deleteCacheReqd, final String e12StorageKeyUser, final String e12StorageKey, final String e12offlinePwdKey, final String buildVersion, final E12TextBox passText, final String passwordTxt, final String passwordSha256, final Response response)
	{
		Document dom = null;
		String deviceStatus = "";
		String recExist = "";
		String detailXML = "";
		final String responseStr = E12CommonUtils.checkNull(response.getText());
		E12CommonUtils.printOnConsole("Login response:["+responseStr+"]");
		if( !"".equalsIgnoreCase(responseStr) )
		{
			//Added By Pankaj T. on 03-07-19 added new option in device security (3 - Admin Approval (More than one device tries to login then send approval to admin, if admin approves then only allow to login.) - start
			if( responseStr.startsWith("WORKFLOW_INVOKED") )
			{
				deviceStatus = responseStr.substring(0, responseStr.indexOf("~~"));
				E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn status:["+deviceStatus+"]");
				recExist = responseStr.substring(responseStr.indexOf("~~")+2, responseStr.lastIndexOf("~~"));
				E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn recExist:["+recExist+"]");
				detailXML = responseStr.substring(responseStr.lastIndexOf("~~")+2);
				E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn detailXML:["+detailXML+"]");
			}
			//Added By Pankaj T. on 03-07-19 added new option in device security (3 - Admin Approval (More than one device tries to login then send approval to admin, if admin approves then only allow to login.) - end
			else
			{
				dom = XMLParser.parse(response.getText());
				XMLParser.removeWhitespace(dom);
				E12CommonUtils.printOnConsole("dom ["+dom+"]");
				
				if( dom.getElementsByTagName("DEVICE_STATUS").item(0) != null )
				{
					E12CommonUtils.printOnConsole("DEVICE_STATUS is not null ["+dom+"]");
					Node statusCode = dom.getElementsByTagName("DEVICE_STATUS").item(0);
					E12CommonUtils.printOnConsole("DEVICE_STATUS :["+statusCode+"]");
					if( statusCode.getFirstChild() != null )
					{
						deviceStatus = statusCode.getFirstChild().getNodeValue();
						deviceStatus = E12CommonUtils.checkNull(deviceStatus);
						E12CommonUtils.printOnConsole("deviceStatus ["+deviceStatus+"]");
					}
				}
			}
			if( !"".equalsIgnoreCase(deviceStatus) )
			{
				loginButton.setStyleName( "gwt-Button" );
				loginButton.addStyleName("logInBtn");
				loginButton.setEnabled(true);
			}
        	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-Start
			final String resultXML = detailXML;
        	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-End
			if( deviceStatus.indexOf("STRICTLY_ENFORCED") != -1 )
			{
				Window.alert(E12Constants.constants.setStrictlyEnforced());
			}
			else if( deviceStatus.indexOf("WORKFLOW_INVOKED") != -1 )
			{
				//Added By Pankaj T. on 03-07-19 added new option in device security (3 - Admin Approval (More than one device tries to login then send approval to admin, if admin approves then only allow to login.) - start
				//Window.alert(E12Constants.constants.setWorkflowInvoked());
				E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn userCode:["+storedUserName+"]");
				E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn E12Global.getHostUrl():["+E12Global.getHostUrl()+"]");
				if("true".equals(recExist))
				{
					Window.alert("This device approval is pending from admin.");
				}
				else
				{
	            	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-Start
					/*if( Window.confirm("This is not a registered device. Admin approval is required to use this request for approval?"))
					{
						E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn click on ok");
						HashMap<String, String> paramMap = new HashMap<String, String>();
						paramMap.put( "DETAIL_XML", detailXML );
						paramMap.put( "USER_CODE", storedUserName );
						paramMap.put( "REMOTE_HOST", "" );
						String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
						String url = E12Global.getHostUrl()+"/ibase/jsp/UpdateUserDevice.jsp?"+paramString;
						RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, url);
						requestBuilder.setHeader("Content-Type","application/x-www-form-urlencoded");
						try
						{
							requestBuilder.sendRequest("", new RequestCallback() {
								
								@Override
								public void onResponseReceived(Request request, Response response) 
								{
									String responseStr = response.getText();
									E12CommonUtils.printOnConsole("E12ApplicationsPanel UpdateUserDevice.jsp responseStr : [" +responseStr + "]");
								}
								
								@Override
								public void onError(Request request, Throwable exception) 
								{
									E12CommonUtils.printOnConsole("E12ApplicationsPanel Error in UpdateUserDevice.jsp : [" + exception.getMessage() + "]");
								}
							});
							
						}
						catch( Exception e )
						{
							E12CommonUtils.printOnConsole("E12ApplicationsPanel Exception in UpdateUserDevice.jsp : [" + e.getMessage() + "]");
						}
					}
					else
					{
						E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn click on cancel");
					}*/
					
					E12AlertBox.getInstance().confirm("This is not a registered device. Admin approval is required to use this request for approval?", "Warning", new CallbackHandler() {
						
						@Override
						public void onCallback(boolean result) {
							
							if( result )
							{
								E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn click on ok");
								HashMap<String, String> paramMap = new HashMap<String, String>();
								paramMap.put( "DETAIL_XML", resultXML );
								paramMap.put( "USER_CODE", storedUserName );
								paramMap.put( "REMOTE_HOST", "" );
								String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
								String url = E12Global.getHostUrl()+"/ibase/jsp/UpdateUserDevice.jsp?"+paramString;
								RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, url);
								requestBuilder.setHeader("Content-Type","application/x-www-form-urlencoded");
								try
								{
									requestBuilder.sendRequest("", new RequestCallback() {
										
										@Override
										public void onResponseReceived(Request request, Response response) 
										{
											String responseStr = response.getText();
											E12CommonUtils.printOnConsole("E12ApplicationsPanel UpdateUserDevice.jsp responseStr : [" +responseStr + "]");
										}
										
										@Override
										public void onError(Request request, Throwable exception) 
										{
											E12CommonUtils.printOnConsole("E12ApplicationsPanel Error in UpdateUserDevice.jsp : [" + exception.getMessage() + "]");
										}
									});
									
								}
								catch( Exception e )
								{
									E12CommonUtils.printOnConsole("E12ApplicationsPanel Exception in UpdateUserDevice.jsp : [" + e.getMessage() + "]");
								}
							}
							else
							{
								E12CommonUtils.printOnConsole("E12ApplicationsPanel loginResponseToVerifyConn click on cancel");
							}
						}
					});
	            	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-End
				}
				//Added By Pankaj T. on 03-07-19 added new option in device security (3 - Admin Approval (More than one device tries to login then send approval to admin, if admin approves then only allow to login.) - end
			}
			else if( deviceStatus.indexOf("VERIFY_USER_DEVICE") != -1 )
			{
				try
				{
					E12CommonUtils.printOnConsole("In OTP screen");
					final E12PopupPanel enterOTPPanel = new E12PopupPanel( false );
					VerticalPanel vertiPanel = new VerticalPanel();
					Label heading = new Label("Verification code sent on your registered Mobile No.");
					heading.setStyleName("otpHeading");
					Label horizontalLine1 = new Label();
					horizontalLine1.setStyleName("horzLine");
					Label horizontalLine2 = new Label();
					horizontalLine2.setStyleName("horzLine");
					final TextBox otpTextBox = new TextBox();
					otpTextBox.addStyleName("otpTextBox");
					otpTextBox.getElement().setId("otpTxtBox");
					otpTextBox.getElement().setAttribute("placeholder", "Enter verification code");
					HorizontalPanel hp = new HorizontalPanel();
					Label cancel = new Label("Cancel");
					cancel.setStyleName("gwt-Label");
					cancel.addStyleName("cancelOTP");
					cancel.addClickHandler(new ClickHandler()
					{
						@Override
						public void onClick(ClickEvent event)
						{
							enterOTPPanel.hide();
							E12Global.getInstance().setLoading(true);
							try
							{
								E12Constants.conApplNm = selectedApp;
								E12Constants.hostUrl = storedHostUrl;
								E12Storage.setItem("hostUrl", storedHostUrl);
								final String passwordSha256 = SHA256.toSha256( passwordTxt );
								final String e12StorageKeyUser = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName +"&conApplNm=" + E12Constants.conApplNm ;
								final String e12StorageKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;
								final String e12offlinePwdKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER="+ storedUserName + "&PASSWORD="+ passwordSha256;

								//Changed By Mahesh Patidar on 28/DEC/12
								HashMap<String, String> paramMap = new HashMap<String, String>();

								paramMap.put("USER", storedUserName);
								paramMap.put("PASSWORD", passwordSha256);
								paramMap.put("action", "CANCEL_DEVICE_VREFN");
								paramMap.put("isSHA256Appld", "true");
								paramMap.put("conApplNm", E12Constants.conApplNm);
								//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] START
								paramMap.put("DEVICETYPE", E12CommonUtils.getInstance().getPlatFormAndDeviceType() );
								paramMap.put("DEVICEUUID", CommonPhoneGapUtil.getInstance().getDeviceUuid() );
								paramMap.put("DEVICEID", E12AppInfo.getInstance().getRegisterIdOrDeviceToken() );
								//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] END
								//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[START]
								if( !E12Global.getInstance().isHostedMode() )
								{
									paramMap.put("CURRENTAPKVERSION", version);
									paramMap.put("APP_NAME", appName);
									paramMap.put("BATTERY_STATUS", E12Global.getInstance().getBatteryStatus());
									paramMap.put("IMEI_NO", E12Global.getInstance().getDeviceIMEINo());
								}
								//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[END]
								//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]- Start
								//String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
								final String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
								if(E12Global.getInstance().getDeviceOS()==DeviceOS.Android || E12Global.getInstance().getDeviceOS()==DeviceOS.iOS)
								{
									//path = storedHostUrl + "/ibase/AuthenticateServlet?" + paramString ;
									path = storedHostUrl + "/ibase/AuthenticateServlet?";
								}
								else{
									//path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?" + paramString ;
									path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?";
								}
								//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -End
								//Added by Sandeep Shelar on 26/02/16 [For onResume Event] Start
								E12Storage.localStorageVars.add(E12Global.getConnectionId()+"AuthenticateURL");
								//Added by Sainath T. on 20-Aug-19 [To add paramString to path and set it to E12Storage]
								E12Storage.setItem(E12Global.getConnectionId()+"AuthenticateURL", path + paramString);
		                        //Added by Sandeep Shelar on 26/02/16 [For onResume Event] End

								//Added by Prajyot [To send new request each time]
								//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
		                        //path = path + "&dummyInt=" + Math.random();
								path = path + "dummyInt=" + Math.random();
//								String path = MELogin.hostUrl + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;

								//Ended By Mahesh Patidar

								StorageKeys.setUsername( storedUserName );
								DataSyncCache.setUsername( storedUserName );
								E12CommonUtils.printOnConsole("In E12ApplicationsPanel e12StorageKeyUser["+e12StorageKeyUser+"] e12StorageKey["+e12StorageKey+"]");
								//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
								//RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, path );
								RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.POST, path );
								requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");
								//added by vishal p. on 06/10/17 [for showing alert msg on login if user enetered wrong url or server is not started]
								//E12Global.getInstance().checkIsNetworkActiveFirst(path, loginButton);
								E12Global.getInstance().setLoading(true);
								E12Global.getInstance().checkIsNetworkActiveFirst( loginButton , false );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
								//requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
								requestStatus = requestBuilder.sendRequest( paramString, new RequestCallback()
								{
									public void onResponseReceived( Request request, final Response response )
									{
										E12Global.getInstance().setLoading( false );
										E12Storage.setItem( e12StorageKeyUser, "" );
										if( response.getText().indexOf("TRUE") != -1 )
										{
											enterOTPPanel.hide();
										}
									}
									public void onError( Request request, Throwable exception )
									{
										E12Global.getInstance().setLoading( false );
										Window.alert( "Error " );
									}
								});
							}
							catch (Exception e)
							{
								E12CommonUtils.printOnConsole("Exception on cancel click:["+e.getMessage()+"]");
								E12Global.getInstance().setLoading( false );
							}
						}
					});
					TouchWidget cancelTouch = new TouchWidget(cancel);

					Label verify = new Label("Verify");
					verify.setStyleName("gwt-Label");
					verify.addStyleName("doneOTP");
					verify.getElement().setId("verifyOTP");
					verify.addClickHandler(new ClickHandler()
					{
						@Override
						public void onClick(ClickEvent event)
						{
							E12CommonUtils.printOnConsole("Done button clicked");
							String otp = otpTextBox.getText().trim();
							if( otp.length() == 0 )
							{
								Window.alert("Please enter the OTP");
							}
							else
							{
								E12Global.getInstance().setLoading(true);
								try
								{
									E12Constants.conApplNm = selectedApp;
									E12Constants.hostUrl = storedHostUrl;
									E12Storage.setItem("hostUrl", storedHostUrl);
									final String passwordSha256 = SHA256.toSha256( passwordTxt );
									final String e12StorageKeyUser = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName +"&conApplNm=" + E12Constants.conApplNm ;
									final String e12StorageKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;
									final String e12offlinePwdKey = storedUserName + "_" + "/ibase/AuthenticateServlet?USER="+ storedUserName + "&PASSWORD="+ passwordSha256;

									//Changed By Mahesh Patidar on 28/DEC/12
									HashMap<String, String> paramMap = new HashMap<String, String>();
									paramMap.put("DEVICE_VER_CODE", otp);
									paramMap.put("USER", storedUserName);
									paramMap.put("PASSWORD", passwordSha256);
									paramMap.put("action", "VERIFY_USER_DEVICE");
									paramMap.put("isSHA256Appld", "true");
									paramMap.put("conApplNm", E12Constants.conApplNm);
									//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] START
									paramMap.put("DEVICETYPE", E12CommonUtils.getInstance().getPlatFormAndDeviceType() );
									paramMap.put("DEVICEUUID", CommonPhoneGapUtil.getInstance().getDeviceUuid() );
									paramMap.put("DEVICEID", E12AppInfo.getInstance().getRegisterIdOrDeviceToken() );
									//Added by Dnyaneshwar Chavan on 01-OCT-13 [WS3GSUN002] [ Device ID & type store in LoginTrace table ] END
									//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[START]
									if( !E12Global.getInstance().isHostedMode() )
									{
										paramMap.put("CURRENTAPKVERSION", version);
										paramMap.put("APP_NAME", appName);
										paramMap.put("BATTERY_STATUS", E12Global.getInstance().getBatteryStatus());
										paramMap.put("IMEI_NO", E12Global.getInstance().getDeviceIMEINo());
									}
									//Changed and Added by Pankaj R on 08-Jan-18 to store current application name and battery status[END]
									//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]-Start
									//String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);
									final String paramString = E12CommonUtils.getInstance().getEncodedParamString(paramMap);

									if(E12Global.getInstance().getDeviceOS()==DeviceOS.Android || E12Global.getInstance().getDeviceOS()==DeviceOS.iOS)
									{
										//path = storedHostUrl + "/ibase/AuthenticateServlet?" + paramString ;
										path = storedHostUrl + "/ibase/AuthenticateServlet?";
									}
									else{
										//path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?" + paramString ;
										path = E12Global.getHostUrl() + "/ibase/AuthenticateServlet?";
									}
									//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post] -End

									//Added by Sandeep Shelar on 26/02/16 [For onResume Event] Start
									E12Storage.localStorageVars.add(E12Global.getConnectionId()+"AuthenticateURL");
									//Added by Sainath T. on 20-Aug-19 [To add paramString to path and set it to E12Storage]
									E12Storage.setItem(E12Global.getConnectionId()+"AuthenticateURL", path + paramString);
			                        //Added by Sandeep Shelar on 26/02/16 [For onResume Event] End

									//Added by Prajyot [To send new request each time]
									//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
			                        //path = path + "&dummyInt=" + Math.random();
									path = path + "dummyInt=" + Math.random();
//									String path = MELogin.hostUrl + "/ibase/AuthenticateServlet?USER=" + storedUserName + "&PASSWORD=" + passwordSha256 + "&action=MELOGIN&isSHA256Appld=true" + "&conApplNm=" + E12Constants.conApplNm ;

									//Ended By Mahesh Patidar

									StorageKeys.setUsername( storedUserName );
									DataSyncCache.setUsername( storedUserName );
									E12CommonUtils.printOnConsole("In E12ApplicationsPanel e12StorageKeyUser["+e12StorageKeyUser+"] e12StorageKey["+e12StorageKey+"]");

									//Chnaged and added by Sainath T. on 07-Jun-19 [To send Authenticate Details using post]
//									RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, path );
									RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.POST, path );
									requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");
									//added by vishal p. on 06/10/17 [for showing alert msg on login if user enetered wrong url or server is not started]
									//E12Global.getInstance().checkIsNetworkActiveFirst(path, loginButton);
									E12Global.getInstance().setLoading(true);
									E12Global.getInstance().checkIsNetworkActiveFirst( loginButton , false );  //Added by Bhupendra on 24-11-17 For Showing error message when server does not respond
									//requestStatus = requestBuilder.sendRequest( null, new RequestCallback()
									requestStatus = requestBuilder.sendRequest( paramString, new RequestCallback()
									{
										public void onResponseReceived( Request request, Response response )
										{
											E12Global.getInstance().setLoading( false );
											E12Storage.setItem( e12StorageKeyUser, "" );
											String verfnResponse = E12CommonUtils.checkNull(response.getText());
											if( !"".equalsIgnoreCase(verfnResponse) )
											{
												String deviceStatus = "";
												Document dom = XMLParser.parse(verfnResponse);
												XMLParser.removeWhitespace(dom);
												E12CommonUtils.printOnConsole("dom ["+dom+"]");

												if( dom.getElementsByTagName("DEVICE_STATUS").item(0) != null )
												{
													E12CommonUtils.printOnConsole("DEVICE_STATUS is not null ["+dom+"]");
													Node statusCode = dom.getElementsByTagName("DEVICE_STATUS").item(0);
													E12CommonUtils.printOnConsole("DEVICE_STATUS :["+statusCode+"]");
													if( statusCode.getFirstChild() != null )
													{
														deviceStatus = statusCode.getFirstChild().getNodeValue();
														deviceStatus = E12CommonUtils.checkNull(deviceStatus);
														E12CommonUtils.printOnConsole("deviceStatus ["+deviceStatus+"]");
													}
												}
												if( deviceStatus.indexOf("INVALID_OTP") != -1 )
												{
													Window.alert("You have entered wrong OTP");
												}
												else
												{
													enterOTPPanel.hide();
													loginResponseToVerifyConn(loginButton, editButton, deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, passText, passwordTxt, passwordSha256, response);
												}
											}
											else
											{
												enterOTPPanel.hide();
												loginResponseToVerifyConn(loginButton, editButton, deleteCacheReqd, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVersion, passText, passwordTxt, passwordSha256, response);
											}
										}

										public void onError( Request request, Throwable exception )
										{
											E12Global.getInstance().setLoading( false );
											Window.alert( "Error " );
										}
									});
								}
								catch (Exception e)
								{
									E12CommonUtils.printOnConsole("Exception on verify click:["+e.getMessage()+"]");
									E12Global.getInstance().setLoading( false );
								}
							}
						}
					});
					TouchWidget verifyTouch = new TouchWidget(verify);
					hp.addStyleName("cancelVerifyOTP");
					hp.add(cancelTouch);
					hp.add(verifyTouch);
					vertiPanel.add(heading);
					vertiPanel.setCellHorizontalAlignment(heading, HasHorizontalAlignment.ALIGN_CENTER);
					vertiPanel.add(horizontalLine1);
					vertiPanel.add(otpTextBox);
					vertiPanel.setCellHorizontalAlignment(otpTextBox, HasHorizontalAlignment.ALIGN_CENTER);
					vertiPanel.add(horizontalLine2);
					vertiPanel.add(hp);
					hp.setWidth("100%");
					hp.setCellWidth(cancelTouch, "50%");
					hp.setCellWidth(verifyTouch, "50%");
					hp.setCellHorizontalAlignment(cancelTouch, HasHorizontalAlignment.ALIGN_CENTER);
					hp.setCellHorizontalAlignment(verifyTouch, HasHorizontalAlignment.ALIGN_CENTER);
					enterOTPPanel.addStyleName("enterOTPPanel");
					enterOTPPanel.add( vertiPanel );
					enterOTPPanel.center();
					enterOTPPanel.setAnimationEnabled(true);
					enterOTPPanel.setAutoHideEnabled(false);
					enterOTPPanel.addStyleNameToContainer("OTPContainer");
					enterOTPPanel.show();
					Window.addResizeHandler(new ResizeHandler()
					{
						@Override
						public void onResize(ResizeEvent event)
						{
							if( enterOTPPanel.isAttached() )
							{
								enterOTPPanel.center();
							}
						}
					});
				}
				catch( Exception e )
				{
					Window.alert("Exception in drawEnterOTPScreen:::"+e.getMessage());
				}
			}
			else
			{
				XMLParser.removeWhitespace(dom);
				//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] Start
				String typeNodeValue = "";
				String message = "";
				String messageId = "";
				if( dom.getElementsByTagName("Message").item(0) != null )
				{
					Node msg = dom.getElementsByTagName("Message").item(0);
					if( msg != null )
					{
						Node type = msg.getAttributes().getNamedItem("type");
						if( type != null )
						{
							typeNodeValue = E12Global.checkNull( type.getNodeValue() );
						}
						Node msgId = msg.getAttributes().getNamedItem("id");
						if( msgId != null )
						{
							messageId = E12Global.checkNull( msgId.getNodeValue() );
						}
					}
				}

				if( "SESSEXIST".equalsIgnoreCase(messageId.trim()) )
				{
					E12CommonUtils.printOnConsole("INside E12ApplicationPanel sessionExist 8192!!!!!!");
					if( dom.getElementsByTagName("message").item(0) != null )
					{
						String sessionIdToRemove = "";
						if( dom.getElementsByTagName("mobileSessionIdToRemove").item(0) != null )
						{
							Node mobileSessionIdToRemove = dom.getElementsByTagName("mobileSessionIdToRemove").item(0);
							sessionIdToRemove = mobileSessionIdToRemove.getFirstChild().getNodeValue();
						}
						Node msg = dom.getElementsByTagName("message").item(0);
						message = msg.getFirstChild().getNodeValue();
						String messageDescription = "";
						if( dom.getElementsByTagName("description").item(0) != null )
						{
							Node description = dom.getElementsByTagName("description").item(0);
							messageDescription = E12CommonUtils.checkNull( description.getFirstChild().getNodeValue() );
						}
						String displayMessage = message + "\n\n" + messageDescription;
		            	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-Start
						final String sessionID = sessionIdToRemove;
		            	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-End
						if( "W".equalsIgnoreCase(typeNodeValue) )
						{
			            	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-Start
							/*if( Window.confirm(displayMessage) )
							{
								if( sessionIdToRemove != null && sessionIdToRemove.length() > 0 )
								{
									HashMap<String, String> newParamMap = new HashMap<String, String>();
									newParamMap.put("mobileSessionId", sessionIdToRemove);
									newParamMap.put("action", "REMOVE_MOBILE_SESSION");
									String newParamString = E12CommonUtils.getInstance().getEncodedParamString(newParamMap);
									String url = storedHostUrl + "/ibase/AuthenticateServlet?" + newParamString ;
									E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, url);
									try
									{
										requestBuilder.sendRequest("", new RequestCallback() {

											@Override
											public void onResponseReceived(Request request, Response response) {
												String responseString = response.getText();
												if( !"".equalsIgnoreCase(responseString) )
												{
													E12CommonUtils.printOnConsole("response for action REMOVE_MOBILE_SESSION ==> "+responseString);
												}
											}

											@Override
											public void onError(Request request, Throwable exception) {
												// TODO Auto-generated method stub

											}
										});
									} catch (RequestException e)
									{
										E12CommonUtils.printOnConsole("Exception while login ===> "+e.toString());
									}
								}
							}
							else
							{
								passText.setText("");
								loginButton.setEnabled( true );
								editButton.setEnabled( true );
								//displayPwd().hide(false);
								logoutUser();
								return;
							}*/
							final Document domData = dom;
							E12AlertBox.getInstance().confirm( "Message : " +message + "\nDescription: " +messageDescription, "Warning", new CallbackHandler() {		
								@Override
								public void onCallback(boolean callbackVal) {
									if( callbackVal )
									{
										E12CommonUtils.printOnConsole("INside E12ApplicationPanel 8266!!!!!!");
										if( sessionID != null && sessionID.length() > 0 )
										{
											HashMap<String, String> newParamMap = new HashMap<String, String>();
											newParamMap.put("mobileSessionId", sessionID);
											newParamMap.put("action", "REMOVE_MOBILE_SESSION");
											String newParamString = E12CommonUtils.getInstance().getEncodedParamString(newParamMap);
											String url = storedHostUrl + "/ibase/AuthenticateServlet?" + newParamString ;
											E12RequestBuilder requestBuilder = new E12RequestBuilder(RequestBuilder.GET, url);
											try
											{
												requestBuilder.sendRequest("", new RequestCallback() {

													@Override
													public void onResponseReceived(Request request, Response response) {
														String responseString = response.getText();
														if( !"".equalsIgnoreCase(responseString) )
														{
															E12CommonUtils.printOnConsole("response for action REMOVE_MOBILE_SESSION ==> "+responseString);
														}
													}

													@Override
													public void onError(Request request, Throwable exception) {
														// TODO Auto-generated method stub

													}
												});
											} catch (RequestException e)
											{
												E12CommonUtils.printOnConsole("Exception while login ===> "+e.toString());
											}
										}
										boolean deleteCacheReq = deleteCacheReqd;
										String buildVern = buildVersion;
										if( domData.getElementsByTagName("buildNo").item(0) != null )
										{
											Node buildNode = domData.getElementsByTagName("buildNo").item(0);
											if( buildNode.getFirstChild() != null )
											{
												buildVern = buildNode.getFirstChild().getNodeValue();
												buildVern = E12CommonUtils.checkNull(buildVern);
												
												String storedBuildVersion = "";
												String key = E12Global.getInstance().getCurConnectionId() + "BUILD_NO";
												//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
												storedBuildVersion = E12Storage.getItemLocalStorage(key);
												storedBuildVersion = E12CommonUtils.checkNull(storedBuildVersion);
												E12CommonUtils.printOnConsole("buildVersion ["+buildVern+"] storedBuildVersion ["+storedBuildVersion+"]");
												if( !"".equalsIgnoreCase(buildVern) && !"".equalsIgnoreCase(storedBuildVersion) )
												{
													if( ! buildVern.equalsIgnoreCase(storedBuildVersion) )
													{
														deleteCacheReq = true;
													}
												}
												//deleteCacheReqd = true;
											}
										}
										
										//deleteCache(e12StorageKeyUser, e12StorageKey, e12offlinePwdKey);
										deleteCache(deleteCacheReq, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVern, new Callback<Boolean, Boolean>() {
											
											@Override
											public void onFailure(Boolean reason)
											{
												
											}
											
											@Override
											public void onSuccess(Boolean respResult)
											{
												String displayMessage = "";
												if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
												{
													if( !"".equalsIgnoreCase(responseStr) )
													{
														Document dom = XMLParser.parse(responseStr);
														XMLParser.removeWhitespace(dom);
														if( dom != null )
														{
															if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
															{
																Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
																if( upgradeMessageNode.getFirstChild() != null )
																{
																	displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
																	//Window.alert(displayMessage);
																	//	createCustomPopup( displayMessage, passText, loginButton, editButton);
																	createCustomPopup( displayMessage);
																	
																	//E12Storage.clear();
																	passText.setText("");
																	loginButton.setEnabled( true );
																	editButton.setEnabled( true );
																	//displayPwd().hide(false);
																	return;
																}
															}
															
															if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
															{
																Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
																if( recommendedMessageNode.getFirstChild() != null )
																{
																	displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
																	//Change by Sandeep S. on 05/12/16 [[S16HBAS012]  Check for latest apk version ]
																	//Window.alert(displayMessage);
																	//showPwdPnl.hide(true);
																	final PopupPanel msgPopPanel = new PopupPanel();
																	VerticalPanel vertMsgPanel = new VerticalPanel();
																	HorizontalPanel hzpanel  = new HorizontalPanel();
																	//Label msg = new Label(displayMessage);
																	HTML msg = new HTML(displayMessage);
																	Button okButton = new Button("Ok");
																	Button laterButton = new Button("Later");
																	
																	okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
																	okButton.getElement().getStyle().setWidth(47, Unit.PX);
																	
																	laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
																	laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
																	laterButton.getElement().getStyle().setWidth(63, Unit.PX);
																	hzpanel.add(okButton);
																	hzpanel.add(laterButton);
																	
																	vertMsgPanel.add(msg);
																	vertMsgPanel.add(hzpanel);
																	vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);
																	
																	msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
																	msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
																	msgPopPanel.add(vertMsgPanel);
																	msgPopPanel.setGlassEnabled(true);
																	msgPopPanel.getElement().getStyle().setZIndex(2);
																	msgPopPanel.center();
																	
																	okButton.addClickHandler(new ClickHandler() {
																		
																		@Override
																		public void onClick(ClickEvent event)
																		{
																			msgPopPanel.hide();
																			passText.setText("");
																			loginButton.setEnabled( true );
																			editButton.setEnabled( true );
																			//displayPwd().hide(false);
																			return;
																		}
																	});
																	
																	laterButton.addClickHandler(new ClickHandler() {
																		@Override
																		public void onClick(ClickEvent event)
																		{
																			msgPopPanel.hide();
																			E12Storage.setItem( e12StorageKeyUser, "" );
																			loginButton.setEnabled( false );
																			editButton.setEnabled( false );
																			PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																			loadingPanel.show();
																			//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																			String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																			E12CommonUtils.printOnConsole( " result ["+result+"]" );
																			if(result=="Yes")
																			{
																				/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																				if user enters wrong password from Login screen.*/
																				//setShaPasswordForConnectionURL(passwordSha256);
																				//showPwdPnl.hide(true);
																				setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																				loadingPanel.hide();
																			}
																			else
																			{
																				//displayPwd().hide(false);
																				loadingPanel.hide();
																				return;
																			}
																		}
																	});
																}
															}
															else
															{
																E12Storage.setItem( e12StorageKeyUser, "" );
																loginButton.setEnabled( false );
																editButton.setEnabled( false );
																PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
																loadingPanel.show();
																//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
																E12CommonUtils.printOnConsole( " result ["+result+"]" );
																if(result=="Yes"){
																	/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
																	if user enters wrong password from Login screen.*/
																	//setShaPasswordForConnectionURL(passwordSha256);
																	//showPwdPnl.hide(true);
																	setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
																	loadingPanel.hide();
																}
																else{
																	//displayPwd().hide(false);
																	loadingPanel.hide();
																	return;
																}
															}
														}
													}
												}
												//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
												else
												{
													E12Storage.setItem( e12StorageKeyUser, "" );
													loginButton.setEnabled( false );
													editButton.setEnabled( false );
													PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
													loadingPanel.show();
													//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
													String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
													E12CommonUtils.printOnConsole( " result ["+result+"]" );
													if(result=="Yes"){
														/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
														if user enters wrong password from Login screen.*/
														//setShaPasswordForConnectionURL(passwordSha256);
														//showPwdPnl.hide(true);
														setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
														loadingPanel.hide();
													}
													else{
														//displayPwd().hide(false);
														loadingPanel.hide();
														return;
													}
												}
											}
										});
									}
									else
									{
										passText.setText("");
										loginButton.setEnabled( true );
										editButton.setEnabled( true );
										//displayPwd().hide(false);
										logoutUser();
										return;
									}
								}
							});
			            	//Changes made by Pratheek on 04-11-19[ to call the custom alert in mobile same as browser]-End						
						}

					}
				}
				//Changes done by Sandeep S. on 01-FEB-18 [To check session exist or not for same user in Mobile apk] End
				E12CommonUtils.printOnConsole("INside E12ApplicationPanel 8522!!!!!! ["+messageId.trim()+"]");
				if( !"SESSEXIST".equalsIgnoreCase(messageId.trim()))
				{
					boolean deleteCacheReq = deleteCacheReqd;
					String buildVern = buildVersion;
					if( dom.getElementsByTagName("buildNo").item(0) != null )
					{
						Node buildNode = dom.getElementsByTagName("buildNo").item(0);
						if( buildNode.getFirstChild() != null )
						{
							buildVern = buildNode.getFirstChild().getNodeValue();
							buildVern = E12CommonUtils.checkNull(buildVern);
							
							String storedBuildVersion = "";
							String key = E12Global.getInstance().getCurConnectionId() + "BUILD_NO";
							//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
							storedBuildVersion = E12Storage.getItemLocalStorage(key);
							storedBuildVersion = E12CommonUtils.checkNull(storedBuildVersion);
							E12CommonUtils.printOnConsole("buildVersion ["+buildVern+"] storedBuildVersion ["+storedBuildVersion+"]");
							if( !"".equalsIgnoreCase(buildVern) && !"".equalsIgnoreCase(storedBuildVersion) )
							{
								if( ! buildVern.equalsIgnoreCase(storedBuildVersion) )
								{
									deleteCacheReq = true;
								}
							}
							//deleteCacheReqd = true;
						}
					}
					
					//deleteCache(e12StorageKeyUser, e12StorageKey, e12offlinePwdKey);
					deleteCache(deleteCacheReq, e12StorageKeyUser, e12StorageKey, e12offlinePwdKey, buildVern, new Callback<Boolean, Boolean>() {
						
						@Override
						public void onFailure(Boolean reason)
						{
							
						}
						
						@Override
						public void onSuccess(Boolean respResult)
						{
							String displayMessage = "";
							if( ! E12Global.getInstance().isHostedMode() && E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
							{
								if( !"".equalsIgnoreCase(responseStr) )
								{
									Document dom = XMLParser.parse(responseStr);
									XMLParser.removeWhitespace(dom);
									if( dom != null )
									{
										if( dom.getElementsByTagName("upgradeMessage").item(0) != null )
										{
											Node upgradeMessageNode = dom.getElementsByTagName("upgradeMessage").item(0);
											if( upgradeMessageNode.getFirstChild() != null )
											{
												displayMessage = upgradeMessageNode.getFirstChild().getNodeValue();
												//Window.alert(displayMessage);
												//	createCustomPopup( displayMessage, passText, loginButton, editButton);
												createCustomPopup( displayMessage);
												
												//E12Storage.clear();
												passText.setText("");
												loginButton.setEnabled( true );
												editButton.setEnabled( true );
												//displayPwd().hide(false);
												return;
											}
										}
										
										if( dom.getElementsByTagName("recommendedMessage").item(0) != null )
										{
											Node recommendedMessageNode = dom.getElementsByTagName("recommendedMessage").item(0);
											if( recommendedMessageNode.getFirstChild() != null )
											{
												displayMessage = recommendedMessageNode.getFirstChild().getNodeValue();
												//Change by Sandeep S. on 05/12/16 [[S16HBAS012]  Check for latest apk version ]
												//Window.alert(displayMessage);
												//showPwdPnl.hide(true);
												final PopupPanel msgPopPanel = new PopupPanel();
												VerticalPanel vertMsgPanel = new VerticalPanel();
												HorizontalPanel hzpanel  = new HorizontalPanel();
												//Label msg = new Label(displayMessage);
												HTML msg = new HTML(displayMessage);
												Button okButton = new Button("Ok");
												Button laterButton = new Button("Later");
												
												okButton.getElement().getStyle().setMarginTop(15, Unit.PX);
												okButton.getElement().getStyle().setWidth(47, Unit.PX);
												
												laterButton.getElement().getStyle().setMarginTop(15, Unit.PX);
												laterButton.getElement().getStyle().setMarginLeft(72, Unit.PX);
												laterButton.getElement().getStyle().setWidth(63, Unit.PX);
												hzpanel.add(okButton);
												hzpanel.add(laterButton);
												
												vertMsgPanel.add(msg);
												vertMsgPanel.add(hzpanel);
												vertMsgPanel.setCellHorizontalAlignment(laterButton, HasHorizontalAlignment.ALIGN_RIGHT);
												
												msgPopPanel.getElement().getStyle().setWidth(190, Unit.PX);
												msgPopPanel.getElement().getStyle().setHeight(100, Unit.PX);
												msgPopPanel.add(vertMsgPanel);
												msgPopPanel.setGlassEnabled(true);
												msgPopPanel.getElement().getStyle().setZIndex(2);
												msgPopPanel.center();
												
												okButton.addClickHandler(new ClickHandler() {
													
													@Override
													public void onClick(ClickEvent event)
													{
														msgPopPanel.hide();
														passText.setText("");
														loginButton.setEnabled( true );
														editButton.setEnabled( true );
														//displayPwd().hide(false);
														return;
													}
												});
												
												laterButton.addClickHandler(new ClickHandler() {
													@Override
													public void onClick(ClickEvent event)
													{
														msgPopPanel.hide();
														E12Storage.setItem( e12StorageKeyUser, "" );
														loginButton.setEnabled( false );
														editButton.setEnabled( false );
														PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
														loadingPanel.show();
														//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
														String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
														E12CommonUtils.printOnConsole( " result ["+result+"]" );
														if(result=="Yes")
														{
															/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
															if user enters wrong password from Login screen.*/
															//setShaPasswordForConnectionURL(passwordSha256);
															//showPwdPnl.hide(true);
															setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
															loadingPanel.hide();
														}
														else
														{
															//displayPwd().hide(false);
															loadingPanel.hide();
															return;
														}
													}
												});
											}
										}
										else
										{
											E12Storage.setItem( e12StorageKeyUser, "" );
											loginButton.setEnabled( false );
											editButton.setEnabled( false );
											PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
											loadingPanel.show();
											//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
											String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
											E12CommonUtils.printOnConsole( " result ["+result+"]" );
											if(result=="Yes"){
												/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
												if user enters wrong password from Login screen.*/
												//setShaPasswordForConnectionURL(passwordSha256);
												//showPwdPnl.hide(true);
												setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
												loadingPanel.hide();
											}
											else{
												//displayPwd().hide(false);
												loadingPanel.hide();
												return;
											}
										}
									}
								}
							}
							//Added by Sandeep S. on 24/11/16 [[S16HBAS012]  Check for latest apk version ] end
							else
							{
								E12Storage.setItem( e12StorageKeyUser, "" );
								loginButton.setEnabled( false );
								editButton.setEnabled( false );
								PopupPanel loadingPanel = E12Global.getInstance().createLoadingPanel();
								loadingPanel.show();
								//setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
								String result = loginButtonClickedOnResponseReceived( storedUserName, storedServerIP,  loginButton, passwordTxt, passwordSha256, response, e12StorageKey, editButton);
								E12CommonUtils.printOnConsole( " result ["+result+"]" );
								if(result=="Yes"){
									/*Commented by Pankaj R on 22-FEB-19 for restricting to set SHA password in localstorage
									if user enters wrong password from Login screen.*/
									//setShaPasswordForConnectionURL(passwordSha256);
									//showPwdPnl.hide(true);
									setSelectedSiteInfo( storedUserName, selectedSiteCode, selectedSiteDescr, selectedSiteProfileId);
									loadingPanel.hide();
								}
								else{
									//displayPwd().hide(false);
									loadingPanel.hide();
									return;
								}
							}
						}
					});
				}

			}
		}
	}
	//Added By Pankaj T. on 18-06-18 for device security based on enterprise level [0-disabled, 1-strictly enforced, 2-OTP, 3-workflow invoked] - End

	// Added by Abhishek T on 05-Sep-18 [For getting application name while re-login in case of OTP] START
	private native String getApplicationName() /*-{
		var key = 'CURR_CONN_ID';
		ls = $wnd.localStorage || {};

		var connectionId = (ls.getItem && ls.getItem('CURR_CONN_ID')) || '';
		var currApplName = connectionId.match(/[a-z]\w+/i)[0] || "";

		//$wnd.console && $wnd.$wnd.customLog('OTPLogin :: getApplicationName : Application Name [' + currApplName + "]");

		return currApplName;
	}-*/;
	// Added by Abhishek T on 05-Sep-18 [For getting application name while re-login in case of OTP] END
	//added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]Start
	private void createCustomPopup(String displayMessage)
	{
		try
		{
			final E12PopupPanel enterOTPPanel = new E12PopupPanel( false );
			enterOTPPanel.setGlassEnabled( true );
			enterOTPPanel.setGlassStyleName( "bgGlass" );
			enterOTPPanel.setModal(true);
			enterOTPPanel.getContainer().setStyleName( "passwordBubbleBox" );
			enterOTPPanel.getContainer().addStyleName( "top" );

			VerticalPanel vertiPanel = new VerticalPanel();
			Label heading = new Label(displayMessage);
			//heading.setStyleName("otpHeading");
			heading.getElement().setAttribute("style", "padding-top: 15px;");

			Label horizontalLine2 = new Label();
			horizontalLine2.setStyleName("horzLine");

			HorizontalPanel hp = new HorizontalPanel();
			Label cancel = new Label("Cancel");
			cancel.setStyleName("gwt-Label");
			cancel.addStyleName("cancelOTP");
			cancel.addClickHandler(new ClickHandler()
			{
				@Override
				public void onClick(ClickEvent event)
				{
					enterOTPPanel.hide();
					return;
				}
			});
			TouchWidget cancelTouch = new TouchWidget(cancel);

			Label verify = new Label("Update Now");
			verify.setStyleName("gwt-Label");
			verify.addStyleName("doneOTP");
			verify.getElement().setId("verifyOTP");
			verify.addClickHandler(new ClickHandler()
			{
				@Override
				public void onClick(ClickEvent event)
				{
					E12CommonUtils.printOnConsole("Done button clicked");
					enterOTPPanel.hide();
					if(E12CommonUtils.checkNull(E12RIA.appId).length()>0)
					{
						openPlayStore( E12RIA.appId );
					}
					else
					{
						openPlayStore( appId );
					}

					return;
				}
			});
			TouchWidget verifyTouch = new TouchWidget(verify);
			hp.addStyleName("cancelVerifyOTP");
			hp.add(cancelTouch);
			hp.add(verifyTouch);
			vertiPanel.add(heading);
			vertiPanel.setCellHorizontalAlignment(heading, HasHorizontalAlignment.ALIGN_CENTER);
			vertiPanel.add(horizontalLine2);
			vertiPanel.add(hp);
			hp.setWidth("100%");
			hp.setCellWidth(cancelTouch, "50%");
			hp.setCellWidth(verifyTouch, "50%");
			hp.setCellHorizontalAlignment(cancelTouch, HasHorizontalAlignment.ALIGN_CENTER);
			hp.setCellHorizontalAlignment(verifyTouch, HasHorizontalAlignment.ALIGN_CENTER);
			enterOTPPanel.addStyleName("enterOTPPanel");
			enterOTPPanel.add( vertiPanel );
			enterOTPPanel.center();

			enterOTPPanel.setAnimationEnabled(true);
			enterOTPPanel.setAutoHideEnabled(false);
			enterOTPPanel.addStyleNameToContainer("OTPContainer");

			enterOTPPanel.show();
			Window.addResizeHandler(new ResizeHandler()
			{
				@Override
				public void onResize(ResizeEvent event)
				{
					if( enterOTPPanel.isAttached() )
					{
						enterOTPPanel.center();
					}
				}
			});
		}
		catch( Exception e )
		{
			E12CommonUtils.printOnConsole("Exception in upgrade version popup:::"+e.getMessage());
		}
	}

	private void setApplicationId()
	{
		try
		{
			E12CustomPlugin.getPrivateInfo(new CallBack()
			{

				@Override
				public void onSuccess(String result)
				{
					if (result == null || "".equals(result.trim())) {
						return;
					}

					JSONArray detailsJsonObj = null;
					JSONValue value = JSONParser.parseStrict(result);

					if( value.isObject() != null )
					{
						JSONObject jsonURL = value.isObject();
						E12CommonUtils.printOnConsole(jsonURL.toString());
						detailsJsonObj = (JSONArray) jsonURL.get("DETAILS");
						E12CommonUtils.printOnConsole("detailsJsonArray[" + detailsJsonObj.size() + "]");
					}
					else if( value.isArray() != null )
					{
						detailsJsonObj = value.isArray();
					}

					JSONArray detailsJsonArray = new JSONArray( detailsJsonObj.getJavaScriptObject() );
					E12CommonUtils.printOnConsole("detailsJsonArray[" + detailsJsonArray.size() + "]");

					if (detailsJsonArray != null)
					{
						for (int i = 0; i < detailsJsonArray.size(); i++)
						{
							JSONObject detailJsonObj = detailsJsonArray.get(i).isObject();
							Iterator<String> detailJsonObjKey = detailJsonObj.keySet().iterator();
							if (detailJsonObjKey != null)
							{
								while(detailJsonObjKey.hasNext())
								{
									String fieldKey = detailJsonObjKey.next();
									E12CommonUtils.printOnConsole(fieldKey);
									if(fieldKey=="app_id")
									{
										String appIdValue = E12CommonUtils.checkNull(detailJsonObj.get(fieldKey).isString().stringValue());
										E12CommonUtils.printOnConsole( "appIdValue["+appIdValue+"]" );
										if(!appIdValue.equals(""))
										{
											 appId = appIdValue;
										}
										break;
									}
								}
							}

						}

					}
				}

				@Override
				public void onError(String error) {

				}
			});
		}
		catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception in get Applicaion Id["+e.getMessage()+"]");
		}
	}

	public native void openPlayStore(String appId)
	/*-{
		 $wnd.customLog("openPlayStore via appId["+appId+"]");
	 	//window.location.href='https://play.google.com/store/apps/details?id=ibase.android.Proteus&hl=en';
		//window.location.href= "market://details?id=ibase.android.Proteus";
		window.location.href= "market://details?id="+appId+"";
	}-*/;

	public native void openAppStore()
	/*-{
		 $wnd.customLog("openAppStore");
	 	 //window.location.href = 'http://itunes.apple.com/lb/app/truecaller-caller-id-number/id448142450?mt=8';
	 	 window.location.href = 'https://itunes.apple.com/us/app/proteus-vision/id1217375829?mt=8';
	}-*/;
	//added by vishal pathare on 7.8.18 for[app update related changes if version incompatible ]End

	// Added by Abhishek T on 06-Dec-18 [For call other action on forgot PIN for OTP login] START
	private void onForgotPIN() {
		LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();

		if (loginMethod == LoginMethod.OTP) {
			E12Storage.getItem("OTP_MOBILE_NUMBER", new Callback<String, String>() {
				private HandlerRegistration resizeHandlerReg;
				@Override
				public void onSuccess(String mobileNumber) {
					double clientHeight = Window.getClientHeight();
					contents.getElement().getStyle().setHeight(clientHeight, Unit.PX);

					outerHeaderPanel.clear();
					contents.getElement().getStyle().setPaddingTop(0, Unit.PX);
					contents.getElement().getStyle().setPaddingBottom(0, Unit.PX);
					contents.clear();

					boolean disableMobileNumberField = mobileNumber.length() > 0;
					final OTPLogin otpLogin = new OTPLogin(mobileNumber, disableMobileNumberField);
					otpLogin.getElement().getStyle().setHeight(clientHeight, Unit.PX);

					add(otpLogin);

					resizeHandlerReg = Window.addResizeHandler(new ResizeHandler() {
						@Override
						public void onResize(ResizeEvent event) {
							new Timer() {

								@Override
								public void run() {
									double clientHeight = Window.getClientHeight();

									contents.getElement().getStyle().setHeight(clientHeight, Unit.PX);
									otpLogin.getElement().getStyle().setHeight(clientHeight, Unit.PX);
								}
							}.schedule(200);

							resizeHandlerReg.removeHandler();
						}
					});
				}

				@Override
				public void onFailure(String reason) {
					this.onSuccess("");
				}
			});
		} else {
			setForgotPin("forgotPIN");
			drawNewConLoginScreen();
		}
	}
	// Added by Abhishek T on 06-Dec-18 [For call other action on forgot PIN for OTP login] END

	// Added by Abhishek T on 08-Dec-18 [For clearing PIN fields,  when relogin failed in OTP case] START
	private native void clearPINFields() /*-{
		var pinFields = $doc.querySelectorAll('input[__pin_field__]');

		for (var i = 0, len = pinFields.length; i < len; i++) {
			var pinField = pinFields[i];

			pinField.value && (pinField.value = '');
		}

		var firstPinField = $doc.querySelector('input[__pin_field_first__]');
		firstPinField && (typeof firstPinField.focus === 'function') && firstPinField.focus();
	}-*/;
	// Added by Abhishek T on 08-Dec-18 [For clearing PIN fields,  when relogin failed in OTP case] END

	// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [START]
	public void drawFingerTouchScreen(final int noOfConnections)
	{
		E12CommonUtils.printOnConsole("E12ApplicationsPanel.drawFingerTouchScreen()");
		E12CustomPlugin.isTouchIdSupported(new E12CustomPlugin.CallBack() {

			@Override
			public void onSuccess(String result)
			{
				if( E12Global.checkNull(result).equals("true") )
				{
					// Change by Sandip
					String touchIdSupport = "Authenticate for " + storedUserName;   // result;
					E12CustomPlugin.isTouchIdAuthenticated(new CallBack()
					{
						@Override
						public void onSuccess(String result)
						{
							E12CommonUtils.printOnConsole("E12ApplicationsPanel drawFingerTouchScreen--- result ["+result);
							if( E12Global.checkNull(result).equals("true") )
							{
								// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] Start
								authenticateUser();
								// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] End
							}
							/*else if( E12Global.checkNull(result).equals("false") )
					{
						//Changed by Sandeep S. on 21-03-17 Start
						//displayPwd().center();
						if( !MELogin.cancelClick )
						{
							drawNewConLoginScreen();
						}
					}*/
							else if( E12Global.checkNull(result).equals("ShowPassword") )
							{
								if( !MELogin.cancelClick )
								{
									drawNewConLoginScreen();
								}
							}
							else if( E12Global.checkNull(result).equalsIgnoreCase("UsePin") )
							{
								//displayPwd().center();
								//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
								if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
								{
									//displayPopPanel(noOfConnections).center();
									drawPinLoginScreen(noOfConnections);
								}
								else
								{
									if( !MELogin.cancelClick )
									{
										drawNewConLoginScreen();
									}
								}
							}
							else if( E12Global.checkNull(result).equalsIgnoreCase("cancel") )
							{
								//if( !MELogin.cancelClick )
								/*{
								drawNewConLoginScreen();
							}*/
								/*if( E12Storage.getItem("iPin_"+storedUserName) != null)
								{
									displayPopPanel(noOfConnections).center();
								}
								else
								{
									if( !MELogin.cancelClick )
									{
										drawNewConLoginScreen();
									}
								}*/
								drawNewConLoginScreen();
							}
							else
							{
								//Added by sunny soni on 02-nov-16 start
								//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
								if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
								{
									//displayPopPanel(noOfConnections).center();
									drawPinLoginScreen(noOfConnections);
								}
								else
								{
									//displayPwd().center();
									if( !MELogin.cancelClick )
									{
										drawNewConLoginScreen();
									}
								}
							}
						}

						@Override
						public void onError(String error)
						{
							E12CommonUtils.printOnConsole("Exception while isTouchIdAuthenticated : "+error);
							//Changed by Sandeep S. on 23-05-17 Start
							//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
							if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
							{
								//displayPopPanel(noOfConnections).center();
								drawPinLoginScreen(noOfConnections);
							}
							else
							{
								drawNewConLoginScreen();
							}
						}
					}, touchIdSupport);
				}
				else
				{
					if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS)
					{
						//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
						if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
						{
							//displayPopPanel(noOfConnections).center();
							drawPinLoginScreen(noOfConnections);
						}
						else
						{
							//displayPwd().center();
							if( !MELogin.cancelClick )
							{
								drawNewConLoginScreen();
							}
						}
					}
					else
					{
						LoginMethod loginMethod = E12Global.getInstance().getLoginMethod();
						//displayPwd().center();
						//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes]
						if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
						{
							//displayPopPanel(noOfConnections).center();
							drawPinLoginScreen(noOfConnections);
						}
						else if (loginMethod == LoginMethod.OTP)
						{
							// set host url from manually in this case
							MELogin.hostUrl = E12Global.getInstance().getElementInnerText("otp-host-url");
							E12Constants.hostUrl = MELogin.hostUrl;
							E12ApplicationsPanel.storedHostUrl = E12Constants.hostUrl;

							double clientHeight = Window.getClientHeight();
							contents.getElement().getStyle().setHeight(clientHeight, Unit.PX);

							outerHeaderPanel.clear();
							contents.getElement().getStyle().setPaddingTop(0, Unit.PX);
							contents.getElement().getStyle().setPaddingBottom(0, Unit.PX);

							OTPLogin otpLogin = new OTPLogin();
							otpLogin.getElement().getStyle().setHeight(clientHeight, Unit.PX);
							add(otpLogin);
						}
						else
						{
							if( !MELogin.cancelClick )
							{
								drawNewConLoginScreen();
							}
						}
					}
					//displayPwd().center();
				}
			}

			@Override
			public void onError(String error)
			{
				E12CommonUtils.printOnConsole("Exception while isTouchIdSupported : "+error);
				//displayPwd().center();
				if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+storedUserName)).length()>0)
				{
					//displayPopPanel(noOfConnections).center();
					drawPinLoginScreen(noOfConnections);
				}
				else
				{
					if( !MELogin.cancelClick )
					{
						drawNewConLoginScreen();
					}
				}
			}
		});

	}
	// Added by Pankaj R on 19-FEB-19 to show Finger Touch screen in case of AUTO mode. [START]
}
