Package org.apache.log4j.chainsaw
Class LoadXMLAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.apache.log4j.chainsaw.LoadXMLAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
class LoadXMLAction extends javax.swing.AbstractAction
Encapsulates the action to load an XML file.- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private static Logger
LOG
use to log messagesprivate javax.swing.JFileChooser
mChooser
the file chooser - configured to allow only the selection of a single file.private XMLFileHandler
mHandler
the content handlerprivate javax.swing.JFrame
mParent
the parent frameprivate org.xml.sax.XMLReader
mParser
parser to read XML files
-
Constructor Summary
Constructors Constructor Description LoadXMLAction(javax.swing.JFrame aParent, MyTableModel aModel)
Creates a newLoadXMLAction
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent aIgnore)
Prompts the user for a file to load events from.private int
loadFile(java.lang.String aFile)
Loads the contents of file into the model-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
LOG
private static final Logger LOG
use to log messages
-
mParent
private final javax.swing.JFrame mParent
the parent frame
-
mChooser
private final javax.swing.JFileChooser mChooser
the file chooser - configured to allow only the selection of a single file.
-
mParser
private final org.xml.sax.XMLReader mParser
parser to read XML files
-
mHandler
private final XMLFileHandler mHandler
the content handler
-
-
Constructor Detail
-
LoadXMLAction
LoadXMLAction(javax.swing.JFrame aParent, MyTableModel aModel) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
Creates a newLoadXMLAction
instance.- Parameters:
aParent
- the parent frameaModel
- the model to add events to- Throws:
org.xml.sax.SAXException
- if an error occursjavax.xml.parsers.ParserConfigurationException
- if an error occurs
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent aIgnore)
Prompts the user for a file to load events from.- Parameters:
aIgnore
- anActionEvent
value
-
loadFile
private int loadFile(java.lang.String aFile) throws org.xml.sax.SAXException, java.io.IOException
Loads the contents of file into the model- Parameters:
aFile
- the file to extract events from- Returns:
- the number of events loaded
- Throws:
org.xml.sax.SAXException
- if an error occursjava.io.IOException
- if an error occurs
-
-