public class SimpleRevisionComparePresenter
extends java.lang.Object
implements java.awt.event.ItemListener, javax.swing.event.ChangeListener, java.awt.event.ActionListener
Modifier and Type | Class and Description |
---|---|
private static class |
SimpleRevisionComparePresenter.DefaultFileHandler
does not try to load the file, returns null
|
static interface |
SimpleRevisionComparePresenter.FileHandler
This interface is used by the SimpleRevisionComparePresenter to handle the file loading.
|
private static class |
SimpleRevisionComparePresenter.MockOperator
Mock revision operator for functional test.
|
Modifier and Type | Field and Description |
---|---|
private SimpleRevisionComparePresenter.FileHandler |
fileHandler
the default file handler cannot load any files and has to be replaced
|
private SimpleRevisionCompareModel |
model
the data model for the revision compare
|
private SimpleRevisionCompareView |
view
the view showing the revision compare
|
Constructor and Description |
---|
SimpleRevisionComparePresenter(SimpleRevisionCompareModel model,
SimpleRevisionCompareView view)
Default Ctor: registers the view as listener to the correct model.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ev) |
void |
itemStateChanged(java.awt.event.ItemEvent ev) |
static void |
main(java.lang.String[] args)
Functional Test method: Only shows the view in a JFrame to test resize behavior.
|
private void |
registerAsViewListener()
Helper method: Register the presenter with the view components.
|
void |
setFileHandler(SimpleRevisionComparePresenter.FileHandler handler)
Sets a file handler responsible for filtering the open file dialog and loading
the selected file.
|
void |
stateChanged(javax.swing.event.ChangeEvent ev) |
private SimpleRevisionCompareModel model
private SimpleRevisionCompareView view
private SimpleRevisionComparePresenter.FileHandler fileHandler
public SimpleRevisionComparePresenter(SimpleRevisionCompareModel model, SimpleRevisionCompareView view)
public void setFileHandler(SimpleRevisionComparePresenter.FileHandler handler)
handler
- An implementation of the FileHandler interface or null. If null is given
then the default handler is used which cannot open any files.private void registerAsViewListener()
public void actionPerformed(java.awt.event.ActionEvent ev)
actionPerformed
in interface java.awt.event.ActionListener
public void stateChanged(javax.swing.event.ChangeEvent ev)
stateChanged
in interface javax.swing.event.ChangeListener
public void itemStateChanged(java.awt.event.ItemEvent ev)
itemStateChanged
in interface java.awt.event.ItemListener
public static void main(java.lang.String[] args)