Java Code Examples for ims.framework.controls.DynamicGridRowCollection

The following are top voted examples for showing how to use ims.framework.controls.DynamicGridRowCollection. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private TemplateBoRefVoCollection getTemplateBoRefFromMappGrid()
{
	DynamicGridRowCollection rows = form.lyrMain().tabByCategory().dyngrdMapps().getRows();
	if (rows.size() == 0)
		return null;

	TemplateBoRefVoCollection result = new TemplateBoRefVoCollection();
	for (int i = 0; i < rows.size(); i++)
	{
		if (rows.get(i).getValue() instanceof DocumentCategoryConfigShortVo)
		{
			result.add(((DocumentCategoryConfigShortVo) rows.get(i).getValue()).getTemplate());
		}
	}

	return result;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void addAllAvailable()
{
	tabByCategoryContainer tab = form.lyrMain().tabByCategory();

	for (int i = 0; i < tab.dyngrdAvailableRep().getRows().size(); i++)
	{
		DynamicGridRowCollection templates = tab.dyngrdAvailableRep().getRows().get(i).getRows();
		if (templates != null)
		{
			for (int j = 0; j < templates.size(); j++)
			{
				DocumentCategoryConfigShortVo docCat = new DocumentCategoryConfigShortVo();
				docCat.setTemplate((TemplateForPatientDocumentVo) templates.get(j).getValue());
				docCat.setCategory(tab.grdDocCat().getValue());
				addRowToMappGrid(docCat);
			}

		}
	}

	tab.dyngrdAvailableRep().getRows().clear();
	updateControlsState();
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void populateDataFromGrid(LookupInstanceCollection data,DynamicGridRowCollection rows)
{
	if (data == null)
		throw new CodingRuntimeException("Data is null. Loading to what?");
	if (isSingleSelect())
	{
		if (form.dyngrdLookup().getValue() instanceof LookupInstVo)
		{
			data.add((LookupInstVo) form.dyngrdLookup().getValue());
			
		}
		return;
	}
	if (rows == null)
		return;
	
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (Boolean.TRUE.equals(rows.get(i).getCells().get(getColumn(COL_SELECT)).getValue()))
			data.add((LookupInstVo) rows.get(i).getValue());
		populateDataFromGrid(data, rows.get(i).getRows());
	}
	
}
 
Example 4
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private boolean rowExists(ReportsCategoryListVo voCategory)
{
	if(voCategory == null || voCategory.getID_ReportsCategory() == null)
		return false;
	
	DynamicGridRowCollection rows = form.dyngrdReports().getRows();
	
	for (int i = 0; i < rows.size(); i++)
	{
		DynamicGridRow dynamicGridRow = rows.get(i);
		Object value = dynamicGridRow.getValue();
		if (value instanceof ReportsCategoryListVo)
		{
			ReportsCategoryListVo voReportsCategory = (ReportsCategoryListVo) value;
			
			if( voCategory.getID_ReportsCategory().equals(voReportsCategory.getID_ReportsCategory()))
				return true;
		}
	}

	return false;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private Integer getReportValue(String reportName, DynamicGridRowCollection rowColl)
{
	if (reportName == null || rowColl == null)
		return null;

	for (int i = 0; rowColl != null && i < rowColl.size(); i++)
	{
		DynamicGridRow dynamicGridRow = rowColl.get(i);
		//Increment the flat index
		Integer lastIndex = form.getLocalContext().getFlatIndex();
		form.getLocalContext().setFlatIndex(new Integer(lastIndex.intValue() + 1));
	
		Integer index = getReport(reportName, dynamicGridRow);
		if (index != INDEX_START)
			return index;

		if (dynamicGridRow.getRows() != null && dynamicGridRow.getRows().size() > 0)
		{
			index = getReportValue(reportName, dynamicGridRow.getRows());
			if (index != INDEX_START)
				return index;
		}
	}

	return INDEX_START;
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private MedicationRouteVoCollection getRoutes(DynamicGridRowCollection rows)
{
	if (rows == null)
		return null;
	MedicationRouteVoCollection result = new MedicationRouteVoCollection();
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			x.setRouteUnits(getUnits(rows.get(i).getRows()));
			if (x.getRouteIsNotNull() || x.getRouteUnitsIsNotNull())
			{
				result.add(x);
			}
		}
	}
	if (result.size() == 0)
		return null;
	return result;
}
 
Example 7
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private MedicationUnitVoCollection getUnits(DynamicGridRowCollection rows)
{
	if (rows == null)
		return null;
	MedicationUnitVoCollection result = new MedicationUnitVoCollection();
	for ( int i = 0 ; i  < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationUnitVo)
		{
			MedicationUnitVo x = (MedicationUnitVo) rows.get(i).getValue();
			if (x.getDoseUnitIsNotNull())
				result.add(x);
		}
	}
	if (result.size()==0)
		return null;
	return result;
}
 
Example 8
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, AssessmentQuestionVo assessmentQuestion)
{
	if (assessmentQuestion == null)
		return null;

	DynamicGridRowCollection rows = null;
	if (groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();

	for (int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if (row.getIdentifier() != null && row.getIdentifier() instanceof AssessmentQuestionVo)
		{
			if (row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}

	return null;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findLastRowWithSameIdentifier(DynamicGridRowCollection rows, Object identifier)
{
	if (rows == null || identifier == null)
		return null;

	DynamicGridRow lastRow = null;
	for (int x = 0; x < rows.size(); x++)
	{
		if (identifier.equals(rows.get(x).getIdentifier()))
		{
			lastRow = rows.get(x);
		}
	}

	return lastRow;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, Assessment_QuestionVo assessmentQuestion)
{
	if (assessmentQuestion == null)
		return null;

	DynamicGridRowCollection rows = null;
	if (groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();

	for (int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if (row.getIdentifier() != null && row.getIdentifier() instanceof Assessment_QuestionVo)
		{
			if (row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}

	return null;
}
 
Example 11
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, AssessmentQuestionVo assessmentQuestion)
{
	if(assessmentQuestion == null)
		return null;
	
	DynamicGridRowCollection rows = null;
	if(groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();
	
	for(int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if(row.getIdentifier() != null && row.getIdentifier() instanceof AssessmentQuestionVo)
		{
			if(row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}
	
	return null;
}
 
Example 12
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findLastRowWithSameIdentifier(DynamicGridRowCollection rows, Object identifier)
{
	if(rows == null || identifier == null)
		return null;
	
	DynamicGridRow lastRow = null;		
	for(int x = 0; x < rows.size(); x++)
	{
		if(identifier.equals(rows.get(x).getIdentifier()))
		{
			lastRow = rows.get(x);
		}
	}
	
	return lastRow;
}
 
Example 13
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, Assessment_QuestionVo assessmentQuestion)
{
	if(assessmentQuestion == null)
		return null;
	
	DynamicGridRowCollection rows = null;
	if(groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();
	
	for(int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if(row.getIdentifier() != null && row.getIdentifier() instanceof Assessment_QuestionVo)
		{
			if(row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}
	
	return null;
}
 
Example 14
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void setNotSelectable(DynamicGridRow row)
{
	if (row == null)
		return;
	row.setSelectable(false);
	row.setReadOnly(true);
	row.setCollapsedImage(getDisabledImage(row));
	row.setExpandedImage(getDisabledImage(row));
	DynamicGridRowCollection childs = row.getRows();
	if (childs == null)
		return;
	for (int i = 0; i < childs.size(); i++)
	{
		setNotSelectable(childs.get(i));
	}
}
 
Example 15
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow[] getAllRows(DynamicGridRowCollection rows)
{
	java.util.ArrayList returnRows = new java.util.ArrayList();
	for(int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		returnRows.add(row);
		
		DynamicGridRow[] childRows = getAllRows(row);
		for(int i = 0; i < childRows.length; i++)
		{
			returnRows.add(childRows[i]);
		}
	}
	
	DynamicGridRow[] result = new DynamicGridRow[returnRows.size()];
	for(int x = 0; x < returnRows.size(); x++)
	{
		result[x] = (DynamicGridRow) returnRows.get(x);
	}
	
	return result;
}
 
Example 16
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private boolean verifyDateinRows(List<String> uiErrors, DynamicGridRowCollection rows, boolean foundBadExpiry)
{
	for (int i = 0; i < rows.size(); i++)
	{
		if (!(rows.get(i).getValue() != null && ((ValueObjectRef) rows.get(i).getValue()).getBoId() != null))
		{

			DynamicGridCell[] cellArray = rows.get(i).getCellArray();
			if (cellArray[2].getValue() != null && ((Date) cellArray[2].getValue()).isLessThan(new Date()))
			{
				uiErrors.add("Expiry Date can't be in the past");
				foundBadExpiry = true;
				break;
			}
		}
	}
	return foundBadExpiry;
}
 
Example 17
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private TemplateBoRefVoCollection getTemplateBoRefFromMappGrid()
{
	DynamicGridRowCollection rows = form.lyrMain().tabByCategory().dyngrdMapps().getRows();
	if (rows.size() == 0)
		return null;

	TemplateBoRefVoCollection result = new TemplateBoRefVoCollection();
	for (int i = 0; i < rows.size(); i++)
	{
		if (rows.get(i).getValue() instanceof DocumentCategoryConfigShortVo)
		{
			result.add(((DocumentCategoryConfigShortVo) rows.get(i).getValue()).getTemplate());
		}
	}

	return result;
}
 
Example 18
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private String validateReasonDelayedDischargeAdded()
{
	StringBuilder reasonValidationErrors = new StringBuilder();
	
	DynamicGridRowCollection delayedReasonsOnScreenRows = form.lyrDetail().tabReadyForDischarge().dyngrdDischReason().getRows();
	if (delayedReasonsOnScreenRows.size() > 0)
	{
		for (int i = 0; i<delayedReasonsOnScreenRows.size();i++)
		{
			if (delayedReasonsOnScreenRows.get(i) == null || !(delayedReasonsOnScreenRows.get(i).getValue() instanceof ReasonForDelayedDischargeVo))
				continue;
			if (delayedReasonsOnScreenRows.get(i).getCells().get(getColumn(COL_DELAY_DATE)).getValue() != null && new DateTime().isLessThan((DateTime)delayedReasonsOnScreenRows.get(i).getCells().get(getColumn(COL_DELAY_DATE)).getValue()))
				reasonValidationErrors.append("Delay Date/Time cannot be in the future");
			if (delayedReasonsOnScreenRows.get(i).getCells().get(getColumn(COL_DELAY_DATE)).getValue() != null && delayedReasonsOnScreenRows.get(i).getCells().get(getColumn(COL_DELAY_END_DATE)).getValue() != null && ((DateTime)delayedReasonsOnScreenRows.get(i).getCells().get(getColumn(COL_DELAY_END_DATE)).getValue()).isLessThan((DateTime) delayedReasonsOnScreenRows.get(i).getCells().get(getColumn(COL_DELAY_DATE)).getValue()))
				reasonValidationErrors.append("End Date/Time cannot be earlier than Delayed Date/Time for a delay reason.");
		}
	}
	return reasonValidationErrors.length() > 0 ? reasonValidationErrors.toString() : null;
}
 
Example 19
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private BayConfigForWardViewVoCollection getSelectedBaysForBlock()
{
	DynamicGridRowCollection grdBayRows = form.lyrDetails().tabBlockB().dyngrdBaysForBlock().getRows();
	BayConfigForWardViewVoCollection bays = new BayConfigForWardViewVoCollection();
	for (int i=0;i<grdBayRows.size();i++)
	{
		if (grdBayRows.get(i) == null || grdBayRows.get(i).getValue() == null || !(grdBayRows.get(i).getValue() instanceof BayConfigForWardViewVo))
			continue;
		if (Boolean.TRUE.equals(grdBayRows.get(i).getCells().get(getColumnBay(COLUMN_BAY_SELECT_BLOCK, form.lyrDetails().tabBlockB().dyngrdBaysForBlock())).getValue()))
		{	
			BayConfigForWardViewVo gridValue = (BayConfigForWardViewVo)grdBayRows.get(i).getValue();
			bays.add((BayConfigForWardViewVo) gridValue.clone());
		}
	}
	return bays;

}
 
Example 20
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findLastRowWithSameIdentifier(DynamicGridRowCollection rows, Object identifier)
{
	if(rows == null || identifier == null)
		return null;
	
	DynamicGridRow lastRow = null;		
	for(int x = 0; x < rows.size(); x++)
	{
		if(identifier.equals(rows.get(x).getIdentifier()))
		{
			lastRow = rows.get(x);
		}
	}
	
	return lastRow;
}
 
Example 21
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private BayConfigForWardViewVoCollection getSelectedBaysForReopen()
{
	DynamicGridRowCollection grdBayRows = form.lyrDetails().tabReopenB().dyngrdBaysForReopen().getRows();
	BayConfigForWardViewVoCollection bays = new BayConfigForWardViewVoCollection();
	for (int i=0;i<grdBayRows.size();i++)
	{
		if (grdBayRows.get(i) == null || grdBayRows.get(i).getValue() == null || !(grdBayRows.get(i).getValue() instanceof BayConfigForWardViewVo))
			continue;
		if (Boolean.TRUE.equals(grdBayRows.get(i).getCells().get(getColumnBay(COLUMN_BAY_SELECT_REOPEN,form.lyrDetails().tabReopenB().dyngrdBaysForReopen())).getValue()))
		{	
			BayConfigForWardViewVo gridValue = (BayConfigForWardViewVo)grdBayRows.get(i).getValue();
			bays.add((BayConfigForWardViewVo) gridValue.clone());
		}
	}
	return bays;

}
 
Example 22
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private MedicationRouteVoCollection getRoutes(DynamicGridRowCollection rows)
{
	if (rows == null)
		return null;
	MedicationRouteVoCollection result = new MedicationRouteVoCollection();
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			x.setRouteUnits(getUnits(rows.get(i).getRows()));
			if (x.getRouteIsNotNull() || x.getRouteUnitsIsNotNull())
			{
				result.add(x);
			}
		}
	}
	if (result.size() == 0)
		return null;
	return result;
}
 
Example 23
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void populateDataFromGrid(LookupInstanceCollection data,DynamicGridRowCollection rows)
{
	if (data == null)
		throw new CodingRuntimeException("Data is null. Loading to what?");
	if (isSingleSelect())
	{
		if (form.dyngrdLookup().getValue() instanceof LookupInstVo)
		{
			data.add((LookupInstVo) form.dyngrdLookup().getValue());
			
		}
		return;
	}
	if (rows == null)
		return;
	
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (Boolean.TRUE.equals(rows.get(i).getCells().get(getColumn(COL_SELECT)).getValue()))
			data.add((LookupInstVo) rows.get(i).getValue());
		populateDataFromGrid(data, rows.get(i).getRows());
	}
	
}
 
Example 24
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private boolean rowExists(ReportsCategoryListVo voCategory)
{
	if(voCategory == null || voCategory.getID_ReportsCategory() == null)
		return false;
	
	DynamicGridRowCollection rows = form.dyngrdReports().getRows();
	
	for (int i = 0; i < rows.size(); i++)
	{
		DynamicGridRow dynamicGridRow = rows.get(i);
		Object value = dynamicGridRow.getValue();
		if (value instanceof ReportsCategoryListVo)
		{
			ReportsCategoryListVo voReportsCategory = (ReportsCategoryListVo) value;
			
			if( voCategory.getID_ReportsCategory().equals(voReportsCategory.getID_ReportsCategory()))
				return true;
		}
	}

	return false;
}
 
Example 25
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private Integer getReportValue(String reportName, DynamicGridRowCollection rowColl)
{
	if (reportName == null || rowColl == null)
		return null;

	for (int i = 0; rowColl != null && i < rowColl.size(); i++)
	{
		DynamicGridRow dynamicGridRow = rowColl.get(i);
		//Increment the flat index
		Integer lastIndex = form.getLocalContext().getFlatIndex();
		form.getLocalContext().setFlatIndex(new Integer(lastIndex.intValue() + 1));
	
		Integer index = getReport(reportName, dynamicGridRow);
		if (index != INDEX_START)
			return index;

		if (dynamicGridRow.getRows() != null && dynamicGridRow.getRows().size() > 0)
		{
			index = getReportValue(reportName, dynamicGridRow.getRows());
			if (index != INDEX_START)
				return index;
		}
	}

	return INDEX_START;
}
 
Example 26
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private MedicationRouteVoCollection getRoutes(DynamicGridRowCollection rows)
{
	if (rows == null)
		return null;
	MedicationRouteVoCollection result = new MedicationRouteVoCollection();
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationRouteVo)
		{
			MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue();
			x.setRouteUnits(getUnits(rows.get(i).getRows()));
			if (x.getRouteIsNotNull() || x.getRouteUnitsIsNotNull())
			{
				result.add(x);
			}
		}
	}
	if (result.size() == 0)
		return null;
	return result;
}
 
Example 27
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, AssessmentQuestionVo assessmentQuestion)
{
	if (assessmentQuestion == null)
		return null;

	DynamicGridRowCollection rows = null;
	if (groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();

	for (int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if (row.getIdentifier() != null && row.getIdentifier() instanceof AssessmentQuestionVo)
		{
			if (row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}

	return null;
}
 
Example 28
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findLastRowWithSameIdentifier(DynamicGridRowCollection rows, Object identifier)
{
	if (rows == null || identifier == null)
		return null;

	DynamicGridRow lastRow = null;
	for (int x = 0; x < rows.size(); x++)
	{
		if (identifier.equals(rows.get(x).getIdentifier()))
		{
			lastRow = rows.get(x);
		}
	}

	return lastRow;
}
 
Example 29
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, Assessment_QuestionVo assessmentQuestion)
{
	if (assessmentQuestion == null)
		return null;

	DynamicGridRowCollection rows = null;
	if (groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();

	for (int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if (row.getIdentifier() != null && row.getIdentifier() instanceof Assessment_QuestionVo)
		{
			if (row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}

	return null;
}
 
Example 30
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, AssessmentQuestionVo assessmentQuestion)
{
	if(assessmentQuestion == null)
		return null;
	
	DynamicGridRowCollection rows = null;
	if(groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();
	
	for(int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if(row.getIdentifier() != null && row.getIdentifier() instanceof AssessmentQuestionVo)
		{
			if(row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}
	
	return null;
}
 
Example 31
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findLastRowWithSameIdentifier(DynamicGridRowCollection rows, Object identifier)
{
	if(rows == null || identifier == null)
		return null;
	
	DynamicGridRow lastRow = null;		
	for(int x = 0; x < rows.size(); x++)
	{
		if(identifier.equals(rows.get(x).getIdentifier()))
		{
			lastRow = rows.get(x);
		}
	}
	
	return lastRow;
}
 
Example 32
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, Assessment_QuestionVo assessmentQuestion)
{
	if(assessmentQuestion == null)
		return null;
	
	DynamicGridRowCollection rows = null;
	if(groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();
	
	for(int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if(row.getIdentifier() != null && row.getIdentifier() instanceof Assessment_QuestionVo)
		{
			if(row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}
	
	return null;
}
 
Example 33
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void setUnselectedSitesToFalse()
{
	TreatmentSiteNameVoCollection treatmentSites = getTreatmentSites();
	DynamicGridRowCollection rows = form.ctnDetails().lyrPrimaryTumour().tabClinicalTrials().dyngrdClinicalTrials().getRows();

	for (int i = 0; i < rows.size(); i++)
	{
		for (int j = 0; j < treatmentSites.size(); j++)
		{
			DynamicGridCell siteCell = rows.get(i).getCells().get(getColumnById(((Integer) treatmentSites.get(j).getTreatmentSite().getID()).toString()));

			if (siteCell == null)
			{
				DynamicGridCell newSiteCell = rows.get(i).getCells().newCell(getColumnById(((Integer) treatmentSites.get(j).getTreatmentSite().getID()).toString()), DynamicCellType.BOOL);
				newSiteCell.setValue(Boolean.FALSE);
				newSiteCell.setTooltip(newSiteCell.getRow().getValue() != null ? newSiteCell.getRow().getValue().toString(): ""); //WDEV-17527
			}
		}
	}
}
 
Example 34
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private void addAllAvailable()
{
	tabByCategoryContainer tab = form.lyrMain().tabByCategory();

	for (int i = 0; i < tab.dyngrdAvailableRep().getRows().size(); i++)
	{
		DynamicGridRowCollection templates = tab.dyngrdAvailableRep().getRows().get(i).getRows();
		if (templates != null)
		{
			for (int j = 0; j < templates.size(); j++)
			{
				DocumentCategoryConfigShortVo docCat = new DocumentCategoryConfigShortVo();
				docCat.setTemplate((TemplateForPatientDocumentVo) templates.get(j).getValue());
				docCat.setCategory(tab.grdDocCat().getValue());
				addRowToMappGrid(docCat);
			}

		}
	}

	tab.dyngrdAvailableRep().getRows().clear();
	updateControlsState();
}
 
Example 35
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void enableOnlyEditedConsultant()
{

	DynamicGridRow consultantParent = form.getLocalContext().getCurrentEditedConsultant();
	DynamicGridRowCollection rows = form.dyngrdMain().getRows();
	for (int i = 0; i < rows.size(); i++)
	{
		if (!rows.get(i).equals(consultantParent))
		{
			setNotSelectable(rows.get(i));
		}
		else
		{
			rows.get(i).setReadOnly(false); //WDEV-20198
		}

	}

}
 
Example 36
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private MedicationUnitVoCollection getUnits(DynamicGridRowCollection rows)
{
	if (rows == null)
		return null;
	MedicationUnitVoCollection result = new MedicationUnitVoCollection();
	for ( int i = 0 ; i  < rows.size() ; i++)
	{
		if (rows.get(i).getValue() instanceof MedicationUnitVo)
		{
			MedicationUnitVo x = (MedicationUnitVo) rows.get(i).getValue();
			if (x.getDoseUnitIsNotNull())
				result.add(x);
		}
	}
	if (result.size()==0)
		return null;
	return result;
}
 
Example 37
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
@Override
protected void onDynGridActionPlansCellValueChanged(DynamicGridCell cell)
{
	if (cell.getType().equals(DynamicCellType.BOOL) && cell.getRow().getParent() == null)
	{
		DynamicGridRow row = cell.getRow();
		DynamicGridRowCollection childRows = row.getRows();

		for (int i = 0; i < childRows.size(); i++)
		{
			childRows.get(i).getCells().get(form.dyngrdActionPlans().getColumns().get(1)).setValue(cell.getValue());
		}
	}
	if (cell.getType().equals(DynamicCellType.BOOL) && cell.getRow().getParent() != null)
	{

		DynamicGridRow parentRow = cell.getRow().getParent();
		parentRow.getCells().get(form.dyngrdActionPlans().getColumns().get(2)).setValue(true);

	}

}
 
Example 38
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private ArrayList<Integer> getDynGrdRowIds()
{
	ArrayList<Integer> diagnosticIds = new ArrayList<Integer>();
	
	DynamicGridRowCollection rows = form.dyngrdDiagnostics().getRows();
	if(rows != null && rows.size()>0 && rows.get(0).getValue() instanceof LinkedDiagnosticVo )
	{
		for(int i=0; i<rows.size(); i++)
		{
		
			Integer diagnosticId = ((LinkedDiagnosticVo)rows.get(i).getValue()).getDiagnostics().getID();
			diagnosticIds.add(diagnosticId);

		}
	}
	return diagnosticIds;
}
 
Example 39
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private DynamicGridRow findRow(DynamicGridRow groupRow, Assessment_QuestionVo assessmentQuestion)
{
	if (assessmentQuestion == null)
		return null;

	DynamicGridRowCollection rows = null;
	if (groupRow != null)
		rows = groupRow.getRows();
	else
		rows = this.grid.getRows();

	for (int x = 0; x < rows.size(); x++)
	{
		DynamicGridRow row = rows.get(x);
		if (row.getIdentifier() != null && row.getIdentifier() instanceof Assessment_QuestionVo)
		{
			if (row.getIdentifier().equals(assessmentQuestion))
				return row;
		}
	}

	return null;
}
 
Example 40
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void populateDataFromGrid(LookupInstanceCollection data,DynamicGridRowCollection rows)
{
	if (data == null)
		throw new CodingRuntimeException("Data is null. Loading to what?");
	if (isSingleSelect())
	{
		if (form.dyngrdLookup().getValue() instanceof LookupInstVo)
		{
			data.add((LookupInstVo) form.dyngrdLookup().getValue());
			
		}
		return;
	}
	if (rows == null)
		return;
	
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (Boolean.TRUE.equals(rows.get(i).getCells().get(getColumn(COL_SELECT)).getValue()))
			data.add((LookupInstVo) rows.get(i).getValue());
		populateDataFromGrid(data, rows.get(i).getRows());
	}
	
}