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

1  
!7
2  
3  
sclass SCP extends DynModule {
4  
  S link, dir;
5  
  L<S> files;
6  
  bool inForm = true;
7  
  
8  
  transient JTextField tfLink, tfDir;
9  
  transient JList list;
10  
  
11  
  start { fetch(); }
12  
  
13  
  visualize {
14  
    if (tfLink == null) tfLink = jtextfield("root@butter.botcompany.de");
15  
    if (tfDir == null) tfDir = jtextfield("/root");
16  
    if (inForm) ret renameSubmitButton("Connect", makeForm(
17  
      "User@Host", tfLink, 
18  
      "Remote directory", tfDir,
19  
      disableButtonWhileCalcing(func -> bool {
20  
        setFields(link := getTextTrim(tfLink), dir := getTextTrim(tfDir));
21  
        if (!fetch()) false;
22  
        revisualize();
23  
        true;
24  
      })));
25  
      
26  
    // We're logged in, show list
27  
    
28  
    list = jlist(files);
29  
    ret jSection(link + ":" + dir, list);
30  
  }
31  
  
32  
  bool fetch() {
33  
    int i = indexOf(link, '@');
34  
    if (i < 0) false;
35  
    setField(files := mapMethod('getName, scpLS(takeFirst(link, i), substring(link, i+1), dir)));
36  
    setField(inForm := false);
37  
    true;
38  
  }
39  
  
40  
  enhanceFrame {
41  
    frameTitlePopupMenuItems(f,
42  
      "Back To Form", r backToForm,
43  
      "Clear Error", r clearError);
44  
  }
45  
  
46  
  void backToForm {
47  
    setField(inForm := true);
48  
    revisualize();
49  
  }
50  
}

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: 552 / 1095
Version history: 19 change(s)
Referenced in: [show references]