From 663d759207217f7e7fc8e45643b528ff3dc97731 Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Wed, 11 Apr 2018 22:58:54 +0200 Subject: [PATCH] add other tabs & implementation Scheduler --- src/main/protocol/HPacket.java | 2 +- src/main/ui/G-Earth.fxml | 24 ++- src/main/ui/GEarthController.java | 15 ++ src/main/ui/extensions/Extensions.fxml | 14 ++ src/main/ui/extensions/Extensions.java | 9 + src/main/ui/info/Info.fxml | 14 ++ src/main/ui/info/Info.java | 9 + src/main/ui/injection/Injection.java | 7 +- src/main/ui/scheduler/Interval.java | 56 ++++++ src/main/ui/scheduler/ScheduleItem.java | 93 ++++++++++ .../ui/scheduler/ScheduleItemContainer.java | 106 ++++++++++++ src/main/ui/scheduler/Scheduler.fxml | 135 +++++++++++++++ src/main/ui/scheduler/Scheduler.java | 161 ++++++++++++++++++ src/main/ui/scheduler/buttons/BoxButton.java | 53 ++++++ .../ui/scheduler/buttons/ButtonDelete.png | Bin 0 -> 3390 bytes .../scheduler/buttons/ButtonDeleteHover.png | Bin 0 -> 443 bytes src/main/ui/scheduler/buttons/ButtonEdit.png | Bin 0 -> 460 bytes .../ui/scheduler/buttons/ButtonEditHover.png | Bin 0 -> 454 bytes src/main/ui/scheduler/buttons/ButtonPause.png | Bin 0 -> 725 bytes .../ui/scheduler/buttons/ButtonPauseHover.png | Bin 0 -> 621 bytes .../ui/scheduler/buttons/ButtonResume.png | Bin 0 -> 3286 bytes .../scheduler/buttons/ButtonResumeHover.png | Bin 0 -> 446 bytes .../ui/scheduler/buttons/DeleteButton.java | 8 + src/main/ui/scheduler/buttons/EditButton.java | 8 + .../scheduler/buttons/PauseResumeButton.java | 91 ++++++++++ src/main/ui/settings/Settings.fxml | 14 ++ src/main/ui/settings/Settings.java | 9 + 27 files changed, 818 insertions(+), 10 deletions(-) create mode 100644 src/main/ui/extensions/Extensions.fxml create mode 100644 src/main/ui/extensions/Extensions.java create mode 100644 src/main/ui/info/Info.fxml create mode 100644 src/main/ui/info/Info.java create mode 100644 src/main/ui/scheduler/Interval.java create mode 100644 src/main/ui/scheduler/ScheduleItem.java create mode 100644 src/main/ui/scheduler/ScheduleItemContainer.java create mode 100644 src/main/ui/scheduler/Scheduler.fxml create mode 100644 src/main/ui/scheduler/Scheduler.java create mode 100644 src/main/ui/scheduler/buttons/BoxButton.java create mode 100644 src/main/ui/scheduler/buttons/ButtonDelete.png create mode 100644 src/main/ui/scheduler/buttons/ButtonDeleteHover.png create mode 100644 src/main/ui/scheduler/buttons/ButtonEdit.png create mode 100644 src/main/ui/scheduler/buttons/ButtonEditHover.png create mode 100644 src/main/ui/scheduler/buttons/ButtonPause.png create mode 100644 src/main/ui/scheduler/buttons/ButtonPauseHover.png create mode 100644 src/main/ui/scheduler/buttons/ButtonResume.png create mode 100644 src/main/ui/scheduler/buttons/ButtonResumeHover.png create mode 100644 src/main/ui/scheduler/buttons/DeleteButton.java create mode 100644 src/main/ui/scheduler/buttons/EditButton.java create mode 100644 src/main/ui/scheduler/buttons/PauseResumeButton.java create mode 100644 src/main/ui/settings/Settings.fxml create mode 100644 src/main/ui/settings/Settings.java diff --git a/src/main/protocol/HPacket.java b/src/main/protocol/HPacket.java index 0f14b2d..1ba4e95 100644 --- a/src/main/protocol/HPacket.java +++ b/src/main/protocol/HPacket.java @@ -758,7 +758,7 @@ public class HPacket { if (resultTest[i] != null) expression.append(resultTest[i]); } - return expression.toString(); + return expression.toString().replace("{i:0}{b:false}{b:true}", "{s:}{i:1}"); } public static void main(String[] args) { diff --git a/src/main/ui/G-Earth.fxml b/src/main/ui/G-Earth.fxml index 2dea4ee..45f238c 100644 --- a/src/main/ui/G-Earth.fxml +++ b/src/main/ui/G-Earth.fxml @@ -29,10 +29,26 @@ - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/ui/GEarthController.java b/src/main/ui/GEarthController.java index 68a5ffb..33bf7fe 100644 --- a/src/main/ui/GEarthController.java +++ b/src/main/ui/GEarthController.java @@ -4,8 +4,12 @@ import javafx.scene.layout.Pane; import javafx.stage.Stage; import main.protocol.HConnection; import main.ui.connection.Connection; +import main.ui.extensions.Extensions; +import main.ui.info.Info; import main.ui.injection.Injection; import main.ui.logger.Logger; +import main.ui.scheduler.Scheduler; +import main.ui.settings.Settings; import main.ui.tools.Tools; public class GEarthController { @@ -17,6 +21,11 @@ public class GEarthController { public Injection injectionController; public Logger loggerController; public Tools toolsController; + public Scheduler schedulerController; + public Settings settingsController; + public Info infoController; + public Extensions extensionsController; + public Pane mover; public GEarthController() { @@ -28,6 +37,12 @@ public class GEarthController { injectionController.setParentController(this); loggerController.setParentController(this); toolsController.setParentController(this); + schedulerController.setParentController(this); + settingsController.setParentController(this); + infoController.setParentController(this); + extensionsController.setParentController(this); + + //custom header bar // final Point[] startpos = {null}; // final Double[] xx = {0.0}; diff --git a/src/main/ui/extensions/Extensions.fxml b/src/main/ui/extensions/Extensions.fxml new file mode 100644 index 0000000..310ec13 --- /dev/null +++ b/src/main/ui/extensions/Extensions.fxml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/ui/extensions/Extensions.java b/src/main/ui/extensions/Extensions.java new file mode 100644 index 0000000..3c22e8c --- /dev/null +++ b/src/main/ui/extensions/Extensions.java @@ -0,0 +1,9 @@ +package main.ui.extensions; + +import main.ui.SubForm; + +/** + * Created by Jonas on 06/04/18. + */ +public class Extensions extends SubForm { +} diff --git a/src/main/ui/info/Info.fxml b/src/main/ui/info/Info.fxml new file mode 100644 index 0000000..45ff5f1 --- /dev/null +++ b/src/main/ui/info/Info.fxml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/ui/info/Info.java b/src/main/ui/info/Info.java new file mode 100644 index 0000000..73b565a --- /dev/null +++ b/src/main/ui/info/Info.java @@ -0,0 +1,9 @@ +package main.ui.info; + +import main.ui.SubForm; + +/** + * Created by Jonas on 06/04/18. + */ +public class Info extends SubForm { +} diff --git a/src/main/ui/injection/Injection.java b/src/main/ui/injection/Injection.java index 7071c36..a15d79a 100644 --- a/src/main/ui/injection/Injection.java +++ b/src/main/ui/injection/Injection.java @@ -19,12 +19,9 @@ public class Injection extends SubForm { public Button btn_sendToClient; protected void onParentSet() { - getHConnection().addStateChangeListener((oldState, newState) -> Platform.runLater(() -> - updateUI())); + getHConnection().addStateChangeListener((oldState, newState) -> Platform.runLater(this::updateUI)); - inputPacket.textProperty().addListener(event -> { Platform.runLater(() -> - updateUI()); - }); + inputPacket.textProperty().addListener(event -> Platform.runLater(this::updateUI)); } private void updateUI() { diff --git a/src/main/ui/scheduler/Interval.java b/src/main/ui/scheduler/Interval.java new file mode 100644 index 0000000..86ca020 --- /dev/null +++ b/src/main/ui/scheduler/Interval.java @@ -0,0 +1,56 @@ +package main.ui.scheduler; + +/** + * Created by Jonas on 11/04/18. + */ +public class Interval { + + private int offset; + private int delay; + + public Interval(int offset, int delay) { + this.offset = offset; + this.delay = delay; + } + + public Interval(String interval) { + String[] split = interval.split("\\+"); + + if (split.length == 0 || split.length > 2) { + delay = -1; + offset = -1; + return; + } + if (!Scheduler.stringIsNumber(split[0]) || (split.length == 2 && !Scheduler.stringIsNumber(split[1]))) { + delay = -1; + offset = -1; + return; + } + + delay = Integer.parseInt(split[0]); + offset = split.length == 2 ? Integer.parseInt(split[1]) : 0; + + if (delay <= 0 || offset < 0 || offset > delay) { + delay = -1; + offset = -1; + } + } + + + public int getDelay() { + return delay; + } + + public int getOffset() { + return offset; + } + + public String toString() { + return delay + "+" + offset; + } + + public static boolean isValid(String s) { + Interval test = new Interval(s); + return (test.delay != -1); + } +} diff --git a/src/main/ui/scheduler/ScheduleItem.java b/src/main/ui/scheduler/ScheduleItem.java new file mode 100644 index 0000000..fc6a74c --- /dev/null +++ b/src/main/ui/scheduler/ScheduleItem.java @@ -0,0 +1,93 @@ +package main.ui.scheduler; + +import javafx.beans.InvalidationListener; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.beans.property.SimpleObjectProperty; +import main.protocol.HMessage; +import main.protocol.HPacket; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Jonas on 07/04/18. + */ +public class ScheduleItem { + + private SimpleIntegerProperty indexProperty; + private SimpleBooleanProperty pausedProperty; + private SimpleObjectProperty delayProperty; + private SimpleObjectProperty packetProperty; + private SimpleObjectProperty destinationProperty; + + ScheduleItem (int index, boolean paused, Interval delay, HPacket packet, HMessage.Side destination) { + this.indexProperty = new SimpleIntegerProperty(index); + this.pausedProperty = new SimpleBooleanProperty(paused); + this.delayProperty = new SimpleObjectProperty<>(delay); + this.packetProperty = new SimpleObjectProperty<>(packet); + this.destinationProperty = new SimpleObjectProperty<>(destination); + } + + public SimpleIntegerProperty getIndexProperty() { + return indexProperty; + } + + public SimpleBooleanProperty getPausedProperty() { + return pausedProperty; + } + + public SimpleObjectProperty getDelayProperty() { + return delayProperty; + } + + public SimpleObjectProperty getPacketProperty() { + return packetProperty; + } + + public SimpleObjectProperty getDestinationProperty() { + return destinationProperty; + } + + + private List onDeleteListeners = new ArrayList<>(); + public void onDelete(InvalidationListener listener) { + onDeleteListeners.add(listener); + } + public void delete() { + for (int i = onDeleteListeners.size() - 1; i >= 0; i--) { + onDeleteListeners.get(i).invalidated(null); + } + } + + private List onEditListeners = new ArrayList<>(); + public void onEdit(InvalidationListener listener) { + onEditListeners.add(listener); + } + public void edit() { + for (int i = onEditListeners.size() - 1; i >= 0; i--) { + onEditListeners.get(i).invalidated(null); + } + } + + private List onIsupdatedListeners = new ArrayList<>(); + public void onIsupdated(InvalidationListener listener) { + onIsupdatedListeners.add(listener); + } + public void isUpdatedTrigger() { + for (int i = onIsupdatedListeners.size() - 1; i >= 0; i--) { + onIsupdatedListeners.get(i).invalidated(null); + } + } + + private List OnIsBeingUpdatedListeners = new ArrayList<>(); + public void onIsBeingUpdated(InvalidationListener listener) { + OnIsBeingUpdatedListeners.add(listener); + } + public void onIsBeingUpdatedTrigger() { + for (int i = OnIsBeingUpdatedListeners.size() - 1; i >= 0; i--) { + OnIsBeingUpdatedListeners.get(i).invalidated(null); + } + } + +} diff --git a/src/main/ui/scheduler/ScheduleItemContainer.java b/src/main/ui/scheduler/ScheduleItemContainer.java new file mode 100644 index 0000000..8028927 --- /dev/null +++ b/src/main/ui/scheduler/ScheduleItemContainer.java @@ -0,0 +1,106 @@ +package main.ui.scheduler; + +import javafx.beans.InvalidationListener; +import javafx.beans.Observable; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.control.Label; +import javafx.scene.control.ScrollPane; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.*; +import javafx.scene.text.Font; +import main.ui.scheduler.buttons.DeleteButton; +import main.ui.scheduler.buttons.EditButton; +import main.ui.scheduler.buttons.PauseResumeButton; + +/** + * Created by Jonas on 07/04/18. + */ +public class ScheduleItemContainer extends GridPane { + + public static final int[] columnWidths = {10, 39, 16, 18, 15}; + ScheduleItem item; + + Label indexLabel; + Label packetLabel; + Label delayLabel; + Label destinationLabel; + + VBox parent; + + ScheduleItemContainer(ScheduleItem item, VBox parent, ScrollPane scrollPane) { + super(); + setGridLinesVisible(true); + VBox.setMargin(this, new Insets(2, -2, -2, -2)); + + setPrefWidth(scrollPane.getWidth()); + setPrefHeight(23); + scrollPane.widthProperty().addListener(observable -> setPrefWidth(scrollPane.getWidth())); + this.parent = parent; + this.item = item; + initialize(); + } + + private void initialize() { + RowConstraints rowConstraints = new RowConstraints(23); + getRowConstraints().addAll(rowConstraints); + + for (int i = 0; i < columnWidths.length; i++) { + ColumnConstraints columnConstraints = new ColumnConstraints(20); + columnConstraints.setPercentWidth(columnWidths[i]); + getColumnConstraints().add(columnConstraints); + } + + indexLabel = initNewLabelColumn(item.getIndexProperty().get()+""); + packetLabel = initNewLabelColumn(item.getPacketProperty().get().toString()); + delayLabel = initNewLabelColumn(item.getDelayProperty().get()+""); + destinationLabel = initNewLabelColumn(item.getDestinationProperty().get().name()); + + add(indexLabel, 0, 0); + add(packetLabel, 1, 0); + add(delayLabel, 2, 0); + add(destinationLabel, 3, 0); + +// getChildren().addAll(indexLabel, packetLabel, delayLabel, destinationLabel); + + item.getIndexProperty().addListener(observable -> indexLabel.setText(item.getIndexProperty().get()+"")); + item.getPacketProperty().addListener(observable -> packetLabel.setText(item.getPacketProperty().get().toString())); + item.getDelayProperty().addListener(observable -> delayLabel.setText(item.getDelayProperty().get()+"")); + item.getDestinationProperty().addListener(observable -> destinationLabel.setText(item.getDestinationProperty().get().name())); + + EditButton editButton = new EditButton(); + DeleteButton deleteButton = new DeleteButton(); + PauseResumeButton pauseResumeButton = new PauseResumeButton(item.getPausedProperty().get()); + editButton.show(); + deleteButton.show(); + editButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.edit()); + deleteButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.delete()); + pauseResumeButton.onClick(observable -> item.getPausedProperty().set(pauseResumeButton.isPaused())); + HBox buttonsBox = new HBox(pauseResumeButton, editButton, deleteButton); + buttonsBox.setSpacing(10); + buttonsBox.setAlignment(Pos.CENTER); + GridPane.setMargin(buttonsBox, new Insets(0, 5, 0, 5)); + add(buttonsBox, 4, 0); + + parent.getChildren().add(this); + + + GridPane this2 = this; + item.onDelete(observable -> parent.getChildren().remove(this2)); + item.onIsBeingUpdated(observable -> setStyle("-fx-background-color: #faebcc;")); + item.onIsupdated(observable -> setStyle("-fx-background-color: #ffffff;")); + } + + private Label initNewLabelColumn(String text) { + Label label = new Label(); +// label.setMaxWidth(Double.MAX_VALUE); +// label.setMinHeight(Double.MAX_VALUE); +// label.setAlignment(Pos.CENTER); + label.setFont(new Font(12)); + GridPane.setMargin(label, new Insets(0, 0, 0, 5)); + label.setText(text); + return label; + } + +} diff --git a/src/main/ui/scheduler/Scheduler.fxml b/src/main/ui/scheduler/Scheduler.fxml new file mode 100644 index 0000000..3cebc8f --- /dev/null +++ b/src/main/ui/scheduler/Scheduler.fxml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/ui/scheduler/Scheduler.java b/src/main/ui/scheduler/Scheduler.java new file mode 100644 index 0000000..082c695 --- /dev/null +++ b/src/main/ui/scheduler/Scheduler.java @@ -0,0 +1,161 @@ +package main.ui.scheduler; + +import javafx.application.Platform; +import javafx.beans.InvalidationListener; +import javafx.beans.Observable; +import javafx.event.ActionEvent; +import javafx.scene.control.*; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.VBox; +import main.protocol.HMessage; +import main.protocol.HPacket; +import main.ui.SubForm; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Jonas on 06/04/18. + */ +public class Scheduler extends SubForm { + + private static final Interval defaultInterval = new Interval(0, 500); + private static final HPacket defaultPacket = new HPacket(0); + + public VBox schedulecontainer; + public GridPane header; + public ScrollPane scrollpane; + + public Button btn_addoredit; + + public TextField txt_delay; + public ToggleGroup scheduler_dest; + public TextField txt_packet; + public RadioButton rb_incoming; + public RadioButton rb_outgoing; + + private ScheduleItem isBeingEdited = null; + + private List scheduleItemList = new ArrayList<>(); + + + public void initialize() { + scrollpane.widthProperty().addListener(observable -> header.setPrefWidth(scrollpane.getWidth())); + scheduler_dest.selectToggle(scheduler_dest.getToggles().get(0)); + + txt_packet.textProperty().addListener(event -> Platform.runLater(this::updateUI)); + txt_delay.textProperty().addListener(event -> Platform.runLater(this::updateUI)); + + updateUI(); + + new Thread(() -> { + long i = 0; + while (true) { + try { + Thread.sleep(1); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + for (ScheduleItem item : scheduleItemList) { + if (!item.getPausedProperty().get()) { + Interval cur = item.getDelayProperty().get(); + if (i % cur.getDelay() == cur.getOffset()) { + getHConnection().sendToServerAsync(item.getPacketProperty().get()); + } + } + + } + + i++; + } + }).start(); + + } + + public static boolean stringIsNumber(String str) { + try { + Integer.parseInt(str); + return true; + } + catch (Exception e){ + return false; + } + } + + private void updateUI() { + btn_addoredit.setDisable(!Interval.isValid(txt_delay.getText()) || new HPacket(txt_packet.getText()).isCorrupted()); + } + + public void scheduleBtnClicked(ActionEvent actionEvent) { + if (isBeingEdited == null) { + HPacket packet = new HPacket(txt_packet.getText()); + if (packet.isCorrupted()) return; + + ScheduleItem newItem = new ScheduleItem( + scheduleItemList.size(), + false, + new Interval(txt_delay.getText()), + new HPacket(txt_packet.getText()), + rb_incoming.isSelected() ? HMessage.Side.TOCLIENT : HMessage.Side.TOSERVER); + + new ScheduleItemContainer(newItem, schedulecontainer, scrollpane); + scheduleItemList.add(newItem); + + + newItem.onDelete(observable -> { + if (isBeingEdited == newItem) { + setInputDefault(); + isBeingEdited = null; + } + scheduleItemList.remove(newItem); + for (int i = 0; i < scheduleItemList.size(); i++) { + scheduleItemList.get(i).getIndexProperty().set(i); + } + }); + newItem.onEdit(observable -> { + if (isBeingEdited != null) { + isBeingEdited.isUpdatedTrigger(); + } + + if (isBeingEdited != newItem) { + txt_packet.setText(newItem.getPacketProperty().get().toString()); + txt_delay.setText(newItem.getDelayProperty().get().toString()); + rb_incoming.setSelected(newItem.getDestinationProperty().get() == HMessage.Side.TOCLIENT); + rb_outgoing.setSelected(newItem.getDestinationProperty().get() == HMessage.Side.TOSERVER); + + isBeingEdited = newItem; + btn_addoredit.setText("Edit schedule item"); //Add to scheduler + updateUI(); + newItem.onIsBeingUpdatedTrigger(); + } + else { + setInputDefault(); + isBeingEdited.isUpdatedTrigger(); + isBeingEdited = null; + } + }); + } + else { + + isBeingEdited.getPacketProperty().set(new HPacket(txt_packet.getText())); + isBeingEdited.getDelayProperty().set(new Interval(txt_delay.getText())); + isBeingEdited.getDestinationProperty().set(rb_incoming.isSelected() ? HMessage.Side.TOCLIENT : HMessage.Side.TOSERVER); + isBeingEdited.isUpdatedTrigger(); + + isBeingEdited = null; + setInputDefault(); + } + + } + + private void setInputDefault() { + txt_delay.setText(defaultInterval.toString()); + txt_packet.setText(defaultPacket.toString()); + rb_incoming.setSelected(true); + rb_outgoing.setSelected(false); + + btn_addoredit.setText("Add to scheduler"); + updateUI(); + } +} diff --git a/src/main/ui/scheduler/buttons/BoxButton.java b/src/main/ui/scheduler/buttons/BoxButton.java new file mode 100644 index 0000000..18ea782 --- /dev/null +++ b/src/main/ui/scheduler/buttons/BoxButton.java @@ -0,0 +1,53 @@ +package main.ui.scheduler.buttons; + +import javafx.event.EventHandler; +import javafx.scene.Cursor; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.StackPane; + +public class BoxButton extends StackPane { + + private ImageView imageView; + private Image image; + private Image imageOnHover; + private boolean isVisible; + + //paths zijn relatief aan deze classpath + public BoxButton(String imagePath, String imageOnHoverPath) { + this.image = new Image(getClass().getResourceAsStream(imagePath)); + this.imageOnHover = new Image(getClass().getResourceAsStream(imageOnHoverPath)); + this.imageView = new ImageView(); + + setCursor(Cursor.DEFAULT); + getChildren().add(imageView); + setOnMouseEntered(onMouseHover); + setOnMouseExited(onMouseHoverDone); + } + + public void show() { + imageView.setImage(image); + isVisible = true; + } + + public void dispose() { + imageView.setImage(null); + isVisible = false; + } + + private EventHandler onMouseHover = + t -> { + if (isVisible) { + imageView.setImage(imageOnHover); + } + }; + + private EventHandler onMouseHoverDone = + t -> { + if (isVisible) { + imageView.setImage(image); + } + }; + +} diff --git a/src/main/ui/scheduler/buttons/ButtonDelete.png b/src/main/ui/scheduler/buttons/ButtonDelete.png new file mode 100644 index 0000000000000000000000000000000000000000..48b0bc8821fff5cfa3cc552fe73b899b3448499b GIT binary patch literal 3390 zcmV-E4Z-q>P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2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&D;;md|tEbIwJW;oNhby(_WF zDSg%xh~PhO))R=tCa3hd&fb+U!@0>5{_^7eSC56Dvw-Fsw}ig6ZT_uVnEw|Xdihkm z=2Ou&JmmYivGdUKe*Bq!(=MTwKLF{t3dwc_%dg)=Unn~hjqs=#tbT)**?`s6g3oFY zB(%QGmz0v=_t~Kz%J5vYf*rVLN@Bn#-=U>90o{Vd*dCG}zDCJH?Pz|uWaGxyp>{MsT%n6?Z(&hWWN@qv zj@wjXi9MgzuiJ_g2C%%Dg|uI6*mjuVB0-;14E1>F>|Nbht2#jjxAsPw^0JR(FHrbb zBW#>lweppts?dJPfvxp4RzH4;Tfz+I2Jp`7vJ2U~`d9dT60gfHX7g$sz=J;n0Eoy{ UA}C$WQ~&?~07*qoM6N<$f=}mJ8vpb1A+m>mg}I2f zmqhC;i#-u3PWZL$6K#v=J>F@*Ph%b;v}Hm8ZA^-O!nYF;b%J3PrtQG+44U8?B*2DC zgzF^4Yp}n7H*g9veIKS>grNa$?B}M5kS(mM%n&?+WALX`rkJ%1F2RY3kctV{!6AqZ z>l1g|wcSYBsG4YYpft~C6%J`Qo)19bwK0xa*5MSlUEKnSaReC5njKdeeJZZTdIra= z+h^dyg3<=RuPl?KR}*R2wxF7w1OwR*vXAvGxU6rn lk`yU>ji<+xGLfuZ=O6PL<(amEtHuBT002ovPDHLkV1l>i#&ZAw literal 0 HcmV?d00001 diff --git a/src/main/ui/scheduler/buttons/ButtonEdit.png b/src/main/ui/scheduler/buttons/ButtonEdit.png new file mode 100644 index 0000000000000000000000000000000000000000..4a0797215aae112ebf4037682d4477afab805708 GIT binary patch literal 460 zcmV;-0WU;V5KK<%>1cEf)et8xSDk$ugWkQhd%Ng5)-5$bIy%5pk zDB@*l;WdXBBf~bXOYrKY2j~7UrncN%iB9Jw1vK}aq?6aLeQ*RL9B$TL zp_p-DbmR~W_ zL7Kyn0E_VZ30ESsJQMr~aicN$rY#K7hz6aA_)ZaWZzAZn;_b8#v~oGMU9V~ChFsZ+ zkCzR6kb;3$3jHlq>W5OT>OyUE4+h&PXw+2NXZi_x0Xgpj!P`Lq0000BrNi?cHqQ8 zl=-pZK#g$VFL--4IcWKA`_%jJIlNxa^LhF_L}?rs5j-3(htfV(Rs;fJ9AprpyV1BP zbyzut;iV8tWaIGruW-ncqfAOsqL{#dYahYe2dGTTkV?$ZYB%GZxRVOx7U+G)*o!;Sbm zxr13ymQesMpNzjb0oK?UW0jc|2toPk9d1$;0ZJNe=6(3146D zczwRaV|eRF(&GhbS(K|!{?qg|gpZeNJl*f$=FEnRlQFE0=Yw)gsr~f=Nd-h=IU?tF w+;QrP3AN%h7Ntn0LZMWN1{tAVn*N%811=!^F0`U^HUIzs07*qoM6N<$f-JPqQ2+n{ literal 0 HcmV?d00001 diff --git a/src/main/ui/scheduler/buttons/ButtonPause.png b/src/main/ui/scheduler/buttons/ButtonPause.png new file mode 100644 index 0000000000000000000000000000000000000000..75de062ec3ae073639cbe24ede65b4cb6256589f GIT binary patch literal 725 zcmV;`0xJE9P)OHfB<3usoDPJ-+z$0Dfhqq2dgbP_8Y8z+O@w700G3PJLSRO!j~OF)$Pdit~dcn120bVE7Hhr=LNrVfyxmf#Ju${|wunLCgUN zAh0bKbDn%S^!49=(^*eGfNb0N=J)@(559qIW&tVs3v}62pfP`;u6+d5{NWGOND%QI z$XS2mAHz?m;I`ZU7!E%C4`zc+`1kkUi%Tb-F)%YRya4g&pZ zKK^B3{0lV~C~@!0AA}oj708|bbN$uF-?!d=1hLsz8ILgCeDx7TgA@P+7$e9lKwv7w z!@S$yn2#SAuMFRQ{bSg1@yo{#U;ny-G^tN~^gG5zfQ6Zfk>T^tzYOb6e)@AWUyfC6 z!XtF3{vwQO#*HJCH+!!tbce-i3xG)!H4K1ae2hOCIDzSzmGdvdHAW;kSmq`NgY*IbWAa{7ae;EZ00000NkvXX Hu0mjf_<~d+ literal 0 HcmV?d00001 diff --git a/src/main/ui/scheduler/buttons/ButtonPauseHover.png b/src/main/ui/scheduler/buttons/ButtonPauseHover.png new file mode 100644 index 0000000000000000000000000000000000000000..c7c1952ebff82df092f2c6ca5bf9f636e844f453 GIT binary patch literal 621 zcmV-z0+RiSP)8=Ck<{bE(?>Xm7^fzq564{r^Wbs$>X=$%# z4du0-<5`(H<7Mhj=1CW415Rr5i<9@_I6fK0k>LQyvLL8#&Z+gy0p)}{f%@q+9DA?^ z>PRShfQbREiy~OuLiGD@xa4=BW)A}%?*baV%5=Vj*j5>X=>o_RuL3kNz_uV}@DhylRj74D6%cvL8&-Jb$AF`%}hpkY=SNN-@~ z%MUmrIgmYE1yCooc*JNfkFk%RVf7{TfO?N|QOaTBQxVqSE08T@4Cu{#KyT(f>O3n4 z04>W|Tv;#Rl=sEI0j5Y6&5;ahra}h*wevE}iMKd9``iGa-oWe?HTNYPnuvmK`azBQ z8_>9f!w>m|<4J=XXaN5E-59iV1zCYd_XQf^`XmExCk?)!`oQWJG%E3Q-hUtrIy0~H z0o_P|ZZTk(Kh$3B1J#N4B|+C$LDv}4$7`4t_Z64|3b|y^P#QFnF>qpAm;qryE~fXh z#J)Hmih=5C+5kSwN(I;7onN;`YKE@_+2%YrVX1ogZWboI?P{jc}~nCdE}wEBkT00000NkvXX Hu0mjft63sH literal 0 HcmV?d00001 diff --git a/src/main/ui/scheduler/buttons/ButtonResume.png b/src/main/ui/scheduler/buttons/ButtonResume.png new file mode 100644 index 0000000000000000000000000000000000000000..6adb81f9be8e4e2d17fb895e6e62ef129c9a3174 GIT binary patch literal 3286 zcmV;{3@P)8P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@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u3L%m4rY literal 0 HcmV?d00001 diff --git a/src/main/ui/scheduler/buttons/ButtonResumeHover.png b/src/main/ui/scheduler/buttons/ButtonResumeHover.png new file mode 100644 index 0000000000000000000000000000000000000000..55ffaaa900b2be3de334089e7c75bd2da5b91d9e GIT binary patch literal 446 zcmV;v0YUzWP)O6WND;bg)5;cxy?m4pN-T;N5wtKO6jQN>CTa-Pwtpq) zA1K{!HxxP3Nz#5hA%r(f;{`568y9dwu@^k#$a~3_nWe#P3+bG?S2*y1DNHsb(4Vx> zK-@}wkrC>R3{y|UOkG>u#JhXu9o;bFbp>?E4w4gmgjj18ZG><$vC&WL&lMkSv{t~w zCKf=*FBKpASjNPk zO=wwxvB}Q@DPdB)T=>Dh5PY~r0AqEpfhwS1gd(N&ByVt`x}uBw9)Pvs+iVC*C4EpL oZs#@Mz9H=o%FgTBVAfjp4S(Rb^bn7Qy8r+H07*qoM6N<$f_Q<%6951J literal 0 HcmV?d00001 diff --git a/src/main/ui/scheduler/buttons/DeleteButton.java b/src/main/ui/scheduler/buttons/DeleteButton.java new file mode 100644 index 0000000..8f221e0 --- /dev/null +++ b/src/main/ui/scheduler/buttons/DeleteButton.java @@ -0,0 +1,8 @@ +package main.ui.scheduler.buttons; + +public class DeleteButton extends BoxButton { + + public DeleteButton() { + super("ButtonDelete.png", "ButtonDeleteHover.png"); + } +} diff --git a/src/main/ui/scheduler/buttons/EditButton.java b/src/main/ui/scheduler/buttons/EditButton.java new file mode 100644 index 0000000..c0739a0 --- /dev/null +++ b/src/main/ui/scheduler/buttons/EditButton.java @@ -0,0 +1,8 @@ +package main.ui.scheduler.buttons; + +public class EditButton extends BoxButton { + + public EditButton() { + super("ButtonEdit.png", "ButtonEditHover.png"); + } +} diff --git a/src/main/ui/scheduler/buttons/PauseResumeButton.java b/src/main/ui/scheduler/buttons/PauseResumeButton.java new file mode 100644 index 0000000..baf9c4e --- /dev/null +++ b/src/main/ui/scheduler/buttons/PauseResumeButton.java @@ -0,0 +1,91 @@ +package main.ui.scheduler.buttons; + +import javafx.beans.InvalidationListener; +import javafx.event.EventHandler; +import javafx.scene.Cursor; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.StackPane; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Jonas on 11/04/18. + */ +public class PauseResumeButton extends StackPane{ + + private boolean isPaused[] = {false}; + + + private ImageView imageView; + private Image imagePause; + private Image imagePauseOnHover; + + private Image imageResume; + private Image imageResumeOnHover; + + private List clickListeners = new ArrayList<>(); + + public PauseResumeButton(boolean isPaused) { + this.isPaused[0] = isPaused; + + this.imagePause = new Image(getClass().getResourceAsStream("ButtonPause.png")); + this.imagePauseOnHover = new Image(getClass().getResourceAsStream("ButtonPauseHover.png")); + this.imageResume = new Image(getClass().getResourceAsStream("ButtonResume.png")); + this.imageResumeOnHover = new Image(getClass().getResourceAsStream("ButtonResumeHover.png")); + this.imageView = new ImageView(); + + setCursor(Cursor.DEFAULT); + getChildren().add(imageView); + setOnMouseEntered(onMouseHover); + setOnMouseExited(onMouseHoverDone); + + imageView.setImage(isPaused() ? imageResume : imagePause); + + PauseResumeButton thiss = this; + setEventHandler(MouseEvent.MOUSE_CLICKED, event -> { + thiss.isPaused[0] = !thiss.isPaused[0]; + imageView.setImage(isPaused() ? imageResumeOnHover : imagePauseOnHover); + + for (int i = clickListeners.size() - 1; i >= 0; i--) { + clickListeners.get(i).invalidated(null); + } + }); + } + + public boolean isPaused() { + return isPaused[0]; + } + + public void onClick(InvalidationListener listener) { + clickListeners.add(listener); + } + + + private EventHandler onMouseHover = + t -> imageView.setImage(isPaused() ? imageResumeOnHover : imagePauseOnHover); + + private EventHandler onMouseHoverDone = + t -> imageView.setImage(isPaused() ? imageResume : imagePause); + + +// private ImageView imageView; +// private Image image; +// private Image imageOnHover; +// private boolean isVisible; +// +// //paths zijn relatief aan deze classpath +// public BoxButton(String imagePath, String imageOnHoverPath) { +// this.image = new Image(getClass().getResourceAsStream(imagePath)); +// this.imageOnHover = new Image(getClass().getResourceAsStream(imageOnHoverPath)); +// this.imageView = new ImageView(); +// +// setCursor(Cursor.DEFAULT); +// getChildren().add(imageView); +// setOnMouseEntered(onMouseHover); +// setOnMouseExited(onMouseHoverDone); +// } + +} diff --git a/src/main/ui/settings/Settings.fxml b/src/main/ui/settings/Settings.fxml new file mode 100644 index 0000000..848b826 --- /dev/null +++ b/src/main/ui/settings/Settings.fxml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/ui/settings/Settings.java b/src/main/ui/settings/Settings.java new file mode 100644 index 0000000..e4e5a65 --- /dev/null +++ b/src/main/ui/settings/Settings.java @@ -0,0 +1,9 @@ +package main.ui.settings; + +import main.ui.SubForm; + +/** + * Created by Jonas on 06/04/18. + */ +public class Settings extends SubForm { +}