Commit 37d65b22 authored by LotfiMed's avatar LotfiMed
Browse files

adding rare-event button and actions

parent 6afca9db
......@@ -40,6 +40,7 @@ public class ToolBar extends JToolBar{
private JButton simbutton = new JButton(new ImageIcon("./Icons8/icons8-Circled Play_2.png"));
private JButton runbutton = new JButton(new ImageIcon("./Icons8/icons8-Run Command.png"));
private JButton graphbutton = new JButton(new ImageIcon("./Icons8/icons8-Positive Dynamic.png"));
private JButton rareEventbutton = new JButton(new ImageIcon("./Icons8/icons8-active-directory.png"));
private JButton fitbutton = new JButton(new ImageIcon("./Icons8/icons8-Fit to Width.png"));
private JButton configbutton = new JButton(new ImageIcon("./Icons8/icons8-Settings.png"));
private JButton helpbutton = new JButton(new ImageIcon("./Icons8/icons8-Help.png"));
......@@ -553,7 +554,44 @@ public class ToolBar extends JToolBar{
}
});
this.add(graphbutton);
rareEventbutton.setToolTipText("Run rare events analysis");
rareEventbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(!tabbedPane.getSelectedProject().equals("")){
if(tabbedPane.hasSelectedModel() == 0){
gui.launchPanelRareEvent();
}
else{
if(tabbedPane.hasSelectedModel() == -1)
JOptionPane.showMessageDialog(null, "Cannot start rare events analysis : select a model first!");
}
}else
JOptionPane.showMessageDialog(null, "Operation failed : please select a project first!");
}
});
this.add(rareEventbutton);
this.addSeparator();
fitbutton.setToolTipText("Adjust text size to width");
fitbutton.addActionListener(new ActionListener() {
......
......@@ -30,6 +30,7 @@ import javax.swing.JViewport;
import ujf.verimag.sbip.gui.tabs.PanelEditor;
import ujf.verimag.sbip.gui.tabs.PanelParametricSMC;
import ujf.verimag.sbip.gui.tabs.PanelRareEvent;
import ujf.verimag.sbip.gui.tabs.PanelSMC;
import ujf.verimag.sbip.gui.tabs.PanelSimulation;
import ujf.verimag.sbip.parser.formula.LtlFormula;
......@@ -521,4 +522,40 @@ private void initializeToolBar() {
public void setFormula(LtlFormula form, String project) {
tabbedPane.setFormula(form, project);
}
protected void launchPanelRareEvent() {
boolean isOpen = false;
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
if(tabbedPane.getComponentAt(i) instanceof JScrollPane){
JViewport vp = (JViewport)((JScrollPane) tabbedPane.getComponentAt(i)).getComponent(0);
// System.out.println(vp);
for (int j = 0; j < vp.getComponentCount(); j++) {
// System.out.println("\t"+vp.getComponent(j));
if(vp.getComponent(j) instanceof PanelRareEvent)
{
tabbedPane.setSelectedIndex(i);
isOpen = true;
}
}
}
}
if(!isOpen){
PanelRareEvent panRareEvent;
try {
panRareEvent = new PanelRareEvent(tabbedPane);
tabbedPane.addCloseablePanel(new JScrollPane(panRareEvent), " Importance splitting setting " , false);
tabbedPane.resizeText();
tabbedPane.setSelectedIndex(tabbedPane.getTabCount()-1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// tabbedPane.addTab(" SMC setting ", new JScrollPane(panSMC));
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment