!7 concept ObjectType > Named { S conceptClassName; toString { ret "object type " + quote(name); } } concept DynamicThing > Named { ObjectType type; toString { ret (type == null ? "?" : type.name) + " " + quote(name); } } cmodule DynamicClassesMultiCRUD > DynVoiceMultiCRUD { transient S defaultCmdsSnippetID = #1027616; L makeTables() { ret itemPlusList(new Table("Object Types", "object type", ObjectType), map(list(ObjectType), type -> new Table(plural(type.name), type.name, DynamicThing, litparams(+type)))); } transient NameBasedVoiceCRUD typesCRUD; start { typesCRUD = voiceCRUDs.get(idx(ObjectType)); // Update voice CRUDs when there is a new object type onConceptsChange(rWatcher_noRunFirstTime( () -> objectTypes(), names -> objectTypesChanged(names))); } void objectTypesChanged(LS names) enter { print("Updating voice CRUDs"); remakeVoiceCRUDs(); vmBus_send objectTypesChanged(module(), names); } void startSwingCRUDs { swingCRUDs = ll( pair("Object Types", CRUD(ObjectType)), pair("Objects", CRUD(DynamicThing))); } void startFrontEnd enter { S frontEnd = dm_showModuleWithParams("#1027602/ChatBotFrontend", backendModuleID := dm_moduleID()); if (eq(dm_call(frontEnd, 'conceptCount), 0)) dm_call(frontEnd, 'importCmdsFromSnippet, defaultCmdsSnippetID); } afterVisualize { addComponent(firstSwingCRUDButtons(), jbutton("Start front-end", rThread startFrontEnd)); } // API LS objectTypes() { ret itemPlus("object type", collect name(list(ObjectType))); } }