Browse Source

Display notification of warnings after computations in GUI.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@4497 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 14 years ago
parent
commit
4fc61415fb
  1. 26
      prism/src/userinterface/GUIPrism.java
  2. 15
      prism/src/userinterface/model/GUIMultiModel.java
  3. 2
      prism/src/userinterface/model/computation/BuildModelThread.java
  4. 2
      prism/src/userinterface/model/computation/ComputeSteadyStateThread.java
  5. 2
      prism/src/userinterface/model/computation/ComputeTransientThread.java
  6. 2
      prism/src/userinterface/model/computation/ExportBuiltModelThread.java
  7. 2
      prism/src/userinterface/model/computation/LoadGraphicModelThread.java
  8. 2
      prism/src/userinterface/model/computation/LoadPEPAModelThread.java
  9. 2
      prism/src/userinterface/model/computation/LoadPRISMModelThread.java
  10. 2
      prism/src/userinterface/model/computation/ParseModelThread.java
  11. 2
      prism/src/userinterface/model/computation/SaveGraphicModelThread.java
  12. 2
      prism/src/userinterface/model/computation/SavePEPAModelThread.java
  13. 2
      prism/src/userinterface/model/computation/SavePRISMModelThread.java
  14. 100
      prism/src/userinterface/properties/GUIMultiProperties.java
  15. 2
      prism/src/userinterface/properties/computation/ExportResultsThread.java
  16. 2
      prism/src/userinterface/properties/computation/LoadPropertiesThread.java
  17. 2
      prism/src/userinterface/properties/computation/SavePropertiesThread.java

26
prism/src/userinterface/GUIPrism.java

@ -155,6 +155,7 @@ public class GUIPrism extends JFrame
private JFileChooser choose;
private JProgressBar progress;
private GUITaskBar taskbar;
private String taskbarText = "";
private Action prismOptions;
private Action fontIncrease;
private Action fontDecrease;
@ -528,6 +529,7 @@ public class GUIPrism extends JFrame
else if(e.getID() == GUIComputationEvent.COMPUTATION_DONE)
{
prismOptions.setEnabled(true);
appendWarningsNoteToTaskBarText(prism.getMainLog());
}
else if(e.getID() == GUIComputationEvent.COMPUTATION_ERROR)
{
@ -606,6 +608,30 @@ public class GUIPrism extends JFrame
public void setTaskBarText(String message)
{
taskbar.setText(message);
// Store message to in case we want to append a (single) warning later
taskbarText = message;
}
/** Utility update method to append a note about warnings to the taskbar
* @param log PrismLog to check for warnings
*/
public void appendWarningsNoteToTaskBarText(PrismLog log)
{
int numWarnings = log.getNumberOfWarnings();
String message = null;
if (numWarnings == 1)
message = "[ There was 1 warning - see log for details ]";
else if (numWarnings > 1)
message = "[ There were " + numWarnings + " warnings - see log for details ]";
if (message != null) {
String taskbarTextNew = taskbarText;
if (taskbarTextNew == null)
taskbarTextNew = "";
if (taskbarTextNew.length() > 0)
taskbarTextNew += " ";
taskbarTextNew += message;
taskbar.setText(taskbarTextNew);
}
}
/** Utility update method to set the JProgressBar to an indeterminate state. */

15
prism/src/userinterface/model/GUIMultiModel.java

@ -300,7 +300,9 @@ public class GUIMultiModel extends GUIPlugin implements PrismSettingsListener
protected void a_build()
{
//check modified since build
// Reset warnings counter
getPrism().getMainLog().resetNumberOfWarnings();
// Request build
handler.forceBuild();
}
/*
@ -321,12 +323,17 @@ public class GUIMultiModel extends GUIPlugin implements PrismSettingsListener
default: res = showSaveFileDialog(textFilter, textFilter[0]); break;
}
if (res != JFileChooser.APPROVE_OPTION) return;
// Reset warnings counter
getPrism().getMainLog().resetNumberOfWarnings();
// do export...
handler.exportBuild(exportEntity, exportType, getChooserFile());
}
protected void a_viewBuild(int exportEntity, int exportType)
{
// Reset warnings counter
getPrism().getMainLog().resetNumberOfWarnings();
// Do view...
handler.exportBuild(exportEntity, exportType, null);
}
@ -342,11 +349,17 @@ public class GUIMultiModel extends GUIPlugin implements PrismSettingsListener
protected void a_computeSteadyState()
{
// Reset warnings counter
getPrism().getMainLog().resetNumberOfWarnings();
// Do steady-state
handler.computeSteadyState();
}
protected void a_computeTransient()
{
// Reset warnings counter
getPrism().getMainLog().resetNumberOfWarnings();
// Do transient
int result = GUITransientTime.requestTime(this.getGUI());
if (result == GUITransientTime.OK) {
handler.computeTransient(GUITransientTime.getTime());

2
prism/src/userinterface/model/computation/BuildModelThread.java

@ -244,8 +244,8 @@ public class BuildModelThread extends GUIComputationThread
//If we are here, the build was successful, notify the interface
SwingUtilities.invokeLater(new Runnable() { public void run() {
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Building model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
handler.modelBuildSuccessful(model, buildValues);
}});
}

2
prism/src/userinterface/model/computation/ComputeSteadyStateThread.java

@ -84,8 +84,8 @@ public class ComputeSteadyStateThread extends GUIComputationThread
{
public void run()
{
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Computing steady-state probabilities... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.stopProgress();
}
});

2
prism/src/userinterface/model/computation/ComputeTransientThread.java

@ -86,8 +86,8 @@ public class ComputeTransientThread extends GUIComputationThread
{
public void run()
{
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Computing transient probabilities... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.stopProgress();
}
});

2
prism/src/userinterface/model/computation/ExportBuiltModelThread.java

@ -108,8 +108,8 @@ public class ExportBuiltModelThread extends GUIComputationThread
//If we get here export was successful, notify interface
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Exporting... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
}});
}
// catch and ignore any thread exceptions

2
prism/src/userinterface/model/computation/LoadGraphicModelThread.java

@ -613,8 +613,8 @@ public class LoadGraphicModelThread extends Thread implements EntityResolver
public void run()
{
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Loading model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
handler.graphicModelLoaded(graphicEdit, f );
}
});

2
prism/src/userinterface/model/computation/LoadPEPAModelThread.java

@ -101,8 +101,8 @@ public class LoadPEPAModelThread extends Thread
//If we get here, the load has been successful, notify the interface and tell the handler.
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Loading model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
if(!reload)
handler.pepaModelLoaded(pepaEdit, f ,replace);
else

2
prism/src/userinterface/model/computation/LoadPRISMModelThread.java

@ -101,8 +101,8 @@ public class LoadPRISMModelThread extends Thread
//If we get here, the load has been successful, notify the interface and tell the handler.
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Loading model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
if(!reload)
handler.prismModelLoaded(textEdit, f ,replace);
else

2
prism/src/userinterface/model/computation/ParseModelThread.java

@ -105,8 +105,8 @@ public class ParseModelThread extends GUIComputationThread
//If we get here, the parse has been successful, notify the interface and tell the handler.
SwingUtilities.invokeLater(new Runnable() { public void run() {
if(!background) plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
if(!background) plug.setTaskBarText("Parsing model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
handler.modelParsedSuccessful(mod);
}});
}

2
prism/src/userinterface/model/computation/SaveGraphicModelThread.java

@ -556,8 +556,8 @@ public class SaveGraphicModelThread extends Thread
public void run()
{
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Saving model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
handler.graphicFileWasSaved(f);
}
});

2
prism/src/userinterface/model/computation/SavePEPAModelThread.java

@ -89,8 +89,8 @@ public class SavePEPAModelThread extends Thread
//If we get here, the save has been successful, notify the interface and tell the handler.
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Saving model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
handler.pepaFileWasSaved(f);
}});
}

2
prism/src/userinterface/model/computation/SavePRISMModelThread.java

@ -88,8 +88,8 @@ public class SavePRISMModelThread extends Thread
//If we get here, the save has been successful, notify the interface and tell the handler.
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
plug.stopProgress();
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
plug.setTaskBarText("Saving model... done.");
plug.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, plug));
handler.prismFileWasSaved(f);
}});
}

100
prism/src/userinterface/properties/GUIMultiProperties.java

@ -29,26 +29,83 @@
package userinterface.properties;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import userinterface.*;
import userinterface.model.*;
import userinterface.properties.computation.*;
import userinterface.util.*;
import userinterface.simulator.*;
import userinterface.simulator.networking.*;
import prism.*;
import parser.*;
import parser.ast.*;
import parser.type.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.KeyStroke;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import parser.Values;
import parser.ast.Expression;
import parser.ast.ModulesFile;
import parser.ast.PropertiesFile;
import parser.ast.Property;
import parser.type.Type;
import parser.type.TypeDouble;
import parser.type.TypeInt;
import parser.type.TypeInterval;
import prism.Model;
import prism.ModelType;
import prism.PrismException;
import prism.PrismSettings;
import prism.PrismSettingsListener;
import prism.UndefinedConstants;
import userinterface.GUIClipboardEvent;
import userinterface.GUIConstantsPicker;
import userinterface.GUIPlugin;
import userinterface.GUIPrism;
import userinterface.GUISimulationPicker;
import userinterface.OptionsPanel;
import userinterface.SimulationInformation;
import userinterface.model.GUIModelEvent;
import userinterface.properties.computation.ExportResultsThread;
import userinterface.properties.computation.LoadPropertiesThread;
import userinterface.properties.computation.ModelCheckThread;
import userinterface.properties.computation.SimulateModelCheckThread;
import userinterface.simulator.GUISimulator;
import userinterface.simulator.networking.GUISimulatorDistributionDialog;
import userinterface.util.GUIComputationEvent;
import userinterface.util.GUIEvent;
import userinterface.util.GUIExitEvent;
import userinterface.util.GUIPrismFileFilter;
/**
* Properties tab of the PRISM GUI.
@ -949,6 +1006,9 @@ public class GUIMultiProperties extends GUIPlugin implements MouseListener, List
public void a_newExperiment()
{
// Reset warnings counter
getPrism().getMainLog().resetNumberOfWarnings();
// Start expt
experimentAfterReceiveParseNotification = true;
notifyEventListeners(new GUIPropertiesEvent(GUIPropertiesEvent.REQUEST_MODEL_PARSE));
}

2
prism/src/userinterface/properties/computation/ExportResultsThread.java

@ -125,8 +125,8 @@ public class ExportResultsThread extends Thread
public void run()
{
parent.stopProgress();
parent.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, parent));
parent.setTaskBarText("Exporting results... done.");
parent.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, parent));
}
});
}

2
prism/src/userinterface/properties/computation/LoadPropertiesThread.java

@ -99,8 +99,8 @@ public class LoadPropertiesThread extends Thread
//If we get here, the load has been successful, notify the interface and tell the handler.
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
parent.stopProgress();
parent.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, parent));
parent.setTaskBarText("Loading properties... done.");
parent.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, parent));
if(isInsert)
parent.propertyInsertSuccessful(props);
else

2
prism/src/userinterface/properties/computation/SavePropertiesThread.java

@ -83,8 +83,8 @@ public class SavePropertiesThread extends Thread
//Computation successful, notify the user interface
SwingUtilities.invokeAndWait(new Runnable() { public void run() {
parent.stopProgress();
parent.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, parent));
parent.setTaskBarText("Saving properties... done.");
parent.notifyEventListeners(new GUIComputationEvent(GUIComputationEvent.COMPUTATION_DONE, parent));
parent.propertySaveSuccessful(f);
}});
}

Loading…
Cancel
Save