Uses 108K of libraries. Click here for Pure Java version (17969L/131K).
!7 static Class _classMigration_LastImagesInDirectory = ImagesInDirectory; // not implemented yet sclass ImagesInDirectory extends DynSCP { new DynModuleRef mate; S dir; L<S> allFiles, imageFiles; transient DynamicHStack buttons; transient ButtonImageLoader imageLoader; File dirObject() { ret newFile(dir); } JComponent visualize2() { if (buttons == null) { buttons = makeNiceButtons(); updateButtons(); } if (imageLoader == null) imageLoader = new ButtonImageLoader(buttons); if (mate! == null) ret jcenteredlabel("Need directory"); ret jHigherScrollPane(jfullcenter(buttons)); } void update { lock lock; int oldChangeCount = mate! == null ? -1 : changeCount; try { if (mate! != null && !dm_moduleStillThere(mate!)) mate.set(null); if (mate! == null) if (setField(mate := DynModuleRef(print("Mate: ", dm_findMateOfType(this, 'DirectoryInfo))))) revisualize2(); if (mate == null) ret; setField(dir := (S) call(mate!, 'getDir)); L<S> allFiles = castCall(mate!, 'getFiles); if (this.allFiles != allFiles) { setField(+allFiles); setField(imageFiles := filterOrNull(allFiles, f isImageFileName)); } } finally { if (changeCount != oldChangeCount) updateButtons(); } } void updateButtons { if (dir == null || buttons == null) ret with setModuleName("Images in directory"); L<TextImageAction> l = filesForNiceButtons(sortFilesByDate( fileNamesInDirToFile(new File(dir), imageFiles)), f showImage); for (final TextImageAction tia : l) tia.popupMenuMaker = ImagesInDirectory_popupMenu(this, tia); replaceNiceButtons(buttons, l); setModuleName(imageFiles == null ? "Not allowed to look in directory " + fileName(dirObject()) : n2(l, "image") + " in directory " + fileName(dirObject())); if (imageLoader != null) imageLoader.update(); } } static VF1<JPopupMenu> ImagesInDirectory_popupMenu(ImagesInDirectory m, final TextImageAction tia) { // Haha, not even used //final WeakReference<ImagesInDirectory> me = new(m); ret voidfunc(JPopupMenu menu) { addPopupItemsForImageFile(menu, filesForNiceButtons_map.get(tia)) }; }
Began life as a copy of #1015916
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015922 |
Snippet name: | Images In Directory [Dyn Module] |
Eternal ID of this version: | #1015922/43 |
Text MD5: | 3dead63dbe2592c9a3a72b6fc4cfdaa9 |
Transpilation MD5: | af37fd0ba0812afbaa9f4dcd47c26350 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-23 12:52:50 |
Source code size: | 2288 bytes / 62 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 476 / 1203 |
Version history: | 42 change(s) |
Referenced in: | #1016035 - Image Preview #1016311 - Videos In Directory [Dyn Module, dev.] #1019109 - Images In Directory v2 [Dyn Module, OK] |