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 |
---|---|
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 |
---|---|
protected GralUserAction |
actionOnFileSelected
This action will be called any time when the selection of a current file is changed.
|
FileRemoteCallback |
callbackChildren1 |
static GralFileSelector.MenuTexts |
contextMenuTexts |
protected FileRemote |
currentDir
The current shown directory.
|
protected FileRemote |
currentFile
Currently selected file in the table.
|
protected int |
durationFillin
Duration of last fillin.
|
protected int |
durationRefresh
Duration of last fillin.
|
protected GralTable<java.lang.String> |
favorList |
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 |
protected int |
refreshCount |
protected GralFileSelector.FileSelectList |
selectList
The implementation of SelectList.
|
protected char |
showTime
Determines which time are present in the date/time column.
|
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) |
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.
|
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) . |
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.
|
void |
specifyActionOnFileSelected(GralUserAction actionOnLineSelected)
Sets an action which is called any time when another line is selected.
|
java.io.File |
XXXgetSelectedFile()
Gets the selected file from this panel.
|
chgPos, clearShowParam, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, 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, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setForegroundColor, setFormat, setHtmlHelp, setLineColor, setLongValue, setMinMax, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setValue, setValue, setValue, setValue, setVisibleState, setVisibleStateWidget, specifyActionChange, specifyContextMenu, toString, XXXgetPixelPositionSize, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread, XXXsetVisibleGThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getContentInfo, setToPanel
getContentInfo, setContentInfo
protected GralUserAction actionOnFileSelected
public FileRemoteCallback callbackChildren1
public static GralFileSelector.MenuTexts contextMenuTexts
protected FileRemote currentDir
protected FileRemote currentFile
protected int durationFillin
protected int durationRefresh
public static final int kColDate
public static final int kColDesignation
public static final int kColFilename
public static final int kColLength
public static final char kSortDateNewest
public static final char kSortDateOldest
public static final char kSortExtension
public static final char kSortExtensionNonCase
public static final char kSortName
public static final char kSortNameNonCase
public static final char kSortSizeLargest
public static final char kSortSizeSmallest
protected int refreshCount
protected GralFileSelector.FileSelectList selectList
protected char showTime
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 long timeFilesRefreshed
protected long timeFillinFinished
protected long timeFillinInvoked
protected GralButton widgBtnFavor
protected GralTextField widgdPathDir
protected GralFileSelector.WindowConfirmSearch windSearch
public static final int zColumns
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 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.protected java.lang.String buildKey(FileRemote file, boolean bAllCompleteWithFileInfo, java.lang.String[] retSortName)
public void checkRefresh(long since)
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 FileRemote currentDir()
currentFile()
is the parent. Elsewhere this method returns the parent of
currentFile()
.public FileRemote currentFile()
File.isDirectory()
.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.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.public void fillInOriginDir()
#setOriginDir(File)
.public void forcefillIn(FileRemote fileIn, boolean bCompleteWithFileInfo)
public FileRemote getCurrentDir()
currentDir()
.public java.lang.String getCurrentDirPath()
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 remove()
GralWidget
#removeWidgetImplementation()
which is implemented in the adaption.remove
in interface Removeable
remove
in class GralWidget
public boolean selectFile(java.lang.String name)
name
- name of file like it is shown in the table (given as key).public GralUserAction setActionOnEnterDirectory(GralUserAction newAction)
public GralUserAction setActionOnEnterFile(GralUserAction newAction)
newAction
- The action to use. The action is invoked with TODOpublic GralUserAction setActionOnEnterPathNewFile(GralUserAction newAction)
public GralUserAction setActionSetFileLineAttrib(GralUserAction newAction)
newAction
- The action to use. The action is invoked with TODOpublic void setDateFormat(java.lang.String sFormat)
public void setFocus()
setFocus
in interface GralWidget_ifc
setFocus
in class GralWidget
GralWidget_ifc.setFocus()
public void setNameWidget(java.lang.String name)
GralWidget.setToPanel(GralMngBuild_ifc)
name
- public void setOriginDir(FileRemote dir)
public void setSortOrder(char sortOrder)
sortOrder
- public void setSortOrderFiles(char order)
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
public void specifyActionOnFileSelected(GralUserAction actionOnLineSelected)
actionOnLineSelected
- The action, null to switch off this functionality.public java.io.File XXXgetSelectedFile()