io.tapirtest.execution.gui.application.views.MainViewModel Maven / Gradle / Ivy
/**
* MIT License
*
* Copyright (c) 2018 b+m Informatik AG
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.tapirtest.execution.gui.application.views;
import com.google.common.collect.Iterables;
import de.bmiag.tapir.bootstrap.TapirBootstrapper;
import de.bmiag.tapir.execution.TapirExecutor;
import de.bmiag.tapir.execution.model.ExecutionPlan;
import de.bmiag.tapir.execution.model.Identifiable;
import de.bmiag.tapir.execution.model.TestClass;
import de.bmiag.tapir.execution.model.TestStep;
import de.bmiag.tapir.execution.model.TestSuite;
import de.saxsys.mvvmfx.ViewModel;
import de.saxsys.mvvmfx.utils.commands.Action;
import de.saxsys.mvvmfx.utils.commands.DelegateCommand;
import io.tapirtest.execution.gui.application.components.AbstractCheckBoxTreeItem;
import io.tapirtest.execution.gui.application.components.ExecutionPlanTreeItem;
import io.tapirtest.execution.gui.application.components.TestStepTreeItem;
import io.tapirtest.execution.gui.application.data.ExecutionStatus;
import io.tapirtest.execution.gui.application.data.Property;
import io.tapirtest.execution.gui.application.filter.GUIStepExecutionInvocationHandler;
import io.tapirtest.execution.gui.application.listener.GUIExecutionListener;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBoxTreeItem;
import javafx.scene.control.TreeItem;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ListExtensions;
import org.eclipse.xtext.xbase.lib.Pure;
import org.springframework.context.ConfigurableApplicationContext;
/**
* The view model of the main page.
*
* @author Nils Christian Ehmke
*
* @since 1.0.0
*/
@Accessors
@SuppressWarnings("all")
public class MainViewModel implements ViewModel {
private final static Logger logger = LogManager.getLogger(MainViewModel.class);
private final DelegateCommand reinitializeExecutionPlanCommand = this.createCommand(((Runnable) () -> {
this.performReinitializeExecutionPlan();
}));
private final DelegateCommand selectAllCommand = this.createCommand(((Runnable) () -> {
this.performSelectAll();
}));
private final DelegateCommand deselectAllCommand = this.createCommand(((Runnable) () -> {
this.performDeselectAll();
}));
private final DelegateCommand startTestsCommand = this.createCommand(((Runnable) () -> {
this.performStartTests();
}));
private final DelegateCommand addPropertyCommand = this.createCommand(((Runnable) () -> {
this.performAddProperty();
}));
private final DelegateCommand deletePropertyCommand = this.createCommand(((Runnable) () -> {
this.performDeleteProperty();
}));
private final SimpleObjectProperty