Skip to content

Commit a11f0b3

Browse files
committed
Rename comment to description and improve style of save window
1 parent 01493a1 commit a11f0b3

File tree

10 files changed

+62
-43
lines changed

10 files changed

+62
-43
lines changed

src/main/java/com/github/introfog/rgit/controller/ExecuteController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class ExecuteController extends BaseController {
4444
private TextField command;
4545

4646
@FXML
47-
private TextField comment;
47+
private TextField description;
4848

4949
@FXML
5050
private Button run;
@@ -101,7 +101,7 @@ protected void updateSavedCommand() {
101101
@FXML
102102
protected void cleanSavedCommand() {
103103
command.clear();
104-
comment.clear();
104+
description.clear();
105105
savedCommand = null;
106106
switchToSavedCommand(false);
107107
}
@@ -121,7 +121,7 @@ protected void saveCommand() {
121121
if (command.getText().isEmpty()) {
122122
DialogFactory.createErrorAlert("Invalid command", "Command can't be empty");
123123
} else {
124-
final CommandDto commandDto = new CommandDto(command.getText(), comment.getText());
124+
final CommandDto commandDto = new CommandDto(command.getText(), description.getText());
125125
AppConfig.getInstance().addCommand(commandDto);
126126
setCommand(commandDto);
127127
}
@@ -173,7 +173,7 @@ protected void foundIssue() {
173173

174174
void setCommand(CommandDto commandDto) {
175175
command.setText(commandDto.getCommand());
176-
comment.setText(commandDto.getComment());
176+
description.setText(commandDto.getDescription());
177177
savedCommand = commandDto;
178178
switchToSavedCommand(true);
179179
}

src/main/java/com/github/introfog/rgit/controller/ExploreController.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ protected void commitCommand(CellEditEvent<CommandDto, String> event) {
6464
}
6565

6666
@FXML
67-
protected void commitComment(CellEditEvent<CommandDto, String> event) {
68-
event.getRowValue().setComment(event.getNewValue());
69-
AppConfig.getInstance().updateCommandComment(event.getRowValue(), event.getNewValue());
67+
protected void commitDescription(CellEditEvent<CommandDto, String> event) {
68+
event.getRowValue().setDescription(event.getNewValue());
69+
AppConfig.getInstance().updateCommandDescription(event.getRowValue(), event.getNewValue());
7070
}
7171

7272
@FXML
@@ -120,8 +120,8 @@ private void fillTable() {
120120
commandTableColumn.setCellValueFactory(new PropertyValueFactory<>("command"));
121121
commandTableColumn.setCellFactory(TextFieldTableCell.forTableColumn());
122122

123-
final TableColumn<CommandDto, String> commentTableColumn = (TableColumn<CommandDto, String>) commandsTable.getColumns().get(1);
124-
commentTableColumn.setCellValueFactory(new PropertyValueFactory<>("comment"));
125-
commentTableColumn.setCellFactory(TextFieldTableCell.forTableColumn());
123+
final TableColumn<CommandDto, String> descriptionTableColumn = (TableColumn<CommandDto, String>) commandsTable.getColumns().get(1);
124+
descriptionTableColumn.setCellValueFactory(new PropertyValueFactory<>("description"));
125+
descriptionTableColumn.setCellFactory(TextFieldTableCell.forTableColumn());
126126
}
127127
}

src/main/java/com/github/introfog/rgit/controller/SaveController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public class SaveController extends BaseController {
3232

3333
@FXML
3434
private TextField command;
35-
// TODO what if define long command or comment? Set some limit.
35+
// TODO what if define long command or description? Set some limit.
3636
@FXML
37-
private TextField comment;
37+
private TextField description;
3838

3939
private ExploreController exploreController;
4040

@@ -61,7 +61,7 @@ protected void save() {
6161
if (command.getText().isEmpty()) {
6262
DialogFactory.createErrorAlert("Invalid command", "Command can't be empty");
6363
} else if (exploreController != null){
64-
final CommandDto commandDto = new CommandDto(command.getText(), comment.getText());
64+
final CommandDto commandDto = new CommandDto(command.getText(), description.getText());
6565
if (AppConfig.getInstance().containsCommand(commandDto)) {
6666
DialogFactory.createErrorAlert("Save error", "The same command already exists");
6767
} else {

src/main/java/com/github/introfog/rgit/controller/UpdateController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public class UpdateController extends BaseController {
3131

3232
@FXML
3333
private TextField command;
34-
// TODO what if define long command or comment? Set some limit.
34+
// TODO what if define long command or description? Set some limit.
3535
@FXML
36-
private TextField comment;
36+
private TextField description;
3737

3838
private CommandDto initialCommand;
3939

@@ -55,7 +55,7 @@ protected void saveAsNew() {
5555
if (command.getText().isEmpty()) {
5656
DialogFactory.createErrorAlert("Invalid command", "Command can't be empty");
5757
} else if (executeController != null) {
58-
final CommandDto commandDto = new CommandDto(command.getText(), comment.getText());
58+
final CommandDto commandDto = new CommandDto(command.getText(), description.getText());
5959
if (commandDto.equals(initialCommand)) {
6060
DialogFactory.createErrorAlert("Save error", "The same command already exists");
6161
} else {
@@ -73,7 +73,7 @@ protected void updateExisted() {
7373
if (command.getText().isEmpty()) {
7474
DialogFactory.createErrorAlert("Invalid command", "Command can't be empty");
7575
} else if (executeController != null) {
76-
final CommandDto currentCommand = new CommandDto(command.getText(), comment.getText());
76+
final CommandDto currentCommand = new CommandDto(command.getText(), description.getText());
7777
AppConfig.getInstance().updateExistedCommand(initialCommand, currentCommand);
7878
executeController.setCommand(currentCommand);
7979
closeStage();
@@ -89,6 +89,6 @@ void setExecuteController(ExecuteController executeController) {
8989
void setCommand(CommandDto commandDto) {
9090
this.initialCommand = commandDto;
9191
command.setText(commandDto.getCommand());
92-
comment.setText(commandDto.getComment());
92+
description.setText(commandDto.getDescription());
9393
}
9494
}

src/main/java/com/github/introfog/rgit/model/AppConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public void updateCommandScript(CommandDto commandDto, String newCommand) {
104104
saveConfig();
105105
}
106106

107-
public void updateCommandComment(CommandDto commandDto, String newComment) {
107+
public void updateCommandDescription(CommandDto commandDto, String newDescription) {
108108
final List<CommandDto> commands = config.getCommands();
109-
commands.get(commands.indexOf(commandDto)).setComment(newComment);
109+
commands.get(commands.indexOf(commandDto)).setDescription(newDescription);
110110
saveConfig();
111111
}
112112

src/main/java/com/github/introfog/rgit/model/dto/CommandDto.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
public class CommandDto {
2323
@JsonProperty("command")
2424
private String command;
25-
@JsonProperty("comment")
26-
private String comment;
25+
@JsonProperty("description")
26+
private String description;
2727

2828
public CommandDto(@JsonProperty("command") String command,
29-
@JsonProperty("comment") String comment) {
29+
@JsonProperty("description") String description) {
3030
this.command = command;
31-
this.comment = comment;
31+
this.description = description;
3232
}
3333

3434
public String getCommand() {
@@ -39,12 +39,12 @@ public void setCommand(String command) {
3939
this.command = command;
4040
}
4141

42-
public String getComment() {
43-
return comment;
42+
public String getDescription() {
43+
return description;
4444
}
4545

46-
public void setComment(String comment) {
47-
this.comment = comment;
46+
public void setDescription(String description) {
47+
this.description = description;
4848
}
4949

5050
@Override
@@ -56,11 +56,11 @@ public boolean equals(Object o) {
5656
return false;
5757
}
5858
CommandDto that = (CommandDto) o;
59-
return Objects.equals(command, that.command) && Objects.equals(comment, that.comment);
59+
return Objects.equals(command, that.command) && Objects.equals(description, that.description);
6060
}
6161

6262
@Override
6363
public int hashCode() {
64-
return Objects.hash(command, comment);
64+
return Objects.hash(command, description);
6565
}
6666
}

src/main/resources/com/github/introfog/rgit/view/executor.fxml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
<TextField fx:id="directory" layoutX="32.0" layoutY="78.0" prefHeight="25.0" prefWidth="378.0" />
1616
<Button layoutX="470.0" layoutY="78.0" mnemonicParsing="false" onAction="#browseDirectory" text="Browse" />
1717
<TextField fx:id="command" layoutX="32.0" layoutY="146.0" prefHeight="25.0" prefWidth="378.0" />
18-
<Label layoutX="32.0" layoutY="115.0" text="Define git command" />
18+
<Label layoutX="32.0" layoutY="115.0" text="Command" />
1919
<Button fx:id="run" layoutX="452.0" layoutY="146.0" mnemonicParsing="false" onAction="#runCommand" text="Run" />
2020
<Button fx:id="save" layoutX="525.0" layoutY="146.0" mnemonicParsing="false" onAction="#saveCommand" text="Save" />
2121
<Button layoutX="243.0" layoutY="251.0" mnemonicParsing="false" onAction="#chooseFromSaved" text="Choose from saved" />
22-
<TextField fx:id="comment" layoutX="32.0" layoutY="207.0" prefHeight="25.0" prefWidth="378.0" />
23-
<Label layoutX="32.0" layoutY="180.0" text="Comment to command" />
22+
<TextField fx:id="description" layoutX="32.0" layoutY="207.0" prefHeight="25.0" prefWidth="378.0" />
23+
<Label layoutX="32.0" layoutY="180.0" text="Description" />
2424
<Button fx:id="update" disable="true" layoutX="443.0" layoutY="207.0" mnemonicParsing="false" onAction="#updateSavedCommand" text="Update" />
2525
<Button fx:id="clean" disable="true" layoutX="523.0" layoutY="207.0" mnemonicParsing="false" onAction="#cleanSavedCommand" text="Clean" />
2626
<MenuBar layoutY="2.0" prefHeight="25.0" prefWidth="600.0">

src/main/resources/com/github/introfog/rgit/view/explorer.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<TableView fx:id="commandsTable" editable="true" prefHeight="223.0" prefWidth="600.0">
1010
<columns>
1111
<TableColumn onEditCommit="#commitCommand" prefWidth="299.0" text="Command" />
12-
<TableColumn onEditCommit="#commitComment" prefWidth="300.0" text="Comment" />
12+
<TableColumn onEditCommit="#commitDescription" prefWidth="300.0" text="Description" />
1313
</columns>
1414
</TableView>
1515
<Button layoutX="72.0" layoutY="236.0" mnemonicParsing="false" onAction="#removeSelectedCommand" text="Remove selected" />

src/main/resources/com/github/introfog/rgit/view/saver.fxml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,32 @@
44
<?import javafx.scene.control.Label?>
55
<?import javafx.scene.control.TextField?>
66
<?import javafx.scene.layout.AnchorPane?>
7-
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.github.introfog.rgit.controller.SaveController">
7+
<?import javafx.scene.text.Font?>
8+
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="182.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.github.introfog.rgit.controller.SaveController">
89
<children>
9-
<Label layoutX="26.0" layoutY="22.0" text="Command" />
10-
<TextField fx:id="command" layoutX="26.0" layoutY="39.0" prefHeight="25.0" prefWidth="448.0" />
11-
<Label layoutX="26.0" layoutY="75.0" text="Comment" />
12-
<TextField fx:id="comment" layoutX="26.0" layoutY="92.0" prefHeight="25.0" prefWidth="448.0" />
13-
<Button layoutX="116.0" layoutY="144.0" mnemonicParsing="false" onAction="#save" text="Save" />
14-
<Button layoutX="325.0" layoutY="144.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
10+
<Label layoutX="27.0" layoutY="21.0" text="Command*">
11+
<font>
12+
<Font name="Verdana" size="14.0" />
13+
</font></Label>
14+
<TextField fx:id="command" layoutX="26.0" layoutY="39.0" prefHeight="25.0" prefWidth="448.0" promptText="Bash command">
15+
<font>
16+
<Font name="Verdana" size="12.0" />
17+
</font></TextField>
18+
<Label layoutX="27.0" layoutY="75.0" text="Description">
19+
<font>
20+
<Font name="Verdana" size="14.0" />
21+
</font></Label>
22+
<TextField fx:id="description" layoutX="26.0" layoutY="92.0" prefHeight="25.0" prefWidth="448.0">
23+
<font>
24+
<Font name="Verdana" size="12.0" />
25+
</font></TextField>
26+
<Button layoutX="428.0" layoutY="139.0" mnemonicParsing="false" onAction="#save" text="Save">
27+
<font>
28+
<Font name="Verdana" size="12.0" />
29+
</font></Button>
30+
<Button layoutX="357.0" layoutY="139.0" mnemonicParsing="false" onAction="#cancel" text="Cancel">
31+
<font>
32+
<Font name="Verdana" size="12.0" />
33+
</font></Button>
1534
</children>
1635
</AnchorPane>

src/main/resources/com/github/introfog/rgit/view/updater.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<children>
99
<Label layoutX="26.0" layoutY="22.0" text="Command" />
1010
<TextField fx:id="command" layoutX="26.0" layoutY="39.0" prefHeight="25.0" prefWidth="448.0" />
11-
<Label layoutX="26.0" layoutY="75.0" text="Comment" />
12-
<TextField fx:id="comment" layoutX="26.0" layoutY="92.0" prefHeight="25.0" prefWidth="448.0" />
11+
<Label layoutX="26.0" layoutY="75.0" text="Description" />
12+
<TextField fx:id="description" layoutX="26.0" layoutY="92.0" prefHeight="25.0" prefWidth="448.0" />
1313
<Button layoutX="26.0" layoutY="144.0" mnemonicParsing="false" onAction="#saveAsNew" text="Save as new" />
1414
<Button layoutX="422.0" layoutY="144.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
1515
<Button layoutX="202.0" layoutY="144.0" mnemonicParsing="false" onAction="#updateExisted" text="Update existed" />

0 commit comments

Comments
 (0)