- java.lang.Object
-
- com.googlecode.lanterna.gui2.AbstractBasePane<Window>
-
- com.googlecode.lanterna.gui2.AbstractWindow
-
- com.googlecode.lanterna.gui2.dialogs.DialogWindow
-
- com.googlecode.lanterna.gui2.dialogs.FileDialog
-
public class FileDialog extends DialogWindow
Dialog that allows the user to iterate the file system and pick file to open/save
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
FileDialog.CancelHandler
private static class
FileDialog.DoNothing
private class
FileDialog.FileSystemLocationLabel
private class
FileDialog.OkHandler
-
Nested classes/interfaces inherited from class com.googlecode.lanterna.gui2.AbstractBasePane
AbstractBasePane.ContentHolder
-
Nested classes/interfaces inherited from interface com.googlecode.lanterna.gui2.Window
Window.Hint
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
directory
private ActionListBox
directoryListBox
private TextBox
fileBox
private ActionListBox
fileListBox
private Button
okButton
private java.io.File
selectedFile
private boolean
showHiddenFilesAndDirs
-
Fields inherited from class com.googlecode.lanterna.gui2.AbstractBasePane
contentHolder, interactableLookupMap
-
-
Constructor Summary
Constructors Constructor Description FileDialog(java.lang.String title, java.lang.String description, java.lang.String actionLabel, TerminalSize dialogSize, boolean showHiddenFilesAndDirs, java.io.File selectedObject)
Default constructor forFileDialog
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
reloadViews(java.io.File directory)
java.io.File
showDialog(WindowBasedTextGUI textGUI)
Opens the dialog by showing it on the GUI and doesn't return until the dialog has been closed-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractWindow
addWindowListener, close, draw, fromGlobal, fromGlobalToContentRelative, fromGlobalToDecoratedRelative, getDecoratedSize, getHints, getPosition, getPostRenderer, getPreferredSize, getSize, getTextGUI, getTitle, handleInput, isVisible, removeWindowListener, setCloseWindowWithEscape, setContentOffset, setDecoratedSize, setFixedSize, setHints, setPosition, setSize, setTextGUI, setTitle, setVisible, setWindowPostRenderer, toGlobal, toGlobalFromContentRelative, toGlobalFromDecoratedRelative, waitUntilClosed
-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractBasePane
addBasePaneListener, getBasePaneListeners, getComponent, getCursorPosition, getFocusedInteractable, getMenuBar, getTheme, invalidate, isInvalid, removeBasePaneListener, setComponent, setEnableDirectionBasedMovements, setFocusedInteractable, setFocusedInteractable, setMenuBar, setStrictFocusChange, setTheme
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.googlecode.lanterna.gui2.BasePane
getTheme, setEnableDirectionBasedMovements, setStrictFocusChange, setTheme
-
Methods inherited from interface com.googlecode.lanterna.gui2.Window
getBounds, getComponent, getCursorPosition, getFocusedInteractable, getMenuBar, invalidate, isInvalid, setComponent, setFocusedInteractable, setMenuBar
-
-
-
-
Field Detail
-
fileListBox
private final ActionListBox fileListBox
-
directoryListBox
private final ActionListBox directoryListBox
-
fileBox
private final TextBox fileBox
-
okButton
private final Button okButton
-
showHiddenFilesAndDirs
private final boolean showHiddenFilesAndDirs
-
directory
private java.io.File directory
-
selectedFile
private java.io.File selectedFile
-
-
Constructor Detail
-
FileDialog
public FileDialog(java.lang.String title, java.lang.String description, java.lang.String actionLabel, TerminalSize dialogSize, boolean showHiddenFilesAndDirs, java.io.File selectedObject)
Default constructor forFileDialog
- Parameters:
title
- Title of the dialogdescription
- Description of the dialog, is displayed at the top of the content areaactionLabel
- Label to use on the "confirm" button, for example "open" or "save"dialogSize
- Rough estimation of how big you want the dialog to beshowHiddenFilesAndDirs
- Iftrue
, hidden files and directories will be visibleselectedObject
- Initially selected file node
-
-
Method Detail
-
showDialog
public java.io.File showDialog(WindowBasedTextGUI textGUI)
Opens the dialog by showing it on the GUI and doesn't return until the dialog has been closed- Overrides:
showDialog
in classDialogWindow
- Parameters:
textGUI
- Text GUI to add the dialog to- Returns:
- The file which was selected in the dialog or
null
if the dialog was cancelled
-
reloadViews
private void reloadViews(java.io.File directory)
-
-