Libraryless. Click here for Pure Java version (16065L/97K).
abstract sclass DynQuickSearch extends DynCalculatedList { transient S query; transient new RestartableCountdown autoHide; transient S moduleDescForSearch; transient O[] quickSearchParams; transient bool doSearchVerbose; transient int yesPopupOffsetY = -13; start { calculateWhenHidden = true; ownResource(vmBus_onMessage('topInput, voidfunc(S s) { doSearch(s) })); ownResource(vmBus_onMessage('topInputChanged, voidfunc(S s) { if (neq(s, query)) doSearch(s) })); dm_vmBus_onMessage_q hideQuickSearchModules(r dm_hideModule); } void doSearch(S s) enter { if (dm_dontQuickSearch_combined(s)) ret; query = s; O qsm = dm_quickSearchManager(); if (qsm != null && !dm_isMe(qsm)) { results = calc(); dm_call(qsm, 'setResultsForModule, dm_moduleID(), moduleDescForSearch, query, results, quickSearchParams); } else { super.update(); if (doSearchVerbose) print("doSearch: Got " + n2(results, "result") + " for " + query); if (nempty(query) && nempty(results)) { dm_placeModuleUnderAIBar_v2(this, query); dm_autoHide(autoHide); if (dm_yesPopupEnabled() && dm_amFirstQuickSearchModule() && !dm_myYesPopup()) dm_showYesToAcceptPopupAbove_v2(list, imageID := #1101462, height := 247/2, mover := voidfunc(Component c, Component popup) enter { JList list = cast c; Rect r = boundsInParent(c, dm_desktopPane()); if (r == null) ret; Rect item = jlist_itemBounds(list, 0); setLocation(popup, r.x+item.x-popup.getWidth(), r.y+item.y+yesPopupOffsetY); }); } else dm_hideModule(); } } void yes { jlist_doubleClickOnItem(list, 0); } final L<S> calc() { if (empty(query)) ret emptyList(); ret calc_impl(); } abstract LS calc_impl(); void enhanceFrame(Container f) { super.enhanceFrame(f); setClosable(f, false); internalFramePopupMenuItem(f, "Delete", rThread { dm_deleteModuleInBackground(module()) }); } // API void selectFirstEntry() { selectRow(list, 0); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1018420 |
Snippet name: | DynQuickSearch |
Eternal ID of this version: | #1018420/29 |
Text MD5: | 2051ae197a97d8c7457df703ecf68ac3 |
Transpilation MD5: | 16a229f3a5c974f97fe4281dfe4a8fcb |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-22 16:06:28 |
Source code size: | 2252 bytes / 69 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 460 / 1159 |
Version history: | 28 change(s) |
Referenced in: | [show references] |