1 package com
.googlecode
.lanterna
.gui2
.dialogs
;
3 import com
.googlecode
.lanterna
.TerminalSize
;
4 import com
.googlecode
.lanterna
.gui2
.LocalizedString
;
9 * Dialog builder for the {@code FileDialog} class, use this to create instances of that class and to customize
13 public class FileDialogBuilder
extends AbstractDialogBuilder
<FileDialogBuilder
, FileDialog
> {
15 private String actionLabel
;
16 private TerminalSize suggestedSize
;
17 private File selectedFile
;
18 private boolean showHiddenDirectories
;
23 public FileDialogBuilder() {
25 actionLabel
= LocalizedString
.OK
.toString();
26 suggestedSize
= new TerminalSize(45, 10);
27 showHiddenDirectories
= false;
32 protected FileDialog
buildDialog() {
33 return new FileDialog(title
, description
, actionLabel
, suggestedSize
, showHiddenDirectories
, selectedFile
);
37 * Defines the label to be but on the confirmation button (default: "ok"). You probably want to set this to
38 * {@code LocalizedString.Save.toString()} or {@code LocalizedString.Open.toString()}
39 * @param actionLabel Label to put on the confirmation button
42 public FileDialogBuilder
setActionLabel(String actionLabel
) {
43 this.actionLabel
= actionLabel
;
48 * Returns the label on the confirmation button
49 * @return Label on the confirmation button
51 public String
getActionLabel() {
56 * Sets the suggested size for the file dialog, it won't have exactly this size but roughly. Default suggested size
58 * @param suggestedSize Suggested size for the file dialog
61 public FileDialogBuilder
setSuggestedSize(TerminalSize suggestedSize
) {
62 this.suggestedSize
= suggestedSize
;
67 * Returns the suggested size for the file dialog
68 * @return Suggested size for the file dialog
70 public TerminalSize
getSuggestedSize() {
75 * Sets the file that is initially selected in the dialog
76 * @param selectedFile File that is initially selected in the dialog
79 public FileDialogBuilder
setSelectedFile(File selectedFile
) {
80 this.selectedFile
= selectedFile
;
85 * Returns the file that is initially selected in the dialog
86 * @return File that is initially selected in the dialog
88 public File
getSelectedFile() {
93 * Sets if hidden files and directories should be visible in the dialog (default: {@code false}
94 * @param showHiddenDirectories If {@code true} then hidden files and directories will be visible
96 public void setShowHiddenDirectories(boolean showHiddenDirectories
) {
97 this.showHiddenDirectories
= showHiddenDirectories
;
101 * Checks if hidden files and directories will be visible in the dialog
102 * @return If {@code true} then hidden files and directories will be visible
104 public boolean isShowHiddenDirectories() {
105 return showHiddenDirectories
;
109 protected FileDialogBuilder
self() {