private BalanceActivitiesCollection populateBalActivitiesFromGrd() { BalanceActivitiesCollection balColl = new BalanceActivitiesCollection(); for (int i = 0; i < form.gridActivities().getRows().size(); i++) { GenForm.gridActivitiesRow rowPar = form.gridActivities().getRows().get(i); if(rowPar.getColSelected()) balColl.add(rowPar.getValue()); for(int x=0; x<form.gridActivities().getRows().get(i).getRows().size(); x++) { GenForm.gridActivitiesRow rowAct = form.gridActivities().getRows().get(i).getRows().get(x); if(rowAct.getColSelected()) balColl.add(rowAct.getValue()); } } return balColl; }
void populateActivitiesGrid(BalanceActivitiesCollection balActivitiesColl) { BalanceActivitiesCollection coll = balActivitiesColl; BalanceActivitiesCollection collInactive = new BalanceActivitiesCollection(); GenForm.gridActivitiesRow row = null; for(int i=0;i<coll.size();i++) { int r=0; for (r=0; r<form.gridActivities().getAllRows().length; r++) { row = form.gridActivities().getAllRows()[r]; if(coll.get(i).equals(row.getColActivities())) { row.setValue(coll.get(i)); row.setColActivities(coll.get(i)); row.setColSelected(true); break; } } if(r == form.gridActivities().getAllRows().length) { collInactive.add(coll.get(i)); } } //inactive record handling boolean inactiveParentAndChild = true; BalanceActivities bal = null; BalanceActivities balParent = null; for(int i=0;i<collInactive.size();i++) { bal = collInactive.get(i); balParent = bal.getParent(); if(balParent != null) { GenForm.gridActivitiesRow rowChild = null; int j=0; for(j=0;j<form.gridActivities().getRows().size();j++) { row = form.gridActivities().getRows().get(j); if(row.getColActivities().equals(balParent)) { rowChild = row.getRows().newRow(); rowChild.setValue(bal); rowChild.setColActivities(bal); rowChild.setColSelected(true); inactiveParentAndChild = false; break; } } if(inactiveParentAndChild == true) displayInactiveParentAndChild(bal); if(j == form.gridActivities().getAllRows().length) { row = row.getRows().newRow(); row.setValue(bal); row.setColActivities(bal); row.setColSelected(true); } } else { //display inactive parent row = form.gridActivities().getRows().newRow(); row.setValue(bal); row.setColActivities(bal); row.setColSelected(true); } } }