private void createSingleStyleLegend(Map<String,Style> styleMap,StyledLayer selectedStyledLayer,Style selectedStyle){
  List<Style> styleList=null;
  if (selectedStyledLayer instanceof NamedLayerImpl) {
    NamedLayerImpl namedLayer=(NamedLayerImpl)selectedStyledLayer;
    styleList=namedLayer.styles();
  }
 else   if (selectedStyledLayer instanceof UserLayerImpl) {
    UserLayerImpl userLayer=(UserLayerImpl)selectedStyledLayer;
    styleList=userLayer.userStyles();
  }
  String styleName;
  if (selectedStyle.getName() != null) {
    styleName=selectedStyle.getName();
  }
 else {
    styleName=String.format("Style %d",styleList.indexOf(selectedStyle));
  }
  styleMap.put(styleName,selectedStyle);
}

private void createSingleStyleLegend ( Map < String , Style > styleMap , StyledLayer selectedStyledLayer , Style selectedStyle ) { List < Style > styleList = null ; if ( selectedStyledLayer instanceof NamedLayerImpl ) { NamedLayerImpl namedLayer = ( NamedLayerImpl ) selectedStyledLayer ; styleList = namedLayer . styles ( ) ; } else if ( selectedStyledLayer instanceof UserLayerImpl ) { UserLayerImpl userLayer = ( UserLayerImpl ) selectedStyledLayer ; styleList = userLayer . userStyles ( ) ; } String styleName ; if ( selectedStyle . getName ( ) != null ) { styleName = selectedStyle . getName ( ) ; } else { styleName = String . format ( "Style %d" , styleList . indexOf ( selectedStyle ) ) ; } styleMap . put ( styleName , selectedStyle ) ; }
creates the legend for a single sld style .
