Search in sources :

Example 1 with WidgetLibrary

use of org.terasology.nui.reflection.WidgetLibrary in project Terasology by MovingBlocks.

the class NUIManagerInternal method refreshWidgetsLibrary.

public void refreshWidgetsLibrary() {
    widgetsLibrary = new WidgetLibrary(context.get(ModuleManager.class).getEnvironment(), context.get(ReflectFactory.class), context.get(CopyStrategyLibrary.class));
    ModuleEnvironment environment = context.get(ModuleManager.class).getEnvironment();
    for (Class<? extends UIWidget> type : environment.getSubtypesOf(UIWidget.class)) {
        Name module = verifyNotNull(environment.getModuleProviding(type), "No module provides %s", type);
        widgetsLibrary.register(new ResourceUrn(module.toString(), type.getSimpleName()), type);
    }
}
Also used : ModuleEnvironment(org.terasology.gestalt.module.ModuleEnvironment) WidgetLibrary(org.terasology.nui.reflection.WidgetLibrary) TypeWidgetLibrary(org.terasology.nui.widgets.types.TypeWidgetLibrary) ModuleManager(org.terasology.engine.core.module.ModuleManager) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) Name(org.terasology.gestalt.naming.Name)

Aggregations

ModuleManager (org.terasology.engine.core.module.ModuleManager)1 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)1 ModuleEnvironment (org.terasology.gestalt.module.ModuleEnvironment)1 Name (org.terasology.gestalt.naming.Name)1 WidgetLibrary (org.terasology.nui.reflection.WidgetLibrary)1 TypeWidgetLibrary (org.terasology.nui.widgets.types.TypeWidgetLibrary)1