Set content in LocaleChangeEvent listener

This commit is contained in:
Arne Keller 2021-07-09 12:18:26 +02:00
parent 5ddfb355c2
commit df218d8be8

View File

@ -36,18 +36,18 @@ public class ImageSlide extends Slide implements LocaleChangeObserver {
slideLayout = new VerticalLayout(); slideLayout = new VerticalLayout();
imageKey = imgKey; imageKey = imgKey;
explanationKey = textKey; explanationKey = textKey;
explanation = new Span(getTranslation(explanationKey)); explanation = new Span();
explanation.setId(EXPLANATION_ID); explanation.setId(EXPLANATION_ID);
slideLayout.add(new Image(getTranslation(imgKey), StringUtils.EMPTY), explanation);
slideLayout.setId(SLIDE_LAYOUT_ID); slideLayout.setId(SLIDE_LAYOUT_ID);
add(slideLayout); add(slideLayout);
// actual content added in localeChange
} }
@Override @Override
public void localeChange(LocaleChangeEvent event) { public void localeChange(LocaleChangeEvent event) {
slideLayout.removeAll(); slideLayout.removeAll();
explanation.setText(getTranslation(explanationKey)); explanation.setText(getTranslation(explanationKey));
slideLayout.add(new Image(getTranslation(imageKey), StringUtils.EMPTY), explanation); slideLayout.add(new Image(getTranslation(imageKey), ""), explanation);
} }
} }