guk.editIM
Class FileRequester
java.lang.Object
|
+--guk.editIM.FileRequester
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener
- public class FileRequester
- extends java.lang.Object
- implements java.awt.event.ActionListener
Helper for the EditIM Input Method Editor:
The file requester (for load, save and merge), with a
bonus combobox to select the actual file format.
Field Summary |
(package private) javax.swing.JFileChooser |
fileChooser
One choser that is not re-initialiyzed: allows all file open
dialogues to remember the CWD from each other etc. |
(package private) MenuHelpers |
menu
The MenuHelpers class provides functions like creating menu items
and buttons. |
Constructor Summary |
FileRequester(MenuHelpers menuHelper)
The constructor needs a MenuHelpers instance for generic
settings like font, action listener and centering base. |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent e)
The main point where events are coming in. |
void |
fileTypeRequest(java.lang.String title,
java.lang.String command)
Sends command encoding filetype filename
after querying for a file and type
(the type will also determine the encoding). |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
menu
MenuHelpers menu
- The MenuHelpers class provides functions like creating menu items
and buttons. Initially, no action listener is set.
fileChooser
javax.swing.JFileChooser fileChooser
- One choser that is not re-initialiyzed: allows all file open
dialogues to remember the CWD from each other etc.
FileRequester
public FileRequester(MenuHelpers menuHelper)
- The constructor needs a MenuHelpers instance for generic
settings like font, action listener and centering base.
- Parameters:
menuHelper
- Provides functions like creating menu items.
Should have the listener set.
fileTypeRequest
public void fileTypeRequest(java.lang.String title,
java.lang.String command)
- Sends command encoding filetype filename
after querying for a file and type
(the type will also determine the encoding).
This shows a popup with a file choser. A combobox to
select some file type is added, and a file filter for
the extensions gim, kmap and u8 is provided in addition
to the default any file filter. The file type selection
also selects the encoding: ISO-8859-1 normally, but
UTF-8 for U8 and Unicode simple text files. Yudit is UTF-8
for the comments, but the data only uses ASCII characters.
The encoding
is added to the command as string, the type is added as
a string representing one of the
AssignObject
format constants.
The selected file will not be opened, but the name of
it will be appended to the command in form of an URL.
- Parameters:
title
- The title that the dialog window should use.command
- The command that should be PRODUCED. Only
the beginning is read to determine the mode of this dialog.
Recognized modes are load, save, and merge.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- The main point where events are coming in.
this is an ActionListener, so it must handle actionPerformed. All
requests are coming in through this method. Each type of request
should be handled by calling one or more of the private methods
of this class. This is the common parser for all. Some of the
methods above throw events back by using menu.tellListener().
Accepted commands:
loadlocale file - ask for a filename AND type to be loaded.
mergelocale file - as loadlocale file, but for merge.
savelocale file - ask for filename AND type for save.
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener