Enable programmatically referencing Window's components
This commit is contained in:
@@ -84,6 +84,13 @@ public class NanoVGGUI implements GUI {
|
||||
return inflater.inflateComponent(is, context, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Component> T inflateComponent(String widgetUid, Class<T> type) {
|
||||
log.info("Inflating component by widget definition with UID: [{}]", widgetUid);
|
||||
var is = widgetDefinitionManager.loadObject(widgetUid);
|
||||
return type.cast(inflater.inflateComponent(is, context, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window inflateWindow(String widgetUid) {
|
||||
log.info("Inflating window by widget definition with UID: [{}]", widgetUid);
|
||||
@@ -91,6 +98,12 @@ public class NanoVGGUI implements GUI {
|
||||
return inflater.inflateWindow(is, context, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Window> T inflateWindow(String widgetUid, Class<T> type) {
|
||||
log.info("Inflating window by widget definition with UID: [{}]", widgetUid);
|
||||
var is = widgetDefinitionManager.loadObject(widgetUid);
|
||||
return type.cast(inflater.inflateWindow(is, context, this));
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
|
||||
@@ -97,7 +97,7 @@ public class DefaultInflater implements Inflater {
|
||||
|
||||
var windowClass = loader.loadClass(canonicalName);
|
||||
|
||||
var window = (Window) windowClass.getConstructor(Context.class, GUI.class).newInstance(context, gui);
|
||||
var window = (Window) windowClass.getConstructor(Context.class, GUI.class, Map.class).newInstance(context, gui, refs);
|
||||
var attributes = root.getAttributes();
|
||||
|
||||
// Set attributes via setter methods
|
||||
|
||||
Reference in New Issue
Block a user