當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。