Commit 2ce23e4b authored by Sarah Grebing's avatar Sarah Grebing

Empty TabPane (not final yet)

parent 311f08d3
Pipeline #11029 failed with stage
in 2 minutes and 26 seconds
......@@ -4,10 +4,7 @@ import de.uka.ilkd.key.logic.op.IProgramMethod;
import de.uka.ilkd.key.pp.ProgramPrinter;
import de.uka.ilkd.key.proof.init.ProofInputException;
import de.uka.ilkd.key.speclang.Contract;
import edu.kit.formal.gui.controls.GoalOptionsMenu;
import edu.kit.formal.gui.controls.JavaArea;
import edu.kit.formal.gui.controls.ScriptArea;
import edu.kit.formal.gui.controls.SequentView;
import edu.kit.formal.gui.controls.*;
import edu.kit.formal.gui.model.RootModel;
import edu.kit.formal.interpreter.Interpreter;
import edu.kit.formal.interpreter.InterpreterBuilder;
......@@ -211,7 +208,7 @@ public class DebuggerMainWindowController implements Initializable {
});
goalView.setCellFactory(GoalNodeListCell::new);
CustomTabPaneSkin skin = new CustomTabPaneSkin(tabPane);
startTab.textProperty().bind(new StringBinding() {
{
super.bind(model.scriptFileProperty());
......
package edu.kit.formal.gui.controls;
import com.sun.javafx.scene.control.skin.TabPaneSkin;
import javafx.scene.Node;
import javafx.scene.control.TabPane;
import javafx.scene.layout.Pane;
/**
* A way to display a custom tab when tab pane is empty
* 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();
//placeHolderText = new Label( "Empty" );
//placeHolderText.setFont( Font.font( null, FontWeight.BOLD, 20 ) );
//placeHolderText.setAlignment( Pos.CENTER );
//placeHolderText.minWidthProperty().bind( getSkinnable().widthProperty() );
//placeHolderText.minHeightProperty().bind( getSkinnable().heightProperty() );
//placeHolder = new VBox( placeHolderText );
placeHolder.minWidthProperty().bind(getSkinnable().widthProperty());
placeHolder.minHeightProperty().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)
->
{
if (newValue) {
getChildren().remove(placeHolder);
} else {
getChildren().add(placeHolder);
}
}
);
break;
}
}
}
public PlaceHolderTab getPlaceHolder() {
return placeHolder;
}
}
package edu.kit.formal.gui.controls;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
/**
* Replacement for empty Tab with two buttons
*/
public class PlaceHolderTab extends VBox {
private final Button newScript = new Button("New Script");
private final Button openScript = new Button("Open Script");
public PlaceHolderTab() {
this.setPadding(new Insets(10, 50, 50, 50));
this.setSpacing(10);
this.getChildren().add(newScript);
this.getChildren().add(openScript);
}
public Button getNewScript() {
return newScript;
}
public Button getOpenScript() {
return openScript;
}
}
package edu.kit.formal.gui.controls;
import javafx.fxml.FXMLLoader;
import javafx.scene.layout.VBox;
import java.io.IOException;
/**
* Created by sarah on 6/8/17.
*/
public class TabPaneScriptArea extends VBox {
public TabPaneScriptArea() {
super();
FXMLLoader loader = new FXMLLoader(getClass().getResource("SectionPane.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -97,7 +97,7 @@
</Button>
</items>
</ToolBar>
<TabPane fx:id="tabPane" side="left"
<TabPane fx:id="tabPane" side="left" styleClass="tab-pane"
tabClosingPolicy="SELECTED_TAB" VBox.vgrow="ALWAYS">
<tabs>
<Tab fx:id="startTab" text="Untitled">
......
<?xml version="1.0" encoding="UTF-8"?>
<?import edu.kit.formal.gui.controls.ScriptArea?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.*?>
<fx:root xmlns:fx="http://javafx.com/fxml/1" prefHeight="100" prefWidth="250" styleClass="tab-pane"
type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8.0.112">
<VBox>
<TabPane fx:id="tabPane" side="left"
tabClosingPolicy="SELECTED_TAB" VBox.vgrow="ALWAYS">
<tabs>
<Tab fx:id="startTab" text="Untitled">
<content>
<ScriptArea fx:id="scriptArea" VBox.vgrow="ALWAYS"/>
</content>
</Tab>
</tabs>
</TabPane>
</VBox>
</fx:root>
\ No newline at end of file
......@@ -195,4 +195,8 @@
.header-buttons .button {
}
}
.tab-pane {
-fx-skin: "edu.kit.formal.gui.controls.CustomTabPaneSkin";
}
\ 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