Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gui/src/main/java/com/devonfw/ide/gui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ private Parent loadMainView() throws IOException {

FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("main-view.fxml"));
fxmlLoader.setResources(this.nlsService.getResourceBundle());
fxmlLoader.setController(new MainController(System.getenv(IdeVariables.IDE_ROOT.getName()), guiStateManager, this.nlsService));
MainController controller = new MainController(System.getenv(IdeVariables.IDE_ROOT.getName()), guiStateManager, this.nlsService);
fxmlLoader.setControllerFactory(type -> controller);
return fxmlLoader.load();
}

Expand Down
7 changes: 7 additions & 0 deletions gui/src/main/java/com/devonfw/ide/gui/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,19 @@ private void setUpTaskListListener() {
taskManager.getTasks().addListener(taskListChangeListener);
}

/**Guard to ensure {@link #initialize()} runs only once across all FXML files.*/
private boolean initialized;

@FXML
private void initialize() {

if (this.initialized) {
return;
}
setProjectsComboBox();
initLanguageComboBox();
selectedWorkspace.setOnAction(this::onWorkspaceSelected);
this.initialized = true;
}

private void onWorkspaceSelected(ActionEvent actionEvent) {
Expand Down
109 changes: 7 additions & 102 deletions gui/src/main/resources/com/devonfw/ide/gui/main-view.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,15 @@
<?import javafx.scene.layout.*?>
<?import java.lang.Double?>
<BorderPane fx:id="rootPane"
fx:controller="com.devonfw.ide.gui.MainController"
maxHeight="-Infinity"
maxWidth="-Infinity"
VBox.vgrow="ALWAYS"
xmlns="http://javafx.com/javafx/25.0.0"
xmlns:fx="http://javafx.com/fxml/1">

<left>
<VBox prefHeight="428.0"
prefWidth="181.0"
spacing="4.0"
stylesheets="@style/navigation.css"
BorderPane.alignment="CENTER">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>

<HBox alignment="CENTER_LEFT" prefWidth="200.0">
<VBox.margin>
<Insets bottom="10.0"/>
</VBox.margin>
<ImageView fitHeight="150.0"
fitWidth="200.0"
pickOnBounds="true"
preserveRatio="true">
<Image url="@assets/logo.png"/>
</ImageView>
</HBox>

<VBox maxHeight="-Infinity"
prefWidth="100.0"
styleClass="sideNavigationElement">
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
<Label fx:id="labelProject"
maxWidth="1.7976931348623157E308"
text="%project"/>
<ComboBox fx:id="selectedProject"
maxWidth="1.7976931348623157E308"
minWidth="-Infinity"
prefHeight="40.0"
prefWidth="150.0"
promptText="%chooseProject"
styleClass="chooseProject"/>
</VBox>

<VBox layoutX="20.0"
layoutY="245.0"
maxHeight="-Infinity"
prefWidth="100.0"
styleClass="sideNavigationElement">
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
<Label fx:id="labelWorkspace"
maxWidth="1.7976931348623157E308"
text="%workspace"/>
<ComboBox fx:id="selectedWorkspace"
disable="true"
maxWidth="1.7976931348623157E308"
minWidth="-Infinity"
prefHeight="40.0"
prefWidth="150.0"
promptText="%chooseWorkspace"
styleClass="chooseProject"
VBox.vgrow="ALWAYS"/>
</VBox>

<!-- Language selector -->
<VBox maxHeight="-Infinity"
prefWidth="100.0"
styleClass="sideNavigationElement">
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
<Label fx:id="labelLanguage"
maxWidth="1.7976931348623157E308"
text="%language"/>
<ComboBox fx:id="selectedLanguage"
maxWidth="1.7976931348623157E308"
minWidth="-Infinity"
prefHeight="40.0"
prefWidth="150.0"
promptText="%chooseLanguage"
styleClass="chooseProject"/>
</VBox>
</VBox>
<fx:include source="navigation.fxml" BorderPane.alignment="CENTER"/>
</left>

<center>
Expand All @@ -110,9 +32,8 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>

<!-- Android Studio -->
<HBox alignment="CENTER_LEFT"
layoutX="20.0"
layoutY="204.0"
prefHeight="100.0"
prefWidth="150.0"
spacing="20.0"
Expand Down Expand Up @@ -152,9 +73,8 @@
</HBox>
</HBox>

<!-- Eclipse -->
<HBox alignment="CENTER_LEFT"
layoutX="20.0"
layoutY="120.0"
prefHeight="100.0"
prefWidth="150.0"
spacing="20.0"
Expand Down Expand Up @@ -193,9 +113,8 @@
</HBox>
</HBox>

<!-- IntelliJ -->
<HBox alignment="CENTER_LEFT"
layoutX="20.0"
layoutY="20.0"
prefHeight="100.0"
prefWidth="150.0"
spacing="20.0"
Expand Down Expand Up @@ -235,6 +154,7 @@
</HBox>
</HBox>

<!-- VS Code -->
<HBox alignment="CENTER_LEFT"
prefHeight="100.0"
prefWidth="150.0"
Expand Down Expand Up @@ -279,21 +199,6 @@
</center>

<bottom>
<HBox fx:id="bottomPanelContainer"
alignment="CENTER_RIGHT"
prefHeight="40.0"
prefWidth="200.0"
spacing="10.0"
BorderPane.alignment="CENTER">
<padding>
<Insets right="8.0"/>
</padding>

<Label fx:id="statusLabel" text="IDEasy is ready."/>
<ProgressBar fx:id="statusProgressBar"
prefWidth="0.0"
progress="0.0"
visible="false"/>
</HBox>
<fx:include source="status-bar.fxml" BorderPane.alignment="CENTER"/>
</bottom>
</BorderPane>
87 changes: 87 additions & 0 deletions gui/src/main/resources/com/devonfw/ide/gui/navigation.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<VBox fx:id="navigationPanel"
fx:controller="com.devonfw.ide.gui.MainController"
prefHeight="428.0"
prefWidth="181.0"
spacing="4.0"
stylesheets="@style/navigation.css"
xmlns="http://javafx.com/javafx/25.0.0"
xmlns:fx="http://javafx.com/fxml/1">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>

<HBox alignment="CENTER_LEFT" prefWidth="200.0">
<VBox.margin>
<Insets bottom="10.0"/>
</VBox.margin>
<ImageView fitHeight="150.0"
fitWidth="200.0"
pickOnBounds="true"
preserveRatio="true">
<Image url="@assets/logo.png"/>
</ImageView>
</HBox>

<VBox maxHeight="-Infinity"
prefWidth="100.0"
styleClass="sideNavigationElement">
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
<Label fx:id="labelProject"
maxWidth="1.7976931348623157E308"
text="%project"/>
<ComboBox fx:id="selectedProject"
maxWidth="1.7976931348623157E308"
minWidth="-Infinity"
prefHeight="40.0"
prefWidth="150.0"
promptText="%chooseProject"
styleClass="chooseProject"/>
</VBox>

<VBox maxHeight="-Infinity"
prefWidth="100.0"
styleClass="sideNavigationElement">
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
<Label fx:id="labelWorkspace"
maxWidth="1.7976931348623157E308"
text="%workspace"/>
<ComboBox fx:id="selectedWorkspace"
disable="true"
maxWidth="1.7976931348623157E308"
minWidth="-Infinity"
prefHeight="40.0"
prefWidth="150.0"
promptText="%chooseWorkspace"
styleClass="chooseProject"
VBox.vgrow="ALWAYS"/>
</VBox>

<!-- Language selector -->
<VBox maxHeight="-Infinity"
prefWidth="100.0"
styleClass="sideNavigationElement">
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
<Label fx:id="labelLanguage"
maxWidth="1.7976931348623157E308"
text="%language"/>
<ComboBox fx:id="selectedLanguage"
maxWidth="1.7976931348623157E308"
minWidth="-Infinity"
prefHeight="40.0"
prefWidth="150.0"
promptText="%chooseLanguage"
styleClass="chooseProject"/>
</VBox>
</VBox>
23 changes: 23 additions & 0 deletions gui/src/main/resources/com/devonfw/ide/gui/status-bar.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<HBox fx:id="bottomPanelContainer"
fx:controller="com.devonfw.ide.gui.MainController"
alignment="CENTER_RIGHT"
prefHeight="40.0"
prefWidth="200.0"
spacing="10.0"
xmlns="http://javafx.com/javafx/25.0.0"
xmlns:fx="http://javafx.com/fxml/1">
<padding>
<Insets right="8.0"/>
</padding>

<Label fx:id="statusLabel" text="IDEasy is ready."/>
<ProgressBar fx:id="statusProgressBar"
prefWidth="0.0"
progress="0.0"
visible="false"/>
</HBox>
3 changes: 2 additions & 1 deletion gui/src/test/java/com/devonfw/ide/gui/AppBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public void start(Stage stage) throws IOException {
assertThat(mainViewUrl).as("Cannot resolve main UI FXML resource!").isNotNull();

FXMLLoader fxmlLoader = new FXMLLoader(mainViewUrl);
fxmlLoader.setController(new MainController(mockIdeRoot.toString(), guiStateManager, nlsService));
MainController controller = new MainController(mockIdeRoot.toString(), guiStateManager, nlsService);
fxmlLoader.setControllerFactory(type -> controller);
Comment thread
hohwille marked this conversation as resolved.
fxmlLoader.setResources(nlsService.getResourceBundle());
Parent root = fxmlLoader.load();
stage.setScene(new Scene(root));
Expand Down