!7 cm TaskBar_dev > DynObjectTable { S showWhat = "All modules"; transient JLabel lblCount; start { dontPersist(); defaultAction = voidfunc(S id) { dm_showModule(id) }; itemToMap = itemToMap_calcSingleColumn("Module", func(O mod) -> S { or2(dm_moduleName(mod), "[...]") }); ownResource(vmBus_onModulesListChange(rstUpdate())); rstUpdate().trigger(); if (dm_bounds() == null) placeOnRight(); onListChanged = syncListInitAndAdd(onListChanged, r { setText(lblCount, countText()) }); } void update { data = null; // force update LS ids = containsWord(showWhat, "visible") ? dm_visibleModuleIDs() : containsWord(showWhat, "invisible") ? dm_invisibleModuleIDs() : dm_moduleIDs(); setData(sortedByCalculatedFieldIC(func(O m) -> S { or2(dm_moduleName(m), unicodeCharacterLastInSortOrder()) }, ids)); } visualize { JComponent theTable = super.visualize(); // TODO: filter these for (final Pair> p : dm_moduleMenuItems()) tablePopupMenuItem(table, p.a, voidfunc(final int row) { thread { callF(p.b, _get(data, row)); } }); tablePopupMenu(table, voidfunc(JPopupMenu menu, int row) { O mod = _get(data, row); Container frame = dm_frame(mod); if (frame cast JInternalFrame) { copyInternalFramePopupMenu(menu, frame); var titlePane = internalFrameTitleComponent(frame); if (titlePane != null) vmBus_send showingPopupMenu(titlePane, menu); } else { // TODO: get all the items even if module is not showing addMenuItem(menu, "ID: " + or(dm_moduleID(mod), mod) + "/" + dm_moduleLibID(mod), null); } }); onCharDown(table, voidfunc(char c) { LS names = map dm_moduleName(data); int cur = selectedIndex(); int i = swic(_get(names, cur+1), str(c)) ? cur+1 // move through items with that characters : indexOfStartingWithIC(names, str(c)); selectRowIfNotNegative(table, i); }); ret northAndCenter( withMargin(westAndEast( lblCount = jlabel(countText()), dm_fieldComboBox('showWhat, ll("All modules", "Visible modules", "Invisible modules")))), theTable); } enhanceFrame { addTitlePopupMenuItems(f, "Place on the right", rThread placeOnRight); } void placeOnRight enter { dm_placeOnRight(); } S countText() { ret join(" of ", litorderedset(count(), dm_moduleCount())); } }