|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JFileChooser
gate.swing.XJFileChooser
public class XJFileChooser
Extends JFileChooser to make sure the shared
MainFrame instance is used as a parent when no parent is specified.
Remember the last path used for each resource type.
The path is saved when the user confirm the dialog.
The resource name must be set with the method setResource(String).
Use setSelectedFile(java.io.File) to preselect a different file
or use setFileName(String) to use a different file name but the
saved directory.
Resource paths are saved in the user config file.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JFileChooser |
|---|
JFileChooser.AccessibleJFileChooser |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
XJFileChooser()
|
|
| Method Summary | |
|---|---|
void |
addChoosableFileFilter(FileFilter filterToAdd)
overriden to add a filter only if not already present |
void |
approveSelection()
overriden to first save the location of the file chooser for the current resource. |
void |
ensureFileIsVisible(File f)
Overriden to test first if the file exists |
String |
getLocationForResource(String resource)
|
Map<String,String> |
getLocations()
Useful to modify the locations used by this file chooser. |
String |
getResource()
Get the resource associated to this file chooser. |
void |
setFileName(String fileName)
Set the file name to be used instead of the one saved in the preferences. |
void |
setLocations(Map<String,String> locations)
Useful to modify the locations used by this file chooser. |
void |
setResource(String resource)
Set the resource to remember the path. |
void |
setSelectedFile(File file)
Overriden to test first if the file exists |
void |
setSelectedFileFromPreferences()
If possible, select the last directory/file used for the resource otherwise use the last file chooser selection directory or if null use the user home directory. |
int |
showDialog(Component parent,
String approveButtonText)
Overridden to make sure the shared MainFrame instance is used as a parent when no parent is specified |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public XJFileChooser()
| Method Detail |
|---|
public int showDialog(Component parent,
String approveButtonText)
throws HeadlessException
showDialog in class JFileChooserHeadlessExceptionpublic void setSelectedFileFromPreferences()
public String getLocationForResource(String resource)
public Map<String,String> getLocations()
setLocations(java.util.Map)public void setLocations(Map<String,String> locations)
locations - a map of (resource name * file location)getLocations()public void setFileName(String fileName)
fileName - file namepublic void approveSelection()
approveSelection in class JFileChooserpublic void setResource(String resource)
showDialog(java.awt.Component, java.lang.String).
resource - name of the resourcepublic String getResource()
public void ensureFileIsVisible(File f)
ensureFileIsVisible in class JFileChooserpublic void setSelectedFile(File file)
setSelectedFile in class JFileChooserpublic void addChoosableFileFilter(FileFilter filterToAdd)
addChoosableFileFilter in class JFileChooser
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||