public class OpenFileAction extends AbstractApplicationAction
URIChooser
and loads the selected URI into an
empty view. If no empty view is available, a new view is created.
This action is called when the user selects the Open item in the File menu. The menu item is automatically created by the application. A Recent Files sub-menu is also automatically generated.
If you want this behavior in your application, you have to create it
and put it in your ApplicationModel
in method
ApplicationModel.initApplication(org.jhotdraw.app.Application)
.
This action is designed for applications which automatically
create a new view for each opened file. This action goes together with
NewFileAction
, OpenDirectoryAction
and CloseFileAction
.
This action should not be used together with LoadFileAction
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID |
Constructor and Description |
---|
OpenFileAction(Application app)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
protected javax.swing.JDialog |
createDialog(URIChooser chooser,
java.awt.Component parent)
We implement JFileChooser.showDialog by ourselves, so that we can center
dialogs properly on screen on Mac OS X.
|
protected URIChooser |
getChooser(View view) |
protected void |
openViewFromURI(View view,
java.net.URI uri,
URIChooser chooser) |
int |
showDialog(URIChooser chooser,
java.awt.Component parent)
We implement JFileChooser.showDialog by ourselves, so that we can center
dialogs properly on screen on Mac OS X.
|
dispose, getApplication, installApplicationListeners, isEnabled, setEnabled, uninstallApplicationListeners, updateApplicationEnabled
public static final java.lang.String ID
public OpenFileAction(Application app)
protected URIChooser getChooser(View view)
public void actionPerformed(java.awt.event.ActionEvent evt)
protected void openViewFromURI(View view, java.net.URI uri, URIChooser chooser)
public int showDialog(URIChooser chooser, java.awt.Component parent)
protected javax.swing.JDialog createDialog(URIChooser chooser, java.awt.Component parent) throws java.awt.HeadlessException
java.awt.HeadlessException