MCPcopy Create free account
hub / github.com/DTStack/molecule / PanelController

Class PanelController

src/controller/panel.tsx:25–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24@singleton()
25export class PanelController extends Controller implements IPanelController {
26 private readonly panelService: IPanelService;
27 private readonly monacoService: IMonacoService;
28 private readonly builtinService: IBuiltinService;
29
30 constructor() {
31 super();
32 this.panelService = container.resolve(PanelService);
33 this.monacoService = container.resolve(MonacoService);
34 this.builtinService = container.resolve(BuiltinService);
35 }
36
37 public initView() {
38 const {
39 builtInOutputPanel,
40 builtInPanelToolbox,
41 builtInPanelToolboxResize,
42 } = this.builtinService.getModules();
43 if (builtInOutputPanel) {
44 const output = builtInOutputPanel;
45 output.renderPane = (item) => (
46 <Output
47 onUpdateEditorIns={(instance) => {
48 // Please notice the problem about memory out
49 // 'Cause we didn't dispose the older instance
50 item.outputEditorInstance = instance;
51 }}
52 {...item}
53 />
54 );
55 this.panelService.add(output);
56 this.panelService.setActive(output.id);
57 }
58
59 const toolbox = [builtInPanelToolboxResize, builtInPanelToolbox].filter(
60 Boolean
61 ) as IActionBarItemProps[];
62
63 this.panelService.setState({
64 toolbox,
65 });
66 }
67
68 public readonly onTabChange = (key: UniqueId): void => {
69 if (key) {
70 this.panelService.setActive(key);
71 }
72 this.emit(PanelEvent.onTabChange, key);
73 };
74
75 public readonly onClose = (key: UniqueId) => {
76 if (key) {
77 this.emit(PanelEvent.onTabClose, key);
78 }
79 };
80
81 public readonly onToolbarClick = (
82 e: React.MouseEvent,

Callers

nothing calls this directly

Calls 5

emitMethod · 0.80
setActiveMethod · 0.65
getConstantsMethod · 0.65
executeCommandMethod · 0.65
toggleMaximizeMethod · 0.65

Tested by

no test coverage detected