private UnderstaffedTabController understaffedTabController;
/**
- * Automatically called initialize() function.
+ * <p>
+ * Automatically called {@code initialize()} function.
+ * </p>
*
+ * <p>
* This is the "main" UI setup routine. For timing reasons, this will/must load
* every subtab manually to get the controller object and set the
* {@link FuelStationUIController} controller in every subtab controller
* element.
+ * </p>
*
+ * <p>
* If not done correctly, using the controller in the subtabs WILL FAIL.
+ * </p>
*
+ * <p>
* USING THE CONTROLLER OBJECT INSIDE THE {@code initialize()} FUNCTION OF THE
* SUBTABS WILL NOT WORK AND WILL ALWAYS BE {@code null} DUE TO TIMING ISSUES
+ * </p>
*/
@FXML
public void initialize() {
private FuelStationUIController parentController;
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parent) {
this.parentController = parent;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.fxml.FXML;
-import javafx.scene.Node;
-import javafx.scene.Parent;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
private FuelStationUIController parentController;
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parent) {
this.parentController = parent;
@FXML
public void refresh() {
table.getItems().clear();
- // ObservableList<FuelRow> list = FXCollections.observableArrayList();
- // table.getItems().add(new FuelRow("TestStation", "TestType", "Diesel", 123,
-
- // 999, 1.23f));
- // System.out.println("On FX thread? " + Platform.isFxApplicationThread());
for (FuelStation station : Main.fuelStations) {
for (Fuel f : station.fuels) {
- // System.out.println("Row: " +
- // parentController.getDisplayName(station) + " | " +
- // station.getClass().getSimpleName() + " | " +
- // f.FUEL_TYPE + " | " +
- // f.getStored_amount() + " | " +
- // f.CAPACITY + " | " +
- // f.getPrice());
-
table.getItems().add(
new FuelRow(
parentController.getDisplayName(station),
f.getStored_amount(),
f.CAPACITY,
f.getPrice()));
- // System.out.println("Processed " + f.toString());
}
}
- // System.out.print(list);
- // table.setItems(list);
}
-
- /**
- * This is just a debugging function. Do not use in a production environment
- *
- * @param node A displayed {@link Node} (i. e. from one of the Tabs) to display
- * a tree-like inner structure for
- * @param depth max. recursion depth
- */
- public static void printNodeTree(Node node, int depth) {
- // Indentation
- String indent = " ".repeat(depth);
-
- // Print this node
- System.out.println(indent + node.getClass().getSimpleName()
- + (node.getId() != null ? " [id=" + node.getId() + "]" : ""));
-
- // If the node is a Parent, get its children and recurse
- if (node instanceof Parent parent) {
- for (Node child : parent.getChildrenUnmodifiable()) {
- printNodeTree(child, depth + 1);
- }
- }
- }
-
}
\ No newline at end of file
private FuelStationUIController parentController;
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parent) {
this.parentController = parent;
}
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parentController) {
this.parentController = parentController;
private FuelStationUIController parentController;
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parent) {
this.parentController = parent;
private FuelStationUIController parentController;
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parent) {
this.parentController = parent;
private FuelStationUIController parentController;
/**
+ * <p>
* For timing reasons this is a common method for every controller that is for a
* tab (not to confuse with the main window controller
- * {@link FuelStationUIController}). This passes the controller object from the
+ * {@link FuelStationUIController}).
+ * </p>
+ * <p>
+ * This passes the controller object from the
* main controller to the controllers for the individual tabs as fields.
* Necessary, if you need to access any methods from the main controller, which
- * is much likely the case
+ * is much likely the case.
+ * </p>
*/
public void setParentController(FuelStationUIController parent) {
this.parentController = parent;
package de.diejungsvondertanke.tankstelle.core;
/**
- * A fuel object. Contains fuel type, price per litre, stored fuel amount and
+ * <p>
+ * A fuel object.
+ * </p>
+ * <p>
+ * Contains fuel type, price per litre, stored fuel amount and
* storage capacity for this fuel
+ * </p>
*
* @author Robin Cheney
*/
public Fuel[] fuels;
/**
- * The {@link Size Size} of a fuel station. Is more or less decorative, because
+ * <p>
+ * The {@link Size Size} of a fuel station.
+ * </p>
+ * <p>
+ * Is more or less decorative, because
* you can infer the size from the fuel station's type
+ * </p>
*/
private Size size;
throw new NoSuchFuelTypeError("This fuel station does not have fuel of the given type");
}
+ /**
+ * This function is used to get a generic simplified class name for display
+ * purposes to indicate the size of this fuel station
+ *
+ * @return {@code null} because this method should be overridden in subclasses
+ */
public String getSimpleName() {
return null;
}
*/
DIESEL("Diesel"),
/**
- * If you want to feel like saving the planet: Now with at most 10% ethanol in
+ * <p>
+ * If you want to feel like saving the planet:
+ * </p>
+ * <p>
+ * Now with at most 10% ethanol in
* your gasoline
+ * </p>
*/
SUPER_E10("Super E10"),
/**
public String toString() {
return name;
}
-
- public static FuelType toEnum(String name) {
- return FuelType.valueOf(name);
- }
}
}
/**
- * Getter method
+ * Get the name of the company running the integrated supermarket
*
* @return the name of the company running the integrated supermarket
*
return supermarket_company;
}
+ /**
+ * This function is used to get a generic simplified class name for display
+ * purposes to indicate the size of this fuel station
+ *
+ * @return the simplified name for a {@link LargeFuelStation large fuel station}
+ */
public String getSimpleName() {
return "large fuel station";
}
}
/**
- * Getter method
+ * Get the retail space in m² of this fuel station
*
* @return retail space in m²
*
return retail_space;
}
+ /**
+ * This function is used to get a generic simplified class name for display
+ * purposes to indicate the size of this fuel station
+ *
+ * @return the simplified name for a {@link MediumFuelStation medium fuel
+ * station}
+ */
public String getSimpleName() {
return "medium fuel station";
}
/**
* The size of a {@link FuelStation fuel station}. Is more or less decorative,
- * because you
- * can infer
- * the size from the fuel station's type
+ * because you can infer the size from the fuel station's type
*
* @see LargeFuelStation
* @see MediumFuelStation
}
/**
- * Getter method
+ * Get the number of drink vending machines this fuel station has
*
* @return the number of drink vending machines this fuel station has
*
return number_of_vending_machines;
}
+ /**
+ * This function is used to get a generic simplified class name for display
+ * purposes to indicate the size of this fuel station
+ *
+ * @return the simplified name for a {@link SmallFuelStation small fuel station}
+ */
public String getSimpleName() {
return "small fuel station";
}
package de.diejungsvondertanke.tankstelle.ui;
/**
- * Glorified record class for the data rows from the table. This is only used
+ * <p>
+ * Glorified record class for the data rows from the table.
+ * </p>
+ * <p>
+ * This is only used
* for the table in the "Overview" tab in the ui
+ * </p>
*
* @author Robin Cheney
*/
import java.io.IOException;
-// import de.diejungsvondertanke.tankstelle.controllers.ControllerRegistry;
import de.diejungsvondertanke.tankstelle.controllers.FuelStationUIController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
}
/**
+ * <p>
* Set the keybinds and set the default closing behaviour to run the quit()
- * function
+ * function.
+ * </p>
+ *
+ * <p>
+ * Yes, as of now, this is just for the fun of it and does not serve any
+ * practical purposes.
+ * </p>
*/
private void initializeKeybinds() {
// Override the default close behaviour
});
}
+ /**
+ * Exit the program with code 0 and call {@link #quit}
+ */
void exit() {
quit();
System.exit(0);
}
+ /**
+ * Exit the program with code {@code status} and call {@link #quit}
+ */
void exit(int status) {
quit();
System.exit(status);
}
+ /**
+ * Internal function. Just to say goodbye. That's all.
+ */
private void quit() {
System.out.println("Exiting program, have a nice day :)");
}