You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.2 KiB
97 lines
2.2 KiB
package application.helpers;
|
|
|
|
import application.UICoordinator;
|
|
import application.enums.NavState;
|
|
import application.helpers.wrappers.WrappedException;
|
|
|
|
/**
|
|
* Callback for the communication between the thread
|
|
* {@link WorkWhileProgressThread} and the {@link UICoordinator}
|
|
*
|
|
* @author Bianca
|
|
*
|
|
*/
|
|
public class ChangeViewCallback
|
|
{
|
|
/**
|
|
* Coordinator for accessing
|
|
*/
|
|
private UICoordinator coord;
|
|
|
|
public ChangeViewCallback(UICoordinator coord)
|
|
{
|
|
this.coord = coord;
|
|
}
|
|
|
|
/**
|
|
* Calls the {@code fillDataList} method of the {@link UICoordinator}. Reads in
|
|
* the health data.
|
|
*
|
|
* @throws WrappedException if there was an error reading the file
|
|
*/
|
|
public void callFillDataList() throws WrappedException
|
|
{
|
|
this.coord.fillDataList();
|
|
}
|
|
|
|
/**
|
|
* Calls the {@code createTempFiles} method of the {@link UICoordinator}.
|
|
* Creates the temp files.
|
|
*
|
|
* @throws WrappedException If there was an error creating or writing to the
|
|
* files
|
|
*/
|
|
public void callCreateTempFiles() throws WrappedException
|
|
{
|
|
this.coord.createTempFiles();
|
|
}
|
|
|
|
/**
|
|
* Changes to the overview view
|
|
*/
|
|
public void callOverview()
|
|
{
|
|
this.coord.changeView(this.coord.getOverviewView());
|
|
this.coord.updateNav(NavState.SELECT_DATA);
|
|
}
|
|
|
|
/**
|
|
* In case an error occurred while the health data was read, the
|
|
* {@link UICoordinator} will be informed.
|
|
*
|
|
* @param text The user readable information about the error.
|
|
*/
|
|
public void callErrorReadingFile(String text)
|
|
{
|
|
this.coord.setErrorReadingFile(text);
|
|
}
|
|
|
|
/**
|
|
* In case an error occurred while the files were written, the
|
|
* {@link UICoordinator} will be informed.
|
|
*
|
|
* @param text The user readable information about the error.
|
|
*/
|
|
public void callErrorWritingTemFiles(String text)
|
|
{
|
|
this.coord.setErrorWritingTempFiles(text);
|
|
}
|
|
|
|
/**
|
|
* Changes to the inspect view
|
|
*/
|
|
public void callInspect()
|
|
{
|
|
this.coord.changeView(this.coord.getInspectView());
|
|
this.coord.updateNav(NavState.INSPECT);
|
|
}
|
|
|
|
/**
|
|
* Changes to the inspect view after an error occurred.
|
|
*/
|
|
public void callInspectWithError()
|
|
{
|
|
this.coord.changeView(this.coord.getInspectView());
|
|
this.coord.updateNav(NavState.INSPECT_WITH_ERROR);
|
|
}
|
|
}
|