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

47
LINES

< > BotCompany Repo | #1030803 // Extra Frame [additional frame for a module]

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

Uses 1059K of libraries. Click here for Pure Java version (2905L/15K).

1  
!7
2  
3  
cmodule2 ExtraFrame {
4  
  S mainModuleID;
5  
  transient JComponent visualization;
6  
  bool deleteOnMainReload; // delete when main module is reloaded
7  
  bool deleteOnReboot; // delete when OS is rebooted
8  
  bool usePreferredSizeInitially;
9  
  int minimumSizePlusY = 100; // fix the god damn window-too-small bug?
10  
  
11  
  visual visualization;
12  
  
13  
  start {
14  
    componentFieldsToKeep = litset("visualization");
15  
    
16  
    if (deleteOnReboot && dm_isBooting())
17  
      dm_deleteModule();
18  
    
19  
    // delete this module when main module is deleted
20  
    dm_vmBus_onMessage_enter moduleDeleted(voidfunc(O mod) {
21  
      if (dm_sameModule(mod, mainModuleID))
22  
        dm_deleteModule();
23  
    });
24  
    
25  
    dm_vmBus_onMessage_enter moduleReloaded(voidfunc(O mod) {
26  
      if (deleteOnMainReload && dm_sameModule(mod, mainModuleID))
27  
        dm_deleteModule();
28  
    });
29  
    
30  
    // react to frame being disposed of by code
31  
    dm_vmBus_onMessage_enter disposingInternalFrame(voidfunc(O frame) {
32  
      if (frame == dm_frame(module()))
33  
        dm_deleteModule();
34  
    });
35  
  }
36  
  
37  
  JComponent _getReloadData() { ret visualization; }
38  
  void _setReloadData(JComponent data) { this.visualization = data; }
39  
  
40  
  bool _usePreferredSizeInitially() { ret usePreferredSizeInitially; }
41  
  
42  
  Pt minimumSize() {
43  
    if (visualization == null) null;
44  
    Dimension d = getMinimumSize(visualization);
45  
    ret Pt(d.width, d.height+minimumSizePlusY);
46  
  }
47  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030803
Snippet name: Extra Frame [additional frame for a module]
Eternal ID of this version: #1030803/13
Text MD5: e978fc6c580270f6055799944f2fbfb6
Transpilation MD5: 706e050ddfa8c1a6ef36edf3defc450c
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-29 13:40:11
Source code size: 1451 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 193 / 560
Version history: 12 change(s)
Referenced in: [show references]