for (int i = 0; i < requestedLayerInfos.size(); i++) {
Object o = requestedLayerInfos.get(i);
Style style = oldStyles.isEmpty() ? null : (Style) oldStyles.get(i);
if (o instanceof LayerGroupInfo) {
LayerGroupInfo groupInfo = (LayerGroupInfo)o;
for(int j = 0; j < groupInfo.getStyles().size(); j++) {
StyleInfo si = groupInfo.getStyles().get(j);
if(si == null)
si = groupInfo.getLayers().get(j).getDefaultStyle();
newStyles.add(si.getStyle());
}
// expand the filter on the layer group to all its sublayers
if(filters != null) {
for (int j = 0; j < groupInfo.getLayers().size(); j++) {
newFilters.add(getFilter(filters, i));
}
}
} else if(o instanceof LayerInfo){
style = oldStyles.size() > 0? oldStyles.get(i) : null;