(config: IPublicTypeWidgetBaseConfig | IWidget)
| 354 | } |
| 355 | |
| 356 | createWidget(config: IPublicTypeWidgetBaseConfig | IWidget) { |
| 357 | if (isWidget(config)) { |
| 358 | return config; |
| 359 | } |
| 360 | |
| 361 | config = this.parseConfig(config); |
| 362 | let widget: IWidget; |
| 363 | if (isDockConfig(config)) { |
| 364 | if (isPanelDockConfig(config)) { |
| 365 | widget = new PanelDock(this, config); |
| 366 | } else if (false) { |
| 367 | // DialogDock |
| 368 | // others... |
| 369 | } else { |
| 370 | widget = new Dock(this, config); |
| 371 | } |
| 372 | } else if (isDividerConfig(config)) { |
| 373 | widget = new Widget(this, { |
| 374 | ...config, |
| 375 | type: 'Widget', |
| 376 | content: Divider, |
| 377 | }); |
| 378 | } else if (isPanelConfig(config)) { |
| 379 | widget = this.createPanel(config); |
| 380 | } else { |
| 381 | widget = new Widget(this, config as WidgetConfig); |
| 382 | } |
| 383 | this.widgets.push(widget); |
| 384 | return widget; |
| 385 | } |
| 386 | |
| 387 | getWidget(name: string): IWidget | undefined { |
| 388 | return this.widgets.find(widget => widget.name === name); |
no test coverage detected