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 classTreeFileChooser.Styledefines styles for the widgets of aTreeFileChooserstatic classTreeFileChooser.TreeNodeNested classes/interfaces inherited from class net.dermetfan.gdx.scenes.scene2d.ui.FileChooser
FileChooser.ListenerNested 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.ClickListenercancelButtonListenerListener forcancelButton.com.badlogic.gdx.scenes.scene2d.utils.ClickListenerchooseButtonListenerListener forchooseButton.com.badlogic.gdx.scenes.scene2d.utils.ClickListenertreeListenerListener fortree.Fields inherited from class net.dermetfan.gdx.scenes.scene2d.ui.FileChooser
handlingFileFilterFields 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.Nodeadd(com.badlogic.gdx.files.FileHandle file)protected voidbuild()override this to build widgets in an implementationprotected voidbuildWidgets()static com.badlogic.gdx.scenes.scene2d.ui.Tree.NodefileNode(com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle labelStyle)static com.badlogic.gdx.scenes.scene2d.ui.Tree.NodefileNode(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.NodefileNode(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.NodefileNode(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.NodefileNode(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.NodefileNode(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.Nodethat recursively adds the children of the given file to it when beingexpandedfor the first timecom.badlogic.gdx.scenes.scene2d.ui.ButtongetCancelButton()com.badlogic.gdx.scenes.scene2d.ui.ButtongetChooseButton()TreeFileChooser.StylegetStyle()com.badlogic.gdx.scenes.scene2d.ui.TreegetTree()com.badlogic.gdx.scenes.scene2d.ui.ScrollPanegetTreePane()voidsetCancelButton(com.badlogic.gdx.scenes.scene2d.ui.Button cancelButton)voidsetChooseButton(com.badlogic.gdx.scenes.scene2d.ui.Button chooseButton)voidsetStyle(TreeFileChooser.Style style)voidsetTree(com.badlogic.gdx.scenes.scene2d.ui.Tree tree)voidsetTreePane(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, setShowHiddenMethods 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, topMethods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateMethods 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, toStringMethods 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, toFrontMethods 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/enableschooseButtonbased on theselectionoftreeandFileChooser.isDirectoriesChoosable() -
chooseButtonListener
public final com.badlogic.gdx.scenes.scene2d.utils.ClickListener chooseButtonListenerListener forchooseButton. CallsFileChooser.Listener.choose(Array)orFileChooser.Listener.choose(FileHandle)depending on theselectionoftree -
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.Stylefromlistener- 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.Styleto usestyleName- thenameof theTreeFileChooser.Styleto uselistener- thelistener- See Also:
TreeFileChooser(Style, FileChooser.Listener)
-
TreeFileChooser
- Parameters:
style- thestylelistener- 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.LabelStyleto 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.Nodethat recursively adds the children of the given file to it when beingexpandedfor 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- theFiletoadd a rootfor- Returns:
- the added
file node
-
buildWidgets
protected void buildWidgets() -
build
protected void build()Description copied from class:FileChooseroverride this to build widgets in an implementation- Specified by:
buildin classFileChooser
-
getStyle
- Returns:
- the
style
-
setStyle
- Parameters:
style- thestyleto 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- thetreeto 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- thetreePaneto 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- thechooseButtonto 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- thecancelButtonto set
-