added checkbox component (#1330)

This commit is contained in:
Leila Lali
2018-05-03 17:11:55 -07:00
committed by GitHub
parent f7371e9ed5
commit 1847c2e322
7 changed files with 224 additions and 15 deletions

View File

@@ -48,6 +48,11 @@ class ModelBuilderImpl implements sqlops.ModelBuilder {
return this.withEventHandler(new InputBoxWrapper(this._proxy, this._handle, id), id);
}
checkBox(): sqlops.ComponentBuilder<sqlops.CheckBoxComponent> {
let id = this.getNextComponentId();
return this.withEventHandler(new CheckBoxWrapper(this._proxy, this._handle, id), id);
}
button(): sqlops.ComponentBuilder<sqlops.ButtonComponent> {
let id = this.getNextComponentId();
return this.withEventHandler(new ButtonWrapper(this._proxy, this._handle, id), id);
@@ -343,6 +348,34 @@ class InputBoxWrapper extends ComponentWrapper implements sqlops.InputBoxCompone
}
}
class CheckBoxWrapper extends ComponentWrapper implements sqlops.CheckBoxComponent {
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
super(proxy, handle, ModelComponentTypes.CheckBox, id);
this.properties = {};
this._emitterMap.set(ComponentEventType.onDidChange, new Emitter<any>());
}
public get checked(): boolean {
return this.properties['checked'];
}
public set checked(v: boolean) {
this.setProperty('checked', v);
}
public get label(): string {
return this.properties['label'];
}
public set label(v: string) {
this.setProperty('label', v);
}
public get onChanged(): vscode.Event<any> {
let emitter = this._emitterMap.get(ComponentEventType.onDidChange);
return emitter && emitter.event;
}
}
class DropDownWrapper extends ComponentWrapper implements sqlops.DropDownComponent {
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {