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

30
LINES

< > BotCompany Repo | #1019783 // Rules [Dyn Module, old]

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

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

!7

concept Rule {
  S in, out;
}

cmodule Rules > DynCRUD<Rule> {
  *() { super(Rule); }
  
  afterVisualize {
    replaceComponent(crud.tableSearcher.tfInput, func(JComponent c) -> JComponent {
      centerAndEastWithMargin(c, jbutton("Add rule...", rThread {
        addRule(searchTerm())
      }))
    });
    onEnter(crud.tableSearcher.tfInput, rThread { addRule(searchTerm()) });
  }
  
  void addRule(fS term) enter {
    final JTextField tfIn = jtextfield(or2(term, dm_topInput())), tfOut = jtextfield();
    showFormTitled("Add Rule",
      "Input:", tfIn,
      "Output:", tfOut,
      rThread {
        S in = gtt(tfIn), out = gtt(tfOut);
        uniq_sync(Rule, +in, +out);
      });
    focus(nempty(term) ? tfOut : tfIn);
  }
}

Author comment

Began life as a copy of #1019714

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019783
Snippet name: Rules [Dyn Module, old]
Eternal ID of this version: #1019783/5
Text MD5: d63eec68c81c3bb5063c6158e38c7211
Transpilation MD5: db158dff8b29657d85b15acb87536632
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-09 17:01:50
Source code size: 770 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 240 / 676
Version history: 4 change(s)
Referenced in: [show references]