Adding 'exit' and 'change project' buttons to the editor window
This commit is contained in:
parent
d5b40053fb
commit
eb754aecf9
4 changed files with 82 additions and 31 deletions
|
|
@ -410,6 +410,11 @@ public class CoderClient extends Application{
|
|||
selectProjectDialog.setProject(null);
|
||||
selectProjectDialog.showOnStage(mainStage);
|
||||
}
|
||||
@Override
|
||||
public void exit() {
|
||||
closeCurrentSession();
|
||||
Platform.exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<SplitPane dividerPositions="0.26588628762541805, 0.7391304347826086" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<SplitPane dividerPositions="0.26588628762541805, 0.7391304347826086" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" SplitPane.resizableWithParent="false">
|
||||
<children>
|
||||
|
|
@ -15,7 +18,8 @@
|
|||
<TreeView fx:id="fileTreeView" prefHeight="398.0" prefWidth="156.0" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children></AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="398.0" prefWidth="271.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
|
|
@ -23,25 +27,57 @@
|
|||
<TextArea fx:id="editTextArea" prefHeight="398.0" prefWidth="271.0" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children></AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0" SplitPane.resizableWithParent="false">
|
||||
<children>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="50.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<content>
|
||||
<PropertySheet fx:id="propertySheet" modeSwitcherVisible="false" searchBoxVisible="false" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<HBox alignment="CENTER" maxHeight="50.0" prefHeight="50.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<Button fx:id="compileButton" mnemonicParsing="false" onAction="#handleCompile" text="Compile">
|
||||
<HBox.margin>
|
||||
<Insets right="15.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button fx:id="runButton" mnemonicParsing="false" onAction="#handleRun" text="Run" />
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
<GridPane maxHeight="-Infinity" minHeight="-Infinity" prefHeight="40.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" maxHeight="50.0" prefHeight="50.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Button fx:id="exitButton" mnemonicParsing="false" onAction="#handleExit" text="Exit">
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button fx:id="changeProjectButton" mnemonicParsing="false" onAction="#handleChangeProject" text="Change Project">
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_RIGHT" maxHeight="50.0" prefHeight="50.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<children>
|
||||
<Button fx:id="compileButton" mnemonicParsing="false" onAction="#handleCompile" text="Compile">
|
||||
<HBox.margin>
|
||||
<Insets right="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button fx:id="runButton" mnemonicParsing="false" onAction="#handleRun" text="Run">
|
||||
<HBox.margin>
|
||||
<Insets right="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public class EditorWindow extends GuiWindow {
|
|||
@FXML private PropertySheet propertySheet;
|
||||
@FXML private Button compileButton;
|
||||
@FXML private Button runButton;
|
||||
@FXML private Button exitButton;
|
||||
@FXML private Button changeProjectButton;
|
||||
|
||||
public EditorWindow() throws IOException{
|
||||
super(EditorWindow.class.getResource("EditorWindow.fxml"));
|
||||
|
|
@ -68,12 +70,19 @@ public class EditorWindow extends GuiWindow {
|
|||
}
|
||||
|
||||
@FXML
|
||||
protected void chageProject(ActionEvent event){
|
||||
protected void handleChangeProject(ActionEvent event){
|
||||
for(EditorWindowListener listener : listsners){
|
||||
listener.changeProject();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void handleExit(ActionEvent event){
|
||||
for(EditorWindowListener listener : listsners){
|
||||
listener.exit();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupFileTreeView(){
|
||||
fileTreeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<String>>() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@ public interface EditorWindowListener {
|
|||
public void compile();
|
||||
public void run();
|
||||
public void changeProject();
|
||||
public void exit();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue