Class TreeFileChooser

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
com.badlogic.gdx.scenes.scene2d.ui.Table
net.dermetfan.gdx.scenes.scene2d.ui.FileChooser
net.dermetfan.gdx.scenes.scene2d.ui.TreeFileChooser
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Cullable, com.badlogic.gdx.scenes.scene2d.utils.Layout

public class TreeFileChooser extends FileChooser
A FileChooser that uses a Tree. DO NOT FORGET TO ADD ROOTS!
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    defines styles for the widgets of a TreeFileChooser
    static class 
     

    Nested classes/interfaces inherited from class net.dermetfan.gdx.scenes.scene2d.ui.FileChooser

    FileChooser.Listener

    Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    com.badlogic.gdx.scenes.scene2d.ui.Table.Debug, com.badlogic.gdx.scenes.scene2d.ui.Table.DebugRect
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    Listener for cancelButton.
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    Listener for chooseButton.
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    Listener for tree.

    Fields inherited from class net.dermetfan.gdx.scenes.scene2d.ui.FileChooser

    handlingFileFilter

    Fields inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    backgroundBottom, backgroundLeft, backgroundRight, backgroundTop, debugActorColor, debugCellColor, debugTableColor

    Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    POOLS
  • Constructor Summary

    Constructors
    Constructor
    Description
    TreeFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String styleName, FileChooser.Listener listener)
     
    TreeFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, FileChooser.Listener listener)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    add(com.badlogic.gdx.files.FileHandle file)
     
    protected void
    override this to build widgets in an implementation
    protected void
    builds chooseButton, cancelButtonListener, tree, treePane
    static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    fileNode(com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle)
     
    static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    fileNode(com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,Void> nodeConsumer)
     
    static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle)
     
    static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,Void> nodeConsumer)
    passes an Accessor that creates labels representing the file name (with slash if it's a folder) using the given label style to fileNode(FileHandle, FileFilter, net.dermetfan.utils.Function, net.dermetfan.utils.Function) (labelSupplier)
    static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, Function<com.badlogic.gdx.files.FileHandle,com.badlogic.gdx.scenes.scene2d.ui.Label> labelSupplier)
     
    static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
    fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, Function<com.badlogic.gdx.files.FileHandle,com.badlogic.gdx.scenes.scene2d.ui.Label> labelSupplier, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,Void> nodeConsumer)
    creates an anonymous subclass of Tree.Node that recursively adds the children of the given file to it when being expanded for the first time
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
     
    com.badlogic.gdx.scenes.scene2d.ui.Tree
     
    com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
     
    void
    setCancelButton(com.badlogic.gdx.scenes.scene2d.ui.Button cancelButton)
     
    void
    setChooseButton(com.badlogic.gdx.scenes.scene2d.ui.Button chooseButton)
     
    void
     
    void
    setTree(com.badlogic.gdx.scenes.scene2d.ui.Tree tree)
     
    void
    setTreePane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane treePane)
     

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    add, add, add, add, add, add, add, align, background, background, bottom, center, clearChildren, clip, clip, columnDefaults, debug, debug, debugActor, debugAll, debugCell, debugTable, defaults, draw, drawBackground, drawDebug, drawDebugBounds, getAlign, getBackground, getCell, getCells, getClip, getColumnMinWidth, getColumnPrefWidth, getColumns, getColumnWidth, getMinHeight, getMinWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getPrefHeight, getPrefWidth, getRow, getRowHeight, getRowMinHeight, getRowPrefHeight, getRows, getSkin, getTableDebug, hit, invalidate, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, removeActor, removeActor, removeActorAt, reset, right, row, setBackground, setBackground, setClip, setDebug, setRound, setSkin, stack, top

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup

    childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group

    act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, clear, clearChildren, computeTransform, drawChildren, drawDebugChildren, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toString

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • fileNode

      public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle)
      See Also:
    • fileNode

      public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,Void> nodeConsumer)
      See Also:
    • fileNode

      public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle)
      See Also:
    • fileNode

      public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,Void> nodeConsumer)
      passes an Accessor that creates labels representing the file name (with slash if it's a folder) using the given label style to fileNode(FileHandle, FileFilter, net.dermetfan.utils.Function, net.dermetfan.utils.Function) (labelSupplier)
      Parameters:
      labelStyle - the Label.LabelStyle to use for created labels
      See Also:
    • fileNode

      public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, Function<com.badlogic.gdx.files.FileHandle,com.badlogic.gdx.scenes.scene2d.ui.Label> labelSupplier)
      See Also:
    • fileNode

      public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, FileFilter filter, Function<com.badlogic.gdx.files.FileHandle,com.badlogic.gdx.scenes.scene2d.ui.Label> labelSupplier, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,Void> nodeConsumer)
      creates an anonymous subclass of Tree.Node that recursively adds the children of the given file to it when being expanded for the first time
      Parameters:
      file - the file to put in Tree.Node.setValue(Object)
      filter - Filters children from being added. May be null to accept all files.
      labelSupplier - supplies labels to use
      nodeConsumer - Does something with nodes after they were created. May be null.
      Returns:
      the created Node
    • add

      public com.badlogic.gdx.scenes.scene2d.ui.Tree.Node add(com.badlogic.gdx.files.FileHandle file)
      Parameters:
      file - the File to add a root for
      Returns:
      the added file node
    • buildWidgets

      protected void buildWidgets()
      builds chooseButton, cancelButtonListener, tree, treePane
    • build

      protected void build()
      Description copied from class: FileChooser
      override this to build widgets in an implementation
      Specified by:
      build in class FileChooser
    • getStyle

      public TreeFileChooser.Style getStyle()
      Returns:
      the style
    • setStyle

      public void setStyle(TreeFileChooser.Style style)
      Parameters:
      style - the style to set
    • getTree

      public com.badlogic.gdx.scenes.scene2d.ui.Tree getTree()
      Returns:
      the tree
    • setTree

      public void setTree(com.badlogic.gdx.scenes.scene2d.ui.Tree tree)
      Parameters:
      tree - the tree to set
    • getTreePane

      public com.badlogic.gdx.scenes.scene2d.ui.ScrollPane getTreePane()
      Returns:
      the treePane
    • setTreePane

      public void setTreePane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane treePane)
      Parameters:
      treePane - the treePane to set
    • getChooseButton

      public com.badlogic.gdx.scenes.scene2d.ui.Button getChooseButton()
      Returns:
      the chooseButton
    • setChooseButton

      public void setChooseButton(com.badlogic.gdx.scenes.scene2d.ui.Button chooseButton)
      Parameters:
      chooseButton - the chooseButton to set
    • getCancelButton

      public com.badlogic.gdx.scenes.scene2d.ui.Button getCancelButton()
      Returns:
      the cancelButton
    • setCancelButton

      public void setCancelButton(com.badlogic.gdx.scenes.scene2d.ui.Button cancelButton)
      Parameters:
      cancelButton - the cancelButton to set