Skip to content

Commit 22e38a5

Browse files
committed
Clean up
1 parent 98a7af7 commit 22e38a5

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

src/main/java/org/ainm/controllers/MainController.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@
4848
public class MainController {
4949

5050
List<String> registered_projects = new ArrayList<>();
51-
String current_project_path = "";
51+
String currentProjectPath = "";
5252

5353
@FXML
54-
private Button date_button;
54+
private Button dateButton;
5555

5656
@FXML
57-
private Button time_button;
57+
private Button timeButton;
5858

5959
@FXML
6060
private TreeView<File> file_explorer;
6161

6262
@FXML
63-
private TabPane tab_pane;
63+
private TabPane tabPane;
6464

6565
@FXML
6666
private Menu RegisteredProjectsListMenu;
@@ -100,7 +100,7 @@ public void run() {
100100
});
101101
}
102102

103-
void add_subdirs(String directory, TreeItem<File> treeItem) throws IOException {
103+
void addSubdirs(String directory, TreeItem<File> treeItem) throws IOException {
104104
// List all sub dirs
105105
File[] directories = new File(directory).listFiles(File::isDirectory);
106106
for (File dir : directories) {
@@ -119,7 +119,7 @@ void add_subdirs(String directory, TreeItem<File> treeItem) throws IOException {
119119
}
120120
}
121121

122-
void open_registered_project(String directory) {
122+
void openRegisteredProject(String directory) {
123123
current_project_path = directory;
124124
Path rootFile = Paths.get(directory);
125125
TreeItem<File> rootItem = new TreeItem<>(new File(directory));
@@ -134,7 +134,7 @@ void open_registered_project(String directory) {
134134
}
135135

136136
@FXML
137-
void add_project(ActionEvent event) {
137+
void addProject(ActionEvent event) {
138138
// Register a new project and open it
139139
DirectoryChooser chooser = new DirectoryChooser();
140140
File project = chooser.showDialog(null);
@@ -144,7 +144,7 @@ void add_project(ActionEvent event) {
144144
projectMenuItem.setText(Paths.get(project.toString()).getFileName().toString());
145145
projectMenuItem.setOnAction(e -> {
146146
// Set open action to open the project, when clicked
147-
open_registered_project(project.toString());
147+
openRegisteredProject(project.toString());
148148
});
149149
RegisteredProjectsListMenu.getItems().add(projectMenuItem);
150150
open_registered_project(project.toString());
@@ -157,7 +157,7 @@ void add_project(ActionEvent event) {
157157
}
158158

159159
@FXML
160-
void delete_current_project(ActionEvent event) {
160+
void deleteCurrentProject(ActionEvent event) {
161161
// Remove the current project from the registered list
162162
registered_projects.remove(current_project_path);
163163
createProjectList();
@@ -186,70 +186,70 @@ void createProjectList() {
186186
}
187187

188188
@FXML
189-
void close_current_project(ActionEvent event) {
189+
void closeCurrentProject(ActionEvent event) {
190190
close_project();
191191
}
192192

193-
void close_project() {
193+
void closeProject() {
194194
// Close the file explorer
195-
file_explorer.setRoot(null);
196-
current_project_path = "";
195+
fileExplorer.setRoot(null);
196+
currentProjectPath = "";
197197
}
198198

199199
@FXML
200-
void open_new_window(ActionEvent event) {
200+
void openNewWindow(ActionEvent event) {
201201
try {
202202
// Open a new window in same process
203203
Parent root = FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml"));
204204
Scene scene = new Scene(root, 640, 480);
205205
Stage stage = new Stage();
206206
stage.setScene(scene);
207-
stage.setTitle("Ainm - 0.01 / Todolist");
207+
stage.setTitle("Idaes - 0.8 - Alpha");
208208
stage.show();
209209
} catch (IOException e) {
210210
e.printStackTrace();
211211
}
212212
}
213213

214214
@FXML
215-
void show_github_site(ActionEvent event) throws IOException, URISyntaxException {
215+
void showGithubSite(ActionEvent event) throws IOException, URISyntaxException {
216216
// Shows the github side of the project in the current standard browser
217217
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
218218
Desktop.getDesktop().browse(new URI("https://github.com/BenHerbst/ainm"));
219219
}
220220
}
221221

222222
@FXML
223-
void close_current_window(ActionEvent event) {
223+
void closeCurrentWindow(ActionEvent event) {
224224
// Close the current stage
225-
date_button.getScene().getWindow().hide();
225+
dateButton.getScene().getWindow().hide();
226226
}
227227

228228
@FXML
229-
void close_app(ActionEvent event) {
229+
void closeApp(ActionEvent event) {
230230
// Fully close the app
231231
Platform.exit();
232232
System.exit(0);
233233
}
234234

235235
@FXML
236-
void open_default_browser(ActionEvent event) throws IOException, URISyntaxException {
236+
void openDefaultBrowser(ActionEvent event) throws IOException, URISyntaxException {
237237
// Shows the github side of the project in the current standard browser
238238
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
239239
Desktop.getDesktop().browse(new URI("https://duckduckgo.com/"));
240240
}
241241
}
242242

243243
@FXML
244-
void open_default_mail(ActionEvent event) throws IOException, URISyntaxException {
244+
void openDefautMail(ActionEvent event) throws IOException, URISyntaxException {
245245
// Shows the github side of the project in the current standard browser
246246
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
247247
Desktop.getDesktop().mail();
248248
}
249249
}
250250

251251
@FXML
252-
void open_file_explorer(ActionEvent event) {
252+
void openFileExplorer(ActionEvent event) {
253253
// Open the file explorer in the user directory
254254
File file = new File(System.getProperty("user.home"));
255255
try {
@@ -263,7 +263,7 @@ void open_file_explorer(ActionEvent event) {
263263
}
264264

265265
@FXML
266-
void add_tab(ActionEvent event) throws IOException {
266+
void addTab(ActionEvent event) throws IOException {
267267
// Open a new empty tab
268268
Tab newTab = new Tab();
269269
newTab.setText("New tab");
@@ -274,27 +274,27 @@ void add_tab(ActionEvent event) throws IOException {
274274
}
275275

276276
@FXML
277-
void close_current_tab(ActionEvent event) {
277+
void closeCurrentTab(ActionEvent event) {
278278
// Close the current tab
279279
SingleSelectionModel<Tab> selectionModel = tab_pane.getSelectionModel();
280280
Tab currentTab = selectionModel.getSelectedItem();
281281
tab_pane.getTabs().remove(currentTab);
282282
}
283283

284284
@FXML
285-
void close_all_tabs(ActionEvent event) {
285+
void closeAllTabs(ActionEvent event) {
286286
// Close all tabs of tabpane
287287
tab_pane.getTabs().clear();
288288
}
289289

290290
@FXML
291-
void close_file(ActionEvent event) {
291+
void closeFile(ActionEvent event) {
292292
// Closes the current file and make the tab content empty
293293
get_current_tab().setContent(null);
294294
}
295295

296296
@FXML
297-
void new_todo_list(ActionEvent event) throws IOException {
297+
void newTosoList(ActionEvent event) throws IOException {
298298
if (current_project_path != "") {
299299
// Shows the create a new file dialog
300300
FXMLLoader loader = new FXMLLoader();

src/main/resources/fxml/MainView.fxml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.ainm.controllers.MainController">
1616
<left>
17-
<TreeView fx:id="file_explorer" prefHeight="352.0" prefWidth="296.0" BorderPane.alignment="CENTER">
17+
<TreeView fx:id="fileExplorer" prefHeight="352.0" prefWidth="296.0" BorderPane.alignment="CENTER">
1818
<stylesheets>
1919
<URL value="@../styles/treeview/background.css" />
2020
<URL value="@../styles/treeview/tree_cell.css" />
@@ -28,8 +28,8 @@
2828
<Button layoutX="10.0" layoutY="10.0" mnemonicParsing="false" text="Properties" />
2929
<Button layoutX="122.0" layoutY="10.0" mnemonicParsing="false" text="Messanges" />
3030
<Button layoutX="193.0" layoutY="10.0" mnemonicParsing="false" text="24°" />
31-
<Button fx:id="date_button" layoutX="272.0" layoutY="10.0" mnemonicParsing="false" text="17/10/2021" />
32-
<Button fx:id="time_button" layoutX="310.0" layoutY="10.0" mnemonicParsing="false" text="12:30" />
31+
<Button fx:id="dateButton" layoutX="272.0" layoutY="10.0" mnemonicParsing="false" text="17/10/2021" />
32+
<Button fx:id="timeButton" layoutX="310.0" layoutY="10.0" mnemonicParsing="false" text="12:30" />
3333
</items>
3434
<stylesheets>
3535
<URL value="@../styles/airbar/button.css" />
@@ -38,7 +38,7 @@
3838
</ToolBar>
3939
</bottom>
4040
<center>
41-
<TabPane fx:id="tab_pane" prefHeight="33.0" prefWidth="600.0" tabClosingPolicy="ALL_TABS" BorderPane.alignment="CENTER">
41+
<TabPane fx:id="tabPane" prefHeight="33.0" prefWidth="600.0" tabClosingPolicy="ALL_TABS" BorderPane.alignment="CENTER">
4242
<tabs>
4343
<Tab text="New tab">
4444
<content>
@@ -88,34 +88,34 @@
8888
<items>
8989
<MenuItem fx:id="menu_item_close_all_tabs" mnemonicParsing="false" onAction="#close_all_tabs" text="Close all tabs" />
9090
<MenuItem fx:id="menu_item_new_tab" mnemonicParsing="false" onAction="#add_tab" text="New tab" />
91-
<MenuItem fx:id="menu_item_close_tab" mnemonicParsing="false" onAction="#close_current_tab" text="Close tab" />
91+
<MenuItem fx:id="menuItemCloseTab" mnemonicParsing="false" onAction="#closeCurrentTab" text="Close tab" />
9292
</items>
9393
</Menu>
9494
<Menu mnemonicParsing="false" text="Projects">
9595
<items>
9696
<MenuItem disable="true" mnemonicParsing="false" text="Start new project" />
9797
<MenuItem fx:id="menu_item_add_project" mnemonicParsing="false" onAction="#add_project" text="Add project" />
9898
<MenuItem fx:id="menu_item_close_project" mnemonicParsing="false" onAction="#close_current_project" text="Close current project" />
99-
<MenuItem fx:id="menu_item_delete_project" mnemonicParsing="false" onAction="#delete_current_project" text="Delete project" />
99+
<MenuItem fx:id="menuItemDeleteProject" mnemonicParsing="false" onAction="#deleteCurrentProject" text="Delete project" />
100100
<Menu fx:id="RegisteredProjectsListMenu" mnemonicParsing="false" text="Project list" />
101101
</items>
102102
</Menu>
103103
<Menu mnemonicParsing="false" text="Window">
104104
<items>
105105
<MenuItem fx:id="menu_item_new_window" mnemonicParsing="false" onAction="#open_new_window" text="New window" />
106-
<MenuItem fx:id="menu_item_close_current_window" mnemonicParsing="false" onAction="#close_current_window" text="Close current window" />
107-
<MenuItem fx:id="menu_item_open_file_explorer" mnemonicParsing="false" onAction="#open_file_explorer" text="Open file explorer" />
108-
<MenuItem fx:id="menu_item_open_browser" mnemonicParsing="false" onAction="#open_default_browser" text="Open browser" />
109-
<MenuItem fx:id="menu_item_open_mail" mnemonicParsing="false" onAction="#open_default_mail" text="Open mail" />
106+
<MenuItem fx:id="menuItemCloseCurrentWindow" mnemonicParsing="false" onAction="#closeCurrentWindow" text="Close current window" />
107+
<MenuItem fx:id="menuItemOpenFileExplorer" mnemonicParsing="false" onAction="#openFileExplorer" text="Open file explorer" />
108+
<MenuItem fx:id="menuItemOpenBrowser" mnemonicParsing="false" onAction="#openDefaultBrowser" text="Open browser" />
109+
<MenuItem fx:id="menuItemOpenMail" mnemonicParsing="false" onAction="#openDefaultMail" text="Open mail" />
110110
<MenuItem disable="true" mnemonicParsing="false" text="Open in standard app" />
111111
</items>
112112
</Menu>
113113
<Menu mnemonicParsing="false" text="Help">
114114
<items>
115115
<MenuItem disable="true" mnemonicParsing="false" text="About" />
116-
<MenuItem fx:id="menu_item_github" mnemonicParsing="false" onAction="#show_github_site" text="Github" />
116+
<MenuItem fx:id="menuItemGithub" mnemonicParsing="false" onAction="#showGithubSite" text="Github" />
117117
<MenuItem disable="true" mnemonicParsing="false" text="Settings" />
118-
<MenuItem fx:id="menu_item_close_app" mnemonicParsing="false" onAction="#close_app" text="Close" />
118+
<MenuItem fx:id="menuItemCloseApp" mnemonicParsing="false" onAction="#closeApp" text="Close" />
119119
</items>
120120
</Menu>
121121
</menus>

0 commit comments

Comments
 (0)