-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1454 - Initial commit with new module project, frontend implementati…
…on and basic class structure
- Loading branch information
Showing
16 changed files
with
677 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.devonfw.cobigen</groupId> | ||
<artifactId>gui-parent</artifactId> | ||
<version>${revision}</version> | ||
</parent> | ||
<artifactId>gui-systemtest</artifactId> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>gui-parent</artifactId> | ||
<groupId>com.devonfw.cobigen</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
<groupId>com.devonfw.cobigen</groupId> | ||
<artifactId>gui</artifactId> | ||
<version>${revision}</version> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-controls</artifactId> | ||
<version>19</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-fxml</artifactId> | ||
<version>19</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
<configuration> | ||
<release>11</release> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-maven-plugin</artifactId> | ||
<version>0.0.8</version> | ||
<executions> | ||
<execution> | ||
<!-- Default configuration for running --> | ||
<!-- Usage: mvn clean javafx:run --> | ||
<id>default-cli</id> | ||
<configuration> | ||
<mainClass>org.gui.Main</mainClass> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module gui { | ||
requires javafx.controls; | ||
|
||
requires javafx.fxml; | ||
|
||
requires transitive javafx.graphics; | ||
|
||
opens org.gui to javafx.fxml; | ||
|
||
exports org.gui; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.gui; | ||
|
||
import javafx.application.Application; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.ListCell; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.layout.HBox; | ||
import javafx.stage.Stage; | ||
|
||
public class CellFactory extends Application { | ||
@Override | ||
public void start(Stage stage) { | ||
|
||
ObservableList<TemplateSetCell> wordsList = FXCollections.observableArrayList(); | ||
wordsList.add(new TemplateSetCell("First Word", "Definition of First Word")); | ||
wordsList.add(new TemplateSetCell("Second Word", "Definition of Second Word")); | ||
wordsList.add(new TemplateSetCell("Third Word", "Definition of Third Word")); | ||
ListView<TemplateSetCell> listViewOfWords = new ListView<>(wordsList); | ||
listViewOfWords.setCellFactory(param -> new ListCell<TemplateSetCell>() { | ||
@Override | ||
protected void updateItem(TemplateSetCell item, boolean empty) { | ||
|
||
super.updateItem(item, empty); | ||
|
||
if (empty || item == null || item.getWord() == null) { | ||
setText(null); | ||
} else { | ||
setText(item.getWord()); | ||
} | ||
} | ||
}); | ||
stage.setScene(new Scene(listViewOfWords)); | ||
stage.show(); | ||
} | ||
|
||
public static class TemplateSetCell extends HBox { | ||
|
||
private final String word; | ||
|
||
private final String definition; | ||
|
||
public TemplateSetCell(String word, String definition) { | ||
|
||
this.word = word; | ||
this.definition = definition; | ||
} | ||
|
||
public String getWord() { | ||
|
||
return this.word; | ||
} | ||
|
||
public String getDefinition() { | ||
|
||
return this.definition; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
launch(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.gui; | ||
|
||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.ResourceBundle; | ||
import java.util.stream.Collectors; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.input.KeyEvent; | ||
|
||
/** | ||
* Controller for the Template Set Management GUI | ||
*/ | ||
public class Controller implements Initializable { | ||
|
||
ArrayList<String> templateSets = new ArrayList<>(Arrays.asList("templates-devon4j-tests", "templates-devon4j-utils", | ||
"crud-openapi-net", "crud-angular-client-app", "crud-ionic-client-app", "rest-documentation")); | ||
|
||
@FXML | ||
public Button clearSearchResultsButton; | ||
|
||
@FXML | ||
public TextField searchBar; | ||
|
||
// TODO: Transform to ListView<HBox> | ||
@FXML | ||
public ListView<String> searchResultsView; | ||
|
||
@FXML | ||
public void search(KeyEvent event) { | ||
|
||
this.searchResultsView.getItems().clear(); | ||
this.searchResultsView.getItems().addAll(searchTemplateSets(this.searchBar.getText(), this.templateSets)); | ||
} | ||
|
||
/** | ||
* Called when clearSearchResultsButton is pressed | ||
*/ | ||
@FXML | ||
public void clearSearchResults() { | ||
|
||
this.searchBar.clear(); | ||
this.searchResultsView.getItems().clear(); | ||
this.searchResultsView.getItems().addAll(this.templateSets); | ||
} | ||
|
||
/** | ||
* Initial View | ||
*/ | ||
@Override | ||
public void initialize(URL arg0, ResourceBundle arg1) { | ||
|
||
this.searchResultsView.getItems().addAll(this.templateSets); | ||
} | ||
|
||
/** | ||
* @param text | ||
* @param templateSets2 | ||
* @return | ||
*/ | ||
private List<String> searchTemplateSets(String searchWords, List<String> listOfStrings) { | ||
|
||
List<String> searchTemplateSetsArray = Arrays.asList(searchWords.trim().split(" ")); | ||
|
||
return listOfStrings.stream().filter(input -> { | ||
return searchTemplateSetsArray.stream().allMatch(word -> input.toLowerCase().contains(word.toLowerCase())); | ||
}).collect(Collectors.toList()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.gui; | ||
|
||
/** | ||
* TODO nneuhaus This type ... | ||
* | ||
*/ | ||
public class DetailsController { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.layout.AnchorPane?> | ||
|
||
<AnchorPane fx:id="detailsPane" minHeight="0.0" minWidth="0.0" prefHeight="459.0" prefWidth="455.0"> | ||
<children> | ||
<SplitPane fx:id="horizontalSplitPane" dividerPositions="0.1119186046511628" orientation="VERTICAL" prefHeight="461.0" prefWidth="432.0"> | ||
<items> | ||
<AnchorPane fx:id="headerPane" minHeight="0.0" minWidth="0.0" prefHeight="57.0" prefWidth="429.0"> | ||
<children> | ||
<Text fx:id="headersText" layoutX="5.0" layoutY="31.0" strokeType="OUTSIDE" strokeWidth="0.0" text="HOME"> | ||
<font> | ||
<Font size="18.0" /> | ||
</font> | ||
</Text> | ||
</children> | ||
</AnchorPane> | ||
<AnchorPane fx:id="detailsPane" minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0"> | ||
<children> | ||
<Label fx:id="howItWorksLabel" layoutX="6.0" layoutY="6.0" text="How it Works"> | ||
<font> | ||
<Font size="14.0" /> | ||
</font> | ||
</Label> | ||
<Separator fx:id="howItWorksSeparator" layoutX="2.0" layoutY="35.0" prefHeight="3.0" prefWidth="432.0" /> | ||
<Text layoutX="9.0" layoutY="59.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Search for template sets in the search bar on the left" wrappingWidth="340.80274963378906" /> | ||
<Text layoutX="19.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Install Template Set" wrappingWidth="108.13612365722656" /> | ||
<Text layoutX="165.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Delete Template Set" wrappingWidth="108.13612365722656" /> | ||
<Text layoutX="305.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Update Template Set" wrappingWidth="114.13612365722656" /> | ||
<Button layoutX="59.0" layoutY="73.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="7.0" style="-fx-background-color: BLUE;" text="+" textFill="WHITE"> | ||
<font> | ||
<Font name="System Bold" size="12.0" /> | ||
</font> | ||
</Button> | ||
<Button layoutX="207.0" layoutY="73.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="7.0" style="-fx-background-color: BLUE;" text="*" textFill="WHITE"> | ||
<font> | ||
<Font name="System Bold" size="12.0" /> | ||
</font> | ||
</Button> | ||
<Button layoutX="346.0" layoutY="73.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="7.0" style="-fx-background-color: BLUE;" text="~" textFill="WHITE"> | ||
<font> | ||
<Font name="System Bold" size="12.0" /> | ||
</font> | ||
</Button> | ||
<Label layoutX="7.0" layoutY="300.0" text="Wiki"> | ||
<font> | ||
<Font size="14.0" /> | ||
</font> | ||
</Label> | ||
<Separator fx:id="wikiSeparator" layoutX="-1.0" layoutY="329.0" prefHeight="3.0" prefWidth="432.0" /> | ||
<Text layoutX="9.0" layoutY="351.0" strokeType="OUTSIDE" strokeWidth="0.0" text="More information can be found in our Wiki: --> https://github.com/devonfw/cobigen/wiki" wrappingWidth="246.13607788085938" /> | ||
<Text layoutX="36.0" layoutY="208.0" strokeType="OUTSIDE" strokeWidth="0.0" text=""Tree view for example template set with increments and templates"" /> | ||
</children> | ||
</AnchorPane> | ||
</items> | ||
</SplitPane> | ||
</children> | ||
</AnchorPane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.gui; | ||
|
||
import java.io.FileInputStream; | ||
|
||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Scene; | ||
import javafx.scene.layout.AnchorPane; | ||
import javafx.stage.Stage; | ||
|
||
public class Main extends Application { | ||
|
||
public static void main(String[] args) { | ||
|
||
launch(args); | ||
} | ||
|
||
@Override | ||
public void start(Stage primaryStage) { | ||
|
||
try { | ||
// Create the FXMLLoader | ||
FXMLLoader loader = new FXMLLoader(); | ||
// Path to the FXML File | ||
String fxmlDocPath = "C:\\projects\\my-project\\workspaces\\main\\cobigen\\cobigen-gui\\gui\\src\\main\\java\\org\\gui\\TemplateSetManagementGui.fxml"; | ||
FileInputStream fxmlStream = new FileInputStream(fxmlDocPath); | ||
// Create the Pane and all Details | ||
AnchorPane root = (AnchorPane) loader.load(fxmlStream); | ||
// Create the Scene | ||
Scene scene = new Scene(root); | ||
// Set the Scene to the Stage | ||
primaryStage.setScene(scene); | ||
// Set the Title to the Stage | ||
primaryStage.setTitle("A SceneBuilder Example"); | ||
// Display the Stage | ||
primaryStage.show(); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.