JavaDoc for controller classes
This commit is contained in:
parent
0257dd9bf0
commit
d725367f4d
|
@ -31,6 +31,9 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the CropDetail.fxml file
|
||||||
|
*/
|
||||||
public class CropDetailController {
|
public class CropDetailController {
|
||||||
private Crop crop;
|
private Crop crop;
|
||||||
|
|
||||||
|
@ -141,6 +144,9 @@ public class CropDetailController {
|
||||||
setCellFactoryTasks();
|
setCellFactoryTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cell Factory for TaskListView
|
||||||
|
*/
|
||||||
private void setCellFactoryTasks() {
|
private void setCellFactoryTasks() {
|
||||||
taskList_listView.setCellFactory(param -> new ListCell<>() {
|
taskList_listView.setCellFactory(param -> new ListCell<>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -158,6 +164,9 @@ public class CropDetailController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cell Factory for PestListView
|
||||||
|
*/
|
||||||
private void setCellFactoryPests() {
|
private void setCellFactoryPests() {
|
||||||
pests_listView.setCellFactory(param -> new ListCell<>() {
|
pests_listView.setCellFactory(param -> new ListCell<>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -175,6 +184,10 @@ public class CropDetailController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update task list
|
||||||
|
* @param crop {@link Crop} that is selected
|
||||||
|
*/
|
||||||
private void setTaskListProperty(Crop crop) {
|
private void setTaskListProperty(Crop crop) {
|
||||||
crop.getCropId().ifPresent(id -> {
|
crop.getCropId().ifPresent(id -> {
|
||||||
List<Task> taskList;
|
List<Task> taskList;
|
||||||
|
@ -189,6 +202,11 @@ public class CropDetailController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link HBox} for the given {@link Task}.
|
||||||
|
* @param task {@link Task} which is selected
|
||||||
|
* @return {@link HBox} that was created
|
||||||
|
*/
|
||||||
private HBox createTaskHBox(Task task) {
|
private HBox createTaskHBox(Task task) {
|
||||||
HBox hBox = new HBox(10);
|
HBox hBox = new HBox(10);
|
||||||
Label taskName = new Label(task.getName()+": ");
|
Label taskName = new Label(task.getName()+": ");
|
||||||
|
@ -215,6 +233,11 @@ public class CropDetailController {
|
||||||
return hBox;
|
return hBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link HBox} for the given {@link Pest}.
|
||||||
|
* @param pest {@link Pest} which is selected
|
||||||
|
* @return {@link HBox} that was created
|
||||||
|
*/
|
||||||
private HBox createPestHBox(Pest pest) {
|
private HBox createPestHBox(Pest pest) {
|
||||||
Label label = new Label(pest.name() + ": ");
|
Label label = new Label(pest.name() + ": ");
|
||||||
label.setStyle("-fx-font-weight: bold");
|
label.setStyle("-fx-font-weight: bold");
|
||||||
|
@ -241,6 +264,11 @@ public class CropDetailController {
|
||||||
button.setGraphic(imageView);
|
button.setGraphic(imageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* opens dialog of {@link Task} edit.
|
||||||
|
* @param task {@link Task}
|
||||||
|
* @return {@link EventHandler} for the case of editing a {@link Task}
|
||||||
|
*/
|
||||||
private EventHandler<ActionEvent> getEditTaskEvent(Task task) {
|
private EventHandler<ActionEvent> getEditTaskEvent(Task task) {
|
||||||
return (event) -> {
|
return (event) -> {
|
||||||
try {
|
try {
|
||||||
|
@ -251,12 +279,24 @@ public class CropDetailController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* opens alert of {@link Task} deletion.
|
||||||
|
* @param task {@link Task}
|
||||||
|
* @return {@link EventHandler} for the case of deleting a {@link Task}
|
||||||
|
*/
|
||||||
private EventHandler<ActionEvent> deleteTask(Task task) {
|
private EventHandler<ActionEvent> deleteTask(Task task) {
|
||||||
return (event) -> {
|
return (event) -> {
|
||||||
showDeleteTask(task);
|
showDeleteTask(task);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* opens a dialog to create a new Task or edit the given Task
|
||||||
|
* @param newTask boolean if it is a new Task
|
||||||
|
* @param givenTask {@link Task} which was selected
|
||||||
|
* @throws IOException Exception
|
||||||
|
* @throws HardinessZoneNotSetException Exception
|
||||||
|
*/
|
||||||
private void createTaskDialog(boolean newTask, Task givenTask) throws IOException, HardinessZoneNotSetException {
|
private void createTaskDialog(boolean newTask, Task givenTask) throws IOException, HardinessZoneNotSetException {
|
||||||
Dialog<Task> dialog = new Dialog<>();
|
Dialog<Task> dialog = new Dialog<>();
|
||||||
dialog.setTitle("Set Task");
|
dialog.setTitle("Set Task");
|
||||||
|
@ -299,6 +339,10 @@ public class CropDetailController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* opens TextField Dialog to enter the plant area.
|
||||||
|
* @throws IOException Exception
|
||||||
|
*/
|
||||||
private void openTextFieldDialog() throws IOException {
|
private void openTextFieldDialog() throws IOException {
|
||||||
Dialog<String> dialog = new Dialog<>();
|
Dialog<String> dialog = new Dialog<>();
|
||||||
dialog.setTitle("set Text Area");
|
dialog.setTitle("set Text Area");
|
||||||
|
@ -329,6 +373,10 @@ public class CropDetailController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alert to delete Task.
|
||||||
|
* @param task {@link Task} which is being deleted
|
||||||
|
*/
|
||||||
private void showDeleteTask(Task task) {
|
private void showDeleteTask(Task task) {
|
||||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||||
alert.setTitle("Delete " + task.getName());
|
alert.setTitle("Delete " + task.getName());
|
||||||
|
|
|
@ -8,6 +8,9 @@ import javafx.scene.image.ImageView;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the Home.fxml file
|
||||||
|
*/
|
||||||
public class HomeController implements Initializable {
|
public class HomeController implements Initializable {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -34,6 +37,11 @@ public class HomeController implements Initializable {
|
||||||
setImages(imageViewPhilippe, "");
|
setImages(imageViewPhilippe, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set image to image view
|
||||||
|
* @param imageView the imageView to update
|
||||||
|
* @param photoName the file name of the photo
|
||||||
|
*/
|
||||||
private void setImages(ImageView imageView, String photoName) {
|
private void setImages(ImageView imageView, String photoName) {
|
||||||
Image img;
|
Image img;
|
||||||
if (photoName.equals("")) {
|
if (photoName.equals("")) {
|
||||||
|
|
|
@ -19,6 +19,9 @@ import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the MainFXML.fxml file
|
||||||
|
*/
|
||||||
public class MainFXMLController {
|
public class MainFXMLController {
|
||||||
private static final Logger LOG = Logger.getLogger(MainFXMLController.class.getName());
|
private static final Logger LOG = Logger.getLogger(MainFXMLController.class.getName());
|
||||||
|
|
||||||
|
@ -176,6 +179,10 @@ public class MainFXMLController {
|
||||||
tutorial_button.visibleProperty().bind(Settings.getInstance().getShowTutorialProperty());
|
tutorial_button.visibleProperty().bind(Settings.getInstance().getShowTutorialProperty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* close Tutorial Window
|
||||||
|
* @param windowEvent event
|
||||||
|
*/
|
||||||
private void closeWindowHandler(WindowEvent windowEvent) {
|
private void closeWindowHandler(WindowEvent windowEvent) {
|
||||||
tutorialModal.close();
|
tutorialModal.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,9 @@ import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the MyGarden.fxml file
|
||||||
|
*/
|
||||||
public class MyGardenController {
|
public class MyGardenController {
|
||||||
private static final Logger LOG = Logger.getLogger(MyGardenController.class.getName());
|
private static final Logger LOG = Logger.getLogger(MyGardenController.class.getName());
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -27,6 +27,9 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the MySchedule.fxml file
|
||||||
|
*/
|
||||||
public class MyScheduleController {
|
public class MyScheduleController {
|
||||||
private static final Logger LOG = Logger.getLogger(MyScheduleController.class.getName());
|
private static final Logger LOG = Logger.getLogger(MyScheduleController.class.getName());
|
||||||
private final ListProperty<List<Task>> taskListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
private final ListProperty<List<Task>> taskListProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||||
|
@ -65,6 +68,9 @@ public class MyScheduleController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sort scheduler to selected crop
|
||||||
|
*/
|
||||||
private void lookForSelectedListEntries() {
|
private void lookForSelectedListEntries() {
|
||||||
scheduledPlants_listview.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
scheduledPlants_listview.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
selectedCrop = newValue;
|
selectedCrop = newValue;
|
||||||
|
@ -76,6 +82,9 @@ public class MyScheduleController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set cellFactory for the crops.
|
||||||
|
*/
|
||||||
private void setCellFactoryCropListView() {
|
private void setCellFactoryCropListView() {
|
||||||
scheduledPlants_listview.setCellFactory(param -> new ListCell<>() {
|
scheduledPlants_listview.setCellFactory(param -> new ListCell<>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,6 +107,9 @@ public class MyScheduleController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set CallFactory for the given Tasks
|
||||||
|
*/
|
||||||
private void setCellFactoryTaskListView() {
|
private void setCellFactoryTaskListView() {
|
||||||
week_listView.setCellFactory(param -> new ListCell<>() {
|
week_listView.setCellFactory(param -> new ListCell<>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,6 +127,10 @@ public class MyScheduleController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update task list
|
||||||
|
* @throws IOException exception
|
||||||
|
*/
|
||||||
private void loadTaskList() throws IOException {
|
private void loadTaskList() throws IOException {
|
||||||
List<List<Task>> taskLists;
|
List<List<Task>> taskLists;
|
||||||
if (selectedCrop != null) {
|
if (selectedCrop != null) {
|
||||||
|
@ -126,6 +142,12 @@ public class MyScheduleController {
|
||||||
taskListProperty.addAll(taskLists);
|
taskListProperty.addAll(taskLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a {@link VBox} of the given TaskList.
|
||||||
|
* @param tasks List of {@link Task}s
|
||||||
|
* @param dayIndex index of the day
|
||||||
|
* @return {@link VBox} of the given Task of the day
|
||||||
|
*/
|
||||||
private VBox weekTaskVBox(List<Task> tasks, int dayIndex) {
|
private VBox weekTaskVBox(List<Task> tasks, int dayIndex) {
|
||||||
VBox vBox = new VBox(10);
|
VBox vBox = new VBox(10);
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
|
@ -28,6 +28,9 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the Plants.fxml file
|
||||||
|
*/
|
||||||
public class PlantsController {
|
public class PlantsController {
|
||||||
private static final Logger LOG = Logger.getLogger(PlantsController.class.getName());
|
private static final Logger LOG = Logger.getLogger(PlantsController.class.getName());
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ import javafx.util.Callback;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the SelectSowDay.fxml file
|
||||||
|
* Gets opened with a dialog.
|
||||||
|
*/
|
||||||
public class SelectSowDayController {
|
public class SelectSowDayController {
|
||||||
private Plant selectedPlant;
|
private Plant selectedPlant;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the Settings.fxml file
|
||||||
|
*/
|
||||||
public class SettingsController implements Initializable {
|
public class SettingsController implements Initializable {
|
||||||
Settings settings = Settings.getInstance();
|
Settings settings = Settings.getInstance();
|
||||||
|
|
||||||
|
@ -31,6 +34,11 @@ public class SettingsController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
private Label location_label;
|
private Label location_label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* open dialog to set location
|
||||||
|
* @param event event
|
||||||
|
* @throws IOException exception
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
void setLocation(ActionEvent event) throws IOException {
|
void setLocation(ActionEvent event) throws IOException {
|
||||||
openTextFieldDialog();
|
openTextFieldDialog();
|
||||||
|
@ -71,6 +79,10 @@ public class SettingsController implements Initializable {
|
||||||
button.setGraphic(imageView);
|
button.setGraphic(imageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* opens Dialog to set exception
|
||||||
|
* @throws IOException exception
|
||||||
|
*/
|
||||||
private void openTextFieldDialog() throws IOException {
|
private void openTextFieldDialog() throws IOException {
|
||||||
Dialog<String> dialog = new Dialog<>();
|
Dialog<String> dialog = new Dialog<>();
|
||||||
dialog.setTitle("Set Location of your Garden");
|
dialog.setTitle("Set Location of your Garden");
|
||||||
|
|
|
@ -19,6 +19,9 @@ import java.net.URL;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the TaskFormular.fxml file
|
||||||
|
*/
|
||||||
public class TaskFormularController implements Initializable {
|
public class TaskFormularController implements Initializable {
|
||||||
private Crop crop;
|
private Crop crop;
|
||||||
private Plant plant;
|
private Plant plant;
|
||||||
|
@ -49,6 +52,11 @@ public class TaskFormularController implements Initializable {
|
||||||
@AfterInject
|
@AfterInject
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the edited or added {@link Task}
|
||||||
|
* @param crop {@link Crop} which was selected
|
||||||
|
* @return {@link Task} which was edited or added
|
||||||
|
*/
|
||||||
public Task returnResult(Crop crop) {
|
public Task returnResult(Crop crop) {
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
if (!(interval_field.getText().isEmpty() || interval_field.getText().equals(""))) {
|
if (!(interval_field.getText().isEmpty() || interval_field.getText().equals(""))) {
|
||||||
|
@ -61,11 +69,21 @@ public class TaskFormularController implements Initializable {
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set selected crop and get the plant from the crop.
|
||||||
|
* @param crop {@link Crop} which was selected
|
||||||
|
* @throws HardinessZoneNotSetException exception
|
||||||
|
* @throws IOException exception
|
||||||
|
*/
|
||||||
public void setCorp(Crop crop) throws HardinessZoneNotSetException, IOException {
|
public void setCorp(Crop crop) throws HardinessZoneNotSetException, IOException {
|
||||||
this.crop = crop;
|
this.crop = crop;
|
||||||
this.plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
|
this.plant = plantList.getPlantById(Settings.getInstance().getCurrentHardinessZone(), crop.getPlantId()).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the values of task into the labels and datePicker.
|
||||||
|
* @param task {@link Task} which was given
|
||||||
|
*/
|
||||||
public void setTaskValue(Task task) {
|
public void setTaskValue(Task task) {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
taskName_field.setText(task.getName());
|
taskName_field.setText(task.getName());
|
||||||
|
@ -79,6 +97,10 @@ public class TaskFormularController implements Initializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dayCellFactory of the start date
|
||||||
|
* @return {@link Callback} of the dayCellFactory
|
||||||
|
*/
|
||||||
private Callback<DatePicker, DateCell> getDayCellFactoryStartDate() {
|
private Callback<DatePicker, DateCell> getDayCellFactoryStartDate() {
|
||||||
|
|
||||||
return (datePicker) -> new DateCell() {
|
return (datePicker) -> new DateCell() {
|
||||||
|
@ -103,6 +125,10 @@ public class TaskFormularController implements Initializable {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dayCellFactory of the end date
|
||||||
|
* @return {@link Callback} of the dayCellFactory
|
||||||
|
*/
|
||||||
private Callback<DatePicker, DateCell> getDayCellFactoryEndDate() {
|
private Callback<DatePicker, DateCell> getDayCellFactoryEndDate() {
|
||||||
|
|
||||||
return (datePicker) -> new DateCell() {
|
return (datePicker) -> new DateCell() {
|
||||||
|
@ -127,6 +153,10 @@ public class TaskFormularController implements Initializable {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* disable button until condition meet.
|
||||||
|
* @param button {@link Button} which was given
|
||||||
|
*/
|
||||||
public void initSaveButton(Button button) {
|
public void initSaveButton(Button button) {
|
||||||
interval_field.textProperty().addListener((observable, oldValue, newValue) -> {
|
interval_field.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
|
@ -139,6 +169,16 @@ public class TaskFormularController implements Initializable {
|
||||||
.or(description_area.textProperty().isEmpty()));
|
.or(description_area.textProperty().isEmpty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initialize dayCellFactories
|
||||||
|
* @param location
|
||||||
|
* The location used to resolve relative paths for the root object, or
|
||||||
|
* {@code null} if the location is not known.
|
||||||
|
*
|
||||||
|
* @param resources
|
||||||
|
* The resources used to localize the root object, or {@code null} if
|
||||||
|
* the root object was not localized.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
start_datePicker.setDayCellFactory(getDayCellFactoryStartDate());
|
start_datePicker.setDayCellFactory(getDayCellFactoryStartDate());
|
||||||
|
|
|
@ -5,6 +5,9 @@ import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the TexFieldFormular.fxml file
|
||||||
|
*/
|
||||||
public class TextFieldFormularController {
|
public class TextFieldFormularController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -14,18 +17,34 @@ public class TextFieldFormularController {
|
||||||
private TextField text_area;
|
private TextField text_area;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set description label
|
||||||
|
* @param string string of the description
|
||||||
|
*/
|
||||||
public void setDescription_label(String string) {
|
public void setDescription_label(String string) {
|
||||||
description_label.setText(string);
|
description_label.setText(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set text area value
|
||||||
|
* @param string string of text area value
|
||||||
|
*/
|
||||||
public void setValueTextArea(String string) {
|
public void setValueTextArea(String string) {
|
||||||
text_area.setText(string);
|
text_area.setText(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return value of text area
|
||||||
|
* @return string of the tex area
|
||||||
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return text_area.getText();
|
return text_area.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable Button until condition meet
|
||||||
|
* @param button {@link Button} which is gets dissabled
|
||||||
|
*/
|
||||||
public void initSaveButton(Button button) {
|
public void initSaveButton(Button button) {
|
||||||
text_area.textProperty().addListener((observable, oldValue, newValue) -> {
|
text_area.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (newValue.matches("\\d*\\.?\\d*")) {
|
if (newValue.matches("\\d*\\.?\\d*")) {
|
||||||
|
|
|
@ -8,6 +8,9 @@ import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller class for the Tutorial.fxml file
|
||||||
|
*/
|
||||||
public class TutorialController {
|
public class TutorialController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -44,16 +47,25 @@ public class TutorialController {
|
||||||
setButtonAbilities();
|
setButtonAbilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* disable next or close button according to the location of button
|
||||||
|
*/
|
||||||
private void setButtonAbilities() {
|
private void setButtonAbilities() {
|
||||||
previousPageButton.setDisable(page <= 0);
|
previousPageButton.setDisable(page <= 0);
|
||||||
nextPageButton.setDisable(page >= tourPages.getChildren().size() - 1);
|
nextPageButton.setDisable(page >= tourPages.getChildren().size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* switch to next view
|
||||||
|
*/
|
||||||
private void switchViews() {
|
private void switchViews() {
|
||||||
tourPages.getChildren().forEach(node -> node.setOpacity(0));
|
tourPages.getChildren().forEach(node -> node.setOpacity(0));
|
||||||
tourPages.getChildren().get(page).setOpacity(1);
|
tourPages.getChildren().get(page).setOpacity(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* close Tutorial
|
||||||
|
*/
|
||||||
public void closeTutorial() {
|
public void closeTutorial() {
|
||||||
Stage root = (Stage) tourPages.getScene().getWindow();
|
Stage root = (Stage) tourPages.getScene().getWindow();
|
||||||
root.close();
|
root.close();
|
||||||
|
|
Loading…
Reference in New Issue