package gui.mainFrame.testConditionViewer;
import common.Constants;
import gui.GUIController;
import gui.mainFrame.testConditionViewer.branchViewer.BranchGraphController;
import gui.mainFrame.testConditionViewer.branchTable.BranchTable;
import gui.mainFrame.testConditionViewer.branchTable.BranchTableModel;
import gui.mainFrame.testConditionViewer.methodInfoViewer.MethodInfoViewer;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import testGenerator.Controller;
/**
*
* @author William Whitney
*/
public class TestConditionViewer extends JPanel
{
private static final long serialVersionUID = 1L;
private final GUIController guiController;
private final Controller controller;
private JTabbedPane tabPane;
private BranchTableModel executionPathModel;
private MethodInfoViewer methodInfo;
private BranchTable branchTablePanel;
/**
* Default Constructor.
* @param controller
* @param guiController
*/
public TestConditionViewer(Controller controller, GUIController guiController)
{
this.controller = controller;
this.guiController = guiController;
//Setup panel
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//Build the view
buildView();
}
private void buildView()
{
//Add title
JLabel title = new JLabel("Method Condition Viewer");
title.setFont(Constants.getHeadingFont());
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
topPanel.setMaximumSize(new Dimension(1000, 50));
topPanel.add(title);
this.add(topPanel);
//Add method information
this.methodInfo = new MethodInfoViewer(controller);
this.add(methodInfo);
//Create tab pane
tabPane = new JTabbedPane();
//Add Execution paths tab
addExecutionPathEditor();
//Add tab pane
this.add(tabPane);
}
private void addExecutionPathEditor()
{
//Add Branch Path Tab
executionPathModel = new BranchTableModel(guiController, controller);
branchTablePanel = new BranchTable(controller, guiController, executionPathModel);
tabPane.addTab("Branch Test Editor", branchTablePanel);
//Add to panel
BranchGraphController bPathControl = guiController.getBasisPathController();
tabPane.addTab("Branch Graph Viewer",bPathControl.getJGraph());
}
public void updateView()
{
this.executionPathModel.fireTableStructureChanged();
this.methodInfo.refresh();
}
}