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

59
LINES

< > BotCompany Repo | #1035953 // G22GalleryPanel

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (64181L) is out of date.

1  
sclass G22GalleryPanel is Swingable {
2  
  settable transient G22Utils g22utils;
3  
  transient new JGallery_v2 gallery;
4  
  transient ImageSurface selectedImageSurface;
5  
  transient new G22AnalysisPanel analysisPanel;
6  
  
7  
  transient ReliableSingleThread rstUpdateGallery = new(l0 updateGalleryImpl);
8  
  
9  
  void selectImage(GalleryImage img) {
10  
    if (img != null) gallery.selectFile(img.path);
11  
  }
12  
    
13  
  cachedVisualize {
14  
    var selectedImageSurface = g22utils.stdImageSurface();
15  
    gallery.onAdaptingButton(button -> {
16  
      if (!g22utils.devMode()) ret;
17  
      componentPopupMenuItem(button, "Upload image...",
18  
        rThread { uploadImageFileDialog(button.imageFile()) });
19  
    });
20  
      
21  
    new AWTOnConceptChangesByClass(g22utils.concepts(), GalleryImage, gallery.visualize(), rstUpdateGallery).install();
22  
23  
    analysisPanel.g22utils(g22utils).imageSurface(selectedImageSurface);
24  
    /*analysisPanel.editAnalyzer = l1 editAnalyzer;
25  
    ownResource(analysisPanel);
26  
    main onChange(analysisPanel, me());*/
27  
28  
    gallery.onFileClicked(imageFile -> {
29  
      var img = loadImage2(imageFile);
30  
      selectedImageSurface.setImage(img);
31  
      analysisPanel?.setImage(img);
32  
    });
33  
    
34  
    ret withBottomMargin(
35  
      //jvsplit(0.75,
36  
        jhsplit(0.25,
37  
          northAndCenter(
38  
            withMargin(rightAlignedLine(
39  
              g22utils.reloadButton("Update gallery", rstUpdateGallery)
40  
            )),
41  
          jCenteredSection("All Images", gallery.visualize())),
42  
          jRaisedCenteredSection("Selected Image",
43  
            withRightAlignedButtons(selectedImageSurface.visualize(),
44  
              "Gallery CRUD" := r { g22utils.showUIURL("Gallery CRUD") }
45  
            )
46  
          )
47  
        ),
48  
        //analysisPanel.visualize()
49  
      /*)*/);
50  
  }
51  
  
52  
  void updateGalleryImpl {
53  
    print("Updating gallery");
54  
    var files = sortFilesAlphaNumIC(
55  
      map(list(g22utils.concepts(), GalleryImage), i -> i.path));
56  
    gallery.setImageFiles(files);
57  
    updateEnclosingTabTitleWithCount(gallery.visualize(), l(files));
58  
  }
59  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035953
Snippet name: G22GalleryPanel
Eternal ID of this version: #1035953/11
Text MD5: ed87d7685673d741a001feb7a79d19a5
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-15 19:35:46
Source code size: 2081 bytes / 59 lines
Pitched / IR pitched: No / No
Views / Downloads: 89 / 150
Version history: 10 change(s)
Referenced in: [show references]