fix chart card header

This commit is contained in:
f43nd1r 2019-12-07 00:58:39 +01:00
parent 61ac16c810
commit ea2ff64358
2 changed files with 5 additions and 1 deletions

View file

@ -40,7 +40,7 @@ abstract class Chart<T> extends Composite<Card> {
} }
public void setContent(@NonNull Map<T, Long> map) { public void setContent(@NonNull Map<T, Long> map) {
getContent().removeAll(); getContent().removeContent();
getContent().add(createChart(map)); getContent().add(createChart(map));
} }

View file

@ -76,6 +76,10 @@ public class Card extends PolymerTemplate<Card.CardModel> implements HasSize, Ha
getStyle().set("--acrarium-card-header-color", backgroundColor); getStyle().set("--acrarium-card-header-color", backgroundColor);
} }
public void removeContent() {
getChildren().filter(component -> component.getElement().getAttribute("slot") == null).forEach(this::remove);
}
public interface CardModel extends TemplateModel { public interface CardModel extends TemplateModel {
void setCanCollapse(boolean collapse); void setCanCollapse(boolean collapse);
boolean getCanCollapse(); boolean getCanCollapse();