Skip to content

Commit

Permalink
Button hints added
Browse files Browse the repository at this point in the history
  • Loading branch information
Guleri24 committed Mar 13, 2022
1 parent 7327038 commit c153339
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.horizonxe</groupId>
<artifactId>fis-global</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>

<!-- This description text is included in the Windows installer by default, see windows-jpackage.txt -->
<description>Maven project setup interface from the chosen project and module.</description>
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/com/horizonxe/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
Expand All @@ -12,14 +11,13 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class MainController {
private static BufferedWriter writer;
private final List<String> projects = new ArrayList<>();
private final List<String> modules = new ArrayList<>();
@FXML
public Button triggerCmd;
@FXML
public ComboBox<String> projectMenu;
@FXML
public ComboBox<String> moduleMenu;
Expand Down Expand Up @@ -83,19 +81,25 @@ private void writeData(BufferedWriter writer, String project, String module) thr
writer.append("mvn -DProj ").append(project).append(" -DMod ").append(module);
}

// Enter the projects and modules here
private void initData() throws IOException {
newFile("data");
String row;

BufferedReader csvReader = new BufferedReader(new FileReader(dataFile));
while ((row = csvReader.readLine()) != null) {

String[] data = row.split(",");
projects.add(data[0]);
modules.add(data[1]);
if (!Objects.equals(data[0], ""))
projects.add(data[0]);
if (!Objects.equals(data[1], ""))
modules.add(data[1]);
}
csvReader.close();

if (projects.isEmpty())
projects.add("Empty");
if (modules.isEmpty())
modules.add("Empty");

projectMenu.setItems(FXCollections.observableArrayList(projects));
moduleMenu.setItems(FXCollections.observableArrayList(modules));
}
Expand All @@ -107,7 +111,7 @@ public void triggerCmd() throws IOException {
writer.close();

if (isWindows) {
Runtime.getRuntime().exec("cmd /c start excel /K \"" + executableFile.getAbsolutePath() + "\"");
Runtime.getRuntime().exec("cmd /c start cmd.exe /K \"" + executableFile.getAbsolutePath() + "\"");
stage.close();
} else {
stage.close();
Expand Down
21 changes: 15 additions & 6 deletions src/main/resources/com.horizonxe/fis-form.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,26 @@
</Label>
<ComboBox fx:id="moduleMenu" layoutX="204.0" layoutY="186.0" prefHeight="35.0" prefWidth="211.0"
stylesheets="@styles.css"/>
<Button fx:id="triggerCmd" layoutX="310.0" layoutY="266.0" mnemonicParsing="false"
onAction="#triggerCmd" prefHeight="30.0" prefWidth="105.0"
style="-fx-background-color: #4bcd3e; -fx-background-radius: 70;" stylesheets="@styles.css"
text="Trigger">
<Button layoutX="310.0" layoutY="266.0" mnemonicParsing="false" onAction="#triggerCmd" prefHeight="30.0"
prefWidth="105.0" style="-fx-background-color: #4bcd3e; -fx-background-radius: 70;"
stylesheets="@styles.css" text="Trigger &gt;">
<font>
<Font name="System Bold" size="13.0"/>
</font>
<tooltip>
<Tooltip text="Executes the executable file"/>
</tooltip>
</Button>
<Button layoutX="26.0" layoutY="14.0" mnemonicParsing="false" onAction="#addData" prefHeight="24.0"
prefWidth="84.0" style="-fx-background-color: #4bcd3e; -fx-background-radius: 70;"
stylesheets="@styles.css" text="Add Data"/>
prefWidth="265.0" style="-fx-background-color: #4bcd3e; -fx-background-radius: 70;"
stylesheets="@styles.css" text="Add new projects or modules &gt;">
<font>
<Font name="System Bold" size="13.0"/>
</font>
<tooltip>
<Tooltip text="eg. project,module or ,module or project,"/>
</tooltip>
</Button>
</Pane>
</center>
</BorderPane>
Expand Down

0 comments on commit c153339

Please sign in to comment.