/*
* SalomeTMF is a Test Management Framework
* Copyright (C) 2005 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @author Fayal SOUGRATI, Vincent Pautret, Marche Mikael
*
* Contact: mikael.marche@rd.francetelecom.com
*/
package org.objectweb.salome_tmf.ihm;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextPane;
import javax.swing.ListSelectionModel;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.objectweb.salome_tmf.api.ApiConstants;
import org.objectweb.salome_tmf.data.Action;
import org.objectweb.salome_tmf.data.DataConstants;
import org.objectweb.salome_tmf.data.Execution;
import org.objectweb.salome_tmf.data.ExecutionResult;
import org.objectweb.salome_tmf.data.ManualTest;
import org.objectweb.salome_tmf.ihm.datawrapper.DataModel;
import org.objectweb.salome_tmf.ihm.languages.Language;
import org.objectweb.salome_tmf.ihm.models.MyTableModel;
import org.objectweb.salome_tmf.ihm.plugins.PluginsTools;
import org.objectweb.salome_tmf.ihm.tools.Tools;
/**
* Classe qui cr?e la fen?tre tracant l'?x?cution d'un test
* @author teaml039
* @version : 0.1
*/
public class ManualExecution extends JDialog implements ApiConstants, DataConstants, IHMConstants, Runnable {
/**
* Bouton pour indiquer que l'action a r?ussi
*/
JButton statusOkButton;
/**
* Bouton pour indiquer que l'action a ?chou?
*/
JButton statusFailedButton;
/**
* Bouton pour indiquer que l'on ne conna?t pas le r?sultat de l'action
*/
JButton statusUnknowButton;
/**
* Bouton pour revenir au test pr?c?dent
*/
JButton prevTestButton;
/**
* Bouton pour passer au test suivant
*/
JButton nextTestButton;
/**
* Bouton pour interrompre l'ex?cution
*/
JButton stopButton;
/**
* Bouton pour sortir de la fen?tre
*/
JButton endButton;
/**
* Mod?le de donn?es pour la table des actions
*/
MyTableModel actionsTableModel;
/**
* Table des actions
*/
JTable actionsTable;
/**
* Description de l'action courante
*/
JTextPane actionDescription;
/**
* R?sultat attendu de l'action courante
*/
JTextPane awaitedResult;
/**
* R?sultat effectif de l'action courante
*/
JTextPane effectiveResult;
/**
* Liste des tests ? ex?cuter
*/
ArrayList testsToBeExecuted;
/**
* Nom du test courant
*/
JLabel testName;
/**
* Description du test courant
*/
JTextPane testDescription;
/**
* Conteneur pour l'affichage
*/
Container contentPaneFrame;
/**
* Le test en cours d'ex?cution
*/
ManualTest testInExecution;
/**
* Indice du test en cours d'ex?cution
*/
int indexOfTextInExecution;
/**
* R?sultat de l'?x?cution
*/
ExecutionResult execResult;
/**
* Nom du r?sultat d'ex?cution courant
*/
String currentExecutionResultName;
/**
* Indexe de bloquage dans la table des actions (pour emp?cher la s?lection)
*/
int blockIndex;
/**
* Mod?le de s?lection pour la table des actions
*/
ListSelectionModel rowSM;
/**
* Execution courante
*/
Execution currentExecution;
HashMap oldMap;
Thread t;
//ExecutionView execView;
//JButton addBugButton;
boolean finished = false;
boolean stop_exec = false;
/******************************************************************************/
/** CONSTRUCTEUR ***/
/******************************************************************************/
//ExecutionResult finalExecResult;
/**
* Constructeur de la fen?tre
* @param testList liste de tests ? ex?cuter
*/
public ManualExecution(ArrayList testList, Execution execution, ExecutionResult executionResult) {
super(SalomeTMF.ptrFrame,true);
//this.finalExecResult = finalExecResult;
finished = false;
blockIndex = 0;
oldMap = new HashMap();
statusOkButton = new JButton(Language.getInstance().getText("Succs"));
statusFailedButton = new JButton(Language.getInstance().getText("Echec"));
statusUnknowButton = new JButton(Language.getInstance().getText("Inconclusif"));
prevTestButton = new JButton(Language.getInstance().getText("Test_prcdent"));
nextTestButton = new JButton(Language.getInstance().getText("Test_suivant"));
stopButton = new JButton(Language.getInstance().getText("Stop"));
endButton = new JButton(Language.getInstance().getText("Terminer"));
actionsTableModel = new MyTableModel();
actionsTable = new JTable();
actionDescription = new JTextPane();
awaitedResult = new JTextPane();
effectiveResult = new JTextPane();
testsToBeExecuted = new ArrayList();
testName = new JLabel();
testDescription = new JTextPane();
// Mapping entre objets graphiques et constantes
SalomeTMF.addToUIComponentsMap(UICompCst.MANUAL_EXECUTION_TEST_DESCRIPTION_TEXTPANE,testDescription);
SalomeTMF.addToUIComponentsMap(UICompCst.MANUAL_EXECUTION_ACTION_DESCRIPTION_TEXTPANE,actionDescription);
SalomeTMF.addToUIComponentsMap(UICompCst.MANUAL_EXECUTION_ACTION_WAITED_RESULT_TEXTPANE,awaitedResult);
SalomeTMF.addToUIComponentsMap(UICompCst.MANUAL_EXECUTION_ACTION_EFFECTIVE_RESULT_TEXTPANE,effectiveResult);
// Activation des plugins associ?s
PluginsTools.activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_TEST_DESCRIPTION_TEXTPANE);
PluginsTools.activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTION_DESCRIPTION_TEXTPANE);
PluginsTools.activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTION_WAITED_RESULT_TEXTPANE);
PluginsTools.activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTION_EFFECTIVE_RESULT_TEXTPANE);
contentPaneFrame = this.getContentPane();
//execView = executionView;
statusOkButton.setToolTipText(Language.getInstance().getText("L'action_a_russie"));
statusOkButton.setIcon(Tools.createAppletImageIcon(PATH_TO_SUCCESS_ICON,""));
statusOkButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int selectedRowIndex = actionsTable.getSelectedRow();
if (selectedRowIndex != -1) {
actionsTableModel.setValueAt(Tools.createAppletImageIcon(PATH_TO_SUCCESS_ICON,""), selectedRowIndex, actionsTableModel.getColumnCount() - 1);
execResult.addStatusForAction(testInExecution.getAction((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), SUCCESS);
if (selectedRowIndex < (actionsTableModel.getRowCount() - 1)) {
blockIndexCalculation(selectedRowIndex);
ListSelectionModel lsm = actionsTable.getSelectionModel();
lsm.setSelectionInterval(selectedRowIndex+1, selectedRowIndex+1);
} else {
blockIndexCalculation(0);
changeTest();
}
}
}
});
statusFailedButton.setToolTipText(Language.getInstance().getText("L'action_a_choue"));
statusFailedButton.setIcon(Tools.createAppletImageIcon(PATH_TO_FAIL_ICON,""));
statusFailedButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int selectedRowIndex = actionsTable.getSelectedRow();
if (selectedRowIndex != -1) {
execResult.addStatusForAction(testInExecution.getAction((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), FAIL);
actionsTableModel.setValueAt(Tools.createAppletImageIcon(PATH_TO_FAIL_ICON,""), selectedRowIndex, actionsTableModel.getColumnCount() - 1);
if (selectedRowIndex < (actionsTableModel.getRowCount() - 1)) {
//blockIndex = selectedRowIndex + 1;
blockIndexCalculation(selectedRowIndex);
} else {
//blockIndex = 0;
blockIndexCalculation(0);
}
}
}
});
statusUnknowButton.setToolTipText(Language.getInstance().getText("Pas_de_rsultat_pour_cette_action"));
statusUnknowButton.setIcon(Tools.createAppletImageIcon(PATH_TO_UNKNOW_ICON, ""));
statusUnknowButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int selectedRowIndex = actionsTable.getSelectedRow();
if (selectedRowIndex != -1) {
execResult.addStatusForAction(testInExecution.getAction((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), UNKNOWN);
actionsTableModel.setValueAt(Tools.createAppletImageIcon(PATH_TO_UNKNOW_ICON,""), selectedRowIndex, actionsTableModel.getColumnCount() - 1);
if (selectedRowIndex < (actionsTableModel.getRowCount() - 1)) {
//blockIndex = selectedRowIndex + 1;
blockIndexCalculation(selectedRowIndex);
} else {
//blockIndex = 0;
blockIndexCalculation(0);
}
}
}
});
prevTestButton.setToolTipText(Language.getInstance().getText("Revenir_au_test_prcdent"));
prevTestButton.setEnabled(false);
prevTestButton.setIcon(Tools.createAppletImageIcon(PATH_TO_ARROW_BACK_ICON,""));
prevTestButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
changeTestBack();
blockIndexCalculation(0);
}
});
nextTestButton.setToolTipText(Language.getInstance().getText("Passer_au_test_suivant"));
nextTestButton.setIcon(Tools.createAppletImageIcon(PATH_TO_ARROW_ICON,""));
nextTestButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
changeTest();
blockIndexCalculation(0);
}
});
if (testList.size() < 2) {
nextTestButton.setEnabled(false);
}
stopButton.setToolTipText(Language.getInstance().getText("Interrompre_l'excution"));
stopButton.setIcon(Tools.createAppletImageIcon(PATH_TO_STOP_ICON,""));
stopButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
testStatusCalculation();
stop_exec = true;
execResult.setExecutionStatus(INTERRUPT);
//execView.libere();
finished = true;
ManualExecution.this.dispose();
}
});
endButton.setToolTipText(Language.getInstance().getText("Sortir_de_l'excution"));
endButton.setIcon(Tools.createAppletImageIcon(PATH_TO_MOVE_ICON,""));
endButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
testStatusCalculation();
finished = true;
ManualExecution.this.dispose();
}
});
JButton attachButton = new JButton(Language.getInstance().getText("Attachements"));
attachButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new AttachmentViewWindow(SalomeTMF.ptrSalomeTMF, EXECUTION_RESULT_TEST, DataModel.getCurrentExecutionTestResult(), null, null, null);
}
});
// Details sur le test
testDescription.setEditable(false);
JScrollPane testDescriptionScrollPane = new JScrollPane(testDescription);
testDescriptionScrollPane.setPreferredSize(new Dimension(150,150));
testDescriptionScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Description_du_test")));
// Table d'actions
actionsTableModel.addColumnNameAndColumn(Language.getInstance().getText("Action"));
actionsTableModel.addColumnNameAndColumn(Language.getInstance().getText("Attachement"));
actionsTableModel.addColumnNameAndColumn(Language.getInstance().getText("Date"));
actionsTableModel.addColumnNameAndColumn(Language.getInstance().getText("Statut"));
/*TableSorter sorter = new TableSorter(actionsTableModel);
actionsTable.setModel(sorter);
sorter.setTableHeader(actionsTable.getTableHeader()); */
actionsTable.setModel(actionsTableModel);
actionsTable.setPreferredScrollableViewportSize(new Dimension(700, 200));
actionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
rowSM = actionsTable.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
int selectedRowIndex = actionsTable.getSelectedRow();
if (selectedRowIndex != -1 && actionsTableModel.getRowCount() > 0) {
if (blockIndex != -1 && selectedRowIndex > blockIndex) {
selectedRowIndex = blockIndex;
rowSM.setSelectionInterval(selectedRowIndex, selectedRowIndex);
}
ArrayList dataList = actionsTableModel.getData(selectedRowIndex);
Action action = testInExecution.getAction((String)dataList.get(0));
actionDescription.setText(Tools.getInstantiedDescription(action.getDescription(), currentExecution.getDataSet()));
actionDescription.getCaret().setDot(0);
awaitedResult.setText(Tools.getInstantiedDescription(action.getAwaitedResult(), currentExecution.getDataSet()));
awaitedResult.getCaret().setDot(0);
effectiveResult.setText(execResult.getEffectivResult(action));
effectiveResult.getCaret().setDot(0);
}
}
});
// Mapping entre objets graphiques et constantes
SalomeTMF.addToUIComponentsMap(UICompCst.MANUAL_EXECUTION_ACTIONS_TABLE,actionsTable);
// Activation des plugins associs
PluginsTools.activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTIONS_TABLE);
JScrollPane actionsTableScrollPane = new JScrollPane(actionsTable);
// Details sur les actions
actionDescription.setEditable(false);
JScrollPane actionDescriptionScrollPane = new JScrollPane(actionDescription);
actionDescriptionScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Description_de_l'action")));
actionDescriptionScrollPane.setPreferredSize(new Dimension(400,180));
awaitedResult.setEditable(false);
JScrollPane awaitedResultScrollPane = new JScrollPane(awaitedResult);
awaitedResultScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Rsultat_attendu")));
awaitedResultScrollPane.setPreferredSize(new Dimension(200,180));
effectiveResult.addCaretListener(new EffectivResultListener());
JScrollPane effectiveResultScrollPane = new JScrollPane(effectiveResult);
effectiveResultScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),Language.getInstance().getText("Rsultat_effectif")));
effectiveResultScrollPane.setPreferredSize(new Dimension(200,180));
// Construction de la fen?tre
//JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel buttonsPanel = new JPanel(new GridLayout(1,10));
buttonsPanel.add(statusOkButton);
buttonsPanel.add(statusFailedButton);
buttonsPanel.add(statusUnknowButton);
buttonsPanel.add(Box.createRigidArea(new Dimension(50,1)));
buttonsPanel.add(prevTestButton);
buttonsPanel.add(nextTestButton);
buttonsPanel.add(stopButton);
buttonsPanel.add(endButton);
buttonsPanel.add(Box.createRigidArea(new Dimension(50,1)));
buttonsPanel.add(attachButton);
//buttonsPanel.add(addBugButton);
// Mapping entre objets graphiques et constantes
SalomeTMF.addToUIComponentsMap(UICompCst.MANUAL_EXECUTION_BUTTONS_PANEL,buttonsPanel);
// Activation des plugins associ?es
PluginsTools.activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_BUTTONS_PANEL);
JPanel testDetailsPanel = new JPanel();
testDetailsPanel.setLayout(new BoxLayout(testDetailsPanel, BoxLayout.Y_AXIS));
testDetailsPanel.add(testName);
testDetailsPanel.add(Box.createRigidArea(new Dimension(1,10)));
testDetailsPanel.add(testDescriptionScrollPane);
JPanel actionsResults = new JPanel();
actionsResults.setLayout(new BoxLayout(actionsResults, BoxLayout.X_AXIS));
actionsResults.add(awaitedResultScrollPane);
actionsResults.add(effectiveResultScrollPane);
JPanel actionsDetailsPanel = new JPanel(new BorderLayout());
actionsDetailsPanel.add(actionDescriptionScrollPane, BorderLayout.NORTH);
actionsDetailsPanel.add(actionsResults, BorderLayout.SOUTH);
contentPaneFrame.add(actionsTableScrollPane, BorderLayout.CENTER);
contentPaneFrame.add(actionsDetailsPanel, BorderLayout.SOUTH);
contentPaneFrame.add(buttonsPanel, BorderLayout.NORTH);
contentPaneFrame.add(testDetailsPanel, BorderLayout.EAST);
initData(testList, execution, executionResult);
if (actionsTableModel.getRowCount() > 0) {
rowSM.setSelectionInterval(0,0);
}
this.addWindowListener(new WindowListener() {
public void windowClosing(WindowEvent e) {
testStatusCalculation();
//execView.libere();
//execResult.setExecutionStatus(INTERRUPT);
stop_exec = true;
finished = true;
}
public void windowDeiconified(WindowEvent e) {
}
public void windowOpened(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
});
this.setLocation(0,80);
this.setTitle(Language.getInstance().getText("Execution_d'un_test_manuel_(exc._en_cours_:_") + execution.getName() + ")");
this.pack();
} // Fin du constructeur ManualExecution/0
/**
* M?thode qui initialise l'ex?cution avec la liste des tests pass?e en
* param?tre
* @param list une liste de tests
*/
public void initData(ArrayList list, Execution execution, ExecutionResult executionResult) {
execResult = executionResult;
currentExecution = execution;
if (list != null && list.size() > 0) {
testsToBeExecuted = list;
indexOfTextInExecution = 0;
blockIndex = 0;
testInExecution = (ManualTest)testsToBeExecuted.get(0);
DataModel.setCurrentExecutionTestResult(execResult.getExecutionTestResult(testInExecution));
testName.setText(Language.getInstance().getText("Nom_du_test_:_") + testInExecution.getName());
testDescription.setText(testInExecution.getDescription());
for (int i = 0; i < testInExecution.getActionList().size(); i++) {
Action action = (Action)testInExecution.getActionList().get(i);
ArrayList actionData = new ArrayList();
actionData.add(action.getName());
actionData.add(action.getAttachmentMap().keySet());
actionData.add(GregorianCalendar.getInstance().getTime().toString());
actionData.add(Tools.getActionStatusIcon(execResult.getActionStatus(action)));
if (execResult.getActionStatus(action) != null && !execResult.getActionStatus(action).equals("")) {
blockIndex = blockIndex + 1;
}
actionsTableModel.addRow(actionData);
}
for (int i = 0; i < list.size(); i++) {
ManualTest test = (ManualTest)list.get(i);
for (int j = 0; j < test.getActionList().size(); j++) {
Action action = (Action)test.getActionList().get(j);
execResult.addDescriptionResult(action, Tools.getInstantiedDescription(action.getDescription(), currentExecution.getDataSet()));
execResult.addAwaitedResult(action, Tools.getInstantiedDescription(action.getAwaitedResult(), currentExecution.getDataSet()));
}
}
}
} // Fin de la m?thode initData/1
/**
* M?thode qui permet de passer au test suivant.
*/
public void changeTest() {
if (testsToBeExecuted.size() > 1) {
prevTestButton.setEnabled(true);
}
if ((indexOfTextInExecution + 1) == (testsToBeExecuted.size() - 1)) {
nextTestButton.setEnabled(false);
}
testStatusCalculation();
if ((indexOfTextInExecution + 1) < testsToBeExecuted.size()) {
indexOfTextInExecution++;
testInExecution = (ManualTest)testsToBeExecuted.get(indexOfTextInExecution);
DataModel.setCurrentExecutionTestResult(execResult.getExecutionTestResult(testInExecution));
testName.setText(Language.getInstance().getText("Nom_du_test_:_") + testInExecution.getName());
testDescription.setText(testInExecution.getDescription());
actionsTableModel.clearTable();
for (int i = 0; i < testInExecution.getActionList().size(); i++) {
Action action = (Action)testInExecution.getActionList().get(i);
ArrayList actionData = new ArrayList();
actionData.add(action.getName());
actionData.add(action.getAttachmentMap().keySet());
actionData.add(GregorianCalendar.getInstance().getTime().toString());
//putIconStatusInTable(actionData, action.getStatus(currentExecutionResultName), i);
putIconStatusInTable(actionData, execResult.getActionStatus(action), i);
actionsTableModel.addRow(actionData);
}
ListSelectionModel lsm = actionsTable.getSelectionModel();
lsm.setSelectionInterval(0, 0);
} else if ((indexOfTextInExecution + 1) == testsToBeExecuted.size()){
}
} // Fin de la m?thode changeTest/0
/**
* M?thode qui permet de passer au test pr?c?dant.
*/
public void changeTestBack() {
if (testsToBeExecuted.size() > 1) {
nextTestButton.setEnabled(true);
}
if ((indexOfTextInExecution - 1) == 0) {
prevTestButton.setEnabled(false);
}
testStatusCalculation();
if ((indexOfTextInExecution - 1) > -1) {
indexOfTextInExecution--;
testInExecution = (ManualTest)testsToBeExecuted.get(indexOfTextInExecution);
DataModel.setCurrentExecutionTestResult(execResult.getExecutionTestResult(testInExecution));
testName.setText(Language.getInstance().getText("Nom_du_test_:_") + testInExecution.getName());
testDescription.setText(testInExecution.getDescription());
actionsTableModel.clearTable();
for (int i = 0; i < testInExecution.getActionList().size(); i++) {
Action action = (Action)testInExecution.getActionList().get(i);
ArrayList actionData = new ArrayList();
actionData.add(action.getName());
actionData.add(action.getAttachmentMap().keySet());
actionData.add(GregorianCalendar.getInstance().getTime().toString());
//putIconStatusInTable(actionData, action.getStatus(currentExecutionResultName), i);
putIconStatusInTable(actionData, execResult.getActionStatus(action), i);
actionsTableModel.addRow(actionData);
}
ListSelectionModel lsm = actionsTable.getSelectionModel();
lsm.setSelectionInterval(0, 0);
}
} // Fin de la m?thode changeTestBack/0
/**
* M?thode qui retourne le r?sultat de l'ex?cution
* @return le r?sultat de l'ex?cution
*/
public ExecutionResult getExecutionResult() {
return execResult;
} // Fin de la m?thode getExecutionResult/0
/**
*
* @param data
* @param type
* @param index
*/
public void putIconStatusInTable(ArrayList data, String type, int index) {
ImageIcon icon = getActionStatusIcon(type, index);
if (icon != null) {
data.add(icon);
} else {
data.add("");
}
} // Fin de la m?thode putIconStatusInTable/2
/**
* Retourne l'icone associ?e au type pass? au param?tre. On retourne <code>null</code>
* si le type n'est pas SUCCESS, FAIL ou UNKNOW.
* @param type
* @param index
* @return
*/
public ImageIcon getActionStatusIcon(String type, int index) {
if (type.equals(SUCCESS)) {
} else if (type.equals(FAIL)) {
blockIndex = index;
} else if (type.equals(UNKNOWN)) {
blockIndex = index;
}
return Tools.getActionStatusIcon(type);
} // Fin de la m?thode getActionStatusIcon/1
/**
*
*
*/
public void testStatusCalculation() {
int successAction = 0;
ArrayList actionList = testInExecution.getActionList();
for (int i = 0; i < actionList.size(); i++) {
if (execResult.getActionStatus(((Action)actionList.get(i))).equals(FAIL)) {
execResult.addTestResultStatus(testInExecution, FAIL);
return;
} else if (execResult.getActionStatus(((Action)actionList.get(i))).equals(UNKNOWN)) {
execResult.addTestResultStatus(testInExecution, UNKNOWN);
return;
} else if (execResult.getActionStatus(((Action)actionList.get(i))).equals(SUCCESS)) {
successAction++;
}
}
if (successAction == actionList.size()) {
execResult.addTestResultStatus(testInExecution, SUCCESS);
return;
}
execResult.addTestResultStatus(testInExecution, "");
} // Fin de la m?thode testStatusCalculation/0
/**
* Calcule l'index de bloquage de la s?lection.
*/
private void blockIndexCalculation(int selectedRowIndex) {
ArrayList actionList = testInExecution.getActionList();
blockIndex = selectedRowIndex + 1;
while (blockIndex < actionList.size() && !execResult.getActionStatus(((Action)actionList.get(blockIndex))).equals("")) {
blockIndex++;
}
} // Fin de la m?thode blockIndexCalculation/0
/**
* Retourne la liste des attachements ? supprimer
* @return
*/
public HashMap getOldAttachMap() {
return oldMap;
} // Fin de la m?thode getOldAttachMap/0
/**
*
* @author teaml039
*/
public class EffectivResultListener implements CaretListener {
/* (non-Javadoc)
* @see javax.swing.event.CaretListener#caretUpdate(javax.swing.event.CaretEvent)
*/
public void caretUpdate(CaretEvent e) {
int selectedRowIndex = actionsTable.getSelectedRow();
if (selectedRowIndex != -1) {
execResult.addEffectivResult(testInExecution.getAction((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), ((JTextPane)e.getSource()).getText());
}
}
} // Fin de la classe EffectivResultListener
public void lauchManualExecution() {
t = new Thread(this);
stop_exec = false;
t.start();
}
public void run() {
this.setVisible(true);
}
public boolean isStoped() {
return stop_exec;
}
public boolean isFinished() {
return finished;
}
public void setFinished(boolean b) {
finished = b;
}
} // Fin de la classe ManualExecution
|