| 1 | package com.jsql.view.swing.panel.address; | |
| 2 | ||
| 3 | import com.jsql.util.I18nUtil; | |
| 4 | import com.jsql.util.LogLevelUtil; | |
| 5 | import com.jsql.view.swing.manager.util.StateButton; | |
| 6 | import com.jsql.view.swing.panel.PanelAddressBar; | |
| 7 | import com.jsql.view.swing.util.MediatorHelper; | |
| 8 | import org.apache.logging.log4j.LogManager; | |
| 9 | import org.apache.logging.log4j.Logger; | |
| 10 | ||
| 11 | import javax.swing.*; | |
| 12 | import java.awt.event.ActionEvent; | |
| 13 | import java.awt.event.ActionListener; | |
| 14 | ||
| 15 | public class ActionStart implements ActionListener { | |
| 16 | | |
| 17 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
| 18 | | |
| 19 | protected final PanelAddressBar panelAddressBar; | |
| 20 | | |
| 21 | public ActionStart(PanelAddressBar panelAddressBar) { | |
| 22 | this.panelAddressBar = panelAddressBar; | |
| 23 | } | |
| 24 | ||
| 25 | @Override | |
| 26 | public void actionPerformed(ActionEvent e) { | |
| 27 | // No injection running | |
| 28 |
1
1. actionPerformed : negated conditional → NO_COVERAGE |
if (this.panelAddressBar.getPanelTrailingAddress().getButtonStart().getState() == StateButton.STARTABLE) { |
| 29 |
1
1. actionPerformed : removed call to com/jsql/view/swing/panel/address/ActionStart::startInjection → NO_COVERAGE |
this.startInjection(); |
| 30 |
1
1. actionPerformed : negated conditional → NO_COVERAGE |
} else if (this.panelAddressBar.getPanelTrailingAddress().getButtonStart().getState() == StateButton.STOPPABLE) { |
| 31 |
1
1. actionPerformed : removed call to com/jsql/view/swing/panel/address/ActionStart::stopInjection → NO_COVERAGE |
this.stopInjection(); // Injection currently running, stop the process |
| 32 | } | |
| 33 | } | |
| 34 | | |
| 35 | protected void startInjection() { | |
| 36 | int option = JOptionPane.OK_OPTION; | |
| 37 |
1
1. startInjection : negated conditional → NO_COVERAGE |
if (MediatorHelper.model().shouldErasePreviousInjection()) { // Ask the user confirmation if injection already built |
| 38 | // Fix #93469: IllegalArgumentException on showConfirmDialog() | |
| 39 | // Fix #33930: ClassCastException on showConfirmDialog() | |
| 40 | // Implementation by sun.awt.image | |
| 41 | try { | |
| 42 | option = JOptionPane.showConfirmDialog( | |
| 43 | MediatorHelper.frame(), | |
| 44 | I18nUtil.valueByKey("DIALOG_NEW_INJECTION_TEXT"), | |
| 45 | I18nUtil.valueByKey("DIALOG_NEW_INJECTION_TITLE"), | |
| 46 | JOptionPane.OK_CANCEL_OPTION | |
| 47 | ); | |
| 48 | } catch (IllegalArgumentException | ClassCastException e) { | |
| 49 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e); | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 |
1
1. startInjection : negated conditional → NO_COVERAGE |
if (option == JOptionPane.OK_OPTION) { // Then start injection |
| 54 |
1
1. startInjection : removed call to com/jsql/view/swing/panel/address/ButtonStart::setToolTipText → NO_COVERAGE |
this.panelAddressBar.getPanelTrailingAddress().getButtonStart().setToolTipText(I18nUtil.valueByKey("BUTTON_STOP_TOOLTIP")); |
| 55 |
1
1. startInjection : removed call to com/jsql/view/swing/panel/address/ButtonStart::setInjectionRunning → NO_COVERAGE |
this.panelAddressBar.getPanelTrailingAddress().getButtonStart().setInjectionRunning(); |
| 56 |
1
1. startInjection : removed call to javax/swing/JComponent::setVisible → NO_COVERAGE |
this.panelAddressBar.getPanelTrailingAddress().getLoader().setVisible(true); |
| 57 | ||
| 58 |
1
1. startInjection : removed call to com/jsql/view/swing/JFrameView::resetInterface → NO_COVERAGE |
MediatorHelper.frame().resetInterface(); // Erase everything in the view from a previous injection |
| 59 | ||
| 60 |
1
1. startInjection : removed call to com/jsql/util/ParameterUtil::controlInput → NO_COVERAGE |
MediatorHelper.model().getMediatorUtils().getParameterUtil().controlInput( |
| 61 | this.panelAddressBar.getTextFieldAddress().getText().trim(), | |
| 62 | this.panelAddressBar.getTextFieldRequest().getText().trim(), | |
| 63 | this.panelAddressBar.getTextFieldHeader().getText().trim(), | |
| 64 | this.panelAddressBar.getMethodInjection(), | |
| 65 | this.panelAddressBar.getTypeRequest(), | |
| 66 | false | |
| 67 | ); | |
| 68 | } | |
| 69 | } | |
| 70 | | |
| 71 | private void stopInjection() { | |
| 72 |
1
1. stopInjection : removed call to javax/swing/JComponent::setVisible → NO_COVERAGE |
this.panelAddressBar.getPanelTrailingAddress().getLoader().setVisible(false); |
| 73 |
1
1. stopInjection : removed call to com/jsql/view/swing/panel/address/ButtonStart::setInjectionStopping → NO_COVERAGE |
this.panelAddressBar.getPanelTrailingAddress().getButtonStart().setInjectionStopping(); |
| 74 |
1
1. stopInjection : removed call to com/jsql/model/InjectionModel::setIsStoppedByUser → NO_COVERAGE |
MediatorHelper.model().setIsStoppedByUser(true); |
| 75 | } | |
| 76 | } | |
Mutations | ||
| 28 |
1.1 |
|
| 29 |
1.1 |
|
| 30 |
1.1 |
|
| 31 |
1.1 |
|
| 37 |
1.1 |
|
| 53 |
1.1 |
|
| 54 |
1.1 |
|
| 55 |
1.1 |
|
| 56 |
1.1 |
|
| 58 |
1.1 |
|
| 60 |
1.1 |
|
| 72 |
1.1 |
|
| 73 |
1.1 |
|
| 74 |
1.1 |