public class GralFileSelector extends GralWidget implements Removeable
FileRemote
. This type inherits from File
and is supported for a local file system on PC. It is possible to work with any remote file system.
specifyActionOnFileSelected(GralUserAction)
allows any action while the user
select any file. For example a user's program can show the content of the file.
Modifier and Type | Class and Description |
---|---|
private static class |
GralFileSelector.ERefresh |
protected class |
GralFileSelector.FileSelectList
Implementation of the base widget.
|
static class |
GralFileSelector.MenuTexts
This class is instantiated static and contains English menu texts.
|
static class |
GralFileSelector.WindowConfirmSearch
A window for search-in-file dialogue.
|
GralWidget.ActionChangeSelect, GralWidget.ConfigData, GralWidget.DynamicData, GralWidget.ImplAccess
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
(package private) GralUserAction |
actionDeselectDirtree |
(package private) GralUserAction |
actionFavorButton |
private GralUserAction |
actionOnEnterDirectory
This action will be called on pressing enter or mouse-click on a directory.
|
private GralUserAction |
actionOnEnterFile
This action will be called on pressing enter or mouse-click on a simple file.
|
private GralUserAction |
actionOnEnterPathNewFile
This action will be called on pressing enter or mouse-click on the path text field
if it contains any text which can't assigned to an existing file.
|
protected GralUserAction |
actionOnFileSelected
This action will be called any time when the selection of a current file is changed.
|
private GralUserAction |
actionOnFileSelection
Action to show the file properties in the info line.
|
private MarkMask_ifc |
actionOnMarkLine |
(package private) GralUserAction |
actionRefreshFileTable
Sets the origin dir of the last focused file table.
|
(package private) GralUserAction |
actionSetFileAttribs |
(package private) GralUserAction |
actionSetPath
Action on [Enter]-key on the path text field.
|
(package private) GralUserAction |
actionShowCreationTime |
(package private) GralUserAction |
actionShowLastAccessTime |
(package private) GralUserAction |
actionShowLastModifiedTime |
(package private) GralUserAction |
actionSortFilePerExtensionCase |
(package private) GralUserAction |
actionSortFilePerExtensionNonCase |
(package private) GralUserAction |
actionSortFilePerLenghLargestFirst |
(package private) GralUserAction |
actionSortFilePerNameCase |
(package private) GralUserAction |
actionSortFilePerNameNonCase |
(package private) GralUserAction |
actionSortFilePerTimestamp |
(package private) GralUserAction |
actionSortFilePerTimestampOldestFirst |
(package private) GralUserAction |
actionSortFilesPerLenghSmallestFirst |
(package private) GralUserAction |
actionSwitchoffCheckRefresh
Sets the check refresh mode to off.
|
(package private) GralUserAction |
actionSwitchonCheckRefresh
Sets the check refresh mode to on.
|
FileRemoteCallback |
callbackChildren1 |
(package private) GralColor |
colorBack |
(package private) GralColor |
colorBackPending |
(package private) GralUserAction |
confirmCreate |
static GralFileSelector.MenuTexts |
contextMenuTexts |
protected FileRemote |
currentDir
The current shown directory.
|
protected FileRemote |
currentFile
Currently selected file in the table.
|
(package private) java.text.SimpleDateFormat |
dateFormatNewer |
(package private) java.text.SimpleDateFormat |
dateFormatOlder |
(package private) java.text.SimpleDateFormat |
dateFormatToday |
(package private) java.text.SimpleDateFormat |
dateFormatYear |
(package private) boolean |
donotCheckRefresh |
protected int |
durationFillin
Duration of last fillin.
|
protected int |
durationRefresh
Duration of last fillin.
|
protected GralTable<java.lang.String> |
favorList |
(package private) boolean |
fillinPending
Set to true if a fillin is pending.
|
private IndexMultiTable<java.lang.String,GralTableLine_ifc<FileRemote>> |
idxLines |
private java.util.Map<java.lang.String,FileRemote> |
indexSelection
This index stores the last selected file for any directory path which was used.
|
static int |
kColDate
Column which contains the time stamp
|
static int |
kColDesignation
Column which contains the designation of entry.
|
static int |
kColFilename
Column which contains the filename.
|
static int |
kColLength
Column which contains the length of file
|
static char |
kSortDateNewest |
static char |
kSortDateOldest |
static char |
kSortExtension |
static char |
kSortExtensionNonCase |
static char |
kSortName |
static char |
kSortNameNonCase |
static char |
kSortSizeLargest |
static char |
kSortSizeSmallest |
(package private) FileRemote |
originDir
The directory which was used on start.
|
protected int |
refreshCount |
(package private) java.lang.String |
sCurrentDir |
(package private) java.lang.String |
sDatePrefixNewer |
(package private) java.lang.String |
sDatePrefixOlder |
(package private) java.lang.String |
sDatePrefixToday |
(package private) java.lang.String |
sDatePrefixYear |
protected GralFileSelector.FileSelectList |
selectList
The implementation of SelectList.
|
protected char |
showTime
Determines which time are present in the date/time column.
|
private char |
sortOrder |
private char |
sortOrderLast |
static java.lang.String |
sVersion
Version, history and copyright/copyleft.
|
protected long |
timeFilesRefreshed
The time after 1970 when the fillin was invoked and finished at last.
|
protected long |
timeFillinFinished
The time after 1970 when the fillin was invoked and finished at last.
|
protected long |
timeFillinInvoked
The time after 1970 when the fillin was invoked and finished at last.
|
protected GralButton |
widgBtnFavor |
protected GralTextField |
widgdPathDir
The widget for showing the path.
|
protected GralFileSelector.WindowConfirmSearch |
windSearch |
static int |
zColumns
Number of columns of the table.
|
_wdgImpl, bEditable, bHasFocus, bShouldInitialize, buildMng, bVisibleState, cfg, contextMenu, dateUser, dyda, htmlHelp, itsMng, name, repaintDelay, repaintDelayMax, sCmd, sFormat, sToolTip, whatIs
version
version
Constructor and Description |
---|
GralFileSelector(java.lang.String name,
int rows,
int[] columns,
int[] columnsFavorlist)
Creates
|
Modifier and Type | Method and Description |
---|---|
boolean |
actionUserKey(int keyCode,
java.lang.Object userDataOfLine,
GralTableLine_ifc<FileRemote> line)
This method is called on any user key or mouse event while operating in the file table.
|
protected java.lang.String |
buildKey(FileRemote file,
boolean bAllCompleteWithFileInfo,
java.lang.String[] retSortName) |
void |
checkRefresh(long since) |
private void |
completeLine(GralTableLine_ifc<FileRemote> tline,
FileRemote file,
long timeNow) |
void |
createImplWidget_Gthread()
Sets the widgets of this instance to a panel.
|
static GralFileSelector.WindowConfirmSearch |
createWindowConfirmSearchGthread(GralMngBuild_ifc mng)
Creates the window to confirm search in files.
|
FileRemote |
currentDir()
Gets the directory which is currently shown.
|
FileRemote |
currentFile()
Gets the current selected file.
|
void |
fillIn(FileRemote fileIn,
boolean bDonotRefrehs)
Fills the content with given directory.
|
private void |
fillIn(java.util.List<java.io.File> files) |
void |
fillInCurrentDir()
It is the refresh operation.
|
void |
fillInOriginDir()
Fills the content with the first directory or the directory which was set with
#setOriginDir(File) . |
(package private) void |
finishShowFileTable()
Finishes a newly showed file table.
|
void |
forcefillIn(FileRemote fileIn,
boolean bCompleteWithFileInfo) |
FileRemote |
getCurrentDir()
same as
currentDir() . |
java.lang.String |
getCurrentDirPath() |
java.util.List<FileRemote> |
getSelectedFiles(boolean bAlsoDirs,
int mask)
Gets the selected file from this panel.
|
boolean |
remove()
Removes the widget from the lists in its panel and from the graphical representation.
|
boolean |
selectFile(java.lang.String name)
Selects the file with the given name in the table
|
GralUserAction |
setActionOnEnterDirectory(GralUserAction newAction)
This action will be called on pressing enter or mouse-click on a directory.
|
GralUserAction |
setActionOnEnterFile(GralUserAction newAction)
Sets the action which is called if any file is entered.
|
GralUserAction |
setActionOnEnterPathNewFile(GralUserAction newAction)
This action will be called on pressing enter or mouse-click on the path text field
if it contains any text which can't assigned to an existing file.
|
GralUserAction |
setActionSetFileLineAttrib(GralUserAction newAction)
Sets the action which is called if any file is set to the table.
|
void |
setDateFormat(java.lang.String sFormat) |
void |
setFocus()
Sets the focus of the associated table widget.
|
void |
setNameWidget(java.lang.String name)
Maybe called after construction, should be called before
GralWidget.setToPanel(GralMngBuild_ifc) |
void |
setOriginDir(FileRemote dir) |
void |
setSortOrder(char sortOrder)
Sets the sort order of entries.
|
void |
setSortOrderFiles(char order) |
boolean |
setVisible(boolean visible)
Sets the widget visible or not.
|
(package private) void |
showFile(FileRemote file1)
This routine is invoked in callback of
callbackChildren1 for fillIn(FileRemote, boolean) in the refresh thread. |
void |
specifyActionOnFileSelected(GralUserAction actionOnLineSelected)
Sets an action which is called any time when another line is selected.
|
(package private) void |
stop() |
java.io.File |
XXXgetSelectedFile()
Gets the selected file from this panel.
|
chgPos, clearShowParam, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, getContentInfo, getContextMenu, getData, getDataIx, getDataPath, getDataPath, getFloatValue, getFormat, getGralWidget, getHtmlHelp, getImpl, getItsPanel, getLongValue, getName, getShowMethod, getShowParam, getsToolTip, getText, getValue, getVariable, getVariableFromContentInfo, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, pos, refreshFromVariable, refreshFromVariable, repaint, repaint, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackColor, setBackgroundColor, setBoundsPixel, setCfgElement, setCmd, setContentIdent, setContentInfo, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setForegroundColor, setFormat, setHtmlHelp, setLineColor, setLongValue, setMinMax, setPanelMng, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setToPanel, setValue, setValue, setValue, setValue, setVisibleState, setVisibleStateWidget, specifyActionChange, specifyContextMenu, toString, XXXgetPixelPositionSize, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread, XXXsetVisibleGThread
public static final java.lang.String sVersion
favorList
is unused yet, create only if position is given.
GralFileSelector(String, int, int[], int[])
: The rows argument is used yet for table zLinesMax.
The old last argument size was never used. replaced by the column designation for the favorList
.
If it is null, do not create a favorList
.
setVisible(boolean)
for this large widget.
fillInCurrentDir()
does not refresh if it was refreshed in the last seconds.
fillIn(FileRemote, boolean)
now with new meaning of boolean: show newly without refresh with the file system.
This is used in callback routines which does a refresh but does not invoke showFile(FileRemote)
especially called from Fcmd.refreshFilePanel(FileRemote)
.
actionSetPath
because the property whether it is a directory or not should be known. Prevents a timeout waiting in graphic thread!!!
fillIn(FileRemote, boolean)
using the new FileRemote#getChildren(org.vishia.fileRemote.FileRemote.ChildrenEvent).
getSelectedFiles(boolean, int)
now has that 2 arguments for directory and mark mask.
Now it is possible and necessary for the application to choice whether directories are gotten too.
The usage is improved. If some files are marked but not visible, it was able that the user does not know about
this situation and an unexpected behavior for the user is done. Now only marked files are returned
if the current file is marked too. The method is correct named 'selected' because the selection is returned,
either the current file or all marked.
fillIn(FileRemote, boolean)
modi of refresh.
#fillInRefreshed(FileRemote, boolean)
now does not clear
the table but writes only lines if the data are changed. This method can be called
in a higher frequency without disturbing the appearance of the table. Used for cyclically refresh.
checkRefresh(long)
, chg: Don't change the content in the table
if the content is identical with the current presentation in table, for refreshing.
fillIn(FileRemote, boolean)
now uses the FileRemote.timeRefresh
actionOnMarkLine
changes the select status of FileRemote.setMarked(int)
CallbackCmd#successCode
etc.
#setToPanel(GralMngBuild_ifc, String, int, int[], char)
preserves the panel
before calling.
#fillInRefreshed(File, boolean)
: If all files are complete with file info,
nevertheless the RefreshTimed#delayedFillin(int) was called because the whole routine was called with false
as bCompleteWithFileInfo-argument. Now that is prevented if all files were tested already.
protected GralFileSelector.WindowConfirmSearch windSearch
private final GralUserAction actionOnFileSelection
private final MarkMask_ifc actionOnMarkLine
public static final int zColumns
public static final int kColDesignation
public static final int kColFilename
public static final int kColLength
public static final int kColDate
public static final char kSortName
public static final char kSortNameNonCase
public static final char kSortExtension
public static final char kSortExtensionNonCase
public static final char kSortDateNewest
public static final char kSortDateOldest
public static final char kSortSizeLargest
public static final char kSortSizeSmallest
public static GralFileSelector.MenuTexts contextMenuTexts
private char sortOrder
private char sortOrderLast
protected char showTime
protected GralFileSelector.FileSelectList selectList
GralColor colorBackPending
private final IndexMultiTable<java.lang.String,GralTableLine_ifc<FileRemote>> idxLines
private final java.util.Map<java.lang.String,FileRemote> indexSelection
protected long timeFillinInvoked
protected long timeFilesRefreshed
protected long timeFillinFinished
protected int durationRefresh
protected int durationFillin
protected int refreshCount
boolean donotCheckRefresh
protected GralTextField widgdPathDir
protected GralButton widgBtnFavor
java.lang.String sDatePrefixNewer
java.text.SimpleDateFormat dateFormatNewer
java.lang.String sDatePrefixToday
java.text.SimpleDateFormat dateFormatToday
java.lang.String sDatePrefixYear
java.text.SimpleDateFormat dateFormatYear
java.lang.String sDatePrefixOlder
java.text.SimpleDateFormat dateFormatOlder
protected FileRemote currentDir
protected FileRemote currentFile
java.lang.String sCurrentDir
FileRemote originDir
protected GralUserAction actionOnFileSelected
private GralUserAction actionOnEnterFile
private GralUserAction actionOnEnterDirectory
private GralUserAction actionOnEnterPathNewFile
GralUserAction actionSetFileAttribs
boolean fillinPending
public FileRemoteCallback callbackChildren1
GralUserAction actionSetPath
indexSelection
.
GralUserAction actionSortFilePerNameCase
GralUserAction actionSortFilePerNameNonCase
GralUserAction actionSortFilePerExtensionCase
GralUserAction actionSortFilePerExtensionNonCase
GralUserAction actionSortFilePerTimestamp
GralUserAction actionSortFilePerTimestampOldestFirst
GralUserAction actionShowLastModifiedTime
GralUserAction actionShowLastAccessTime
GralUserAction actionShowCreationTime
GralUserAction actionSortFilePerLenghLargestFirst
GralUserAction actionSortFilesPerLenghSmallestFirst
GralUserAction actionDeselectDirtree
GralUserAction actionRefreshFileTable
Fcmd.getLastSelectedFileCards()
.GralUserAction actionSwitchoffCheckRefresh
GralUserAction actionSwitchonCheckRefresh
GralUserAction confirmCreate
GralUserAction actionFavorButton
public GralFileSelector(java.lang.String name, int rows, int[] columns, int[] columnsFavorlist)
posName
- "@position=name"
or "name"
, see GralWidget.GralWidget(String, char)
arg1,rows
- columns
- size
- public void setNameWidget(java.lang.String name)
GralWidget.setToPanel(GralMngBuild_ifc)
name
- public void setDateFormat(java.lang.String sFormat)
public void createImplWidget_Gthread()
GralMngBuild_ifc.selectPanel(String)
and
GralMngBuild_ifc#setPositionInPanel(float, float, float, float, char)
.
The instance has more as one widget, all widgets are set in the area of the given position.
The position area should be a range of at least 3 lines.createImplWidget_Gthread
in interface GralWidget_ifc
createImplWidget_Gthread
in class GralWidget
panelMng
- The panelManager.identArgJbat
- The name of the table widget. The Text-widget for the path gets the name * "-Path".rows
- Number of rows to showcolumns
- Array with column width.size
- Presentation size. It is a character 'A'..'E', where 'A' is a small size. The size determines
the font size especially.public static GralFileSelector.WindowConfirmSearch createWindowConfirmSearchGthread(GralMngBuild_ifc mng)
public void specifyActionOnFileSelected(GralUserAction actionOnLineSelected)
actionOnLineSelected
- The action, null to switch off this functionality.public java.lang.String getCurrentDirPath()
public void setOriginDir(FileRemote dir)
public void setSortOrder(char sortOrder)
sortOrder
- public GralUserAction setActionOnEnterFile(GralUserAction newAction)
newAction
- The action to use. The action is invoked with TODOpublic GralUserAction setActionOnEnterDirectory(GralUserAction newAction)
public GralUserAction setActionOnEnterPathNewFile(GralUserAction newAction)
public GralUserAction setActionSetFileLineAttrib(GralUserAction newAction)
newAction
- The action to use. The action is invoked with TODOpublic void fillInOriginDir()
#setOriginDir(File)
.public void fillInCurrentDir()
fillinPending
is set yet this operation does nothing. It means it is possible to call in a short cycle
more as one time after another, for example for all files of a directory without calculation effort.private void fillIn(java.util.List<java.io.File> files)
public void forcefillIn(FileRemote fileIn, boolean bCompleteWithFileInfo)
public void fillIn(FileRemote fileIn, boolean bDonotRefrehs)
fileIn
- The directory which's files are shown.bDonotRefrehs
- false then invoke an extra thread to walk through the file system,
see @FileRemote#refreshPropertiesAndChildren(FileRemoteCallback)
and callbackChildren1
.
If true then it is presumed that the FileRemote children are refreshed in the last time already.
The fill the table newly with given content in this thread.void showFile(FileRemote file1)
callbackChildren1
for fillIn(FileRemote, boolean)
in the refresh thread.file1
- void finishShowFileTable()
colorBackPending
yet, they are not refreshed because that files don't exist furthermore.
Gets the currentFile()
of this table from the indexSelection
if the currentFile
is null,
sets the current line and repaint the table.private void completeLine(GralTableLine_ifc<FileRemote> tline, FileRemote file, long timeNow)
protected java.lang.String buildKey(FileRemote file, boolean bAllCompleteWithFileInfo, java.lang.String[] retSortName)
public void checkRefresh(long since)
public java.io.File XXXgetSelectedFile()
public java.util.List<FileRemote> getSelectedFiles(boolean bAlsoDirs, int mask)
bAlsoDirs
- false then returns never a directory. If the current selected file is a directory
then return null.public boolean selectFile(java.lang.String name)
name
- name of file like it is shown in the table (given as key).public FileRemote currentFile()
File.isDirectory()
.public FileRemote currentDir()
currentFile()
is the parent. Elsewhere this method returns the parent of
currentFile()
.public FileRemote getCurrentDir()
currentDir()
.public void setFocus()
setFocus
in interface GralWidget_ifc
setFocus
in class GralWidget
GralWidget_ifc.setFocus()
public boolean setVisible(boolean visible)
GralWidget
GralWidget.ImplAccess.chgVisible
or GralWidget.ImplAccess.chgInvisible
in GralWidget.DynamicData.setChanged(int)
and invokes GralWidget.repaint()
with the GralWidget.repaintDelay
and GralWidget.repaintDelayMax
setVisible
in interface GralWidget_ifc
setVisible
in class GralWidget
void stop()
public boolean remove()
GralWidget
#removeWidgetImplementation()
which is implemented in the adaption.remove
in interface Removeable
remove
in class GralWidget
public boolean actionUserKey(int keyCode, java.lang.Object userDataOfLine, GralTableLine_ifc<FileRemote> line)
key
- code or mouse code, one of constants from KeyCode
.userDataOfLine
- The user data stored in the line of table.line
- The table line.public void setSortOrderFiles(char order)