Uses 1113K of libraries. Click here for Pure Java version (14600L/76K).
!7 cm AllOnlineComputers > DynCalculatedList { transient LS computerIDs, data; transient StefansOS_ConnectToServer connector; transient JLabel trayIcon; LS calc() { ret data; } start { dm_addTrayIcon(trayIcon = jlabel()); updateList(); ownResource(connector = new StefansOS_ConnectToServer); connector.onLine = voidfunc(S line) { new Matches m; if (swic(line, "ComputerIDs = ", m)) { computerIDs = (LS) safeUnstruct($1); updateList(); vmBus_send('onlineComputerIDs, computerIDs); setModuleName(n2(computerIDs, "Online Computer")); } }; connector.startWithSubs("computerIDs"); } afterVisualize { listPopupMenuItemsThreaded(list, "Send clipboard there", rEnter { pcall-infobox { dm_sendClipboardTo_verbose(selectedComputerID()); } }, "Set name...", rEnter { setNameDialog(selectedComputerID()) }); } // API LS onlineComputerIDs() { ret computerIDs; } bool isComputerOnline(S computerID) { ret contains(computerIDs, computerID); } void updateList { O computerNames = dm_computerNames_opt(); if (setField(data := sortedIC(map(computerIDs, func(S id) -> S { S name = dm_callOpt(computerNames, "nameForID", id); ret (eq(id, computerID()) ? "[this one] " : "") + (nempty(name) ? name + " (" + id + ")" : id); })))); dm_q(r update); setTextAndToolTip(trayIcon, n2(data) + "c", nComputers(data) + " online"); } S selectedComputerID() { ret extractLastComputerID(selected()); } void setNameDialog(S computerID) { dm_call(dm_requireComputerNames(), 'openDialogForComputerID, computerID); } }
Began life as a copy of #1016576
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1016578 |
Snippet name: | All Online Computers [Show Connected Computers] |
Eternal ID of this version: | #1016578/43 |
Text MD5: | 9df1357f3bbe9ac0b6582d3660202ea8 |
Transpilation MD5: | 6eafaf66f045ccc24c774294eba0b7f0 |
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: | 2022-01-10 16:21:53 |
Source code size: | 1755 bytes / 61 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 566 / 83384 |
Version history: | 42 change(s) |
Referenced in: | [show references] |