Dart Documentationdock_spawnTabHandle

TabHandle Class

A tab handle represents the tab button on the tab strip

Constructors

Code new TabHandle(TabPage parent) #

TabHandle(this.parent) {
  undockHandler = _performUndock;
  elementBase = new DivElement();
  elementText = new DivElement();
  elementCloseButton = new DivElement();
  elementBase.classes.add("tab-handle");
  elementBase.classes.add("disable-selection"); // Disable text selection
  elementText.classes.add("tab-handle-text");
  elementCloseButton.classes.add("tab-handle-close-button");
  elementBase.nodes.add(elementText);
  if (parent.host.displayCloseButton) {
    elementBase.nodes.add(elementCloseButton);
  }
  
  parent.host.tabListElement.nodes.add(elementBase);
  
  PanelContainer panel = parent.container;
  String title = panel.getRawTitle();
  elementText.innerHTML = title;
  
  // Set the close button text (font awesome)
  String closeIcon = "icon-remove-sign";
  elementCloseButton.innerHTML = '<i class="$closeIcon"></i>';
  
  _bringToFront(elementBase);
  
  undockInitiator = new UndockInitiator(elementBase, undockHandler);
  undockInitiator.enabled = true;

  mouseClickHandler = onMouseClicked;
  elementBase.on.click.add(mouseClickHandler);
  
  closeButtonHandler = onCloseButtonClicked;
  elementCloseButton.on.mouseDown.add(closeButtonHandler);
  
}

Static Fields

Code int zIndexCounter #

static int zIndexCounter = 1000;

Methods

Code void destroy() #

void destroy() {
  elementBase.on.click.remove(mouseClickHandler);
  elementCloseButton.on.mouseDown.remove(closeButtonHandler);
  elementBase.remove();
  elementCloseButton.remove();
  elementBase = null;
  elementCloseButton = null;
}

Code void onCloseButtonClicked(MouseEvent e) #

void onCloseButtonClicked(MouseEvent e) {
  // If the page contains a panel element, undock it and destroy it
  if (parent.container.containerType == "panel") {
    undockInitiator.enabled = false;
    PanelContainer panel = parent.container;
    panel.performUndock();
  }
}

Code void onMouseClicked(MouseEvent e) #

void onMouseClicked(MouseEvent e) {
  parent.onSelected();
}

Code void setSelected(bool selected) #

void setSelected(bool selected) {
  String selectedClassName = "tab-handle-selected";
  if (selected) {
    elementBase.classes.add(selectedClassName);
  } else {
    elementBase.classes.remove(selectedClassName);
  }
}

Code void setZIndex(int zIndex) #

void setZIndex(int zIndex) {
  elementBase.style.zIndex = "$zIndex";
}

Fields

Code var closeButtonHandler #

var closeButtonHandler;

Code DivElement elementBase #

DivElement elementBase;

Code DivElement elementCloseButton #

DivElement elementCloseButton;

Code DivElement elementText #

DivElement elementText;

Code var mouseClickHandler #

var mouseClickHandler;

Code TabPage parent #

TabPage parent;

Code var undockHandler #

var undockHandler;

Code UndockInitiator undockInitiator #

UndockInitiator undockInitiator;