Class DraggableTabController

java.lang.Object
javafx.scene.control.Tab
dk.gtz.graphedit.view.DraggableTabController
All Implemented Interfaces:
IProjectResourceView, javafx.css.Styleable, javafx.event.EventTarget

public class DraggableTabController extends javafx.scene.control.Tab implements IProjectResourceView
A draggable tab that can optionally be detached from its tab pane and shown in a separate window. This can be added to any normal TabPane, however a TabPane with draggable tabs must *only* have DraggableTabs, normal tabs and DrragableTabs mixed will cause issues! Edits by Asger Gitz-Johansen: General code cleanup and make it easier to use in an FXML context.
  • Property Summary

    Properties inherited from class javafx.scene.control.Tab

    closable, content, contextMenu, disabled, disable, graphic, id, onClosed, onCloseRequest, onSelectionChanged, selected, style, tabPane, text, tooltip
  • Field Summary

    Fields inherited from class javafx.scene.control.Tab

    CLOSED_EVENT, SELECTION_CHANGED_EVENT, TAB_CLOSE_REQUEST_EVENT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new draggable tab.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add an editor to the view
    void
    addOnClosedListener(javafx.event.EventHandler<javafx.stage.WindowEvent> e)
    Add a listener that will be invoked when a tab is closed.
    void
    setDetachable(boolean detachable)
    Set whether it's possible to detach the tab from its pane and move it to another pane or another window.
    void
    Set the label text to be highlighted.
    void
    Set the label text on this draggable tab.
    void
    Set the label text to not be highlighted.

    Methods inherited from class javafx.scene.control.Tab

    buildEventDispatchChain, closableProperty, contentProperty, contextMenuProperty, disabledProperty, disableProperty, getClassCssMetaData, getContent, getContextMenu, getCssMetaData, getGraphic, getId, getOnClosed, getOnCloseRequest, getOnSelectionChanged, getProperties, getPseudoClassStates, getStyle, getStyleableParent, getStyleClass, getTabPane, getText, getTooltip, getTypeSelector, getUserData, graphicProperty, hasProperties, idProperty, isClosable, isDisable, isDisabled, isSelected, onClosedProperty, onCloseRequestProperty, onSelectionChangedProperty, selectedProperty, setClosable, setContent, setContextMenu, setDisable, setGraphic, setId, setOnClosed, setOnCloseRequest, setOnSelectionChanged, setStyle, setText, setTooltip, setUserData, styleProperty, tabPaneProperty, textProperty, tooltipProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Constructor Details

    • DraggableTabController

      public DraggableTabController(String text, IEventHandler editor)
      Create a new draggable tab. This can be added to any normal TabPane, however a TabPane with draggable tabs must *only* have DraggableTabs, normal tabs and DrragableTabs mixed will cause issues!
      Parameters:
      text - the text to appear on the tag label.
      editor - the editor to use for handling events.
  • Method Details

    • addOnClosedListener

      public void addOnClosedListener(javafx.event.EventHandler<javafx.stage.WindowEvent> e)
      Add a listener that will be invoked when a tab is closed.
      Parameters:
      e - the event handler to add.
    • setDetachable

      public void setDetachable(boolean detachable)
      Set whether it's possible to detach the tab from its pane and move it to another pane or another window. Defaults to true.
      Parameters:
      detachable - true if the tab should be detachable, false otherwise.
    • setLabelText

      public void setLabelText(String text)
      Set the label text on this draggable tab. This must be used instead of setText() to set the label, otherwise weird side effects will result!
      Parameters:
      text - the label text for this tab.
    • setHighlight

      public void setHighlight()
      Set the label text to be highlighted. Useful for indicating "unsaved changes"
    • unsetHighlight

      public void unsetHighlight()
      Set the label text to not be highlighted. Useful for indicating "unsaved changes"
    • addEditor

      public void addEditor(ModelEditorController editor)
      Description copied from interface: IProjectResourceView
      Add an editor to the view
      Specified by:
      addEditor in interface IProjectResourceView
      Parameters:
      editor - The model editor to add