Skip to content

Commit 00777cd

Browse files
committed
Clean up
1 parent 22e38a5 commit 00777cd

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class MainController {
5757
private Button timeButton;
5858

5959
@FXML
60-
private TreeView<File> file_explorer;
60+
private TreeView<File> fileExplorer;
6161

6262
@FXML
6363
private TabPane tabPane;
@@ -74,23 +74,23 @@ void initialize() {
7474
e1.printStackTrace();
7575
}
7676
// Set date from date button
77-
date_button.setText(LocalDate.now().toString());
77+
dateButton.setText(LocalDate.now().toString());
7878
Timer timer = new Timer();
7979
timer.scheduleAtFixedRate(new TimerTask() {
8080
@Override
8181
public void run() {
8282
// Updates file explorer
83-
// if (current_project_path != "") {
84-
// Platform.runLater(() -> open_registered_project(current_project_path));
83+
// if (currentProjectPath != "") {
84+
// Platform.runLater(() -> openRegisteredProject(currentProjectPath));
8585
// }
8686
// Updates the time button every 2 seconds
8787
int minutes = LocalTime.now().getMinute();
8888
int hours = LocalTime.now().getHour();
89-
Platform.runLater(() -> time_button
89+
Platform.runLater(() -> timeButton
9090
.setText(Integer.toString(hours) + ((minutes < 10) ? ":0" : ":") + Integer.toString(minutes)));
9191
}
9292
}, 0, 2000);
93-
file_explorer.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
93+
fileExplorer.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
9494
try {
9595
openFile(newValue.getValue().getAbsolutePath());
9696
} catch (IOException e) {
@@ -108,7 +108,7 @@ void addSubdirs(String directory, TreeItem<File> treeItem) throws IOException {
108108
TreeItem<File> currentDirTreeItem = new TreeItem<>(dir.getAbsoluteFile());
109109
treeItem.getChildren().add(currentDirTreeItem);
110110
// Add all subdirs / files from every subdir to tree
111-
add_subdirs(dir.getAbsolutePath(), currentDirTreeItem);
111+
addSubdirs(dir.getAbsolutePath(), currentDirTreeItem);
112112
}
113113
// List all sub files
114114
File[] files = new File(directory).listFiles(File::isFile);
@@ -120,13 +120,13 @@ void addSubdirs(String directory, TreeItem<File> treeItem) throws IOException {
120120
}
121121

122122
void openRegisteredProject(String directory) {
123-
current_project_path = directory;
123+
currentProjectPath = directory;
124124
Path rootFile = Paths.get(directory);
125125
TreeItem<File> rootItem = new TreeItem<>(new File(directory));
126-
file_explorer.setRoot(rootItem);
126+
fileExplorer.setRoot(rootItem);
127127
try {
128128
// Add all subdirs and subfiles to the tree root
129-
add_subdirs(directory, rootItem);
129+
addSubdirs(directory, rootItem);
130130
} catch (IOException e) {
131131
e.printStackTrace();
132132
}
@@ -147,7 +147,7 @@ void addProject(ActionEvent event) {
147147
openRegisteredProject(project.toString());
148148
});
149149
RegisteredProjectsListMenu.getItems().add(projectMenuItem);
150-
open_registered_project(project.toString());
150+
openRegisteredProject(project.toString());
151151
try {
152152
saveProjectList();
153153
} catch (IOException e1) {
@@ -159,9 +159,9 @@ void addProject(ActionEvent event) {
159159
@FXML
160160
void deleteCurrentProject(ActionEvent event) {
161161
// Remove the current project from the registered list
162-
registered_projects.remove(current_project_path);
162+
registered_projects.remove(currentProjectPath);
163163
createProjectList();
164-
close_project();
164+
closeProject();
165165
try {
166166
saveProjectList();
167167
} catch (IOException e1) {
@@ -179,15 +179,15 @@ void createProjectList() {
179179
projectMenuItem.setText(Paths.get(project_path).getFileName().toString());
180180
projectMenuItem.setOnAction(e -> {
181181
// Set open action to open the project, when clicked
182-
open_registered_project(project_path);
182+
openRegisteredProject(project_path);
183183
});
184184
RegisteredProjectsListMenu.getItems().add(projectMenuItem);
185185
}
186186
}
187187

188188
@FXML
189189
void closeCurrentProject(ActionEvent event) {
190-
close_project();
190+
closeProject();
191191
}
192192

193193
void closeProject() {
@@ -241,7 +241,7 @@ void openDefaultBrowser(ActionEvent event) throws IOException, URISyntaxExceptio
241241
}
242242

243243
@FXML
244-
void openDefautMail(ActionEvent event) throws IOException, URISyntaxException {
244+
void openDefaultMail(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();
@@ -267,24 +267,24 @@ void addTab(ActionEvent event) throws IOException {
267267
// Open a new empty tab
268268
Tab newTab = new Tab();
269269
newTab.setText("New tab");
270-
tab_pane.getTabs().add(newTab);
270+
tabPane.getTabs().add(newTab);
271271
// Select the tab
272-
SingleSelectionModel<Tab> selectionModel = tab_pane.getSelectionModel();
272+
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
273273
selectionModel.select(newTab);
274274
}
275275

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

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

290290
@FXML
@@ -294,16 +294,16 @@ void closeFile(ActionEvent event) {
294294
}
295295

296296
@FXML
297-
void newTosoList(ActionEvent event) throws IOException {
298-
if (current_project_path != "") {
297+
void newTodolist(ActionEvent event) throws IOException {
298+
if (currentProjectPath != "") {
299299
// Shows the create a new file dialog
300300
FXMLLoader loader = new FXMLLoader();
301301
loader.setLocation(getClass().getResource("/fxml/dialogs/CreateNewFile.fxml"));
302302
DialogPane createNewFileDialog = loader.load();
303303
// Get the control of the dialog
304304
CreateNewFileDialogController createFileDialogController = loader.getController();
305305
createFileDialogController.changeExtention(".todo");
306-
createFileDialogController.setDirectoryField(current_project_path + "/");
306+
createFileDialogController.setDirectoryField(currentProjectPath + "/");
307307
Dialog<ButtonType> dialog = new Dialog<>();
308308
dialog.setDialogPane(createNewFileDialog);
309309
dialog.setTitle("Create a new file");
@@ -405,7 +405,7 @@ void loadProjectList() throws IOException, JsonException {
405405
}
406406

407407
Tab get_current_tab() {
408-
SingleSelectionModel<Tab> selectionModel = tab_pane.getSelectionModel();
408+
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
409409
return (selectionModel.getSelectedItem());
410410
}
411411

src/main/resources/fxml/MainView.fxml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@
6565
<MenuItem disable="true" mnemonicParsing="false" text="Open" />
6666
<Menu mnemonicParsing="false" text="New">
6767
<items>
68-
<MenuItem fx:id="menu_item_new_todolist" mnemonicParsing="false" onAction="#new_todo_list" text="New Todolist" />
68+
<MenuItem fx:id="menuItemNewTodolist" mnemonicParsing="false" onAction="#newTodolist" text="New Todolist" />
6969
<MenuItem disable="true" mnemonicParsing="false" text="New Kanban" />
7070
<MenuItem disable="true" mnemonicParsing="false" text="New Calendar" />
7171
<MenuItem disable="true" mnemonicParsing="false" text="New Whiteboard" />
7272
</items>
7373
</Menu>
7474
<MenuItem fx:id="menuItemSaveAs" mnemonicParsing="false" onAction="#saveFileAs" text="Save as" />
7575
<MenuItem fx:id="menuItemSaveCurrentFile" mnemonicParsing="false" onAction="#saveCurrentFile" text="Save" />
76-
<MenuItem fx:id="menu_item_close_file" mnemonicParsing="false" onAction="#close_file" text="Close" />
76+
<MenuItem fx:id="menuItemCloseFile" mnemonicParsing="false" onAction="#closeFile" text="Close" />
7777
</items>
7878
</Menu>
7979
<Menu disable="true" mnemonicParsing="false" text="Edit">
@@ -86,23 +86,23 @@
8686
</Menu>
8787
<Menu mnemonicParsing="false" text="Navigation">
8888
<items>
89-
<MenuItem fx:id="menu_item_close_all_tabs" mnemonicParsing="false" onAction="#close_all_tabs" text="Close all tabs" />
90-
<MenuItem fx:id="menu_item_new_tab" mnemonicParsing="false" onAction="#add_tab" text="New tab" />
89+
<MenuItem fx:id="menuItemCloseAllTabs" mnemonicParsing="false" onAction="#closeAllTabs" text="Close all tabs" />
90+
<MenuItem fx:id="menuItemNewTab" mnemonicParsing="false" onAction="#addTab" text="New tab" />
9191
<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" />
97-
<MenuItem fx:id="menu_item_add_project" mnemonicParsing="false" onAction="#add_project" text="Add project" />
98-
<MenuItem fx:id="menu_item_close_project" mnemonicParsing="false" onAction="#close_current_project" text="Close current project" />
97+
<MenuItem fx:id="menuItemAddProject" mnemonicParsing="false" onAction="#addProject" text="Add project" />
98+
<MenuItem fx:id="menuItemCloseProject" mnemonicParsing="false" onAction="#closeCurrentProject" text="Close current project" />
9999
<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>
105-
<MenuItem fx:id="menu_item_new_window" mnemonicParsing="false" onAction="#open_new_window" text="New window" />
105+
<MenuItem fx:id="menuItemNewWIndow" mnemonicParsing="false" onAction="#openNewWindow" text="New window" />
106106
<MenuItem fx:id="menuItemCloseCurrentWindow" mnemonicParsing="false" onAction="#closeCurrentWindow" text="Close current window" />
107107
<MenuItem fx:id="menuItemOpenFileExplorer" mnemonicParsing="false" onAction="#openFileExplorer" text="Open file explorer" />
108108
<MenuItem fx:id="menuItemOpenBrowser" mnemonicParsing="false" onAction="#openDefaultBrowser" text="Open browser" />
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.context-menu {
2-
-fx-skin: "com.sun.javafx.scene.control.skin.ContextMenuSkin";
32
-fx-background-radius: 0 0 10 10;
43
-fx-background-color: #232323;
54
}

0 commit comments

Comments
 (0)