Adds support for loading Layer components VIA JSON.
@@ -89,20 +89,16 @@ public class ScreenBuilder extends ComponentBuilder<Screen> {
final ComponentBuilder componentBuilder = loadComponentFromJSON(arrayElement, radio);
if (componentBuilder != null) {
- // todo Add special case for LayerBuilder
- /*
- if (component instanceof Layer) {
- layerComponents.add((Layer) component);
+ if (componentBuilder instanceof LayerBuilder) {
+ layerComponents.add((Layer) componentBuilder.build());
} else {
- this.components.add(component);
- }
- */
this.components.add(componentBuilder.build());
}
}
}
}
}
+ }
/**
* Loads a component from it's JSON representation.
@@ -150,6 +146,13 @@ public class ScreenBuilder extends ComponentBuilder<Screen> {
return labelBuilder;
}
+ case "layer": {
+ final LayerBuilder layerBuilder = new LayerBuilder();
+ layerBuilder.parseJSON(jsonObject);
+ layerBuilder.setRadio(radio);
+ return layerBuilder;
+ }
+
case "progress bar": {
final ProgressBarBuilder progressBarBuilder = new ProgressBarBuilder();
progressBarBuilder.parseJSON(jsonObject);
