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.

sclass G22GalleryPanel is Swingable {
  settable transient G22Utils g22utils;
  transient new JGallery_v2 gallery;
  transient ImageSurface selectedImageSurface;
  transient new G22AnalysisPanel analysisPanel;
  
  transient ReliableSingleThread rstUpdateGallery = new(l0 updateGalleryImpl);
  
  void selectImage(GalleryImage img) {
    if (img != null) gallery.selectFile(img.path);
  }
    
  cachedVisualize {
    var selectedImageSurface = g22utils.stdImageSurface();
    gallery.onAdaptingButton(button -> {
      if (!g22utils.devMode()) ret;
      componentPopupMenuItem(button, "Upload image...",
        rThread { uploadImageFileDialog(button.imageFile()) });
    });
      
    new AWTOnConceptChangesByClass(g22utils.concepts(), GalleryImage, gallery.visualize(), rstUpdateGallery).install();

    analysisPanel.g22utils(g22utils).imageSurface(selectedImageSurface);
    /*analysisPanel.editAnalyzer = l1 editAnalyzer;
    ownResource(analysisPanel);
    main onChange(analysisPanel, me());*/

    gallery.onFileClicked(imageFile -> {
      var img = loadImage2(imageFile);
      selectedImageSurface.setImage(img);
      analysisPanel?.setImage(img);
    });
    
    ret withBottomMargin(
      //jvsplit(0.75,
        jhsplit(0.25,
          northAndCenter(
            withMargin(rightAlignedLine(
              g22utils.reloadButton("Update gallery", rstUpdateGallery)
            )),
          jCenteredSection("All Images", gallery.visualize())),
          jRaisedCenteredSection("Selected Image",
            withRightAlignedButtons(selectedImageSurface.visualize(),
              "Gallery CRUD" := r { g22utils.showUIURL("Gallery CRUD") }
            )
          )
        ),
        //analysisPanel.visualize()
      /*)*/);
  }
  
  void updateGalleryImpl {
    print("Updating gallery");
    var files = sortFilesAlphaNumIC(
      map(list(g22utils.concepts(), GalleryImage), i -> i.path));
    gallery.setImageFiles(files);
    updateEnclosingTabTitleWithCount(gallery.visualize(), l(files));
  }
}

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: 23 / 62
Version history: 10 change(s)
Referenced in: [show references]