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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TreeFileChooser.Style
defines styles for the widgets of aTreeFileChooser
static class
TreeFileChooser.TreeNode
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 com.badlogic.gdx.scenes.scene2d.utils.ClickListener
cancelButtonListener
Listener forcancelButton
.com.badlogic.gdx.scenes.scene2d.utils.ClickListener
chooseButtonListener
Listener forchooseButton
.com.badlogic.gdx.scenes.scene2d.utils.ClickListener
treeListener
Listener fortree
.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
-
Constructor Summary
Constructors Constructor Description TreeFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, java.lang.String styleName, FileChooser.Listener listener)
TreeFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, FileChooser.Listener listener)
TreeFileChooser(TreeFileChooser.Style style, 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
build()
override this to build widgets in an implementationprotected void
buildWidgets()
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,java.lang.Void> nodeConsumer)
static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node
fileNode(com.badlogic.gdx.files.FileHandle file, java.io.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, java.io.FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,java.lang.Void> nodeConsumer)
passes an Accessor that creates labels representing the file name (with slash if it's a folder) using the given label style tofileNode(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, java.io.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, java.io.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,java.lang.Void> nodeConsumer)
creates an anonymous subclass ofTree.Node
that recursively adds the children of the given file to it when beingexpanded
for the first timecom.badlogic.gdx.scenes.scene2d.ui.Button
getCancelButton()
com.badlogic.gdx.scenes.scene2d.ui.Button
getChooseButton()
TreeFileChooser.Style
getStyle()
com.badlogic.gdx.scenes.scene2d.ui.Tree
getTree()
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
getTreePane()
void
setCancelButton(com.badlogic.gdx.scenes.scene2d.ui.Button cancelButton)
void
setChooseButton(com.badlogic.gdx.scenes.scene2d.ui.Button chooseButton)
void
setStyle(TreeFileChooser.Style style)
void
setTree(com.badlogic.gdx.scenes.scene2d.ui.Tree tree)
void
setTreePane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane treePane)
Methods inherited from class net.dermetfan.gdx.scenes.scene2d.ui.FileChooser
getFileFilter, getHandlingFileFilter, getListener, isDirectoriesChoosable, isNewFilesChoosable, isShowHidden, setDirectoriesChoosable, setFileFilter, setListener, setNewFilesChoosable, setShowHidden
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, 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
-
treeListener
public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener treeListenerListener fortree
.Disables/enables
chooseButton
based on theselection
oftree
andFileChooser.isDirectoriesChoosable()
-
chooseButtonListener
public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener chooseButtonListenerListener forchooseButton
. CallsFileChooser.Listener.choose(Array)
orFileChooser.Listener.choose(FileHandle)
depending on theselection
oftree
-
cancelButtonListener
public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener cancelButtonListener
-
-
Constructor Details
-
TreeFileChooser
public TreeFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, FileChooser.Listener listener)- Parameters:
skin
- the skin to get aTreeFileChooser.Style
fromlistener
- thelistener
- See Also:
TreeFileChooser(Style, FileChooser.Listener)
-
TreeFileChooser
public TreeFileChooser(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, java.lang.String styleName, FileChooser.Listener listener)- Parameters:
skin
- the skin holding theTreeFileChooser.Style
to usestyleName
- thename
of theTreeFileChooser.Style
to uselistener
- thelistener
- See Also:
TreeFileChooser(Style, FileChooser.Listener)
-
TreeFileChooser
- Parameters:
style
- thestyle
listener
- thelistener
-
-
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) -
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,java.lang.Void> nodeConsumer) -
fileNode
public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, java.io.FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle) -
fileNode
public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, java.io.FileFilter filter, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle, Function<com.badlogic.gdx.scenes.scene2d.ui.Tree.Node,java.lang.Void> nodeConsumer)passes an Accessor that creates labels representing the file name (with slash if it's a folder) using the given label style tofileNode(FileHandle, FileFilter, net.dermetfan.utils.Function, net.dermetfan.utils.Function)
(labelSupplier)- Parameters:
labelStyle
- theLabel.LabelStyle
to use for created labels- See Also:
fileNode(FileHandle, FileFilter, Function, Function)
-
fileNode
public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, java.io.FileFilter filter, Function<com.badlogic.gdx.files.FileHandle,com.badlogic.gdx.scenes.scene2d.ui.Label> labelSupplier) -
fileNode
public static com.badlogic.gdx.scenes.scene2d.ui.Tree.Node fileNode(com.badlogic.gdx.files.FileHandle file, java.io.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,java.lang.Void> nodeConsumer)creates an anonymous subclass ofTree.Node
that recursively adds the children of the given file to it when beingexpanded
for the first time- Parameters:
file
- the file to put inTree.Node.setValue(Object)
filter
- Filters children from being added. May be null to accept all files.labelSupplier
- supplies labels to usenodeConsumer
- 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
- theFile
toadd a root
for- Returns:
- the added
file node
-
buildWidgets
protected void buildWidgets() -
build
protected void build()Description copied from class:FileChooser
override this to build widgets in an implementation- Specified by:
build
in classFileChooser
-
getStyle
- Returns:
- the
style
-
setStyle
- Parameters:
style
- thestyle
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
- thetree
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
- thetreePane
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
- thechooseButton
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
- thecancelButton
to set
-