當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript tabbar.TabBar類代碼示例

本文整理匯總了TypeScript中phosphor/lib/ui/tabbar.TabBar的典型用法代碼示例。如果您正苦於以下問題:TypeScript TabBar類的具體用法?TypeScript TabBar怎麽用?TypeScript TabBar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TabBar類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  /**
   * Construct a new tab panel.
   *
   * @param options - The options for initializing the tab panel.
   */
  constructor(options: TabPanel.IOptions = {}) {
    super();
    this.addClass(TAB_PANEL_CLASS);

    // Create the tab bar and stacked panel.
    this._tabBar = new TabBar(options);
    this._tabBar.tabsMovable = true;
    this._tabBar.addClass(TAB_BAR_CLASS);
    this._tabContents = new EventedPanel();
    this._tabContents.addClass(TAB_CONTENTS_CLASS);

    // Connect the tab bar signal handlers.
    this._tabBar.tabMoved.connect(this._onTabMoved, this);
    this._tabBar.currentChanged.connect(this._onCurrentChanged, this);
    this._tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);

    // Connect the stacked panel signal handlers.
    this._tabContents.widgetRemoved.connect(this._onWidgetRemoved, this);

    // Get the data related to the placement.
    this._tabPlacement = options.tabPlacement || 'top';
    let direction = Private.directionFromPlacement(this._tabPlacement);
    let orientation = Private.orientationFromPlacement(this._tabPlacement);

    // Configure the tab bar for the placement.
    this._tabBar.orientation = orientation;
    this._tabBar.addClass(`p-mod-${this._tabPlacement}`);

    // Create the box layout.
    let layout = new PanelLayout();

    // Add the child widgets to the layout.
    layout.addWidget(this._tabBar);
    layout.addWidget(this._tabContents);

    // Install the layout on the tab panel.
    this.layout = layout;
  }
開發者ID:cameronoelsen,項目名稱:ipywidgets,代碼行數:43,代碼來源:tabpanel.ts

示例2: render

    /**
     * Called when view is rendered.
     */
    render() {
        var parent = this;

        this.el.classList.add('jupyter-widgets');
        this.el.classList.add('widget-tab');

        this.tabBar = new TabBar();
        this.tabBar.tabsMovable = false;
        this.tabBar.addClass('widget-tab-bar');
        this.tabBar.currentChanged.connect(this._onTabChanged, this);
        this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);

        this.tabContents = document.createElement('div');
        this.tabContents.className = 'widget-tab-contents';

        this.childrenViews.update(this.model.get('children'));

        this.displayed.then(function() {
            Widget.attach(parent.tabBar, parent.el)
            parent.el.appendChild(parent.tabContents);
        });
    }
開發者ID:Lomascolo,項目名稱:ipywidgets,代碼行數:25,代碼來源:widget_selectioncontainer.ts

示例3: 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

示例4: tabPlacement

  /**
   * Set the tab placement for the tab panel.
   *
   * #### Notes
   * This controls the position of the tab bar relative to the content.
   */
  set tabPlacement(value: TabPanel.TabPlacement) {
    // Bail if the placement does not change.
    if (this._tabPlacement === value) {
      return;
    }

    // Swap the internal values.
    let old = this._tabPlacement;
    this._tabPlacement = value;

    // Get the values related to the placement.
    let direction = Private.directionFromPlacement(value);
    let orientation = Private.orientationFromPlacement(value);

    // Configure the tab bar for the placement.
    this._tabBar.orientation = orientation;
    this._tabBar.removeClass(`p-mod-${old}`);
    this._tabBar.addClass(`p-mod-${value}`);

    // Update the layout direction.
    (this.layout as BoxLayout).direction = direction;
  }
開發者ID:cameronoelsen,項目名稱:ipywidgets,代碼行數:28,代碼來源:tabpanel.ts

示例5: remove

 remove() {
     /*
      * The tab bar needs to be disposed before its node is removed by the
      * super call, otherwise phosphor's Widget.detach will throw an error.
      */
     this.tabBar.dispose();
     /*
      * We remove this widget before removing the children as an optimization
      * we want to remove the entire container from the DOM first before
      * removing each individual child separately.
      */
     super.remove();
     this.childrenViews.remove();
 }
開發者ID:Lomascolo,項目名稱:ipywidgets,代碼行數:14,代碼來源:widget_selectioncontainer.ts

示例6: _onWidgetRemoved

 /**
  * Handle the `widgetRemoved` signal from the stacked panel.
  */
 private _onWidgetRemoved(sender: Panel, widget: Widget): void {
   this._tabBar.removeTab(widget.title);
 }
開發者ID:cameronoelsen,項目名稱:ipywidgets,代碼行數:6,代碼來源:tabpanel.ts


注:本文中的phosphor/lib/ui/tabbar.TabBar類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。