/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/Nursing/src/ims/nursing/forms/must/Logic.java
//#############################################################################
//#                                                                           #
//#  Copyright (C) <2015>  <IMS MAXIMS>                                       #
//#                                                                           #
//#  This program is free software: you can redistribute it and/or modify     #
//#  it under the terms of the GNU Affero General Public License as           #
//#  published by the Free Software Foundation, either version 3 of the       #
//#  License, or (at your option) any later version.                          # 
//#                                                                           #
//#  This program is distributed in the hope that it will be useful,          #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of           #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
//#  GNU Affero General Public License for more details.                      #
//#                                                                           #
//#  You should have received a copy of the GNU Affero General Public License #
//#  along with this program.  If not, see <http://www.gnu.org/licenses/>.    #
//#                                                                           #
//#  IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of    #
//#  this program.  Users of this software do so entirely at their own risk.  #
//#  IMS MAXIMS only ensures the Clinical Safety of unaltered run-time        #
//#  software that it builds, deploys and maintains.                          #
//#                                                                           #
//#############################################################################
//#EOH
// This code was generated by Charlotte Murphy using IMS Development Environment (version 1.45 build 2377.15764)
// Copyright (C) 1995-2006 IMS MAXIMS plc. All rights reserved.

package ims.nursing.forms.must;

import ims.configuration.gen.ConfigFlag;
import ims.core.vo.AuthoringInformationVo;
import ims.core.vo.VSMetrics;
import ims.core.vo.VitalSignsVo;
import ims.domain.exceptions.StaleObjectException;
import ims.framework.Control;
import ims.framework.enumerations.FormMode;
import ims.framework.exceptions.FormOpenException;
import ims.framework.exceptions.PresentationLogicException;
import ims.framework.utils.Color;
import ims.framework.utils.DateTime;
import ims.nursing.forms.must.GenForm.ctnMustContainer.GroupHEnumeration;
import ims.nursing.forms.must.GenForm.ctnMustContainer.GroupWEnumeration;
import ims.nursing.vo.MUSTVo;
import ims.nursing.vo.MUSTVoCollection;
import ims.nursing.vo.lookups.MUSTManagement;

public class Logic extends BaseLogic
{
	private static final long serialVersionUID = 1L;

	protected void onFormOpen() throws PresentationLogicException
	{
		initialize();
		open();
	}
	public void open() throws PresentationLogicException
	{		
		populateListControl(domain.listMUSTByCareContext(form.getGlobalContext().Core.getCurrentCareContext()));
		
		//set selection back
		if (form.getLocalContext().getSelectedRecordIsNotNull())
		{
			//need to get timestamp from record retrieved from List call.
			GenForm.grdDetailsRow row = form.grdDetails().getRowByValue(form.getLocalContext().getSelectedRecord());
			if (row != null && row.getValue() != null)
			{			
				form.getLocalContext().setSelectedRecord(row.getValue());
				form.grdDetails().setValue(form.getLocalContext().getSelectedRecord());
				populateInstanceControl(form.grdDetails().getValue());
			}
			else
				clearInstanceControls();
			updateControlsState();			
		}
		else		
			form.ctnMust().setCollapsed(true);
		
		form.setMode(FormMode.VIEW);
		
	}
	
	private void populateListControl(MUSTVoCollection voMUSTColl)
	{
		clear();
		
		if(voMUSTColl == null) return;
		
		for(int i=0; i<voMUSTColl.size(); i++)
		{
			MUSTVo voMUST = voMUSTColl.get(i);
			GenForm.grdDetailsRow row = form.grdDetails().getRows().newRow();
			
			if(voMUST.getAuthoringInformationIsNotNull())
			row.setColDateTime(voMUST.getAuthoringInformation().getAuthoringDateTime().toString()+" - "+ voMUST.getAuthoringInformation().getAuthoringHcp().toString());
			
			
			if(voMUST.getBMIScoreIsNotNull())
				row.setColStep1(voMUST.getBMIScore().toString());
			if(voMUST.getUWLScoreIsNotNull())
				row.setColStep2(voMUST.getUWLScore().toString());
			if(voMUST.getADEScoreIsNotNull())
				row.setColStep3(voMUST.getADEScore().toString());
			if(voMUST.getORMScoreIsNotNull())
				row.setColTotal(voMUST.getORMScore().toString());
			if(voMUST.getManagementIsNotNull())
				row.setColManagement(voMUST.getManagement().toString());
			
			row.setColAction(voMUST.getActionTaken());
			row.setTooltipForColAction(voMUST.getActionTakenIsNotNull()? voMUST.getActionTaken():"");
			
			row.setValue(voMUST);
			
			if(voMUST.getManagement().equals(MUSTManagement.HIGHRISK))
				row.setTextColor(Color.Red);
		}
	}
	public void clear()
	{
		super.clear();
		form.grdDetails().getRows().clear();
		clearInstanceControls();
	}
	public void clearInstanceControls()
	{
		form.ctnMust().decWeight().setValue(null);
		form.ctnMust().decHeight().setValue(null);
		form.ctnMust().decPreviousWeight().setValue(null);
		form.ctnMust().chkAcutelyIll().setValue(false);
		form.ctnMust().decBMI().setValue(null);
		form.ctnMust().decUWL().setValue(null);
		form.ctnMust().intStep1().setValue(new Integer(0));
		form.ctnMust().intStep2().setValue(new Integer(0));
		form.ctnMust().intStep3().setValue(new Integer(0));
		form.ctnMust().intStepTotal().setValue(null);
		form.ctnMust().cmbManagement().setValue(null);
		form.ctnMust().txtAction().setValue(null);
		form.ctnMust().txtWeightLossReason().setValue(null);
		form.ctnMust().customControlAuth().setValue(null);
		
		if(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue())//WDEV-15193
		{
			form.ctnMust().GroupH().setValue(GroupHEnumeration.None);
			form.ctnMust().GroupW().setValue(GroupWEnumeration.None);
		}
	}
	protected void onGrdDetailsSelectionChanged() throws ims.framework.exceptions.PresentationLogicException
	{
		selectionChanged();
	}
	private void selectionChanged()
	{
		//Display Panel and detail
		form.getLocalContext().setSelectedRecord(form.grdDetails().getValue());
		populateInstanceControl(form.grdDetails().getValue());
		updateControlsState();
	}	
	private void populateInstanceControl(MUSTVo voMUST) 
	{
		VitalSignsVo voVital = voMUST.getVitalSign();
		VSMetrics voMetrics = voMUST.getMetrics();
		if(voVital != null && voVital.getMetricsIsNotNull())
		{
			form.ctnMust().decWeight().setValue(voVital.getMetrics().getWeightValue());
			form.ctnMust().decHeight().setValue(voVital.getMetrics().getHeightValue());
			
			if(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue())//WDEV-15193
			{
				form.ctnMust().GroupH().setValue(voVital.getMetrics().getHeightEstimatedMeasuredIsNotNull() && voVital.getMetrics().getHeightEstimatedMeasured() ? GroupHEnumeration.rdoHM : GroupHEnumeration.rdoHE);
				form.ctnMust().GroupW().setValue(voVital.getMetrics().getWeightEstimatedMeasuredIsNotNull() && voVital.getMetrics().getWeightEstimatedMeasured() ? GroupWEnumeration.rdoWM : GroupWEnumeration.rdoWE);
			}
		}
		else if(voMetrics != null)
		{
			form.ctnMust().decWeight().setValue(voMetrics.getWeightValue());
			form.ctnMust().decHeight().setValue(voMetrics.getHeightValue());
			
			if(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue())//WDEV-15193
			{
				form.ctnMust().GroupH().setValue(voMetrics.getHeightEstimatedMeasuredIsNotNull() && voMetrics.getHeightEstimatedMeasured() ? GroupHEnumeration.rdoHM : GroupHEnumeration.rdoHE);
				form.ctnMust().GroupW().setValue(voMetrics.getWeightEstimatedMeasuredIsNotNull() && voMetrics.getWeightEstimatedMeasured() ? GroupWEnumeration.rdoWM : GroupWEnumeration.rdoWE);
			}
		}
		
		form.ctnMust().decPreviousWeight().setValue(voMUST.getPreviousHealthyWeight());
		form.ctnMust().chkAcutelyIll().setValue(voMUST.getAcutelyIll().booleanValue());
		form.ctnMust().chkAcutelyIll().setValue(voMUST.getAcutelyIll().booleanValue());
		form.ctnMust().intStep1().setValue(voMUST.getBMIScore());
		form.ctnMust().intStep2().setValue(voMUST.getUWLScore());
		form.ctnMust().intStep3().setValue(voMUST.getADEScore());
		form.ctnMust().intStepTotal().setValue(voMUST.getORMScore());
		form.ctnMust().cmbManagement().setValue(voMUST.getManagement());
		form.ctnMust().txtAction().setValue(voMUST.getActionTaken());
		form.ctnMust().txtWeightLossReason().setValue(voMUST.getWeightLossReason());		
		form.ctnMust().customControlAuth().setValue(voMUST.getAuthoringInformation());
		
		calculateUWL();
		calculateBMI();
		
		form.ctnMust().setCollapsed(false);
	}
	protected void onBtnNewClick() throws ims.framework.exceptions.PresentationLogicException
	{
		newInstance();
	}
	protected void onBtnUpdateClick() throws ims.framework.exceptions.PresentationLogicException
	{
		updateInstance();
	}
	protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException
	{
		if(save())
			open();
	}
	public String[] validateUIRules()
	{
		java.util.ArrayList<String> listOfErrors = new java.util.ArrayList<String>();
		
		if (form.ctnMust().decWeight().getValue() == null)
		{
			listOfErrors.add("Please enter a " + form.ctnMust().lblWeight().getValue() + " value - Required for MUST score calculation");
			form.ctnMust().decWeight().setFocus();
		}

		if (form.ctnMust().decHeight().getValue() == null )
		{			
			listOfErrors.add("Please enter a " + form.ctnMust().lblHeight().getValue() + " value - Required for MUST score calculation");
			form.ctnMust().decHeight().setFocus();
		}
		
		if (form.ctnMust().decHeight().getValue() != null && form.ctnMust().decWeight().getValue() != null && 
				((form.ctnMust().decHeight().getValue() >= 0 && form.ctnMust().decHeight().getValue() < 1) ||
					(form.ctnMust().decWeight().getValue() >= 0 && form.ctnMust().decWeight().getValue() < 1)))
		{
			listOfErrors.add("A non-zero and greater than 1 value needs to be specified for Height and Weight"); //WDEV-19619 					
		}
		//WDEV-19619
		if (form.ctnMust().decPreviousWeight().getValue() != null  &&				
					(form.ctnMust().decPreviousWeight().getValue() >= 0 && form.ctnMust().decPreviousWeight().getValue() < 1))
		{
			listOfErrors.add("A non-zero and greater than 1 value needs to be specified for Previous Healthy Weight");					
		}
		if(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue())//WDEV-15193
		{
			if (form.ctnMust().GroupH().getValue() == GroupHEnumeration.None)
			{
				listOfErrors.add("You must specify if Height was estimated or measured.");
			}
			if (form.ctnMust().GroupW().getValue() == GroupWEnumeration.None)
			{
				listOfErrors.add("You must specify if Weight was estimated or measured.");
			}
		}		
		int errorCount = listOfErrors.size();
		if(errorCount == 0)
		{
			return null;
		}
				
		return listOfErrors.toArray(new String[errorCount]); //WDEV-19619
	}
	public boolean save() throws PresentationLogicException
	{
		MUSTVo voMust = populateInstanceData();
		
		String[] arrErrors = voMust.validate(validateUIRules());
		
		if(arrErrors != null)
		{
			engine.showErrors(arrErrors);
			return false;
		}
		try 
		{
			form.getLocalContext().setSelectedRecord(domain.saveMUST(voMust));
		} 
		catch (StaleObjectException e)
		{
			engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
			open();
			return false;
		}
		return true;
	}
	private MUSTVo populateInstanceData() 
	{
		MUSTVo voMust = form.getLocalContext().getSelectedRecord();
		
		if(voMust == null)
			voMust = new MUSTVo();
		
		voMust.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
		if(voMust.getClinicalContact() == null)
			voMust.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
		
		
		voMust.setActionTaken(form.ctnMust().txtAction().getValue());
		voMust.setAcutelyIll(new Boolean(form.ctnMust().chkAcutelyIll().getValue()));
		voMust.setManagement(form.ctnMust().cmbManagement().getValue());
		voMust.setPreviousHealthyWeight(form.ctnMust().decPreviousWeight().getValue());
		voMust.setWeightLossReason(form.ctnMust().txtWeightLossReason().getValue());
		
		voMust.setORMScore(form.ctnMust().intStepTotal().getValue());
		voMust.setBMIScore(form.ctnMust().intStep1().getValue());
		voMust.setUWLScore(form.ctnMust().intStep2().getValue());
		voMust.setADEScore(form.ctnMust().intStep3().getValue());
		
		VSMetrics voMetrics = null;
		VitalSignsVo voVitalSign = voMust.getVitalSign();

		if(form.ctnMust().customControlAuth().getValue()!=null 
			&& form.ctnMust().customControlAuth().getValue().getAuthoringDateTimeIsNotNull()
				&& form.ctnMust().customControlAuth().getValue().getAuthoringHcpIsNotNull())
			voMust.setAuthoringInformation(form.ctnMust().customControlAuth().getValue());
		else
			voMust.setAuthoringInformation(null);
		
		if ( ConfigFlag.UI.SHOW_VITAL_SIGNS_METRIC_CONTROLS.getValue())
		{
			if(voVitalSign == null)
				voVitalSign = new VitalSignsVo();
			
			voVitalSign.setAuthoringInformation(new AuthoringInformationVo());

			voVitalSign.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
			if(voVitalSign.getClinicalContact() == null)
				voVitalSign.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
			
			if (form.ctnMust().customControlAuth().getValue() != null)
			{
				voVitalSign.setAuthoringInformation(form.ctnMust().customControlAuth().getValue());
			}
			else
				//
				voVitalSign.setAuthoringInformation(new AuthoringInformationVo());
				
			voVitalSign.setVitalsTakenDateTime(new DateTime());
			voMetrics = voVitalSign.getMetrics();
		}

		if(voMetrics == null)
			voMetrics = new VSMetrics();
		//wdev-13657
		if (form.ctnMust().customControlAuth().getValue() != null)
			voMetrics.setAuthoringInformation(form.ctnMust().customControlAuth().getValue());

		voMetrics.setBMI(form.ctnMust().decBMI().getValue());
		voMetrics.setHeightValue(form.ctnMust().decHeight().getValue());
		voMetrics.setWeightValue(form.ctnMust().decWeight().getValue());
		voMetrics.setPatient(form.getGlobalContext().Core.getPatientShort());
		
		if(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue())//WDEV-15193
		{
			voMetrics.setHeightEstimatedMeasured(form.ctnMust().GroupH().getValue()==GroupHEnumeration.rdoHM ? true : false);
			voMetrics.setWeightEstimatedMeasured(form.ctnMust().GroupW().getValue()==GroupWEnumeration.rdoWM ? true : false);
		}
		
		if ( ConfigFlag.UI.SHOW_VITAL_SIGNS_METRIC_CONTROLS.getValue())
		{
			voVitalSign.setMetrics(voMetrics);
			voMust.setVitalSign(voVitalSign);
		}
		else
			voMust.setMetrics(voMetrics);
		
		return voMust;
	}
	protected void onBtnCancelClick() throws ims.framework.exceptions.PresentationLogicException
	{
		open();
	}
	private void calculateUWL()
	{
		if(form.ctnMust().decPreviousWeight().getValue() == null || form.ctnMust().decWeight().getValue() == null) return;
		
		float newWeight = form.ctnMust().decWeight().getValue().floatValue();
		float previousWeight = form.ctnMust().decPreviousWeight().getValue().floatValue();
		
		if(newWeight < previousWeight)
		{
			Float uwl = unplannedBodyLoss(previousWeight, newWeight);
			
			form.ctnMust().decUWL().setValue(uwl);
			
			if(uwl.floatValue() < 5)
				form.ctnMust().intStep2().setValue(new Integer(0));
			if(uwl.floatValue() >= 5 && uwl.floatValue() <= 10)
				form.ctnMust().intStep2().setValue(new Integer(1));
			if(uwl.floatValue() > 10)
				form.ctnMust().intStep2().setValue(new Integer(2));
		}
		else
		{
			form.ctnMust().decUWL().setValue(new Float(0));
			form.ctnMust().intStep2().setValue(new Integer(0));
		}
			
	}
	private Float unplannedBodyLoss(float previousWeight, float newWeight) 
	{
		return new Float(((previousWeight - newWeight)/previousWeight) * 100/1);
	}
	private void calculateBMI()
	{	
		form.ctnMust().intStep1().setValue(null);
		form.ctnMust().decBMI().setValue(null);
		
		if(form.ctnMust().decWeight().getValue() == null || form.ctnMust().decHeight().getValue() == null) 
			return;

		if (form.ctnMust().decHeight().getValue() < 1 || form.ctnMust().decWeight().getValue() < 1)
			return;
		
		Float bmi = bodyMassIndex(form.ctnMust().decHeight().getValue().floatValue(), form.ctnMust().decWeight().getValue().floatValue());
		
		populateBMIControl(bmi);	
	}
	private Float bodyMassIndex(float height/*cm*/, float weight/*kg*/)
	{
		//we have to convert the HEIGHT from cm to m as the formula requires m
		return new Float((float)(weight / (height / 100.0 * height / 100.0)));
	}
	
	private void populateBMIControl(Float bmi) 
	{
		if(bmi == null) return;
		
		Float bmiResult = null;
		
		if(bmi.floatValue() > 20)
			bmiResult = new Float(0);
	
		if(bmi.floatValue() >= 18.5 && bmi.floatValue() <= 20)
			bmiResult = new Float(1);

		if(bmi.floatValue() < 18.5)
			bmiResult = new Float(2);
		
		if(bmiResult != null)
			form.ctnMust().intStep1().setValue(new Integer(bmiResult.intValue()));
		form.ctnMust().decBMI().setValue(bmi);
	}	
	protected void onFormModeChanged()
	{
		updateControlsState();		
	}
	protected void onDecHeightValueChanged() throws PresentationLogicException 
	{
		calculateBMI();
		calculateTotalScore();
	}
	protected void onDecWeightValueChanged() throws PresentationLogicException 
	{
		calculateBMI();
		calculateUWL();
		calculateTotalScore();
	}
	protected void onDecPreviousWeightValueChanged() throws PresentationLogicException 
	{
		calculateUWL();
		calculateTotalScore();
	}
	
	protected void onChkAcutelyIllValueChanged() throws PresentationLogicException 
	{
		if(form.ctnMust().chkAcutelyIll().getValue())
			form.ctnMust().intStep3().setValue(new Integer(2));
		else
			form.ctnMust().intStep3().setValue(new Integer(0));
		
		calculateTotalScore();
	}
	private void calculateTotalScore() 
	{
		int total = 0;
		
		if(form.ctnMust().intStep1().getValue() != null)
			total += form.ctnMust().intStep1().getValue().intValue();
		if(form.ctnMust().intStep2().getValue() != null)
			total += form.ctnMust().intStep2().getValue().intValue();
		if(form.ctnMust().intStep3().getValue() != null)
			total += form.ctnMust().intStep3().getValue().intValue();
		
		form.ctnMust().intStepTotal().setValue(new Integer(total));
		
		populateManagement();
	}
	protected void populateManagement() 
	{
		if(form.ctnMust().intStepTotal().getValue() == null) return;
		
		if(form.ctnMust().intStepTotal().getValue().intValue() == 0)
			form.ctnMust().cmbManagement().setValue(MUSTManagement.LOWRISK);
		else if(form.ctnMust().intStepTotal().getValue().intValue() == 1)
			form.ctnMust().cmbManagement().setValue(MUSTManagement.MEDIUMRISK);
		else if(form.ctnMust().intStepTotal().getValue().intValue() >= 2)
			form.ctnMust().cmbManagement().setValue(MUSTManagement.HIGHRISK);
		
	}
	protected void onContextMenuItemClick(int menuItemID, Control sender) throws PresentationLogicException 
	{
		switch(menuItemID)
		{
			case GenForm.ContextMenus.GenericGrid.Add:
				newInstance();
				break;
			case GenForm.ContextMenus.GenericGrid.Update:
				updateInstance();
				break;
		}
	}
	public void updateInstance()
	{
		if (allowUpdate())
		{		
			form.setMode(FormMode.EDIT);
			enableAuthoringControls(false);
			form.getLocalContext().setSelectedRecord(form.grdDetails().getValue());
		}
	}
	public void newInstance() throws PresentationLogicException
	{
		if (allowNew())
		{
			clearInstanceControls();
			form.ctnMust().customControlAuth().initializeComponent();
			enableAuthoringControls(true);
			form.ctnMust().customControlAuth().setIsRequiredPropertyToControls(true);
			// initalise the screen for a new record
			form.getLocalContext().setSelectedRecord(new MUSTVo());			
			getLastHeightWeight();
			form.ctnMust().setCollapsed(false);
			//set the form mode

			form.setMode(FormMode.EDIT);
		}			
	}
	private void getLastHeightWeight()
	{
		VSMetrics voMetrics = null;
		if ( ConfigFlag.UI.SHOW_VITAL_SIGNS_METRIC_CONTROLS.getValue())
			voMetrics = domain.getLastMetrics(form.getGlobalContext().Core.getCurrentCareContext());
		else
			voMetrics = domain.getLastMUSTMetrics(form.getGlobalContext().Core.getCurrentCareContext());
			
		if(voMetrics != null)
		{
			form.ctnMust().decHeight().setValue(voMetrics.getHeightValue());
			
			if(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue())//WDEV-15193
			{
				form.ctnMust().GroupH().setValue(Boolean.TRUE.equals(voMetrics.getHeightEstimatedMeasured()) ? GroupHEnumeration.rdoHM : GroupHEnumeration.rdoHE);
			}
		}
	}
	private void enableAuthoringControls(boolean enable) 
	{
		form.ctnMust().setcustomControlAuthEnabled(enable);
	}
	public void updateControlsState() 
	{	
		if(form.getMode().equals(FormMode.EDIT))
		{			
			form.getContextMenus().getGenericGridAddItem().setVisible(false);
			form.getContextMenus().getGenericGridUpdateItem().setVisible(false);						
		}
		else
		{
			if (form.grdDetails().getSelectedRowIndex()>=0)
			{
				form.getContextMenus().getGenericGridAddItem().setVisible(true);
				form.getContextMenus().getGenericGridUpdateItem().setVisible(true);
				if (form.grdDetails().getSelectedRowIndex()>=0)
					form.btnUpdate().setVisible(true);
				else
					form.btnUpdate().setVisible(false);
			}
			else
			{
				form.getContextMenus().getGenericGridAddItem().setVisible(true);
				form.getContextMenus().getGenericGridUpdateItem().setVisible(false);
				form.btnUpdate().setVisible(false);
			}						
		}
		
		form.ctnMust().GroupH().setVisible(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue());//WDEV-15193
		form.ctnMust().GroupW().setVisible(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue());//WDEV-15193
		
		form.ctnMust().GroupH().setEnabled(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue() && FormMode.EDIT.equals(form.getMode()));//WDEV-15193
		form.ctnMust().GroupW().setEnabled(ConfigFlag.UI.HW_MEASURED_ESTIMATED_FUNCTIONALITY.getValue() && FormMode.EDIT.equals(form.getMode()));//WDEV-15193
	}
	
	public void initialize() throws FormOpenException
	{
		super.initialize();
		form.getContextMenus().getGenericGridAddItem().setText("New MUST");
		form.getContextMenus().getGenericGridUpdateItem().setText("Edit MUST");
	}
}
