Commit ea456fa2 authored by Alexander Weigl's avatar Alexander Weigl

renaming and extension to InspectionView

parent b98da27d
Pipeline #11260 passed with stage
in 2 minutes and 27 seconds
package edu.kit.formal.gui.controls;
import com.sun.javafx.scene.control.skin.TabPaneSkin;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.TabPane;
import javafx.scene.layout.Pane;
......@@ -11,30 +10,25 @@ import javafx.scene.layout.Pane;
* from https://stackoverflow.com/questions/35239420/display-label-if-tabpane-has-no-tabs
*/
public class CustomTabPaneSkin extends TabPaneSkin {
//private final VBox placeHolder;
//private final Label placeHolderText;
private final PlaceHolderTab placeHolder;
public CustomTabPaneSkin(TabPane tabPane) {
super(tabPane);
placeHolder = new PlaceHolderTab();
placeHolder.getVbox().minWidthProperty().bind(getSkinnable().widthProperty());
placeHolder.getVbox().minHeightProperty().bind(getSkinnable().heightProperty());
placeHolder.getVbox().setAlignment(Pos.CENTER);
placeHolder.prefWidthProperty().bind(getSkinnable().widthProperty());
placeHolder.prefHeightProperty().bind(getSkinnable().heightProperty());
for (Node node : getChildren()) {
if (node.getStyleClass().contains("tab-header-area")) {
Pane headerArea = (Pane) node;
// Header area is hidden if there is no tabs, thus when the tabpane is "empty"
headerArea.visibleProperty().addListener((observable, oldValue, newValue)
->
headerArea.visibleProperty().addListener((observable, oldValue, newValue) ->
{
if (newValue) {
getChildren().remove(placeHolder);
} else {
getChildren().add(placeHolder);
}
}
......
......@@ -2,44 +2,31 @@ package edu.kit.formal.gui.controls;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import edu.kit.formal.gui.controller.DebuggerMainWindowController;
import javafx.beans.binding.StringBinding;
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableStringValue;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Modality;
import javafx.util.Callback;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.controlsfx.control.StatusBar;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.Date;
import java.util.LinkedList;
import java.util.logging.LogRecord;
/**
* Created by weigl on 09.06.2017.
......
package edu.kit.formal.gui.controls;
import com.sun.org.apache.xpath.internal.operations.Mod;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import de.uka.ilkd.key.logic.op.IProgramMethod;
import de.uka.ilkd.key.pp.ProgramPrinter;
import edu.kit.formal.gui.model.InspectionModel;
......@@ -7,47 +10,80 @@ import edu.kit.formal.gui.model.RootModel;
import edu.kit.formal.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData;
import javafx.beans.Observable;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.SplitPane;
import javafx.scene.control.Tab;
import javafx.scene.input.MouseEvent;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Right part of the splitpane that displays the different parts of a state
*
* @author S. Grebing
*/
public class InspectionViewTab extends Tab implements Initializable {
public class InspectionViewTab extends Tab {
public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
@FXML
private SectionPane sectionPaneJavaCode;
@FXML
private SplitPane lowerSplitPane;
@FXML
private SequentView sequentView;
@FXML
private JavaArea javaSourceCode;
@FXML
private ListView goalView;
private ObjectProperty<Mode> mode = new SimpleObjectProperty<>();
private BooleanProperty showCode = new SimpleBooleanProperty(true);
public InspectionViewTab() {
super();
FXMLLoader loader = new FXMLLoader(getClass().getResource("InspectionView.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
Utils.createWithFXML(this);
getGoalView().getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null && newValue.getData() != null) {
getSequentView().setNode(newValue.getData().getNode());
}
});
getGoalView().setCellFactory(GoalNodeListCell::new);
mode.addListener(o -> {
getStyleClass().removeAll(
Mode.DEAD.name(),
Mode.LIVING.name(),
Mode.POSTMORTEM.name()
);
getStyleClass().add(mode.get().name());
if (mode.get() == Mode.LIVING) {
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.RUN);
setClosable(false);
setGraphic(icon);
} else {
setGraphic(null);
setClosable(true);
}
});
mode.set(Mode.POSTMORTEM);
showCode.addListener(o -> {
if (showCode.get())
lowerSplitPane.getItems().add(sectionPaneJavaCode);
else
lowerSplitPane.getItems().remove(sectionPaneJavaCode);
});
showCode.set(false);
}
public SequentView getSequentView() {
......@@ -72,7 +108,6 @@ public class InspectionViewTab extends Tab implements Initializable {
}
public void initialize(InspectionModel model) {
System.out.println("model");
}
......@@ -96,18 +131,32 @@ public class InspectionViewTab extends Tab implements Initializable {
}
public Mode getMode() {
return mode.get();
}
@Override
public void initialize(URL location, ResourceBundle resources) {
getGoalView().getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null && newValue.getData() != null) {
getSequentView().setNode(newValue.getData().getNode());
}
});
public void setMode(Mode mode) {
this.mode.set(mode);
}
getGoalView().setCellFactory(GoalNodeListCell::new);
public ObjectProperty<Mode> modeProperty() {
return mode;
}
public boolean isShowCode() {
return showCode.get();
}
public void setShowCode(boolean showCode) {
this.showCode.set(showCode);
}
public BooleanProperty showCodeProperty() {
return showCode;
}
enum Mode {
LIVING, DEAD, POSTMORTEM,
}
/**
......@@ -133,5 +182,4 @@ public class InspectionViewTab extends Tab implements Initializable {
setText(text);
}
}
}
......@@ -2,11 +2,8 @@ package edu.kit.formal.gui.controls;
import edu.kit.formal.gui.model.RootModel;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.TabPane;
import java.io.IOException;
/**
* TabPane on the right side of the GUI containing the inspection view as tabs
*/
......@@ -25,16 +22,7 @@ public class InspectionViewTabPane extends TabPane {
public InspectionViewTabPane() {
super();
FXMLLoader loader = new FXMLLoader(getClass().getResource("InspectionViewTabPane.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
Utils.createWithFXML(this);
}
......@@ -62,9 +50,6 @@ public class InspectionViewTabPane extends TabPane {
bindGoalNodesWithCurrentTab(model);
this.getTabs().add(tab);
}
public void bindGoalNodesWithCurrentTab(RootModel model) {
......@@ -78,7 +63,4 @@ public class InspectionViewTabPane extends TabPane {
});
}
}
package edu.kit.formal.gui.controls;
import javafx.geometry.Pos;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
/**
* Replacement for empty Tab with two buttons
*/
public class PlaceHolderTab extends FlowPane {
public class PlaceHolderTab extends BorderPane {
/**
* Button to open a new script
*/
private final Button newScript = new Button("New Script");
@FXML
private Button newScript;
/**
* Button to open a script
*/
private final Button openScript = new Button("Open Script");
private VBox vbox;
@FXML
private Button openScript;
/**
* Pane holding the buttons for an empty tab
*/
public PlaceHolderTab() {
vbox = new VBox();
newScript.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
openScript.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
newScript.setAlignment(Pos.CENTER);
openScript.setAlignment(Pos.CENTER);
vbox.getChildren().add(newScript);
vbox.getChildren().add(openScript);
vbox.setAlignment(Pos.CENTER);
this.getChildren().add(vbox);
}
Utils.createWithFXML(this);
public VBox getVbox() {
return vbox;
}
public Button getNewScript() {
......@@ -48,6 +39,4 @@ public class PlaceHolderTab extends FlowPane {
public Button getOpenScript() {
return openScript;
}
}
......@@ -6,26 +6,18 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.control.Tab;
import java.io.IOException;
import java.io.UTFDataFormatException;
/**
* Tab with a ScriptArea
*/
public class ScriptAreaTab extends Tab {
@FXML
private ScriptArea scriptArea;
public ScriptAreaTab(@NamedArg("text") String title) {
super(title);
FXMLLoader loader = new FXMLLoader(getClass().getResource("TabScriptArea.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
}
Utils.createWithFXML(this);
}
public ScriptArea getScriptArea() {
......
package edu.kit.formal.gui.controls;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXMLLoader;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Iterator;
/**
* Controller for TabPane
*
* @author Sarah Grebing
*/
public class ScriptTabPane extends TabPane {
private static Logger logger = LogManager.getLogger(ScriptTabPane.class);
/**
* String is filepath; if string already exists if new tab should be created nothing happens
* If wished for, instead of filepath an object with omre script information may be used
* If wished for, instead of filepath an object with more script information may be used
*/
private HashMap<String, ScriptAreaTab> mappingOfTabs = new HashMap();
private BiMap<String, ScriptAreaTab> mappingOfTabs = HashBiMap.create();
private SimpleObjectProperty<Tab> activeTab = new SimpleObjectProperty<>();
private StringProperty activeScriptPath = new SimpleStringProperty();
public ScriptTabPane() {
super();
FXMLLoader loader = new FXMLLoader(getClass().getResource("TabPaneScriptArea.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
Utils.createWithFXML(this);
activeTab.bind(this.getSelectionModel().selectedItemProperty());
activeTab.addListener(o -> {
activeScriptPath.set(mappingOfTabs.inverse().get(activeTab.get()));
});
}
/**
......@@ -52,7 +51,7 @@ public class ScriptTabPane extends TabPane {
this.getSelectionModel().select(mappingOfTabs.get(filePath));
} else {
System.out.println("File already exists. Will not load it again");
logger.info("File already exists. Will not load it again");
this.getSelectionModel().select(mappingOfTabs.get(filePath));
}
}
......@@ -76,7 +75,30 @@ public class ScriptTabPane extends TabPane {
public ScriptAreaTab getActiveScriptAreaTab() {
return (ScriptAreaTab) activeTab.get();
}
public Tab getActiveTab() {
return activeTab.get();
}
public SimpleObjectProperty<Tab> activeTabProperty() {
return activeTab;
}
public void setActiveTab(Tab activeTab) {
this.activeTab.set(activeTab);
}
public String getActiveScriptPath() {
return activeScriptPath.get();
}
public StringProperty activeScriptPathProperty() {
return activeScriptPath;
}
public void setActiveScriptPath(String activeScriptPath) {
this.activeScriptPath.set(activeScriptPath);
}
}
......@@ -6,46 +6,46 @@
<?import javafx.scene.control.*?>
<fx:root xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
type="edu.kit.formal.gui.controls.InspectionViewTab">
type="edu.kit.formal.gui.controls.InspectionViewTab" styleClass="inspection-view-tab">
<SplitPane orientation="VERTICAL" dividerPositions="0.25,0.75">
<items>
<SectionPane title="Current Goals">
<headerRight>
<Button onMouseClicked="#showGoalOptions">
<graphic>
<MaterialDesignIconView glyphName="WRENCH"/>
</graphic>
</Button>
</headerRight>
<center>
<ListView fx:id="goalView"/>
</center>
</SectionPane>
<SplitPane>
<padding>
<Insets top="5" left="5" right="5" bottom="5"/>
</padding>
<items>
<SectionPane title="Sequent">
<SectionPane title="Current Goals">
<headerRight>
<Button>
<Button onMouseClicked="#showGoalOptions">
<graphic>
<MaterialDesignIconView glyphName="WRENCH"/>
</graphic>
</Button>
</headerRight>
<center>
<SequentView fx:id="sequentView"/>
</center>
</SectionPane>
<SectionPane title="Source Code">
<center>
<JavaArea fx:id="javaSourceCode"/>
<ListView fx:id="goalView"/>
</center>
</SectionPane>
</items>
</SplitPane>
<SplitPane fx:id="lowerSplitPane">
<padding>
<Insets top="5" left="5" right="5" bottom="5"/>
</padding>
<items>
<SectionPane title="Sequent">
<headerRight>
<Button>
<graphic>
<MaterialDesignIconView glyphName="WRENCH"/>
</graphic>
</Button>
</headerRight>
<center>
<SequentView fx:id="sequentView"/>
</center>
</SectionPane>
<SectionPane title="Source Code" fx:id="sectionPaneJavaCode">
<center>
<JavaArea fx:id="javaSourceCode"/>
</center>
</SectionPane>
</items>
</SplitPane>
</items>
</SplitPane>
......
<?xml version="1.0" encoding="UTF-8"?>
<?import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<fx:root maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="250.0" styleClass="place-holder-tab" type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
<center>
<StackPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="250.0">
<children>
<VBox fillWidth="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="25.0" StackPane.alignment="CENTER">
<children>
<Label contentDisplay="CENTER" maxWidth="1.7976931348623157E308" text="Quick Start">
<font>
<Font size="18.0" />
</font>
</Label>
<Button contentDisplay="TOP" maxWidth="1.7976931348623157E308" text="Open Script...">
<graphic>
<MaterialDesignIconView glyphName="BOOK_OPEN_VARIANT" size="24" />
</graphic>
</Button>
<Button contentDisplay="TOP" maxWidth="1.7976931348623157E308" text="New Script">
<graphic>
<MaterialDesignIconView glyphName="NEW_BOX" size="24" />
</graphic>
</Button>
<Button contentDisplay="TOP" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Introduction">
<graphic>
<MaterialDesignIconView glyphName="HELP_CIRCLE" size="24" />
</graphic>
</Button>
</children>
<padding>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
</padding>
<StackPane.margin>
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
</StackPane.margin>
</VBox>
</children>
</StackPane>
</center>
</fx:root>
......@@ -80,16 +80,16 @@
-fx-underline: true;
}
.line-highlight-postmortem{
.line-highlight-postmortem {
-rtfx-background-color: @blue;
}
.line-unhighlight{
-fx-background-color: @base3;
.line-unhighlight {
-fx-background-color: @base3;
}
.line-highlight-mainScript{
-rtfx-background-color: @green;
.line-highlight-mainScript {
-rtfx-background-color: @green;
}
}
......@@ -235,3 +235,18 @@
.tab-pane {
-fx-skin: "edu.kit.formal.gui.controls.CustomTabPaneSkin";
}
/**********************************************************************************************************************/
.inspection-view-tab {
&.LIVING {
-fx-background-color: forestgreen;
}
&.DEAD {
-fx-background-color: darkgrey;
}
&.POSTMORTEM {
-fx-background-color: blueviolet;
}
}
\ No newline at end of file
Markdown is supported
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