|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel uic.widgets.filechooser.FileChooserBase uic.widgets.filechooser.FileChooser
public class FileChooser
A widget for selecting a file.
Currently only support some KDE settings.. but still needs a lot of improvement
Nested Class Summary | |
---|---|
protected static class |
FileChooser.BrowseIcon
Very simple icon based on FileChooser.newFolderIcon. |
protected class |
FileChooser.FileChooserComboBoxEditor
|
protected class |
FileChooser.FileChooserComboBoxModel
|
protected static class |
FileChooser.FileChooserPreviewPanel
|
protected static class |
FileChooser.FileFilterListCellRenderer
Paint the FileFilters description in the filters combobox and list. |
protected class |
FileChooser.HiddenFilesFileFilter
|
protected class |
FileChooser.HistoryMenuItem
Class that shows the history menu item. |
protected class |
FileChooser.HistoryPopupMenu
Class that shows the history popupmenu. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
FILE_ACCEPTED
Add property listener to FileChooser with FILE_ACCEPTED to keep track of files accepted from FileChooser. |
Fields inherited from class uic.widgets.filechooser.FileChooserBase |
---|
directory, directoryUpButton, directoryUpButtonAction, fileName, fileShortcutsList, filters, newFolderButton, newFolderButtonAction, nextButton, nextButtonAction, optionsButton, optionsButtonAction, previousButton, previousButtonAction, textLabel1, textLabel1_2, textLabel2, viewContent |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
protected |
FileChooser(File defaultDirectory,
String instance)
Constructor. |
Method Summary | |
---|---|
void |
directorySelectedSlot()
A directory has been selected by the navigation bar. |
void |
directoryUpButtonPressedSlot()
Go to the parent of the current selected directory. |
void |
fileAccepted(File selectedFile)
|
void |
fileSelectionChanged(File file)
|
protected static File |
getFile(File f)
Checks for shortcuts. |
static FileChooser |
getInstance(String instance,
File defaultDirectory)
Return the instance of the FileChooser. |
String |
getInstanceName()
|
boolean |
getMutipleSelection()
|
File |
getSelectedFile()
Return the selected file. |
File[] |
getSelectedFiles()
Return the selected files. |
void |
guiInit()
|
static void |
main(String[] args)
Test functionality. |
void |
newFolderButtonPressedSlot()
Create a new directory in the current folder. |
void |
nextButtonPressedSlot()
Go to the next directory in the history. |
void |
previousButtonPressedSlot()
Go to the previous directory in the history. |
protected static String |
replace(String str,
String search,
String replace)
Replaces first occurance of search with replace. |
static File |
selectFile(MainWindow parent)
Convenience method for the selectFile(Window) method. |
static File |
selectFile(MainWindow parent,
String instance)
Convenience method for the selectFile(Window,String) method. |
static File |
selectFile(MainWindow parent,
String instance,
List fileFilters)
Convenience method for the selectFile(Window,String,List) method. |
static File |
selectFile(MainWindow parent,
String instance,
List fileFilters,
String windowTitle)
Convenience method for the selectFile(Window,String,List,String) method. |
static File |
selectFile(MainWindow parent,
String instance,
List fileFilters,
String windowTitle,
File defaultDirectory)
Convenience method for the selectFile(Window,String,List,String,File) method. |
static File |
selectFile(Window parent)
Show file selection dialog. |
static File |
selectFile(Window parent,
String instance)
Show file selection dialog. |
static File |
selectFile(Window parent,
String instance,
List fileFilters)
Show file selection dialog. |
static File |
selectFile(Window parent,
String instance,
List fileFilters,
String windowTitle)
Show file selection dialog. |
static File |
selectFile(Window parent,
String instance,
List fileFilters,
String windowTitle,
File defaultDirectory)
Show file selection dialog. |
static File[] |
selectFiles(MainWindow parent,
String instance,
List fileFilters,
String windowTitle,
File defaultDirectory)
Convenience method for the selectFiles(Window,String,List,String,File) method. |
static File[] |
selectFiles(Window parent,
String instance,
List fileFilters,
String windowTitle,
File defaultDirectory)
Show file selection dialog. |
void |
setFileFilters(List filefilters)
Set the filefilters that can be used in the filechooser. |
void |
setFilePreview(FilePreviewInterface fpi)
|
void |
setMultipleSelection(boolean multipleSelection)
Sets the filedialog to multiple or single selection. |
void |
setSelectedFile(File selectedFile)
Select the current file from the view. |
void |
setSelectedFiles(File[] selectedFiles)
|
void |
shortcutSelectedSlot()
A shortcut has been selected. |
File[] |
showFileChooser(Window parent,
String windowTitle)
Deprecated. use showOpenDialog or showSaveDialog |
File[] |
showFileChooser(Window parent,
String windowTitle,
String acceptButtonTitle)
Show a StandardDialog to select files from the current FileChooser instance. |
File[] |
showOpenDialog(Window parent)
Show an open dialog from the current filechooser instance. |
File |
showSaveDialog(Window parent)
Show a save dialog from the current filechooser instance. |
TranslationInterface |
translate()
|
protected void |
updateByHistory(File historyFile)
|
Methods inherited from class uic.widgets.filechooser.FileChooserBase |
---|
optionsButtonPressedSlot |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String FILE_ACCEPTED
Constructor Detail |
---|
protected FileChooser(File defaultDirectory, String instance)
defaultDirectory
- the directory to start the filechooser when no last saved existsinstance
- name for this FileChooser, so that settings can be made (last directory, etc) per instance, null when no settings need to be restored/savedMethod Detail |
---|
public void guiInit()
guiInit
in class FileChooserBase
public static File selectFile(MainWindow parent)
selectFile(Window)
method.
public static File selectFile(MainWindow parent, String instance)
selectFile(Window,String)
method.
public static File selectFile(MainWindow parent, String instance, List fileFilters)
selectFile(Window,String,List)
method.
public static File selectFile(MainWindow parent, String instance, List fileFilters, String windowTitle)
selectFile(Window,String,List,String)
method.
public static File selectFile(MainWindow parent, String instance, List fileFilters, String windowTitle, File defaultDirectory)
selectFile(Window,String,List,String,File)
method.
public static File[] selectFiles(MainWindow parent, String instance, List fileFilters, String windowTitle, File defaultDirectory)
selectFiles(Window,String,List,String,File)
method.
public static File selectFile(Window parent)
FileChooser.selectFile(parent, null, null)
parent
- the parent that is used to display the filechooser on top of.
public static File selectFile(Window parent, String instance)
AllFilesFilter
Same as calling FileChooser.selectFile(parent, instance, null)
Note that fileFilters should contain a file filter for "all files" if this filter should be choosable
parent
- the parent that is used to display the filechooser on top of.instance
- the instance of the FileChooser to return. Settings will be stored per instance
public static File selectFile(Window parent, String instance, List fileFilters)
FileChooser.selectFile(parent, fileFilters, instance, null)
Note that fileFilters should contain a file filter for "all files" if this filter should be choosable
parent
- the parent that is used to display the filechooser on top of.fileFilters
- a collection of AbstractFileFilter objects that is displayed in the filter combobox or null when the default (AllFilesFilter) should be usedinstance
- the instance of the FileChooser to return. Settings will be stored per instance
public static File selectFile(Window parent, String instance, List fileFilters, String windowTitle)
FileChooser.selectFile(parent, fileFilters, instance, null)
Note that fileFilters should contain a file filter for "all files" if this filter should be choosable
parent
- the parent that is used to display the filechooser on top of.fileFilters
- a collection of AbstractFileFilter objects that is displayed in the filter combobox or null when the default (AllFilesFilter) should be usedinstance
- the instance of the FileChooser to return. Settings will be stored per instancewindowTitle
- the title of the FileChooser window, when null "Open File" will be used
public static File selectFile(Window parent, String instance, List fileFilters, String windowTitle, File defaultDirectory)
FileChooser.selectFile(parent, fileFilters, instance, null)
Note that fileFilters should contain a file filter for "all files" if this filter should be choosable
parent
- the parent that is used to display the filechooser on top of.instance
- the instance of the FileChooser to return. Settings will be stored per instancefileFilters
- a collection of AbstractFileFilter objects that is displayed in the filter combobox or null when the default (AllFilesFilter) should be usedwindowTitle
- the title of the FileChooser window, when null "Open File" will be useddefaultDirectory
- the directory to start the filechooser when no last saved exists
public static File[] selectFiles(Window parent, String instance, List fileFilters, String windowTitle, File defaultDirectory)
FileChooser.selectFile(parent, fileFilters, instance, null)
Note that fileFilters should contain a file filter for "all files" if this filter should be choosable
parent
- the parent that is used to display the filechooser on top of.fileFilters
- a collection of AbstractFileFilter objects that is displayed in the filter combobox or null when the default (AllFilesFilter) should be usedinstance
- the instance of the FileChooser to return. Settings will be stored per instancewindowTitle
- the title of the FileChooser window, when null "Open File" will be useddefaultDirectory
- the directory to start the filechooser when no last saved exists
public File[] showFileChooser(Window parent, String windowTitle)
public File[] showOpenDialog(Window parent)
parent
- the parent windowpublic File showSaveDialog(Window parent)
parent
- the parent window
IllegalStateException
- when multipleselection is onpublic File[] showFileChooser(Window parent, String windowTitle, String acceptButtonTitle)
parent
- the parent window for modal settingswindowTitle
- the window title, or ull when a translation of Open file should be usedacceptButtonTitle
- the translated version of the accept button (open or save) including the mnemonic, or null for &Open
public static FileChooser getInstance(String instance, File defaultDirectory)
instance
- the name of the instance to return, or null when no instance settings requ
reddefaultDirectory
- the directory to start by default, or null when the default user d
rectory should be de defualt
public String getInstanceName()
public void setFileFilters(List filefilters)
filefilters
- collection of AbstractFileFilter objectspublic void setFilePreview(FilePreviewInterface fpi)
public void setMultipleSelection(boolean multipleSelection)
multipleSelection
- true when multiple selection allowedpublic boolean getMutipleSelection()
public void fileAccepted(File selectedFile)
fileAccepted
in interface FileSelectionListener
public void fileSelectionChanged(File file)
fileSelectionChanged
in interface FileSelectionListener
public void setSelectedFile(File selectedFile)
setSelectedFile
in interface FileSelectionListener
public void setSelectedFiles(File[] selectedFiles)
setSelectedFiles
in interface FileSelectionListener
public void shortcutSelectedSlot()
public void directorySelectedSlot()
public void directoryUpButtonPressedSlot()
directoryUpButtonPressedSlot
in class FileChooserBase
public void nextButtonPressedSlot()
nextButtonPressedSlot
in class FileChooserBase
public void previousButtonPressedSlot()
previousButtonPressedSlot
in class FileChooserBase
protected void updateByHistory(File historyFile)
protected static File getFile(File f)
public void newFolderButtonPressedSlot()
newFolderButtonPressedSlot
in class FileChooserBase
public File getSelectedFile()
public File[] getSelectedFiles()
public TranslationInterface translate()
translate
in class FileChooserBase
protected static String replace(String str, String search, String replace)
str
- the string to search onsearch
- the string to search forreplace
- the string to replace search with
public static void main(String[] args) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |