More builder removal (#4810)

* remove more builder references

* formatting
This commit is contained in:
Anthony Dresser
2019-04-03 16:18:03 -07:00
committed by GitHub
parent fcb8fe50fe
commit 80a8e1a4da
12 changed files with 135 additions and 178 deletions

View File

@@ -5,7 +5,6 @@
'use strict';
import 'vs/css!./media/accountPicker';
import { Builder } from 'sql/base/browser/builder';
import * as DOM from 'vs/base/browser/dom';
import { Event, Emitter } from 'vs/base/common/event';
import { List } from 'vs/base/browser/ui/list/listWidget';
@@ -126,7 +125,7 @@ export class AccountPicker extends Disposable {
this._accountList.setSelection([0]);
this.onAccountSelectionChange(this._accountList.getSelectedElements()[0]);
} else {
new Builder(this._refreshContainer).hide();
DOM.hide(this._refreshContainer);
}
this._register(this._themeService.onThemeChange(e => this.updateTheme(e)));
@@ -151,9 +150,9 @@ export class AccountPicker extends Disposable {
this.viewModel.selectedAccount = account;
if (account && account.isStale) {
this._refreshAccountAction.account = account;
new Builder(this._refreshContainer).show();
DOM.show(this._refreshContainer);
} else {
new Builder(this._refreshContainer).hide();
DOM.hide(this._refreshContainer);
}
this._onAccountSelectionChangeEvent.fire(account);

View File

@@ -11,21 +11,19 @@ import { attachModalDialogStyler } from 'sql/platform/theme/common/styler';
import { Dialog, DialogButton } from 'sql/platform/dialog/dialogTypes';
import { DialogPane } from 'sql/platform/dialog/dialogPane';
import { Builder } from 'sql/base/browser/builder';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { Button } from 'vs/base/browser/ui/button/button';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { localize } from 'vs/nls';
import { Emitter } from 'vs/base/common/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { DialogMessage, MessageLevel } from '../../workbench/api/common/sqlExtHostTypes';
import { DialogMessage } from '../../workbench/api/common/sqlExtHostTypes';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { append, $ } from 'vs/base/browser/dom';
export class DialogModal extends Modal {
private _dialogPane: DialogPane;
@@ -111,10 +109,7 @@ export class DialogModal extends Modal {
}
protected renderBody(container: HTMLElement): void {
let body: HTMLElement;
new Builder(container).div({ class: 'dialogModal-body' }, (bodyBuilder) => {
body = bodyBuilder.getHTMLElement();
});
const body = append(container, $('div.dialogModal-body'));
this._dialogPane = new DialogPane(this._dialog.title, this._dialog.content,
valid => this._dialog.notifyValidityChanged(valid), this._instantiationService, false);

View File

@@ -17,7 +17,6 @@ import { DialogModule } from 'sql/platform/dialog/dialog.module';
import { DialogComponentParams, LayoutRequestParams } from 'sql/platform/dialog/dialogContainer.component';
import * as DOM from 'vs/base/browser/dom';
import { Builder } from 'sql/base/browser/builder';
import { IThemable } from 'vs/platform/theme/common/styler';
import { Disposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -48,42 +47,40 @@ export class DialogPane extends Disposable implements IThemable {
}
public createBody(container: HTMLElement): HTMLElement {
new Builder(container).div({ class: 'dialogModal-pane' }, (bodyBuilder) => {
this._body = bodyBuilder.getHTMLElement();
if (typeof this._content === 'string' || this._content.length < 2) {
let modelViewId = typeof this._content === 'string' ? this._content : this._content[0].content;
this.initializeModelViewContainer(this._body, modelViewId);
} else {
this._tabbedPanel = new TabbedPanel(this._body);
this._content.forEach((tab, tabIndex) => {
if (this._selectedTabIndex === tabIndex) {
this._selectedTabContent = tab.content;
}
let tabContainer = document.createElement('div');
tabContainer.style.display = 'none';
this._body.appendChild(tabContainer);
this.initializeModelViewContainer(tabContainer, tab.content, tab);
this._tabbedPanel.onTabChange(e => {
tabContainer.style.height = (this.getTabDimension().height - this._tabbedPanel.headersize) + 'px';
this._onLayoutChange.fire({ modelViewId: tab.content });
});
this._tabbedPanel.pushTab({
title: tab.title,
identifier: 'dialogPane.' + this.title + '.' + tabIndex,
view: {
render: (container) => {
if (tabContainer.parentElement === this._body) {
this._body.removeChild(tabContainer);
}
container.appendChild(tabContainer);
tabContainer.style.display = 'block';
},
layout: (dimension) => { this.getTabDimension(); }
} as IPanelView
} as IPanelTab);
this._body = DOM.append(container, DOM.$('div.dialogModal-pane'));
if (typeof this._content === 'string' || this._content.length < 2) {
let modelViewId = typeof this._content === 'string' ? this._content : this._content[0].content;
this.initializeModelViewContainer(this._body, modelViewId);
} else {
this._tabbedPanel = new TabbedPanel(this._body);
this._content.forEach((tab, tabIndex) => {
if (this._selectedTabIndex === tabIndex) {
this._selectedTabContent = tab.content;
}
let tabContainer = document.createElement('div');
tabContainer.style.display = 'none';
this._body.appendChild(tabContainer);
this.initializeModelViewContainer(tabContainer, tab.content, tab);
this._tabbedPanel.onTabChange(e => {
tabContainer.style.height = (this.getTabDimension().height - this._tabbedPanel.headersize) + 'px';
this._onLayoutChange.fire({ modelViewId: tab.content });
});
}
});
this._tabbedPanel.pushTab({
title: tab.title,
identifier: 'dialogPane.' + this.title + '.' + tabIndex,
view: {
render: (container) => {
if (tabContainer.parentElement === this._body) {
this._body.removeChild(tabContainer);
}
container.appendChild(tabContainer);
tabContainer.style.display = 'block';
},
layout: (dimension) => { this.getTabDimension(); }
} as IPanelView
} as IPanelTab);
});
}
return this._body;
}

View File

@@ -15,7 +15,6 @@ import { DialogMessage } from 'sql/workbench/api/common/sqlExtHostTypes';
import { DialogModule } from 'sql/platform/dialog/dialog.module';
import { Button } from 'vs/base/browser/ui/button/button';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { Builder } from 'sql/base/browser/builder';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
@@ -25,6 +24,7 @@ import { Emitter } from 'vs/base/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { append, $ } from 'vs/base/browser/dom';
export class WizardModal extends Modal {
private _dialogPanes = new Map<WizardPage, DialogPane>();
@@ -121,20 +121,14 @@ export class WizardModal extends Modal {
}
protected renderBody(container: HTMLElement): void {
let bodyBuilderObj;
new Builder(container).div({ class: 'dialogModal-body' }, (bodyBuilder) => {
bodyBuilderObj = bodyBuilder;
this._body = bodyBuilder.getHTMLElement();
});
this._body = append(container, $('div.dialogModal-body'));
this.initializeNavigation(this._body);
bodyBuilderObj.div({ class: 'dialog-message-and-page-container' }, (mpContainer) => {
this._messageAndPageContainer = mpContainer.getHTMLElement();
mpContainer.append(this._messageElement);
this._pageContainer = mpContainer.div({ class: 'dialogModal-page-container' }).getHTMLElement();
});
const mpContainer = append(this._body, $('div.dialog-message-and-page-container'));
this._messageAndPageContainer = mpContainer;
mpContainer.append(this._messageElement);
this._pageContainer = append(mpContainer, $('div.dialogModal-page-container'));
this._wizard.pages.forEach(page => {
this.registerPage(page);