Class SimpleRevisionComparePresenter
- java.lang.Object
 - 
- net.sf.tweety.lp.asp.beliefdynamics.gui.SimpleRevisionComparePresenter
 
 
- 
- All Implemented Interfaces:
 java.awt.event.ActionListener,java.awt.event.ItemListener,java.util.EventListener,javax.swing.event.ChangeListener
public class SimpleRevisionComparePresenter extends java.lang.Object implements java.awt.event.ItemListener, javax.swing.event.ChangeListener, java.awt.event.ActionListenerThis class couples the SimpleRevisionCompare View and Model, it needs to know the implementation used to load external belief base files, see FileHandler interface. The presenter reacts to user inputs on the view and proofs if the changes are valid and then delegates them to the model. It also registers the view as a PropertyListener to the correct model. This gui is based on the RevisionCompare gui from the beliefdynamics.gui package.- Author:
 - Sebastian Homann, Tim Janus
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSimpleRevisionComparePresenter.DefaultFileHandlerdoes not try to load the file, returns nullstatic interfaceSimpleRevisionComparePresenter.FileHandlerThis interface is used by the SimpleRevisionComparePresenter to handle the file loading.private static classSimpleRevisionComparePresenter.MockOperatorMock revision operator for functional test. 
- 
Field Summary
Fields Modifier and Type Field Description private SimpleRevisionComparePresenter.FileHandlerfileHandlerthe default file handler cannot load any files and has to be replacedprivate SimpleRevisionCompareModelmodelthe data model for the revision compareprivate SimpleRevisionCompareViewviewthe view showing the revision compare 
- 
Constructor Summary
Constructors Constructor Description SimpleRevisionComparePresenter(SimpleRevisionCompareModel model, SimpleRevisionCompareView view)Default Ctor: registers the view as listener to the correct model. 
- 
Method Summary
Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent ev)voiditemStateChanged(java.awt.event.ItemEvent ev)static voidmain(java.lang.String[] args)Functional Test method: Only shows the view in a JFrame to test resize behavior.private voidregisterAsViewListener()Helper method: Register the presenter with the view components.voidsetFileHandler(SimpleRevisionComparePresenter.FileHandler handler)Sets a file handler responsible for filtering the open file dialog and loading the selected file.voidstateChanged(javax.swing.event.ChangeEvent ev) 
 - 
 
- 
- 
Field Detail
- 
model
private SimpleRevisionCompareModel model
the data model for the revision compare 
- 
view
private SimpleRevisionCompareView view
the view showing the revision compare 
- 
fileHandler
private SimpleRevisionComparePresenter.FileHandler fileHandler
the default file handler cannot load any files and has to be replaced 
 - 
 
- 
Constructor Detail
- 
SimpleRevisionComparePresenter
public SimpleRevisionComparePresenter(SimpleRevisionCompareModel model, SimpleRevisionCompareView view)
Default Ctor: registers the view as listener to the correct model.- Parameters:
 model- the modelview- the view
 
 - 
 
- 
Method Detail
- 
setFileHandler
public void setFileHandler(SimpleRevisionComparePresenter.FileHandler handler)
Sets a file handler responsible for filtering the open file dialog and loading the selected file.- Parameters:
 handler- An implementation of the FileHandler interface or null. If null is given then the default handler is used which cannot open any files.
 
- 
registerAsViewListener
private void registerAsViewListener()
Helper method: Register the presenter with the view components. 
- 
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ev)
- Specified by:
 actionPerformedin interfacejava.awt.event.ActionListener
 
- 
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent ev)
- Specified by:
 stateChangedin interfacejavax.swing.event.ChangeListener
 
- 
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent ev)
- Specified by:
 itemStateChangedin interfacejava.awt.event.ItemListener
 
- 
main
public static void main(java.lang.String[] args)
Functional Test method: Only shows the view in a JFrame to test resize behavior.- Parameters:
 args- some arguments
 
 - 
 
 -