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

51
LINES

< > BotCompany Repo | #1019109 // Images In Directory v2 [Dyn Module, OK]

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

Uses 1113K of libraries. Compilation Failed (15961L/86K).

!7

cm ImagesInDirectory extends DynSCP {
  File dir;

  transient DynamicHStack buttons;
  transient ButtonImageLoader imageLoader;
  
  start {
    ownResource(vmBus_onDirChange(dir, r updateButtons));
  }

  JComponent visualize2() {
    print("dir: " + dir);
    if (dir == null)
      ret jHandleFileDrop(jcenteredbutton("Select directory...", rThread select), voidfunc(File f) { setDir(f) });
    else {
      setDir(dir);
      ret getComponent();
    }
  }
  
  void select {
    temp enter();
    selectDir(voidfunc(File dir) { setDir(dir) });
  }
  
  void setDir(File dir) {
    temp enter();
    setField(+dir);

    buttons = makeNiceButtons();
    imageLoader = new ButtonImageLoader(buttons);
    updateButtons();
    setComponent(jHigherScrollPane(jfullcenter(buttons)));
  }
  
  void updateButtons {
    if (dir == null || buttons == null) ret;
    temp enter();
    L<File> imageFiles = listImageFiles(dir);
    L<TextImageAction> l = filesForNiceButtons(sortFilesByDate(
      imageFiles), lambda1 showImage);
    for (final TextImageAction tia : l)
      tia.popupMenuMaker = imageFilesPopupMenuFunction(tia);
    replaceNiceButtons(buttons, l);
    setModuleName(
      n2(l, "image") + " in directory " + fileName(dir));
    if (imageLoader != null) imageLoader.update();
  }
}

Author comment

Began life as a copy of #1015922

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019109
Snippet name: Images In Directory v2 [Dyn Module, OK]
Eternal ID of this version: #1019109/20
Text MD5: c3b97e3cd1425f4d635bf01bf6aab3e1
Transpilation MD5: 6f2c35299de61716d7c6aa00bc103775
Author: stefan
Category: javax / gui
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-10 17:40:09
Source code size: 1350 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 437 / 1097
Version history: 19 change(s)
Referenced in: [show references]