Small cleanup
This commit is contained in:
parent
b658a1870a
commit
3edaf61c46
@ -14,7 +14,6 @@ import app.model.Model;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
private Stage window;
|
||||
private Scene scene;
|
||||
private FXMLLoader fxmlLoader;
|
||||
private Parent fxmlRoot;
|
||||
@ -33,7 +32,6 @@ public class Main extends Application {
|
||||
* Set up a window with title and icon.
|
||||
*/
|
||||
private void setupWindow(Stage window) {
|
||||
this.window = window;
|
||||
window.setTitle(TITLE);
|
||||
window.getIcons().add(new Image(getClass().getResourceAsStream(ICON_PATH)));
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class MainController implements Initializable {
|
||||
|
||||
/**
|
||||
* Change the CSS according to which language is being used.
|
||||
* @param event The event containing data about the language to switch to
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe
|
||||
private void handle(LanguageChangedEvent event) {
|
||||
@ -73,6 +73,10 @@ public class MainController implements Initializable {
|
||||
Model.getScene().getStylesheets().add(nextStyleSheet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an exit request for the whole program.
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe
|
||||
private void handle(ExitApplicationEvent event) {
|
||||
// TODO: send save file event, exit application safely.
|
||||
|
@ -30,6 +30,21 @@ public class MenubarController implements Initializable, Controller {
|
||||
@FXML
|
||||
private ToggleGroup languageToggleGroup;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventBus(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
this.eventBus.register(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* FILE */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
@FXML
|
||||
public String handleOpenFile() {
|
||||
FileChooser fc = new FileChooser();
|
||||
@ -72,21 +87,6 @@ public class MenubarController implements Initializable, Controller {
|
||||
// fc.showOpenDialog(stage);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventBus(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
this.eventBus.register(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* FILE */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* Handles the event where the language was change from the menu.
|
||||
* @param event
|
||||
@ -116,6 +116,15 @@ public class MenubarController implements Initializable, Controller {
|
||||
this.eventBus.post(new ToggleCommentEvent());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ABOUT */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* SUBSCRIPTIONS */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* Updates menubuttons whenever the language is changed
|
||||
* @param event
|
||||
@ -132,8 +141,4 @@ public class MenubarController implements Initializable, Controller {
|
||||
.setSelected(true);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ABOUT */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ public class ModelineController implements Initializable, Controller {
|
||||
*/
|
||||
@Subscribe
|
||||
private void handle(FileSaveStateChangedEvent event) {
|
||||
// TODO: Add CSS styleclass for coloring the saveState label
|
||||
// whenever it changes
|
||||
this.saveState.setText(event.getIsSaved() ? "Saved!" : "Modified");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package app.events;
|
||||
|
||||
public class ExitApplicationEvent {
|
||||
public class ExitApplicationEvent extends Event {
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package app.events;
|
||||
|
||||
import app.model.Model;
|
||||
|
||||
public class FileSaveStateChangedEvent {
|
||||
public class FileSaveStateChangedEvent extends Event {
|
||||
|
||||
private boolean isSaved;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.events;
|
||||
|
||||
import app.languages.Java;
|
||||
import app.languages.Markdown;
|
||||
import app.model.languages.Java;
|
||||
import app.model.languages.Markdown;
|
||||
import app.model.Model;
|
||||
|
||||
public class LanguageChangedEvent extends Event {
|
||||
|
@ -1,5 +1,5 @@
|
||||
package app.events;
|
||||
|
||||
public class ToggleCommentEvent {
|
||||
public class ToggleCommentEvent extends Event {
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.languages;
|
||||
package app.model.languages;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.AbstractMap;
|
@ -1,4 +1,4 @@
|
||||
package app.languages;
|
||||
package app.model.languages;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.AbstractMap;
|
Loading…
Reference in New Issue
Block a user