Libraryless. Click here for Pure Java version (12390L/80K).
1 | abstract sclass DynPrintLog extends DynModule { |
2 | transient JFastLogView_noWrap printLogView; |
3 | transient Lock updatePrintLog_lock = lock(); |
4 | transient StringBuffer actualPrintLog; |
5 | transient int printLogUpdateInterval = 500; |
6 | transient JComponent printLogPanel; |
7 | |
8 | visual makePrintLogPanel(); |
9 | |
10 | JComponent makePrintLogPanel() { |
11 | JComponent section = printLogPanel = jSection("Log", |
12 | jscroll_copyBackground(printLogView = jFastLogView_noWrap(getPrintLog()))); |
13 | componentPopupMenuItem(section, "Clear", rEnter dm_clearModulePrintLog); |
14 | ret awtEvery(section, printLogUpdateInterval, r updatePrintLog); |
15 | } |
16 | |
17 | void updatePrintLog swing { |
18 | // TODO: optimize |
19 | lock updatePrintLog_lock; |
20 | JFastLogView_noWrap _view = printLogView; |
21 | if (_view == null) ret; |
22 | if (_view.setText(getPrintLog())) { |
23 | // Still trying to reliably scroll down |
24 | scrollAllTheWayDown(_view); |
25 | awtLater(100, r { scrollAllTheWayDown(_view) }); |
26 | } |
27 | } |
28 | |
29 | JFastLogView_noWrap myPrintLogComponent() { ret printLogView; } |
30 | |
31 | void enableWordWrap { // TODO |
32 | } |
33 | |
34 | S getPrintLog() { |
35 | if (actualPrintLog == null) { |
36 | if (printToModule()) |
37 | actualPrintLog = _printLog; |
38 | else |
39 | actualPrintLog = liveLocalPrintLog_realMC(this); |
40 | } |
41 | ret str(actualPrintLog); |
42 | } |
43 | } |
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: | 778 / 3974 |
Version history: | 37 change(s) |
Referenced in: | [show references] |