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

68
LINES

< > BotCompany Repo | #1019992 // My Programs [Personal Program List]

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

Libraryless. Click here for Pure Java version (21360L/161K).

1  
!7
2  
3  
module LocalSnippets > DynObjectTable<Snippet> {
4  
  visualize {
5  
    JComponent c = super.visualize();
6  
    ret withCenteredButtons(centerAndEastWithMargins(c, vstackWithSpacing(
7  
      makeBold(tableDependentButton(table, "RUN", rThread {
8  
        dm_addDynamicModuleDialog2(selected().id)
9  
      })),
10  
      tableDependentButton(table, "Edit", rThread {
11  
        dm_editSnippet(selected().id)
12  
      }),
13  
      tableDependentButton(table, "Transpile", rThread {
14  
        transpileLocalSnippet(selected().id);
15  
        updateList();
16  
      }),
17  
      tableDependentButton(table, "Rename...", rThread {
18  
        fS id = selected().id;
19  
        inputText("Rename Snippet " + id,
20  
          getSnippetTitle(id),
21  
          voidfunc(S title) enter {
22  
            renameSnippet(id, title);
23  
            updateList();
24  
          });
25  
      })
,
26  
      tableDependentButton(table, "Delete", rThread {
27  
        if (confirmOKCancel("Delete snippet " + snippetWithTitle(selected()) + "? It will be backed up.")) {
28  
          deleteLocalSnippet(selected().id);
29  
          infoBox("Snippet deleted!");
30  
          updateList();
31  
        }
32  
      }),
33  
      )),
34  
    "New program...", r addSnippet);
35  
  }
36  
  
37  
  start {
38  
    itemToMap = func(Snippet s) -> Map {
39  
      litorderedmap(
40  
        "ID" := s.id,
41  
        "Title" := unnull(s.title),
42  
        "Type" := s.type,
43  
        "Lines" := str(numberOfLinesInFile(localSnippetFile(s.id))),
44  
        "Transpiled" := isLocalSnippetTranspiled(s.id) ? "yes" : "no")
45  
    };
46  
    doEveryAndNow(5.0, r updateList);
47  
  }
48  
  
49  
  void updateList enter {
50  
    setData(listLocalSnippets());
51  
  }
52  
  
53  
  void addSnippet enter {
54  
    final JTextField tfTitle = jtextfield();
55  
    showFormTitled("Create local snippet",
56  
      "Title", tfTitle,
57  
      "Type",  "Dynamic Module",
58  
      rThread {
59  
        long id = newLocalSnippetID();
60  
        File f = localSnippetFile(id);
61  
        assertFalse(fileExists(f));
62  
        saveTextFile(f, newModuleText());
63  
        setFileInfoField(f, "Title", gtt(tfTitle));
64  
        setLocalSnippetType(id, snippetType_dynModule());
65  
        updateList();
66  
      });
67  
  }
68  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019992
Snippet name: My Programs [Personal Program List]
Eternal ID of this version: #1019992/29
Text MD5: a381594a066ea66bce2861defa211336
Transpilation MD5: 339dcab2005c5ca995685e004e114778
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-18 16:39:15
Source code size: 2131 bytes / 68 lines
Pitched / IR pitched: No / No
Views / Downloads: 413 / 3897
Version history: 28 change(s)
Referenced in: [show references]