Class ListFileChooser

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.ListFileChooser
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Cullable, com.badlogic.gdx.scenes.scene2d.utils.Layout

public class ListFileChooser extends FileChooser
A TextField showing the pathField of the currently browsed folder with backButton and parentButton buttons. There's a scrollable List under those showing the contents of the currently browsed folder and chooseButton and cancelButton buttons. If directories can be chosen, a openButton button is added so that the user is able to go into folders. Files can be filtered. Use the listener to get user input.
  • Nested Class Summary

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

    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
    goes back to the previous directory
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
     
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    chooses the selected file in from the contents
    final com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
    enables/disables chooseButton and openButton
    final com.badlogic.gdx.scenes.scene2d.InputListener
    key controls of contents
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    goes into the currently marked folder
    final com.badlogic.gdx.scenes.scene2d.utils.ClickListener
    sets directory to its parent
    final com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener
    if it exists, this open the file at the given absolute path if it is not a folder, goes into it otherwise,

    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
    ListFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String styleName, FileChooser.Listener listener)
    The ui skin file needs an entry for this class; see https://bitbucket.org/dermetfan/libgdx-utils/issue/3
    ListFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, FileChooser.Listener listener)
    The ui skin file needs an entry for this class; see https://bitbucket.org/dermetfan/libgdx-utils/issue/3
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Override this if you want to adjust the layout.
    protected void
    Override this if you want to adjust all the Widgets.
    com.badlogic.gdx.files.FileHandle
     
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
    com.badlogic.gdx.scenes.scene2d.ui.List<String>
     
    com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
     
    com.badlogic.gdx.files.FileHandle
     
    com.badlogic.gdx.utils.Array<com.badlogic.gdx.files.FileHandle>
     
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
    com.badlogic.gdx.scenes.scene2d.ui.Button
     
    com.badlogic.gdx.scenes.scene2d.ui.TextField
     
     
    void
    refreshes the contents
    protected void
    scan(com.badlogic.gdx.files.FileHandle dir)
    populates contents with the children of directory
    void
    setBackButton(com.badlogic.gdx.scenes.scene2d.ui.Button backButton)
     
    void
    setCancelButton(com.badlogic.gdx.scenes.scene2d.ui.Button cancelButton)
     
    void
    setChooseButton(com.badlogic.gdx.scenes.scene2d.ui.Button chooseButton)
     
    void
    setContents(com.badlogic.gdx.scenes.scene2d.ui.List<String> contents)
     
    void
    setContentsPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane contentsPane)
     
    void
    setDirectoriesChoosable(boolean directoriesChoosable)
    builds if necessary
    void
    setDirectory(com.badlogic.gdx.files.FileHandle dir)
    set directory and adds it to fileHistory
    void
    setDirectory(com.badlogic.gdx.files.FileHandle dir, boolean addToHistory)
    sets directory and updates all things that need to be updated
    void
    setFileHistory(com.badlogic.gdx.utils.Array<com.badlogic.gdx.files.FileHandle> fileHistory)
     
    void
    setFileType(com.badlogic.gdx.Files.FileType fileType)
     
    void
    setOpenButton(com.badlogic.gdx.scenes.scene2d.ui.Button openButton)
     
    void
    setParentButton(com.badlogic.gdx.scenes.scene2d.ui.Button parentButton)
     
    void
    setPathField(com.badlogic.gdx.scenes.scene2d.ui.TextField pathField)
     
    void
     

    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

    • pathFieldListener

      public final com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener pathFieldListener
      if it exists, this open the file at the given absolute path if it is not a folder, goes into it otherwise,
    • chooseButtonListener

      public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener chooseButtonListener
      chooses the selected file in from the contents
    • openButtonListener

      public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener openButtonListener
      goes into the currently marked folder
    • cancelButtonListener

      public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener cancelButtonListener
      See Also:
    • backButtonListener

      public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener backButtonListener
      goes back to the previous directory
    • parentButtonListener

      public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener parentButtonListener
      sets directory to its parent
    • contentsListener

      public final com.badlogic.gdx.scenes.scene2d.utils.ChangeListener contentsListener
      enables/disables chooseButton and openButton
    • keyControlsListener

      public final com.badlogic.gdx.scenes.scene2d.InputListener keyControlsListener
      key controls of contents
  • Constructor Details

    • ListFileChooser

      public ListFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, FileChooser.Listener listener)
      The ui skin file needs an entry for this class; see https://bitbucket.org/dermetfan/libgdx-utils/issue/3
    • ListFileChooser

      public ListFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String styleName, FileChooser.Listener listener)
      The ui skin file needs an entry for this class; see https://bitbucket.org/dermetfan/libgdx-utils/issue/3
    • ListFileChooser

      public ListFileChooser(ListFileChooser.Style style, FileChooser.Listener listener)
  • Method Details

    • setFileType

      public void setFileType(com.badlogic.gdx.Files.FileType fileType)
    • buildWidgets

      protected void buildWidgets()
      Override this if you want to adjust all the Widgets. Be careful though!
    • build

      protected void build()
      Override this if you want to adjust the layout. Clears this ListFileChooser's children and adds backButton, pathField, parentButton, contentsPane, chooseButton, cancelButton and openButton if FileChooser.isDirectoriesChoosable() is true.
      Specified by:
      build in class FileChooser
    • refresh

      public void refresh()
      refreshes the contents
    • scan

      protected void scan(com.badlogic.gdx.files.FileHandle dir)
      populates contents with the children of directory
    • currentlySelected

      public com.badlogic.gdx.files.FileHandle currentlySelected()
      Returns:
      the file currently selected in contents
    • setDirectory

      public void setDirectory(com.badlogic.gdx.files.FileHandle dir)
      set directory and adds it to fileHistory
      See Also:
    • setDirectory

      public void setDirectory(com.badlogic.gdx.files.FileHandle dir, boolean addToHistory)
      sets directory and updates all things that need to be updated
    • getBackButton

      public com.badlogic.gdx.scenes.scene2d.ui.Button getBackButton()
      Returns:
      the backButton
    • setBackButton

      public void setBackButton(com.badlogic.gdx.scenes.scene2d.ui.Button backButton)
      Parameters:
      backButton - the backButton 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
    • 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
    • getContents

      public com.badlogic.gdx.scenes.scene2d.ui.List<String> getContents()
      Returns:
      the contents
    • setContents

      public void setContents(com.badlogic.gdx.scenes.scene2d.ui.List<String> contents)
      Parameters:
      contents - the contents to set
    • getContentsPane

      public com.badlogic.gdx.scenes.scene2d.ui.ScrollPane getContentsPane()
      Returns:
      the contentsPane
    • setContentsPane

      public void setContentsPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane contentsPane)
      Parameters:
      contentsPane - the contentsPane to set
    • getDirectory

      public com.badlogic.gdx.files.FileHandle getDirectory()
      Returns:
      the directory
    • getFileHistory

      public com.badlogic.gdx.utils.Array<com.badlogic.gdx.files.FileHandle> getFileHistory()
      Returns:
      the fileHistory
    • setFileHistory

      public void setFileHistory(com.badlogic.gdx.utils.Array<com.badlogic.gdx.files.FileHandle> fileHistory)
      Parameters:
      fileHistory - the fileHistory to set
    • getOpenButton

      public com.badlogic.gdx.scenes.scene2d.ui.Button getOpenButton()
      Returns:
      the openButton
    • setOpenButton

      public void setOpenButton(com.badlogic.gdx.scenes.scene2d.ui.Button openButton)
      Parameters:
      openButton - the openButton to set
    • getParentButton

      public com.badlogic.gdx.scenes.scene2d.ui.Button getParentButton()
      Returns:
      the parentButton
    • setParentButton

      public void setParentButton(com.badlogic.gdx.scenes.scene2d.ui.Button parentButton)
      Parameters:
      parentButton - the parentButton to set
    • getPathField

      public com.badlogic.gdx.scenes.scene2d.ui.TextField getPathField()
      Returns:
      the pathField
    • setPathField

      public void setPathField(com.badlogic.gdx.scenes.scene2d.ui.TextField pathField)
      Parameters:
      pathField - the pathField to set
    • setDirectoriesChoosable

      public void setDirectoriesChoosable(boolean directoriesChoosable)
      builds if necessary
      Overrides:
      setDirectoriesChoosable in class FileChooser
      Parameters:
      directoriesChoosable - the FileChooser.directoriesChoosable to set
    • getStyle

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

      public void setStyle(ListFileChooser.Style style)
      Parameters:
      style - the style to set and use for all widgets