Relative file type filter: java,class,
Syntactically, file type filter strings have at least one comma.
Note that the file name filter string "*.java" is semantically the same
as a type filter string "java,". Either one can be used and will get
the same results. However, if you specify "java" you will be in trouble,
as it will mean look for a file explicitly named "java".
It is invalid to have both a comma and an asterisk in the same filter string.
It is also invalid to have both a comma and a period in the same filter string.
Clients may use or subclass this class. When subclassing, clients need to
ensure that the subclass is always capable of performing a deep clone
operation with the
clone()
method, so if they add fields of
complex type, these need to be dealt with by overriding
clone()
.
path
protected
String path
file
protected
String file
types
protected
String[] types
subdirs
protected boolean subdirs
files
protected boolean files
filterByTypes
protected boolean filterByTypes
PATH_SEP
protected
String PATH_SEP
TYPE_SEP
public static final char TYPE_SEP
-
See Also:
-
Constant Field Values
TYPE_SEP_STRING
public static final
String TYPE_SEP_STRING
-
See Also:
-
Constant Field Values
SWITCH_NOSUBDIRS
public static final
String SWITCH_NOSUBDIRS
-
See Also:
-
Constant Field Values
SWITCH_NOFILES
public static final
String SWITCH_NOFILES
-
See Also:
-
Constant Field Values
RemoteFileFilterString
public RemoteFileFilterString()
- Constructor to use for a filter to list roots when used absolutely, or list all contents
when used relatively.
RemoteFileFilterString
public RemoteFileFilterString(
IRemoteFileSubSystemConfiguration subsysFactory)
- Constructor to use when there is no existing filter string.
This constructor is better that the default constructor, because it takes a remote file subsystem
factory, from which we can query the folder and path separator characters, which are needed
to parse and re-build filter strings.
-
See Also:
-
setPath(String)
,
setFile(String)
,
setTypes(String[])
RemoteFileFilterString
public RemoteFileFilterString(
IRemoteFileSubSystemConfiguration subsysFactory,
String input)
- Constructor to use when an absolute filter string already exists.
RemoteFileFilterString
public RemoteFileFilterString(
IRemoteFileSubSystemConfiguration subsysFactory,
String path,
String input)
- Constructor to use when you have a path and filename filter or comma-separated file types list.
In the latter case, the last char must be a TYPE_SEP or comma, even for a single type.
setSubSystemConfiguration
public void setSubSystemConfiguration(
IRemoteFileSubSystemConfiguration subsysFactory)
-
-
setFile
public void setFile(
String obj)
- Set the file name filter. You either call this or setTypes!
-
-
setPath
public void setPath(
String path)
- Set the path to list files and/or folders in
-
-
setTypes
public void setTypes(
String[] types)
- Set the file types to subset by. These are extensions, without the dot, as
in java, class, gif, etc.
You either call this or setFile!
-
-
setShowFiles
public void setShowFiles(boolean set)
- Allow files?
-
-
setShowSubDirs
public void setShowSubDirs(boolean set)
- Allow subdirs?
-
-
getFile
public
String getFile()
- Get the file name filter
-
-
getFileOrTypes
public
String getFileOrTypes()
- Return the file part of the filter string, without the path.
This is either the file name filter or a comma-separated list of types if this
is a file type filter string.
-
-
getTypesString
public static
String getTypesString(
String[] typesArray)
- Concatenate the given file types as a single string, each type comma-separated
-
-
getTypesAsString
public
String getTypesAsString()
- For file types filters, returns the types as a string of concatenated types,
comma-delimited. For file name filters, returns null;
-
-
getPath
public
String getPath()
- Get the path to list files and/or folders in
-
-
getTypes
public
String[] getTypes()
- Get the types to subset by, if specified.
Will be null if this is not a by-type filter string.
-
-
getShowFiles
public boolean getShowFiles()
- Should the filter show individual files?
-
-
getShowSubDirs
public boolean getShowSubDirs()
- Subdirs allowed?
-
-
getFilterByTypes
public boolean getFilterByTypes()
- Return true if this filter string filters by file types versus by file name
-
-
listRoots
public boolean listRoots()
- This filter string represent a list-roots filter string?
-
-
listRoot
public boolean listRoot()
- This filter string represent a list-files-in-root filter string?
-
-
parse
protected void parse(
String inputPath,
String input)
-
-
parseFileOrTypes
protected void parseFileOrTypes(
String filter)
- Parse the non-folder part of the filter string. Will either be a
generic name or comma-separated list of types.
-
-
parseTypes
public static
String[] parseTypes(
String typeList)
- Parse a comma-separated list of strings into an array of strings
-
-
toString
public
String toString()
- Serialize into a string capturing all the attributes
-
-
Overrides:
-
toString
in class
Object
-
toStringNoSwitches
public
String toStringNoSwitches()
- Return the filter as a string, without the switches for no-files, no-folders
-
-
clone
public
Object clone()
- Clone this into another filter string object with the same attributes.
Subclasses must ensure that such a deep copy operation is always
possible, so their state must always be cloneable. Which should
always be possible to achieve, since this Object also needs to be
serializable.
-
-
Overrides:
-
clone
in class
Object
-
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.