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

43
LINES

< > BotCompany Repo | #1016205 // DynPrintLog - show program's print log as visualization - new version with fast log view

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

Libraryless. Click here for Pure Java version (12390L/80K).

abstract sclass DynPrintLog extends DynModule {
  transient JFastLogView_noWrap printLogView;
  transient Lock updatePrintLog_lock = lock();
  transient StringBuffer actualPrintLog;
  transient int printLogUpdateInterval = 500;
  transient JComponent printLogPanel;
  
  visual makePrintLogPanel();
  
  JComponent makePrintLogPanel() {
    JComponent section = printLogPanel = jSection("Log",
      jscroll_copyBackground(printLogView = jFastLogView_noWrap(getPrintLog())));
    componentPopupMenuItem(section, "Clear", rEnter dm_clearModulePrintLog);
    ret awtEvery(section, printLogUpdateInterval, r updatePrintLog);
  }
  
  void updatePrintLog swing {
    // TODO: optimize
    lock updatePrintLog_lock;
    JFastLogView_noWrap _view = printLogView;
    if (_view == null) ret;
    if (_view.setText(getPrintLog())) {
      // Still trying to reliably scroll down
      scrollAllTheWayDown(_view);
      awtLater(100, r { scrollAllTheWayDown(_view) });
    }
  }
  
  JFastLogView_noWrap myPrintLogComponent() { ret printLogView; }
  
  void enableWordWrap { // TODO
  }
  
  S getPrintLog() {
    if (actualPrintLog == null) {
      if (printToModule())
        actualPrintLog = _printLog;
      else
        actualPrintLog = liveLocalPrintLog_realMC(this);
    }
    ret str(actualPrintLog);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1016205
Snippet name: DynPrintLog - show program's print log as visualization - new version with fast log view
Eternal ID of this version: #1016205/38
Text MD5: 7b1c2aa07daf4de5a6f13192430c63c6
Transpilation MD5: 466b647c2d2624d4643942fde9d1b5dc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-12 09:39:58
Source code size: 1348 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 777 / 3972
Version history: 37 change(s)
Referenced in: #1018873 - DynImageSurface - module showing an image
#1019849 - Loadable Utils
#1024214 - DynPrintLog - show program's print log as visualization - old version with JTextArea
#1029927 - Loadable Utils v2 (old)
#1030491 - DynPrintLogAndWeb - DynPrintLog + web module
#1030952 - Loadable Utils for Gazelle BEA [LIVE, see #1030953, edited by #1030951]
#1031186 - Loadable Utils v5
#1032272 - Loadable Utils for Gazelle BEA [backup]
#1032708 - Secret BEA Utils [purposely different from regular utils]
#1033505 - Loadable Utils for Gazelle V [stable version]
#1033861 - Loadable Utils for Gazelle 22 [dev version]
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)