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

50
LINES

< > BotCompany Repo | #1015951 - SCP Module v1 (doesn't do that much)

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

Uses 9724K of libraries. Click here for Pure Java version (14640L/102K).

!7

sclass SCP extends DynModule {
  S link, dir;
  L<S> files;
  bool inForm = true;
  
  transient JTextField tfLink, tfDir;
  transient JList list;
  
  start { fetch(); }
  
  visualize {
    if (tfLink == null) tfLink = jtextfield("root@butter.botcompany.de");
    if (tfDir == null) tfDir = jtextfield("/root");
    if (inForm) ret renameSubmitButton("Connect", makeForm(
      "User@Host", tfLink, 
      "Remote directory", tfDir,
      disableButtonWhileCalcing(func -> bool {
        setFields(link := getTextTrim(tfLink), dir := getTextTrim(tfDir));
        if (!fetch()) false;
        revisualize();
        true;
      })));
      
    // We're logged in, show list
    
    list = jlist(files);
    ret jSection(link + ":" + dir, list);
  }
  
  bool fetch() {
    int i = indexOf(link, '@');
    if (i < 0) false;
    setField(files := mapMethod('getName, scpLS(takeFirst(link, i), substring(link, i+1), dir)));
    setField(inForm := false);
    true;
  }
  
  enhanceFrame {
    frameTitlePopupMenuItems(f,
      "Back To Form", r backToForm,
      "Clear Error", r clearError);
  }
  
  void backToForm {
    setField(inForm := true);
    revisualize();
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015951
Snippet name: SCP Module v1 (doesn't do that much)
Eternal ID of this version: #1015951/20
Text MD5: 89245f12724f4ab1fd00941bb7ea0845
Transpilation MD5: 37fbfef4f147f7f996a888b2a09653c1
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-24 02:06:43
Source code size: 1227 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 879
Version history: 19 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1015951 & http://1015951.tinybrain.de