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).

1  
!7
2  
3  
concept Rule {
4  
  S in, out;
5  
}
6  
7  
cmodule Rules > DynCRUD<Rule> {
8  
  *() { super(Rule); }
9  
  
10  
  afterVisualize {
11  
    replaceComponent(crud.tableSearcher.tfInput, func(JComponent c) -> JComponent {
12  
      centerAndEastWithMargin(c, jbutton("Add rule...", rThread {
13  
        addRule(searchTerm())
14  
      }))
15  
    });
16  
    onEnter(crud.tableSearcher.tfInput, rThread { addRule(searchTerm()) });
17  
  }
18  
  
19  
  void addRule(fS term) enter {
20  
    final JTextField tfIn = jtextfield(or2(term, dm_topInput())), tfOut = jtextfield();
21  
    showFormTitled("Add Rule",
22  
      "Input:", tfIn,
23  
      "Output:", tfOut,
24  
      rThread {
25  
        S in = gtt(tfIn), out = gtt(tfOut);
26  
        uniq_sync(Rule, +in, +out);
27  
      });
28  
    focus(nempty(term) ? tfOut : tfIn);
29  
  }
30  
}

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: 248 / 687
Version history: 4 change(s)
Referenced in: [show references]