当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript widget.Widget类代码示例

本文整理汇总了TypeScript中phosphor/lib/ui/widget.Widget的典型用法代码示例。如果您正苦于以下问题:TypeScript Widget类的具体用法?TypeScript Widget怎么用?TypeScript Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Widget类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createKernelNameItem

function createKernelNameItem(kernelOwner: IKernelOwner): Widget {
  let widget = new Widget();
  widget.addClass(TOOLBAR_KERNEL_CLASS);
  updateKernelNameItem(widget, kernelOwner.kernel);
  kernelOwner.kernelChanged.connect(() => {
    updateKernelNameItem(widget, kernelOwner.kernel);
  });
  return widget;
}
开发者ID:marami52,项目名称:jupyterlab,代码行数:9,代码来源:kernel.ts

示例2: it

 it('should save when clicked', () => {
   let button = ToolbarItems.createSaveButton(panel);
   Widget.attach(button, document.body);
   button.node.click();
   expect(context.methods).to.contain('save');
   button.dispose();
 });
开发者ID:matt-bowers,项目名称:jupyterlab,代码行数:7,代码来源:default-toolbar.spec.ts

示例3: it

 it('should create a widget for a simple realistic model', () => {
     let model = new NotebookMergeModel(
         notebook, NBdecisions);
     let widget = new NotebookMergeWidget(model, rendermime);
     expect(widget).to.not.be(null);
     Widget.attach(widget, document.body);
 });
开发者ID:willingc,项目名称:nbdime,代码行数:7,代码来源:widget.spec.ts

示例4: function

 return Promise.resolve(view).then((view) => {
     PWidget.Widget.attach(view.pWidget, this.el);
     view.on('remove', function() {
         console.log('view removed', view);
     });
     return view;
 });
开发者ID:cameronoelsen,项目名称:ipywidgets,代码行数:7,代码来源:manager.ts

示例5: function

 return Promise.resolve(view).then(function(view) {
     PhosphorWidget.Widget.attach(view.pWidget, options.el);
     view.on('remove', function() {
         console.log('View removed', view);
     });
     return view;
 });
开发者ID:minrk,项目名称:ipywidgets,代码行数:7,代码来源:embed-manager.ts

示例6: insertWidget

 /**
  * Insert a widget into the tab panel at a specified index.
  *
  * @param index - The index at which to insert the widget.
  *
  * @param widget - The widget to insert into to the tab panel.
  *
  * #### Notes
  * If the widget is already contained in the panel, it will be moved.
  *
  * The widget's `title` is used to populate the tab.
  */
 insertWidget(index: number, widget: Widget): void {
   if (widget !== this.currentWidget) {
     widget.hide();
   }
   this._tabContents.insertWidget(index, widget);
   this._tabBar.insertTab(index, widget.title);
 }
开发者ID:cameronoelsen,项目名称:ipywidgets,代码行数:19,代码来源:tabpanel.ts

示例7: constructor

  /**
   * Create a dialog panel instance.
   *
   * @param options - The dialog setup options.
   *
   * @param resolve - The function that resolves the dialog promise.
   *
   * @param reject - The function that rejects the dialog promise.
   *
   * #### Notes
   * Currently the dialog resolves with `cancelButton` rather than
   * rejecting the dialog promise.
   */
  constructor(options: IDialogOptions, resolve: (value: IButtonItem) => void, reject?: (error: any) => void) {
    super();

    if (!(options.body instanceof Widget)) {
      throw 'A widget dialog can only be created with a widget as its body.';
    }

    this.resolve = resolve;
    this.reject = reject;

    // Create the dialog nodes (except for the buttons).
    let content = new Panel();
    let header = new Widget({node: document.createElement('div')});
    let body = new Panel();
    let footer = new Widget({node: document.createElement('div')});
    let title = document.createElement('span');
    this.addClass(DIALOG_CLASS);
    if (options.dialogClass) {
      this.addClass(options.dialogClass);
    }
    content.addClass(CONTENT_CLASS);
    header.addClass(HEADER_CLASS);
    body.addClass(BODY_CLASS);
    footer.addClass(FOOTER_CLASS);
    title.className = TITLE_CLASS;
    this.addWidget(content);
    content.addWidget(header);
    content.addWidget(body);
    content.addWidget(footer);
    header.node.appendChild(title);

    // Populate the nodes.
    title.textContent = options.title || '';
    let child = options.body as Widget;
    child.addClass(BODY_CONTENT_CLASS);
    body.addWidget(child);
    this._buttons = options.buttons.slice();
    this._buttonNodes = options.buttons.map(createButton);
    this._buttonNodes.map(buttonNode => {
      footer.node.appendChild(buttonNode);
    });
    let primary = options.primary || this.lastButtonNode;
    if (typeof primary === 'number') {
      primary = this._buttonNodes[primary];
    }
    this._primary = primary as HTMLElement;
  }
开发者ID:Carreau,项目名称:jupyterlab,代码行数:60,代码来源:index.ts

示例8: it

 it('should insert below when clicked', () => {
   let button = ToolbarItems.createInsertButton(panel);
   Widget.attach(button, document.body);
   button.node.click();
   expect(panel.content.activeCellIndex).to.be(1);
   expect(panel.content.activeCell).to.be.a(CodeCellWidget);
   button.dispose();
 });
开发者ID:danielballan,项目名称:jupyterlab,代码行数:8,代码来源:default-toolbar.spec.ts


注:本文中的phosphor/lib/ui/widget.Widget类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。