srecord noeq G22ShowCasePanel(G22Utils g22utils) is Swingable { transient SingleComponentPanel scpShowCase; transient ReliableSingleThread rstUpdateShowCase = rst(l0 updateShowCase); void updateShowCase() { if (!isShowing(scpShowCase)) ret; var autoStarter = g22utils.autoStarter(); if (autoStarter.cancelled()) ret with scpShowCase.set(jcenteredlabel("Auto-start cancelled")); if (!autoStarter.waitedAndDone()) ret; var script = varShowCasedScript()!; if (script == null) ret with scpShowCase.set(g22utils.jGazelleLogo()); scpShowCase.set(g22utils.visualizeAutoRunnableScript(script)); } IVarWithNotify varShowCasedScript() { ret g22utils.projectActions().varShowCasedScript(); } cachedVisualize { g22utils.autoStarter().onDone(rstUpdateShowCase); scpShowCase = singleComponentPanel( varShowCasedScript()! == null ? null : jcenteredlabel("Waiting for auto-start to finish...")); onChange(varShowCasedScript(), rstUpdateShowCase); bindToComponent(scpShowCase, rstUpdateShowCase); // LAYOUT ret northAndCenterWithMargin( centerAndEastWithMargin( // combo box (script selector) withSideMargins(withLabel("Script:", bindComboBoxToVar(varShowCasedScript(), swing(-> centerComboBoxAndItems(new ConceptsComboBox<>(g22utils.concepts(), G22LeftArrowScript) .allowNull(true) .itemFilter(script -> classIs(G22LeftArrowScript, script) && script.isClearForAutoRun()) .sorter(l -> sortedByFieldAlphanumIC description(l)) ))))), jline( jimageButton(#1101440, "Re-run script", rstUpdateShowCase), g22utils.editButton("Edit script", -> g22utils.projectActions().editScript(varShowCasedScript()!)) ) ), scpShowCase ); } }