Skip to content

Commit

Permalink
devonfw#1454 Implemented TemplateSetDetails Page to be ready for Temp…
Browse files Browse the repository at this point in the history
…late Set Data
  • Loading branch information
NelsonNew committed Nov 22, 2022
1 parent bfa89a9 commit 0f7439e
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class Controller implements Initializable {
@FXML
private AnchorPane homePane;

@FXML
private AnchorPane templateSetDetailsPane;

@FXML
public Button homeButton;

Expand Down Expand Up @@ -78,8 +81,10 @@ public void loadHome(javafx.event.ActionEvent actionEvent) throws IOException {
* @param actionEvent
* @throws IOException
*/
public void details(javafx.event.ActionEvent actionEvent) throws IOException {
public void loadDetails(javafx.event.ActionEvent actionEvent) throws IOException {

this.templateSetDetailsPane = FXMLLoader.load(getClass().getResource("fxml/TemplateSetDetails.fxml"));
this.detailsPane.getChildren().setAll(this.templateSetDetailsPane);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,94 @@
package com.devonfw.cobigen.gui.controllers;

import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;

import com.devonfw.cobigen.gui.services.TreeViewBuilder;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TreeView;
import javafx.scene.layout.AnchorPane;

/**
* TODO nneuhaus This type ...
*
*/
public class DetailsController {
public class DetailsController implements Initializable {

// TODO: getIncrements()
private List<String> INCREMENTS = new ArrayList<>();

@FXML
AnchorPane treeViewPane;

@Override
public void initialize(URL location, ResourceBundle resources) {

showName();
showVersion();
showTreeView(TreeViewBuilder.buildTreeView(TreeViewBuilder.transformIncrementsToArray(this.INCREMENTS)));

}

/**
*
*/
private void showName() {

// TODO: getName()

}

/**
*
*/
private void showVersion() {

// TODO: getVersion()

}

/**
* @param treeView
*/
public void showTreeView(TreeView<String> treeView) {

treeView.setId("treeView");
AnchorPane.setTopAnchor(treeView, 0.0);
AnchorPane.setRightAnchor(treeView, 0.0);
AnchorPane.setBottomAnchor(treeView, 0.0);
AnchorPane.setLeftAnchor(treeView, 0.0);
this.treeViewPane.getChildren().add(treeView);
}

/**
* @param actionEvent
*/
@FXML
public void installTemplateSet(javafx.event.ActionEvent actionEvent) {

// TODO
}

/**
* @param actionEvent
*/
@FXML
public void updateTemplateSet(javafx.event.ActionEvent actionEvent) {

// TODO
}

/**
* @param actionEvent
*/
@FXML
public void uninstallTemplateSet(javafx.event.ActionEvent actionEvent) {

// TODO
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ public static String[] transformIncrementsToArray(List<String> templateSetIncrem
}

/**
* @param listOfItems list to
* @return
* @param arrayOfItems to transform to tree
* @return the complete TreeView
*/
public static TreeView<String> buildTreeView(String[] listOfItems) {
public static TreeView<String> buildTreeView(String[] arrayOfItems) {

TreeItem<String> rootItem = new TreeItem<>("Increments");
rootItem.setExpanded(true);

for (int i = 0; i < listOfItems.length; i++) {
TreeItem<String> increment = new TreeItem<>(listOfItems[i]);
for (int i = 0; i < arrayOfItems.length; i++) {
TreeItem<String> increment = new TreeItem<>(arrayOfItems[i]);
i++;
TreeItem<String> incrementDescription = new TreeItem<>(listOfItems[i]);
TreeItem<String> incrementDescription = new TreeItem<>(arrayOfItems[i]);
increment.getChildren().add(incrementDescription);
rootItem.getChildren().add(increment);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
<Text layoutX="19.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Install Template Set" wrappingWidth="108.13612365722656" AnchorPane.leftAnchor="20.0" />
<Text layoutX="172.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" AnchorPane.rightAnchor="20.0" />
<Text layoutX="6.0" layoutY="19.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How it Works" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="10.0">
<Text layoutX="6.0" layoutY="19.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How it Works" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0">
<font>
<Font size="14.0" />
</font>
</Text>
<Separator layoutX="-2.0" layoutY="24.0" prefHeight="16.0" prefWidth="455.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="30.0" />
<Separator layoutY="24.0" prefHeight="16.0" prefWidth="455.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="24.0" />
<Button layoutX="58.0" layoutY="71.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="7.0" style="-fx-background-color: BLUE;" text="+" textFill="WHITE" AnchorPane.leftAnchor="58.0">
<font>
<Font name="System Bold" size="12.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.SplitMenuButton?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="459.0" prefWidth="455.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
<children>
<SplitPane dividerPositions="0.17514534883720928" orientation="VERTICAL" prefHeight="461.0" prefWidth="432.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<Text layoutX="14.0" layoutY="31.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TITLE OF TEMPLATE SET" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0">
<font>
<Font size="18.0" />
</font>
</Text>
<AnchorPane layoutX="256.0" layoutY="13.0" prefHeight="25.0" prefWidth="100.0" style="-fx-background-color: GREY; -fx-background-radius: 5px;" AnchorPane.rightAnchor="70.0" AnchorPane.topAnchor="10.0">
<children>
<Text fill="WHITE" layoutX="9.0" layoutY="17.0" strokeType="OUTSIDE" strokeWidth="0.0" text="UNINSTALLED" textAlignment="CENTER">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Text>
</children>
</AnchorPane>
<Button layoutX="367.0" layoutY="13.0" mnemonicParsing="false" style="-fx-background-color: BLUE;" text="Install" textFill="WHITE" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Button>
<Text layoutX="14.0" layoutY="55.0" strokeType="OUTSIDE" strokeWidth="0.0" text="&quot;Short Description in one sentence&quot;" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="45.0" />
<SplitMenuButton layoutX="328.0" layoutY="44.0" mnemonicParsing="false" style="-fx-background-color: BLUE;" text="&quot;Version&quot;" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="42.0">
<items>
<MenuItem mnemonicParsing="false" text="v1.2" />
<MenuItem mnemonicParsing="false" text="v3" />
</items>
</SplitMenuButton>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<Label layoutX="4.0" layoutY="14.0" text="Template Set Structure" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0">
<font>
<Font size="14.0" />
</font>
</Label>
<Separator layoutY="28.0" prefHeight="0.0" prefWidth="453.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="30.0" />
<AnchorPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="40.0">
<children>
<ScrollPane fitToWidth="true" prefHeight="200.0" prefWidth="433.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane fx:id="treeViewPane" minHeight="0.0" minWidth="0.0" prefHeight="326.0" prefWidth="417.0" />
</content>
</ScrollPane>
</children>
</AnchorPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.testfx.api.FxRobotException;
import org.testfx.assertions.api.Assertions;

import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.TreeItem;
Expand Down Expand Up @@ -76,7 +77,12 @@ public void testFoldingIncrementTreeView() {
this.incrementsTreeView = (TreeView) this.mainRoot.lookup(TREEVIEW);
TreeItem<String> root = this.incrementsTreeView.getRoot();
Assertions.assertThat(root.isExpanded());
// TODO
ObservableList<TreeItem<String>> children = root.getChildren();
for (int i = 0; i < children.size(); i++) {
TreeItem<String> child = children.get(i);
Assertions.assertThat(!child.isExpanded());
Assertions.assertThat(child.getChildren().get(0).isLeaf());
}
}

}

0 comments on commit 0f7439e

Please sign in to comment.