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

!7

concept Grouping { S text, grouped; }

cmodule Groupings > DynCRUD<Grouping> {
  start { dbIndexingCI(Grouping, 'text); }
  
  afterVisualize {
    replaceComponent(crud.tableSearcher.tfInput, func(JComponent c) -> JComponent {
      centerAndEastWithMargin(c, jbutton("Group...", rThread { define(searchTerm()) }))
    });
    onEnter(crud.tableSearcher.tfInput, rThread { define(searchTerm()) });
  }
  
  void define(fS text) enter {
    final JTextField tfText = jtextfield(or2(text, dm_topInput())), tfGrouped = jtextfield();
    showFormTitled("Add Grouping",
      "Text:", tfText,
      "Grouped:", tfGrouped,
      rThread {
        S text = gtt(tfText), grouped = gtt(tfGrouped);
        if (empty(text)) text = tok_dropCurlyBrackets(grouped);
        uniq_sync(Grouping, +text, +grouped);
      });
    focus(nempty(text) ? tfGrouped : tfText);
  }
  
  // API
  
  void addGroupingInput(S text) {
    if (nempty(text = trim(text))) uniqCI_sync Grouping(+text);
  }
}

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: 315 / 1590
Version history: 10 change(s)
Referenced in: [show references]