Uses 911K of libraries. Click here for Pure Java version (13753L/73K).
!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 { switchable S caseID; transient S defaultCmdsSnippetID = #1027616; L<Table> makeTables() { ret itemPlusList(new Table("Object Types", "object type", ObjectType), map(list(cc, ObjectType), type -> new Table(plural(type.name), type.name, DynamicThing, litparams(+type)))); } transient NameBasedVoiceCRUD<ObjectType> typesCRUD; void startDB { cc = dm_handleCaseIDField(); } start { typesCRUD = voiceCRUDs.get(idx(ObjectType)); // Update voice CRUDs when there is a new object type onConceptsChange(cc, 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(cc, ObjectType)), pair("Objects", CRUD(cc, 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)); } @Override S moreActions(S s) null { if "stats" ret "You have stored " + nObjects(countConcepts(cc, ObjectType)) + " of " + nTypes(countConcepts(cc, DynamicThing)); } // API LS objectTypes() { ret itemPlus("object type", collect name(list(cc, ObjectType))); } }
Began life as a copy of #1027580
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027591 |
Snippet name: | Generic Multi-CRUD |
Eternal ID of this version: | #1027591/33 |
Text MD5: | 4d907ba40a914cc692ce31a1d7d45b5c |
Transpilation MD5: | 2ed50b76fc54d7c4e6067e51f16d13ec |
Author: | stefan |
Category: | javax / voice crud |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-28 00:22:01 |
Source code size: | 2010 bytes / 70 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 311 / 42206 |
Version history: | 32 change(s) |
Referenced in: | [show references] |