|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.smardec.asc.filechooser.FileChooserManager
FileChooserManager
builds file choosers and file filter using the information from the xml.
Sample usage:
FileChooserManager fileChooserManager = new FileChooserManager(getClass().getClassLoader().getResourceAsStream("com/smardec/asc/demo/filechoosers.xml"));
fileChooserManager.buildFileChooser();
JAscFileChooser fileChooser = fileChooserManager.getFileChooserById("FileChooser.Xml");
if (fileChooser != null)
fileChooser.showOpenDialog(this);
Xml file has the following structure:
<!-- The root element of the filechoosers.xml file. It contains all the information used by com.smardec.asc.filechooser.FileChooserManager to build filechoosers and filefilters. --> <!ELEMENT root (filters, filechoosers)> <!-- The filters element contains information about the filters and groups of filters. --> <!ELEMENT filters (filter-group+)> <!-- 'icon-base-path' base path that is used with 'icon' to complete icon's path in filter element. --> <!ATTLIST filters icon-base-path CDATA #IMPLIED> <!-- The filter-group element defines information about the group of filters that is used in filechooser element. --> <!ELEMENT filter-group (filter)> <!-- 'id' unique filter group id 'file-hiding-enabled' overrides the corresponding attribute of the file chooser that is used with filter group 'accept-all-file-filter-used' overrides the corresponding attribute of the file chooser that is used with filter group 'show-hidden-files' overrides the corresponding attribute of the file chooser that is used with filter group --> <!ATTLIST filter-group id CDATA #REQUIRED file-hiding-enabled (yes | true | no | false) #IMPLIED accept-all-file-filter-used (yes | true | no | false) #IMPLIED show-hidden-files (yes | true | no | false) #IMPLIED > <!-- The filter element defines information about the file filter that is used in filechooser element. --> <!ELEMENT filter EMPTY> <!-- 'filename' specifies file name that are shown by the filter 'extension' specifies file extension that are shown by the filter 'description' specifies description of the file that are shown by the filter 'icon' specifies icon of the file that are shown by the filter --> <!ATTLIST filter filename CDATA #IMPLIED extension CDATA #IMPLIED description CDATA #IMPLIED icon CDATA #IMPLIED > <!-- The filechoosers element contains information about the filechoosers. --> <!ELEMENT filechoosers (filechooser+)> <!-- The filechooser element contains information about the filechooser. --> <!ELEMENT filechooser (filter-group-ref, selection-mode, root-dir)> <!-- 'id' unique filechooser id --> <!ATTLIST filechooser id CDATA #REQUIRED> <!-- The filter-group-ref element contains reference to filter group that is used in file chooser. --> <!ELEMENT filter-group-ref EMPTY> <!-- 'id' filter group id that defines information about the filters --> <!ATTLIST filter-group-ref id CDATA #REQUIRED> <!-- The selection-mode element specifies information about file selection mode. --> <!ELEMENT selection-mode EMPTY> <!-- 'type' defines selection mode 'multi-selection' defines multiple file selections --> <!ATTLIST selection-mode type (files_only | directories_only | files_and_directories) #REQUIRED multi-selection (yes | true | no | false) #REQUIRED > <!-- The root-dir element specifies root directory for file chooser. --> <!ELEMENT root-dir EMPTY> <!-- 'dir-path' file chooser's root directory path --> <!ATTLIST root-dir dir-path CDATA #REQUIRED>
Constructor Summary | |
FileChooserManager(java.io.InputStream inputStream)
Creates new FileChooserManager given the InputStream to read from. |
|
FileChooserManager(java.lang.String menuFileChooserFileName)
Creates new FileChooserManager given the name of the xml file to read from. |
Method Summary | |
void |
buildFileChooser()
Builds file choosers using specified data. |
JAscFileChooser |
getFileChooserById(java.lang.String fileChooserId)
Returns JAscFileChooser object with specified file chooser id fileChooserId . |
JAscFileChooser |
putFileChooser(java.lang.String fileChooserId,
JAscFileChooser jAscFileChooser)
Maps the specified fileChooserId to the specified jAscFileChooser . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileChooserManager(java.lang.String menuFileChooserFileName) throws java.lang.Exception
FileChooserManager
given the name of the xml file to read from.
menuFileChooserFileName
- xml file name to read data from
java.lang.Exception
- if failed to read filepublic FileChooserManager(java.io.InputStream inputStream) throws java.lang.Exception
FileChooserManager
given the InputStream
to read from.
inputStream
- InputStream
to read from
java.lang.Exception
- if failed to read streamMethod Detail |
public void buildFileChooser() throws java.lang.Exception
java.lang.Exception
- if failed to buildpublic JAscFileChooser getFileChooserById(java.lang.String fileChooserId)
JAscFileChooser
object with specified file chooser id fileChooserId
.
fileChooserId
cannot be null.
fileChooserId
- id of JAscFileChooser
JAscFileChooser
object with specified file chooser id fileChooserId
.public JAscFileChooser putFileChooser(java.lang.String fileChooserId, JAscFileChooser jAscFileChooser)
fileChooserId
to the specified jAscFileChooser
.
Neither the fileChooserId
nor the jAscFileChooser
can be null
.
The jAscFileChooser
can be retrieved by calling the getFileChooserById(String)
method
with a id that is equal to the original id.
fileChooserId
- id of the specified file chooserjAscFileChooser
- file chooser to hold in this FileChooserManager
FileChooserManager
,
or null
if it did not have one.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |