private void populateDiscriminatorsGrid( ProtocolDiscriminatorVoCollection newdiscriminatorCollection) { grdDiscriminatorsRowCollection addedDiscriminatorCollection = form.grdDiscriminators().getRows(); if (addedDiscriminatorCollection.size() == 0) { addNewRow(newdiscriminatorCollection); } else { ProtocolDiscriminatorVoCollection remainingDiscriminatorCollection = new ProtocolDiscriminatorVoCollection(); for (int x = 0; x < newdiscriminatorCollection.size(); x++) { remainingDiscriminatorCollection.add(newdiscriminatorCollection.get(x)); } for (int a = newdiscriminatorCollection.size() - 1; a >= 0; a--) { for (int n = addedDiscriminatorCollection.size() - 1; n >= 0; n--) { if (addedDiscriminatorCollection .get(n) .getcolDiscriminator() .equals( newdiscriminatorCollection.get(a).getDiscriminator().getDiscriminatorName())) { addedDiscriminatorCollection .get(n) .setcolPriority(newdiscriminatorCollection.get(a).getPriority().toString()); addedDiscriminatorCollection.get(n).setValue(newdiscriminatorCollection.get(a)); remainingDiscriminatorCollection.remove(a); } } } addNewRow(remainingDiscriminatorCollection); } }
private void addNewRow(ProtocolDiscriminatorVoCollection newdiscriminatorCollection) { for (int i = 0; i < newdiscriminatorCollection.size(); i++) { grdDiscriminatorsRow newRow = form.grdDiscriminators().getRows().newRow(); newRow.setcolPriority(newdiscriminatorCollection.get(i).getPriority().getText()); newRow.setcolDiscriminator( newdiscriminatorCollection.get(i).getDiscriminator().getDiscriminatorName()); newRow.setValue(newdiscriminatorCollection.get(i)); } }