public void render ( ) { removeMembers ( getMembers ( ) ) ; // Then go over all layers, to draw styles: for ( Layer < ? > layer : mapModel . getLayers ( ) ) { if ( staticLegend || layer . isShowing ( ) ) { // Go over every truly visible layer: if ( layer instanceof VectorLayer ) { ClientVectorLayerInfo layerInfo = ( ( VectorLayer ) layer ) . getLayerInfo ( ) ; // For vector layer; loop over the style definitions: UserStyleInfo userStyle = layerInfo . getNamedStyleInfo ( ) . getUserStyle ( ) ; FeatureTypeStyleInfo info = userStyle . getFeatureTypeStyleList ( ) . get ( 0 ) ; for ( int i = 0 ; i < info . getRuleList ( ) . size ( ) ; i ++ ) { RuleInfo rule = info . getRuleList ( ) . get ( i ) ; // use title if present, name if not String title = ( rule . getTitle ( ) != null ? rule . getTitle ( ) : rule . getName ( ) ) ; // fall back to style name if ( title == null ) { title = layerInfo . getNamedStyleInfo ( ) . getName ( ) ; } addVector ( ( VectorLayer ) layer , i , title ) ; } } else if ( layer instanceof RasterLayer ) { addRaster ( ( RasterLayer ) layer ) ; } } } }
Render the legend . This triggers a complete redraw .