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

36
LINES

< > BotCompany Repo | #1036104 // G22ScreenPartsPanel

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

Transpiled version (61391L) is out of date.

persistable sclass G22ScreenPartsPanel extends G22CRUDAndDetailPanel<G22ScreenPart> {
  SimpleCRUD_v2<G22ScreenPart> makeCRUD() {
    var crud = new SimpleCRUD_v2<>(g22utils.concepts(), G22ScreenPart);
    crud.entityName = -> "Screen part";
    crud.addButton("Add all screens", rThread addAllScreens);
    ret crud;
  }
  
  void addAllScreens {
    uniq(g22utils.concepts(), G22ScreenPart,
      name := "All screens",
      bounds := combinedScreenBounds());
  }
  
  JComponent makeDetailView(G22ScreenPart screenPart) {
    var maxSize = 100;
  
    var full = combinedScreenRect();
    var rect = screenPart.bounds;
    
    var scale = min(doubleRatio(maxSize, full.w()), doubleRatio(maxSize, full.h()));
    
    var image = whiteImage(iround(scale*full.w()), iround(scale*full.h()));
    
    if (rect != null) {
      var scaled = scaleRect(rect, scale);
      fillRect(image, scaled, java.awt.Color.gray);
    }
    
    image = addBorderToImage(image, java.awt.Color.black, 1);

    ret g22utils.stdImageSurface(image);
  }
  
  selfType g22utils(G22Utils g22utils) { super.g22utils(g22utils); this; }
}

Author comment

Began life as a copy of #1035958

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1036104
Snippet name: G22ScreenPartsPanel
Eternal ID of this version: #1036104/7
Text MD5: 3d2e0adb1488f23afd4365f1af8709bc
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-15 19:21:57
Source code size: 1151 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 237
Version history: 6 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)
#1036107 - G22MasksPanel