Skip to content

Commit a7eb091

Browse files
authored
Merge pull request #8 from reugn/develop
v0.2.0
2 parents 7551875 + 1e90e35 commit a7eb091

32 files changed

+1150
-277
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# dev-tools
2-
Common development tools in one app
2+
Common development tools in one app.
3+
* [Json Editor](#json_editor)
4+
* [UUID/Password Generator](#generator)
5+
* [Hash Calculator](#hash_calculator)
6+
* [Epoch Converter](#epoch_converter)
7+
* [Regular Expression Tester](#regex)
8+
* [Rest API Tester](#rest_api)
39

410
## Installation
511
This is a Maven JavaFX application.
@@ -13,33 +19,56 @@ or download the latest release.
1319

1420
## Tools List
1521

22+
<a name="json_editor"/>
23+
1624
### Json Editor
1725
* Json Pretty Print with Highlighting
1826
* Json Validation
1927
* Search Bar (Ctrl+F)
2028

2129
![](./images/json_editor.png)
2230

23-
### Generator
31+
<a name="generator"/>
32+
33+
### UUID/Password Generator
2434
* UUID Generator
2535
* Password Generator
2636

2737
![](./images/generator.png)
2838

39+
<a name="hash_calculator"/>
40+
2941
### Hash Calculator
3042
* Hash Functions
3143
* URL Encode/Decode
3244
* Base64 Encode/Decode
3345

3446
![](./images/hash_calculator.png)
3547

48+
<a name="epoch_converter"/>
49+
3650
### Epoch Converter
3751
* Current Unix Epoch Time
3852
* Timestamp to Human Date
3953
* Human Date to Timestamp
4054

4155
![](./images/epoch_converter.png)
4256

57+
<a name="regex"/>
58+
59+
### Regular Expression Tester
60+
* Regex Flags
61+
* Capturing Groups
62+
63+
![](./images/regex.png)
64+
65+
<a name="rest_api"/>
66+
67+
### Rest API Tester
68+
* Rest API Testing Client
69+
70+
![](./images/rest_api.png)
71+
4372
## Contributing
4473
If you find this project useful and want to contribute, please open an issue or create a PR.
4574

images/epoch_converter.png

8.51 KB
Loading

images/generator.png

1.91 KB
Loading

images/hash_calculator.png

1.93 KB
Loading

images/json_editor.png

-1.56 KB
Loading

images/regex.png

61.3 KB
Loading

images/rest_api.png

43.1 KB
Loading

src/main/java/com/github/reugn/devtools/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void start(Stage primaryStage) throws Exception {
2020
Parent root = FXMLLoader.load(getClass().getResource("/views/main.fxml"));
2121
primaryStage.setTitle("Dev-tools");
2222
primaryStage.getIcons().add(new Image("/images/icons8-toolbox-64.png"));
23-
Scene scene = new Scene(root, 800, 500);
23+
Scene scene = new Scene(root, 900, 500);
2424
scene.getStylesheets().addAll("/css/main.css", "/css/json-highlighting.css");
2525
primaryStage.setScene(scene);
2626
primaryStage.show();
Lines changed: 67 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,56 @@
11
package com.github.reugn.devtools.controllers;
22

33
import com.github.reugn.devtools.services.EpochService;
4+
import com.github.reugn.devtools.utils.Elements;
45
import com.github.reugn.devtools.utils.Logger;
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.Button;
10-
import javafx.scene.control.Label;
11-
import javafx.scene.control.TextArea;
12-
import javafx.scene.control.TextField;
13-
import javafx.scene.layout.*;
14-
import javafx.scene.paint.Color;
10+
import javafx.scene.control.*;
11+
import javafx.scene.input.KeyEvent;
12+
import javafx.scene.layout.Border;
13+
import javafx.scene.layout.GridPane;
14+
import javafx.scene.layout.HBox;
1515

1616
import java.net.URL;
1717
import java.time.LocalDateTime;
1818
import java.util.ResourceBundle;
19+
import java.util.TimeZone;
1920

2021
public class EpochController implements Initializable, Logger {
2122

22-
public Label currentEpochLabel;
23-
24-
public TextField currentEpoch;
25-
26-
public Button currentEpochRefreshButton;
27-
28-
public TextField tsToHumanField;
29-
30-
public Button tsToHumanButton;
31-
32-
public TextArea tsToHumanResult;
33-
34-
public Button humanToTsButton;
35-
36-
public TextArea humanToTsResult;
37-
38-
public TextField epochYear;
39-
public TextField epochMonth;
40-
public TextField epochDay;
41-
public TextField epochHour;
42-
public TextField epochMinute;
43-
public TextField epochSecond;
23+
@FXML
24+
private Label currentEpochLabel;
25+
@FXML
26+
private TextField currentEpoch;
27+
@FXML
28+
private Button currentEpochRefreshButton;
29+
@FXML
30+
private TextField tsToHumanField;
31+
@FXML
32+
private Button tsToHumanButton;
33+
@FXML
34+
private TextArea tsToHumanResult;
35+
@FXML
36+
private Button humanToTsButton;
37+
@FXML
38+
private TextArea humanToTsResult;
39+
@FXML
40+
private TextField epochYear;
41+
@FXML
42+
private TextField epochMonth;
43+
@FXML
44+
private TextField epochDay;
45+
@FXML
46+
private TextField epochHour;
47+
@FXML
48+
private TextField epochMinute;
49+
@FXML
50+
private TextField epochSecond;
51+
@FXML
52+
private ComboBox<String> timeZoneComboBox;
53+
private int timeZoneComboBoxIndex;
4454

4555
@FXML
4656
private void handleRefreshEpoch(final ActionEvent event) {
@@ -55,8 +65,7 @@ private void handleTsToHumanEpoch(final ActionEvent event) {
5565
String result = EpochService.toHumanEpoch(dt);
5666
tsToHumanResult.setText(result);
5767
} catch (Exception e) {
58-
tsToHumanField.setBorder(new Border(new BorderStroke(Color.RED,
59-
BorderStrokeStyle.SOLID, new CornerRadii(3), BorderWidths.DEFAULT)));
68+
tsToHumanField.setBorder(Elements.alertBorder);
6069
tsToHumanResult.setText("");
6170
}
6271
}
@@ -71,13 +80,30 @@ private void handleHumanToTsEpoch(final ActionEvent event) {
7180
int hour = EpochService.validate(epochHour, 0, 24);
7281
int minute = EpochService.validate(epochMinute, 0, 59);
7382
int second = EpochService.validate(epochSecond, 0, 59);
74-
String result = EpochService.toTsEpoch(year, month, day, hour, minute, second);
83+
String timeZone = timeZoneComboBox.getSelectionModel().getSelectedItem();
84+
String result = EpochService.toTsEpoch(year, month, day, hour, minute, second, timeZone);
7585
humanToTsResult.setText(result);
7686
} catch (Exception e) {
7787
humanToTsResult.setText("");
7888
}
7989
}
8090

91+
@FXML
92+
private void handleTimeZoneSearch(KeyEvent keyEvent) {
93+
String key = keyEvent.getText();
94+
if (key.length() == 0) return;
95+
int i = 0;
96+
for (String item : timeZoneComboBox.getItems()) {
97+
if (item.toLowerCase().startsWith(key) && i > timeZoneComboBoxIndex) {
98+
timeZoneComboBox.setValue(item);
99+
timeZoneComboBoxIndex = i;
100+
return;
101+
}
102+
i++;
103+
}
104+
timeZoneComboBoxIndex = 0;
105+
}
106+
81107
private void resetBorders() {
82108
epochYear.setBorder(Border.EMPTY);
83109
epochMonth.setBorder(Border.EMPTY);
@@ -89,11 +115,11 @@ private void resetBorders() {
89115

90116
@Override
91117
public void initialize(URL location, ResourceBundle resources) {
92-
HBox.setMargin(currentEpochLabel, new Insets(20, 5, 15, 0));
93-
HBox.setMargin(currentEpoch, new Insets(15, 5, 15, 0));
94-
HBox.setMargin(currentEpochRefreshButton, new Insets(15, 5, 15, 0));
95-
HBox.setMargin(tsToHumanField, new Insets(15, 5, 15, 0));
96-
HBox.setMargin(tsToHumanButton, new Insets(15, 5, 15, 0));
118+
HBox.setMargin(currentEpochLabel, new Insets(15, 5, 10, 0));
119+
HBox.setMargin(currentEpoch, new Insets(10, 5, 10, 0));
120+
HBox.setMargin(currentEpochRefreshButton, new Insets(10, 5, 10, 0));
121+
HBox.setMargin(tsToHumanField, new Insets(10, 5, 10, 0));
122+
HBox.setMargin(tsToHumanButton, new Insets(10, 5, 10, 0));
97123

98124
GridPane.setMargin(epochYear, new Insets(10, 5, 0, 0));
99125
GridPane.setMargin(epochMonth, new Insets(10, 5, 0, 0));
@@ -102,6 +128,7 @@ public void initialize(URL location, ResourceBundle resources) {
102128
GridPane.setMargin(epochMinute, new Insets(10, 5, 0, 0));
103129
GridPane.setMargin(epochSecond, new Insets(10, 5, 0, 0));
104130
GridPane.setMargin(humanToTsButton, new Insets(10, 5, 0, 0));
131+
GridPane.setMargin(timeZoneComboBox, new Insets(10, 5, 0, 0));
105132

106133
long now = System.currentTimeMillis();
107134
currentEpoch.setText(Long.toString(now));
@@ -114,5 +141,9 @@ public void initialize(URL location, ResourceBundle resources) {
114141
epochHour.setText(String.valueOf(date.getHour()));
115142
epochMinute.setText(String.valueOf(date.getMinute()));
116143
epochSecond.setText(String.valueOf(date.getSecond()));
144+
145+
timeZoneComboBox.getItems().setAll(TimeZone.getAvailableIDs());
146+
timeZoneComboBox.setValue("UTC");
147+
timeZoneComboBoxIndex = 0;
117148
}
118149
}

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

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package com.github.reugn.devtools.controllers;
22

3+
import com.github.reugn.devtools.utils.Elements;
34
import com.github.reugn.devtools.utils.Logger;
45
import com.github.reugn.devtools.utils.PasswordGenerator;
56
import javafx.event.ActionEvent;
67
import javafx.fxml.FXML;
78
import javafx.fxml.Initializable;
89
import javafx.geometry.Insets;
910
import javafx.scene.control.*;
10-
import javafx.scene.layout.*;
11-
import javafx.scene.paint.Color;
11+
import javafx.scene.layout.Border;
12+
import javafx.scene.layout.VBox;
1213

1314
import java.net.URL;
1415
import java.security.InvalidParameterException;
@@ -19,37 +20,26 @@ public class GeneratorController implements Initializable, Logger {
1920

2021
@FXML
2122
private ComboBox<Integer> uuidAmount;
22-
2323
@FXML
2424
private Label uuidAmountLabel;
25-
2625
@FXML
2726
private CheckBox uuidUpperCase;
28-
2927
@FXML
3028
private CheckBox uuidHyphens;
31-
3229
@FXML
3330
private TextArea generatorResult;
34-
3531
@FXML
3632
private CheckBox pwdLowChars;
37-
3833
@FXML
3934
private CheckBox pwdDigits;
40-
4135
@FXML
4236
private CheckBox pwdUpperChars;
43-
4437
@FXML
4538
private CheckBox pwdSymbols;
46-
4739
@FXML
4840
private TextField pwdLength;
49-
5041
@FXML
5142
private Label pwdLengthLabel;
52-
5343
@FXML
5444
private Button clearButton;
5545

@@ -77,8 +67,7 @@ private void handleGeneratePasswordAction(final ActionEvent actionEvent) {
7767
pwdLength.setBorder(Border.EMPTY);
7868
length = validatePasswordLength();
7969
} catch (Exception e) {
80-
pwdLength.setBorder(new Border(new BorderStroke(Color.RED,
81-
BorderStrokeStyle.SOLID, new CornerRadii(3), BorderWidths.DEFAULT)));
70+
pwdLength.setBorder(Elements.alertBorder);
8271
return;
8372
}
8473
PasswordGenerator generator = new PasswordGenerator.PasswordGeneratorBuilder()

0 commit comments

Comments
 (0)