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

!7

module LocalSnippets > DynObjectTable<Snippet> {
  visualize {
    JComponent c = super.visualize();
    ret withCenteredButtons(centerAndEastWithMargins(c, vstackWithSpacing(
      makeBold(tableDependentButton(table, "RUN", rThread {
        dm_addDynamicModuleDialog2(selected().id)
      })),
      tableDependentButton(table, "Edit", rThread {
        dm_editSnippet(selected().id)
      }),
      tableDependentButton(table, "Transpile", rThread {
        transpileLocalSnippet(selected().id);
        updateList();
      }),
      tableDependentButton(table, "Rename...", rThread {
        fS id = selected().id;
        inputText("Rename Snippet " + id,
          getSnippetTitle(id),
          voidfunc(S title) enter {
            renameSnippet(id, title);
            updateList();
          });
      })
,
      tableDependentButton(table, "Delete", rThread {
        if (confirmOKCancel("Delete snippet " + snippetWithTitle(selected()) + "? It will be backed up.")) {
          deleteLocalSnippet(selected().id);
          infoBox("Snippet deleted!");
          updateList();
        }
      }),
      )),
    "New program...", r addSnippet);
  }
  
  start {
    itemToMap = func(Snippet s) -> Map {
      litorderedmap(
        "ID" := s.id,
        "Title" := unnull(s.title),
        "Type" := s.type,
        "Lines" := str(numberOfLinesInFile(localSnippetFile(s.id))),
        "Transpiled" := isLocalSnippetTranspiled(s.id) ? "yes" : "no")
    };
    doEveryAndNow(5.0, r updateList);
  }
  
  void updateList enter {
    setData(listLocalSnippets());
  }
  
  void addSnippet enter {
    final JTextField tfTitle = jtextfield();
    showFormTitled("Create local snippet",
      "Title", tfTitle,
      "Type",  "Dynamic Module",
      rThread {
        long id = newLocalSnippetID();
        File f = localSnippetFile(id);
        assertFalse(fileExists(f));
        saveTextFile(f, newModuleText());
        setFileInfoField(f, "Title", gtt(tfTitle));
        setLocalSnippetType(id, snippetType_dynModule());
        updateList();
      });
  }
}

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: 411 / 3895
Version history: 28 change(s)
Referenced in: [show references]