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

33
LINES

< > BotCompany Repo | #1019722 // Groupings CRUD [Dyn Module]

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

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

1  
!7
2  
3  
concept Grouping { S text, grouped; }
4  
5  
cmodule Groupings > DynCRUD<Grouping> {
6  
  start { dbIndexingCI(Grouping, 'text); }
7  
  
8  
  afterVisualize {
9  
    replaceComponent(crud.tableSearcher.tfInput, func(JComponent c) -> JComponent {
10  
      centerAndEastWithMargin(c, jbutton("Group...", rThread { define(searchTerm()) }))
11  
    });
12  
    onEnter(crud.tableSearcher.tfInput, rThread { define(searchTerm()) });
13  
  }
14  
  
15  
  void define(fS text) enter {
16  
    final JTextField tfText = jtextfield(or2(text, dm_topInput())), tfGrouped = jtextfield();
17  
    showFormTitled("Add Grouping",
18  
      "Text:", tfText,
19  
      "Grouped:", tfGrouped,
20  
      rThread {
21  
        S text = gtt(tfText), grouped = gtt(tfGrouped);
22  
        if (empty(text)) text = tok_dropCurlyBrackets(grouped);
23  
        uniq_sync(Grouping, +text, +grouped);
24  
      });
25  
    focus(nempty(text) ? tfGrouped : tfText);
26  
  }
27  
  
28  
  // API
29  
  
30  
  void addGroupingInput(S text) {
31  
    if (nempty(text = trim(text))) uniqCI_sync Grouping(+text);
32  
  }
33  
}

Author comment

Began life as a copy of #1019714

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019722
Snippet name: Groupings CRUD [Dyn Module]
Eternal ID of this version: #1019722/11
Text MD5: 529a9ae8f74665251d559ff3917f0d53
Transpilation MD5: 62a0241014e07e6bf6a82a5a1177ca63
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-06-17 20:33:04
Source code size: 1014 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 316 / 1591
Version history: 10 change(s)
Referenced in: [show references]