sclass FormInFlight { Conversation conversation; S hashTag; new L<FormStep> steps; int stepIndex; // in steps list S handleInput(S s) { null; } FormStep currentStep() { ret get(steps, stepIndex); } void update(Runnable onChange) { if (currentStep() != null) currentStep().update(onChange); } S complete() { ret "Form complete"; } S cancel() { ret "Request cancelled"; } FormStep byKey(S key) { ret objectWhere(steps, +key); } S getValue(S key) { FormStep step = byKey(key); ret step?.value; } SS allValues() { SS map = litorderedmap(); for (FormStep step : steps) map.put(step.key, step.value); ret map; } bool allowGeneralOverride() { false; } Conversation cancelMe() { Conversation conv = conversation; print("cancelMe called"); // TODO: conversation.cancelForm(); ret conv; } void change { if (conversation != null) conversation.change(); } } abstract concept BotShowForm > BotStep { abstract FormInFlight makeForm(); bool run(Conversation conv) { Form form = makeForm(); true; }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1029912 | 
| Snippet name: | Form wrapper for DynNewBot2 [dev.] | 
| Eternal ID of this version: | #1029912/1 | 
| Text MD5: | da88932ce16ebfea96822918f454083f | 
| Author: | stefan | 
| Category: | javax / html | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2020-10-03 12:24:50 | 
| Source code size: | 1183 bytes / 56 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 374 / 428 | 
| Referenced in: | [show references] |