Skip to content

Commit

Permalink
Merge pull request #27 from reugn/develop
Browse files Browse the repository at this point in the history
v0.5.0
  • Loading branch information
reugn committed Sep 17, 2022
2 parents 607eaed + e8f9220 commit 2a2f9e7
Show file tree
Hide file tree
Showing 46 changed files with 972 additions and 753 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11

- name: Maven cache and restore deps
uses: actions/cache@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dev-tools ![Build](https://github.com/reugn/dev-tools/workflows/Build/badge.svg)

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

## Installation
`dev-tools` is a Maven JavaFX application.
Build an executable jar from the source:
* `dev-tools` is a [JavaFX](https://openjfx.io/) Maven application.
Build an executable jar from the source.
```
mvn clean package -U
```
Build a native application using [Gluon Client plugin](https://github.com/gluonhq/client-maven-plugin):

* Build a native application using the [GluonFX Maven plugin](https://github.com/gluonhq/gluonfx-maven-plugin).
[GraalVM](https://www.graalvm.org/) installation is required.
```
mvn clean client:build
mvn clean gluonfx:build
```
or download the latest release.

***JavaFX is not a part of Java SDK as of JDK 11.***
* Download a build from the [releases](https://github.com/reugn/dev-tools/releases).

## Prerequisites
* Java 11 (JavaFX is not a part of Java SDK as of JDK 11).

## Features
* Dark/Light mode.
Expand Down Expand Up @@ -76,6 +80,7 @@ or download the latest release.

### Rest API Tester
* Rest API testing client.
* Export/import HTTP request history.

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

Expand Down
Binary file modified docs/images/rest_api.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 22 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.reugn</groupId>
<artifactId>devtools</artifactId>
<version>0.4.0</version>
<version>0.5.0</version>

<organization>
<name>com.github.reugn</name>
Expand All @@ -15,13 +15,14 @@
<properties>
<java.version>11</java.version>

<jackson.version>2.12.1</jackson.version>
<jackson.version>2.13.4</jackson.version>
<javafx.version>11.0.2</javafx.version>
<controlsfx.version>11.0.3</controlsfx.version>
<richtextfx.version>0.10.5</richtextfx.version>
<log4j.version>1.2.17</log4j.version>
<guava.version>30.1-jre</guava.version>
<commons-lang3.version>3.11</commons-lang3.version>
<richtextfx.version>0.10.9</richtextfx.version>
<log4j.version>2.18.0</log4j.version>
<guava.version>31.1-jre</guava.version>
<guice.version>5.1.0</guice.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
</properties>

<build>
Expand All @@ -38,15 +39,15 @@
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<version>0.0.8</version>
<configuration>
<mainClass>com.github.reugn.devtools.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>0.1.36</version>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.15</version>
<configuration>
<mainClass>com.github.reugn.devtools.Main</mainClass>
</configuration>
Expand Down Expand Up @@ -94,14 +95,24 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/com/github/reugn/devtools/GuiceModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.reugn.devtools;

import com.github.reugn.devtools.services.*;
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import javafx.fxml.FXMLLoader;

public class GuiceModule extends AbstractModule {

@Override
protected void configure() {
bind(AsciiService.class).to(AsciiServiceImpl.class).in(Scopes.SINGLETON);
bind(EpochService.class).to(EpochServiceImpl.class).in(Scopes.SINGLETON);
bind(HashService.class).to(HashServiceImpl.class).in(Scopes.SINGLETON);
bind(JsonService.class).to(JsonServiceImpl.class).in(Scopes.SINGLETON);
bind(LogService.class).to(LogServiceImpl.class).in(Scopes.SINGLETON);
bind(RegexService.class).to(RegexServiceImpl.class).in(Scopes.SINGLETON);
bind(RestService.class).to(RestServiceImpl.class).in(Scopes.SINGLETON);
}

@Provides
public FXMLLoader getFXMLLoader(Injector injector) {
FXMLLoader loader = new FXMLLoader();
loader.setControllerFactory(injector::getInstance);
return loader;
}
}
40 changes: 32 additions & 8 deletions src/main/java/com/github/reugn/devtools/Main.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package com.github.reugn.devtools;

import com.github.reugn.devtools.controllers.MainController;
import com.google.inject.Guice;
import com.google.inject.Injector;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.awt.*;
import java.net.URL;

import static java.util.Objects.requireNonNull;

public class Main {

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

public static class App extends Application {

private static final String title = "Development Tools";

public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/main.fxml"));
Parent root = loader.load();
MainController mainController = loader.getController();
primaryStage.setTitle("Development tools");
primaryStage.getIcons().add(new Image("/images/icons8-toolbox-64.png"));
setTaskbarIcon();
Injector injector = Guice.createInjector(new GuiceModule());
FXMLLoader fxmlLoader = injector.getInstance(FXMLLoader.class);
fxmlLoader.setLocation(getClass().getResource("/views/main.fxml"));
Parent root = fxmlLoader.load();
MainController mainController = fxmlLoader.getController();
primaryStage.setTitle(title);
primaryStage.getIcons().add(new Image(requireNonNull(
getClass().getResourceAsStream("/images/icons8-toolbox-64.png"))));
Scene scene = new Scene(root, 900, 500);
scene.getStylesheets().addAll("/css/main-dark.css", "/css/json-highlighting-dark.css");
scene.getRoot().setStyle("-fx-font-family: 'Arial'");
primaryStage.setScene(scene);
mainController.setScene(scene);
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
private void setTaskbarIcon() {
try {
URL imageResource = getClass().getResource("/images/icons8-toolbox-64.png");
java.awt.Image image = Toolkit.getDefaultToolkit().getImage(imageResource);
Taskbar taskbar = Taskbar.getTaskbar();
taskbar.setIconImage(image);
} catch (Exception ignore) {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.github.reugn.devtools.async;

@FunctionalInterface
public interface ExceptionRunnable {

void run(Throwable e);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.reugn.devtools.services;
package com.github.reugn.devtools.async;

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

@FunctionalInterface
public interface ResponseRunnable {

public void run(RestResponse response);
void run(RestResponse response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

import com.github.reugn.devtools.services.AsciiService;
import com.github.reugn.devtools.utils.Elements;
import com.google.inject.Inject;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.scene.control.*;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Border;
import javafx.scene.layout.HBox;
Expand All @@ -18,6 +23,7 @@

public class AsciiController implements Initializable {

private final AsciiService asciiService;
@FXML
private Label asciiLabel;
@FXML
Expand Down Expand Up @@ -47,6 +53,11 @@ public class AsciiController implements Initializable {
@FXML
private Label fontStyleLabel;

@Inject
public AsciiController(AsciiService asciiService) {
this.asciiService = asciiService;
}

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {

Expand Down Expand Up @@ -78,12 +89,12 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
}

@FXML
private void handleKeyMatch(final KeyEvent keyEvent) {
private void handleKeyMatch(@SuppressWarnings("unused") final KeyEvent keyEvent) {
doConvert();
}

@FXML
private void handleConvert(final ActionEvent actionEvent) {
private void handleConvert(@SuppressWarnings("unused") final ActionEvent actionEvent) {
doConvert();
}

Expand All @@ -92,15 +103,15 @@ private void doConvert() {
asciiResult.setText("");
if (validate()) {
int height = Integer.parseInt(fontSizeField.getText());
int style = AsciiService.getStyleByName(fontStyleComboBox.getSelectionModel().getSelectedItem());
String converted = AsciiService.convert(asciiField.getText(), asciiCharField.getText(),
int style = asciiService.getStyleByName(fontStyleComboBox.getSelectionModel().getSelectedItem());
String converted = asciiService.convert(asciiField.getText(), asciiCharField.getText(),
height, style, fontNameComboBox.getSelectionModel().getSelectedItem());
asciiResult.setText(converted);
}
}

@FXML
private void handleClear(final ActionEvent actionEvent) {
private void handleClear(@SuppressWarnings("unused") final ActionEvent actionEvent) {
asciiField.setText("");
asciiResult.setText("");
}
Expand All @@ -113,7 +124,8 @@ private boolean validate() {
Integer.parseInt(fontSizeField.getText()) > 128) {
fontSizeField.setBorder(Elements.alertBorder);
return false;
} else return !asciiField.getText().isEmpty();
}
return !asciiField.getText().isEmpty();
}

private void resetBorders() {
Expand Down

0 comments on commit 2a2f9e7

Please sign in to comment.