# HG changeset patch # User dnt_bjoernsen # Date 1611070790 -3600 # Node ID 2197a7ccb4a8364b532c0db15513cea4e78b82ea # Parent da21bbabd3adbbf6e32c77b7c83c61b44ca22d5d LegendWindow zu 3.1. + 3.2 DEBUG diff -r da21bbabd3ad -r 2197a7ccb4a8 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java Tue Jan 19 15:00:50 2021 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java Tue Jan 19 16:39:50 2021 +0100 @@ -74,13 +74,33 @@ final HLayout row = new HLayout(); row.addMember(label); row.addMember(img); - - row.setHeight(150); - row.setWidth(400); - + + String url = "url"; + + if (img instanceof Image) { + setDimensions( row, ((Image) img).getHeight(), ((Image) img).getWidth()); + url = " url " + ((Image) img).getUrl(); + } + else if (img instanceof Img) { + setDimensions( row, ((Img) img).getHeight(), ((Img) img).getWidth()); + url = " dataPath " + ((Img) img).getDataPath(); + } + else { + setDimensions( row, 150, 400); //not sure when this is executed + } + String labelText = at.getDescription() +", height: "+ row.getHeight()+"width: "+ row.getWidth()+" "+url; + // +// final HLayout row2= new HLayout(); + row.addMember(new Label(labelText)); return row; } + private void setDimensions(HLayout row, int height, int width ) { + final int minHeight = 30; + row.setHeight(height < minHeight ? minHeight : height); + row.setWidth(width); + } + private Widget createLegendGraphics(final AttributedTheme at) { final String legend = at.getAttr("legend"); @@ -100,11 +120,8 @@ // final double heightPercent = imageHeight / 150.; if (widthPercent > 1)// || heightPercent > 1) { - // if (widthPercent > heightPercent) image.setSize((int) (imageWidth / widthPercent) + "px", (int) (imageHeight / widthPercent) + "px"); - // else - // image.setSize((int) (imageWidth / heightPercent) + "px", (int) (imageHeight / heightPercent) + "px"); - // } + return image; } final String imgUrl = MapUtils.getLegendGraphicUrl(at.getAttr("url"), at.getAttr("layers"));