Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

50
LINES

< > BotCompany Repo | #1026559 // List With Feedback

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (10826L/58K).

!7

sclass Entry {
  S item, reasoning, feedback = "";
  
  sS _fieldOrder = "reasoning item feedback";
}

cmodule ListWithFeedback > DynObjectTable<Entry> {
  S description, code, computerNotes, humanNotes, metaData, globalIDSaved;
  
  start {
    defaultAction = voidfunc(Entry e) {
      inputText("Feedback for: " + e.item, e.feedback, feedback -> { e.feedback = feedback; change(); });
    };
  }
  
  visual northCenterAndSouthWithMargins(
    northAndCenterWithMargin(
      centerAndEastWithMargin(
        dm_textFieldWithLabel description(),
        jThreadedButton("Save data", rEnter saveData)),
      jMinHeight(70,
        jhsplit(0.75, dm_textAreaWithTitle code(), dm_textAreaWithTitle computerNotes()))),
    withTitle("The List", super),
    withTitle("Human Notes", centerAndEastWithMargin(
      jMinHeight(70, dm_textArea humanNotes()),
      jNorth(jbutton("All good", r-thread { setField(humanNotes := "all good"); })))));
  
  // API
  
  void saveData {
    File dir = ai_listsWithFeedbackDir();
    setField(metaData := "Made on computer " + computerID() + " on " + localDateWithSeconds());
    S globalID = aGlobalID();
    S struct = javaTokWordWrap(dm_freshModuleStruct());
    setField(globalIDSaved := globalID);
    infoBox("Saved: " + renderFileInfo(saveTextFile(newFile(dir, globalID + ".struct"), struct)));
  }
  
  // takes a list of strings or pairs (item + reasoning)
  void importItems(L l) {
    setData(map(l, o -> {
      o = quickImport(o);
      if (o cast Pair) ret nu Entry(item := o.a, reasoning := o.b);
      if (o cast WithReasoning) ret nu Entry(item := str(o!), reasoning := o.reasoning);
      ret nu Entry(item := str(o));
    }));
  }
}

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: #1026559
Snippet name: List With Feedback
Eternal ID of this version: #1026559/30
Text MD5: d0d5d64ade8f680a25baf2da473db3d2
Transpilation MD5: c26a95c78a36594646fbd657605798eb
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-20 14:25:34
Source code size: 1741 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 300 / 1137
Version history: 29 change(s)
Referenced in: [show references]