Skip to content

Commit 2a2f9e7

Browse files
authored
Merge pull request #27 from reugn/develop
v0.5.0
2 parents 607eaed + e8f9220 commit 2a2f9e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+972
-753
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ jobs:
1111

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515

1616
- name: Set up JDK 11
17-
uses: actions/setup-java@v1
17+
uses: actions/setup-java@v3
1818
with:
19+
distribution: 'temurin'
1920
java-version: 11
2021

21-
- name: Maven cache and restore deps
22-
uses: actions/cache@v1
22+
- name: Cache local Maven repository
23+
uses: actions/cache@v2
2324
with:
2425
path: ~/.m2/repository
2526
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dev-tools ![Build](https://github.com/reugn/dev-tools/workflows/Build/badge.svg)
22

3-
The most popular software developer tools in one app.
3+
Widely used software developer tools in a single application.
44
* [Json Editor](#json_editor)
55
* [UUID/Password Generator](#generator)
66
* [Hash Calculator](#hash_calculator)
@@ -11,18 +11,22 @@ The most popular software developer tools in one app.
1111
* [Logs Generator](#logs)
1212

1313
## Installation
14-
`dev-tools` is a Maven JavaFX application.
15-
Build an executable jar from the source:
14+
* `dev-tools` is a [JavaFX](https://openjfx.io/) Maven application.
15+
Build an executable jar from the source.
1616
```
1717
mvn clean package -U
1818
```
19-
Build a native application using [Gluon Client plugin](https://github.com/gluonhq/client-maven-plugin):
19+
20+
* Build a native application using the [GluonFX Maven plugin](https://github.com/gluonhq/gluonfx-maven-plugin).
21+
[GraalVM](https://www.graalvm.org/) installation is required.
2022
```
21-
mvn clean client:build
23+
mvn clean gluonfx:build
2224
```
23-
or download the latest release.
2425

25-
***JavaFX is not a part of Java SDK as of JDK 11.***
26+
* Download a build from the [releases](https://github.com/reugn/dev-tools/releases).
27+
28+
## Prerequisites
29+
* Java 11 (JavaFX is not a part of Java SDK as of JDK 11).
2630

2731
## Features
2832
* Dark/Light mode.
@@ -76,6 +80,7 @@ or download the latest release.
7680

7781
### Rest API Tester
7882
* Rest API testing client.
83+
* Export/import HTTP request history.
7984

8085
![](docs/images/rest_api.png)
8186

docs/images/rest_api.png

51.6 KB
Loading

pom.xml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.reugn</groupId>
88
<artifactId>devtools</artifactId>
9-
<version>0.4.0</version>
9+
<version>0.5.0</version>
1010

1111
<organization>
1212
<name>com.github.reugn</name>
@@ -15,13 +15,14 @@
1515
<properties>
1616
<java.version>11</java.version>
1717

18-
<jackson.version>2.12.1</jackson.version>
18+
<jackson.version>2.13.4</jackson.version>
1919
<javafx.version>11.0.2</javafx.version>
2020
<controlsfx.version>11.0.3</controlsfx.version>
21-
<richtextfx.version>0.10.5</richtextfx.version>
22-
<log4j.version>1.2.17</log4j.version>
23-
<guava.version>30.1-jre</guava.version>
24-
<commons-lang3.version>3.11</commons-lang3.version>
21+
<richtextfx.version>0.10.9</richtextfx.version>
22+
<log4j.version>2.18.0</log4j.version>
23+
<guava.version>31.1-jre</guava.version>
24+
<guice.version>5.1.0</guice.version>
25+
<commons-lang3.version>3.12.0</commons-lang3.version>
2526
</properties>
2627

2728
<build>
@@ -38,15 +39,15 @@
3839
<plugin>
3940
<groupId>org.openjfx</groupId>
4041
<artifactId>javafx-maven-plugin</artifactId>
41-
<version>0.0.4</version>
42+
<version>0.0.8</version>
4243
<configuration>
4344
<mainClass>com.github.reugn.devtools.Main</mainClass>
4445
</configuration>
4546
</plugin>
4647
<plugin>
4748
<groupId>com.gluonhq</groupId>
48-
<artifactId>client-maven-plugin</artifactId>
49-
<version>0.1.36</version>
49+
<artifactId>gluonfx-maven-plugin</artifactId>
50+
<version>1.0.15</version>
5051
<configuration>
5152
<mainClass>com.github.reugn.devtools.Main</mainClass>
5253
</configuration>
@@ -94,14 +95,24 @@
9495
<artifactId>guava</artifactId>
9596
<version>${guava.version}</version>
9697
</dependency>
98+
<dependency>
99+
<groupId>com.google.inject</groupId>
100+
<artifactId>guice</artifactId>
101+
<version>${guice.version}</version>
102+
</dependency>
97103
<dependency>
98104
<groupId>org.apache.commons</groupId>
99105
<artifactId>commons-lang3</artifactId>
100106
<version>${commons-lang3.version}</version>
101107
</dependency>
102108
<dependency>
103-
<groupId>log4j</groupId>
104-
<artifactId>log4j</artifactId>
109+
<groupId>org.apache.logging.log4j</groupId>
110+
<artifactId>log4j-core</artifactId>
111+
<version>${log4j.version}</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.apache.logging.log4j</groupId>
115+
<artifactId>log4j-api</artifactId>
105116
<version>${log4j.version}</version>
106117
</dependency>
107118
<dependency>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.github.reugn.devtools;
2+
3+
import com.github.reugn.devtools.services.*;
4+
import com.google.inject.AbstractModule;
5+
import com.google.inject.Injector;
6+
import com.google.inject.Provides;
7+
import com.google.inject.Scopes;
8+
import javafx.fxml.FXMLLoader;
9+
10+
public class GuiceModule extends AbstractModule {
11+
12+
@Override
13+
protected void configure() {
14+
bind(AsciiService.class).to(AsciiServiceImpl.class).in(Scopes.SINGLETON);
15+
bind(EpochService.class).to(EpochServiceImpl.class).in(Scopes.SINGLETON);
16+
bind(HashService.class).to(HashServiceImpl.class).in(Scopes.SINGLETON);
17+
bind(JsonService.class).to(JsonServiceImpl.class).in(Scopes.SINGLETON);
18+
bind(LogService.class).to(LogServiceImpl.class).in(Scopes.SINGLETON);
19+
bind(RegexService.class).to(RegexServiceImpl.class).in(Scopes.SINGLETON);
20+
bind(RestService.class).to(RestServiceImpl.class).in(Scopes.SINGLETON);
21+
}
22+
23+
@Provides
24+
public FXMLLoader getFXMLLoader(Injector injector) {
25+
FXMLLoader loader = new FXMLLoader();
26+
loader.setControllerFactory(injector::getInstance);
27+
return loader;
28+
}
29+
}
Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package com.github.reugn.devtools;
22

33
import com.github.reugn.devtools.controllers.MainController;
4+
import com.google.inject.Guice;
5+
import com.google.inject.Injector;
46
import javafx.application.Application;
57
import javafx.fxml.FXMLLoader;
68
import javafx.scene.Parent;
79
import javafx.scene.Scene;
810
import javafx.scene.image.Image;
911
import javafx.stage.Stage;
1012

13+
import java.awt.*;
14+
import java.net.URL;
15+
16+
import static java.util.Objects.requireNonNull;
17+
1118
public class Main {
1219

1320
public static void main(String[] args) {
@@ -16,22 +23,39 @@ public static void main(String[] args) {
1623

1724
public static class App extends Application {
1825

26+
private static final String title = "Development Tools";
27+
28+
public static void main(String[] args) {
29+
launch(args);
30+
}
31+
1932
@Override
2033
public void start(Stage primaryStage) throws Exception {
21-
FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/main.fxml"));
22-
Parent root = loader.load();
23-
MainController mainController = loader.getController();
24-
primaryStage.setTitle("Development tools");
25-
primaryStage.getIcons().add(new Image("/images/icons8-toolbox-64.png"));
34+
setTaskbarIcon();
35+
Injector injector = Guice.createInjector(new GuiceModule());
36+
FXMLLoader fxmlLoader = injector.getInstance(FXMLLoader.class);
37+
fxmlLoader.setLocation(getClass().getResource("/views/main.fxml"));
38+
Parent root = fxmlLoader.load();
39+
MainController mainController = fxmlLoader.getController();
40+
primaryStage.setTitle(title);
41+
primaryStage.getIcons().add(new Image(requireNonNull(
42+
getClass().getResourceAsStream("/images/icons8-toolbox-64.png"))));
2643
Scene scene = new Scene(root, 900, 500);
2744
scene.getStylesheets().addAll("/css/main-dark.css", "/css/json-highlighting-dark.css");
45+
scene.getRoot().setStyle("-fx-font-family: 'Arial'");
2846
primaryStage.setScene(scene);
2947
mainController.setScene(scene);
3048
primaryStage.show();
3149
}
3250

33-
public static void main(String[] args) {
34-
launch(args);
51+
private void setTaskbarIcon() {
52+
try {
53+
URL imageResource = getClass().getResource("/images/icons8-toolbox-64.png");
54+
java.awt.Image image = Toolkit.getDefaultToolkit().getImage(imageResource);
55+
Taskbar taskbar = Taskbar.getTaskbar();
56+
taskbar.setIconImage(image);
57+
} catch (Exception ignore) {
58+
}
3559
}
3660
}
37-
}
61+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.github.reugn.devtools.async;
2+
3+
@FunctionalInterface
4+
public interface ExceptionRunnable {
5+
6+
void run(Throwable e);
7+
}

src/main/java/com/github/reugn/devtools/services/ResponseRunnable.java renamed to src/main/java/com/github/reugn/devtools/async/ResponseRunnable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.github.reugn.devtools.services;
1+
package com.github.reugn.devtools.async;
22

33
import com.github.reugn.devtools.models.RestResponse;
44

55
@FunctionalInterface
66
public interface ResponseRunnable {
77

8-
public void run(RestResponse response);
8+
void run(RestResponse response);
99
}

src/main/java/com/github/reugn/devtools/controllers/AsciiController.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
import com.github.reugn.devtools.services.AsciiService;
44
import com.github.reugn.devtools.utils.Elements;
5+
import com.google.inject.Inject;
56
import javafx.event.ActionEvent;
67
import javafx.fxml.FXML;
78
import javafx.fxml.Initializable;
89
import javafx.geometry.Insets;
9-
import javafx.scene.control.*;
10+
import javafx.scene.control.Button;
11+
import javafx.scene.control.ComboBox;
12+
import javafx.scene.control.Label;
13+
import javafx.scene.control.TextArea;
14+
import javafx.scene.control.TextField;
1015
import javafx.scene.input.KeyEvent;
1116
import javafx.scene.layout.Border;
1217
import javafx.scene.layout.HBox;
@@ -18,6 +23,7 @@
1823

1924
public class AsciiController implements Initializable {
2025

26+
private final AsciiService asciiService;
2127
@FXML
2228
private Label asciiLabel;
2329
@FXML
@@ -47,6 +53,11 @@ public class AsciiController implements Initializable {
4753
@FXML
4854
private Label fontStyleLabel;
4955

56+
@Inject
57+
public AsciiController(AsciiService asciiService) {
58+
this.asciiService = asciiService;
59+
}
60+
5061
@Override
5162
public void initialize(URL url, ResourceBundle resourceBundle) {
5263

@@ -78,12 +89,12 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
7889
}
7990

8091
@FXML
81-
private void handleKeyMatch(final KeyEvent keyEvent) {
92+
private void handleKeyMatch(@SuppressWarnings("unused") final KeyEvent keyEvent) {
8293
doConvert();
8394
}
8495

8596
@FXML
86-
private void handleConvert(final ActionEvent actionEvent) {
97+
private void handleConvert(@SuppressWarnings("unused") final ActionEvent actionEvent) {
8798
doConvert();
8899
}
89100

@@ -92,15 +103,15 @@ private void doConvert() {
92103
asciiResult.setText("");
93104
if (validate()) {
94105
int height = Integer.parseInt(fontSizeField.getText());
95-
int style = AsciiService.getStyleByName(fontStyleComboBox.getSelectionModel().getSelectedItem());
96-
String converted = AsciiService.convert(asciiField.getText(), asciiCharField.getText(),
106+
int style = asciiService.getStyleByName(fontStyleComboBox.getSelectionModel().getSelectedItem());
107+
String converted = asciiService.convert(asciiField.getText(), asciiCharField.getText(),
97108
height, style, fontNameComboBox.getSelectionModel().getSelectedItem());
98109
asciiResult.setText(converted);
99110
}
100111
}
101112

102113
@FXML
103-
private void handleClear(final ActionEvent actionEvent) {
114+
private void handleClear(@SuppressWarnings("unused") final ActionEvent actionEvent) {
104115
asciiField.setText("");
105116
asciiResult.setText("");
106117
}
@@ -113,7 +124,8 @@ private boolean validate() {
113124
Integer.parseInt(fontSizeField.getText()) > 128) {
114125
fontSizeField.setBorder(Elements.alertBorder);
115126
return false;
116-
} else return !asciiField.getText().isEmpty();
127+
}
128+
return !asciiField.getText().isEmpty();
117129
}
118130

119131
private void resetBorders() {

0 commit comments

Comments
 (0)