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

39
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 (10209L/72K).

abstract sclass DynPrintLog extends DynModule {
  transient JFastLogView_noWrap printLogView;
  transient Lock updatePrintLog_lock = lock();
  transient StringBuffer actualPrintLog;
  
  visualize {
    JComponent section = jSection("Log",
      jscroll_copyBackground(printLogView = jFastLogView_noWrap(getPrintLog())));
    componentPopupMenuItem(section, "Clear", rEnter dm_clearModulePrintLog);
    ret awtEvery(section, 500, r updatePrintLog);
  }
  
  void updatePrintLog {
    // 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   

Travelled to 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz

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/34
Text MD5: 2f6b15f66057385a42d6b1d720db5ce3
Transpilation MD5: e82c8545c8ca820f203754c9f38cf0ca
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-29 12:08:31
Source code size: 1165 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 255 / 1237
Version history: 33 change(s)
Referenced in: [show references]