@fluxResource = [File#]
FileResource models a sys::File
as a Flux resource.
Slots
- childrenSource
-
override FileResource[]? children()
Overrides flux::Resource.children
Get the navigation children of the resource. Return an empty list or null to indicate no children. Default returns null.
-
internal Void duplicate(Frame frame, File src)
Duplicate the given file.
- fileSource
-
const File file
The target file.
- fileToIconSource
-
static Image fileToIcon(File f)
Get the icon for the specified file based on its mime type.
-
internal Void findInFiles(Frame? frame, File dir)
Invoke the find-in-files command on the specified directory
-
static private Int gb := 1048576 * 1024
- hasChildrenSource
-
override Bool hasChildren()
Overrides flux::Resource.hasChildren
If we haven't loaded the children yet, then return true for directories and false for normal files.
- iconSource
-
override Image icon
Overrides flux::Resource.icon
The icon is based on mime type.
-
static private Int kb := 1024
-
private FileResource[]? kids
- makeSource
-
Make a resource for the specified file.
-
new makeFile(File file)
Make from file using file's uri - the file must be normalized.
-
static private Int mb := 1024 * 1024
- nameSource
-
override Str name
Overrides flux::Resource.name
Return the file name.
-
internal Void newDir(Frame frame, File dir)
Create a new diretory under the current directory.
-
internal Void openIn(File dir)
Open the given directory using the OS specific directory browser (i.e. Windows Explorer or Mac Finder)
- popupSource
-
override Menu? popup(Frame? frame, Event? event)
Overrides flux::Resource.popup
Add command specific Files.
-
private Str? promptFileName(Frame frame, Str label, File dir, Str oldName)
Prompt the user for a new valid filename, returns the new filename, or null if the dialog was canceled.
-
internal Void rename(Frame frame, File src)
Rename the given file.
- sizeToStrSource
-
static Str sizeToStr(Int? size)
Given a file size in bytes return a suitable string representation for display. If size is null return "".
- sortFilesSource
-
static File[] sortFiles(File[] files)
Sort files in-place for display. Directories are always sorted before normal files using locale name comparison.
- uriSource
-
override Uri uri
Overrides flux::Resource.uri
The absolute file uri
- viewsSource
-
override Type[] views()
Overrides flux::Resource.views
View types are based on mime type. Register a file view using the facet "fluxViewMimeType" with a Str value for the MIME type such as "image/png". You can also register with just the media type, for example use "image" to register a view on any image file.