fix of zero interval
This commit is contained in:
parent
6d24687f7b
commit
e9258fb238
|
@ -22,6 +22,7 @@ import javafx.scene.control.*;
|
|||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
@ -205,22 +206,28 @@ public class CropDetailController {
|
|||
}
|
||||
|
||||
private HBox createTaskHBox(Task task) {
|
||||
HBox hBox = new HBox();
|
||||
HBox hBox = new HBox(10);
|
||||
Label taskName = new Label(task.getName()+": ");
|
||||
taskName.setMinWidth(100);
|
||||
taskName.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||
taskName.setStyle("-fx-font-weight: bold");
|
||||
Label taskDescription = new Label(task.getDescription());
|
||||
taskDescription.setWrapText(true);
|
||||
taskDescription.setMaxWidth(2000);
|
||||
HBox.setHgrow(taskDescription, Priority.ALWAYS);
|
||||
taskDescription.setMaxSize(600, Double.MAX_VALUE);
|
||||
Pane puffer = new Pane();
|
||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||
|
||||
|
||||
Button edit = new Button();
|
||||
Button delete = new Button();
|
||||
HBox.setHgrow(edit, Priority.NEVER);
|
||||
HBox.setHgrow(delete, Priority.NEVER);
|
||||
setIconToButton(edit, "editIcon.png");
|
||||
setIconToButton(delete, "deleteIcon.png");
|
||||
edit.setOnAction(getEditTaskEvent(task));
|
||||
delete.setOnAction(deleteTask(task));
|
||||
|
||||
hBox.getChildren().addAll(taskName, taskDescription, edit, delete);
|
||||
hBox.getChildren().addAll(taskName, taskDescription, puffer, edit, delete);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
|
@ -229,12 +236,15 @@ public class CropDetailController {
|
|||
label.setStyle("-fx-font-weight: bold");
|
||||
HBox hBox = new HBox();
|
||||
hBox.fillHeightProperty();
|
||||
Label label1 = new Label(pest.description());
|
||||
label1.setAlignment(Pos.TOP_LEFT);
|
||||
label1.setWrapText(true);
|
||||
label1.setMaxWidth(600);
|
||||
Label description = new Label(pest.description());
|
||||
description.setAlignment(Pos.TOP_LEFT);
|
||||
description.setWrapText(true);
|
||||
description.setMaxWidth(600);
|
||||
Pane puffer = new Pane();
|
||||
HBox.setHgrow(puffer, Priority.ALWAYS);
|
||||
Button button = new Button("Get Counter Measures");
|
||||
hBox.getChildren().addAll(label, label1, button);
|
||||
HBox.setHgrow(button, Priority.NEVER);
|
||||
hBox.getChildren().addAll(label, description, puffer, button);
|
||||
return hBox;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ public class GardenSchedule {
|
|||
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) {
|
||||
dayTaskList.get(finalI).add(task);
|
||||
}
|
||||
if (task.getInterval().orElse(0) == 0) break;
|
||||
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
|
||||
} while (task.getInterval().isPresent() && checkDate.isBefore(LocalDate.now().plusDays(listLength)));
|
||||
});
|
||||
|
|
|
@ -18,6 +18,7 @@ public class Task {
|
|||
private LocalDate nextExecution;
|
||||
private LocalDate nextNotification;
|
||||
private long cropId;
|
||||
private boolean done;
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
|
@ -69,7 +70,7 @@ public class Task {
|
|||
}
|
||||
|
||||
public void done(){
|
||||
if(interval != null && !nextExecution.plusDays(interval).isAfter(endDate)){
|
||||
if(interval != null && interval != 0 && !nextExecution.plusDays(interval).isAfter(endDate)){
|
||||
nextExecution = nextExecution.plusDays(interval);
|
||||
} else {
|
||||
nextExecution = null;
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<Insets right="60.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<Label fx:id="area_label" text="Label">
|
||||
<Label fx:id="area_label" minWidth="-Infinity" prefWidth="50.0" text="Label">
|
||||
<HBox.margin>
|
||||
<Insets right="10.0" />
|
||||
</HBox.margin>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<Insets right="40.0" />
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<Label fx:id="location_label" text="Label">
|
||||
<Label fx:id="location_label" minHeight="-Infinity" prefWidth="50.0" text="Label">
|
||||
<HBox.margin>
|
||||
<Insets right="10.0" />
|
||||
</HBox.margin>
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="259.0" prefWidth="390.0" xmlns="http://javafx.com/javafx/17"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.TaskFormularController">
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="259.0" prefWidth="390.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.gartenverwaltung.TaskFormularController">
|
||||
<children>
|
||||
<VBox layoutX="14.0" layoutY="14.0" prefHeight="272.0" prefWidth="390.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<padding>
|
||||
|
@ -27,7 +25,7 @@
|
|||
<HBox prefHeight="77.0" prefWidth="350.0">
|
||||
<children>
|
||||
<Label maxWidth="1.7976931348623157E308" text="Description:" HBox.hgrow="ALWAYS" />
|
||||
<TextArea fx:id="description_area" prefHeight="73.0" prefWidth="206.0" promptText="Description" />
|
||||
<TextArea fx:id="description_area" prefHeight="73.0" prefWidth="206.0" promptText="Description" wrapText="true" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" layoutX="30.0" layoutY="30.0" prefHeight="35.0" prefWidth="560.0">
|
||||
|
|
Loading…
Reference in New Issue