diff --git a/src/main/java/ecdar/abstractions/Location.java b/src/main/java/ecdar/abstractions/Location.java index 795e97d9..10a4b43f 100644 --- a/src/main/java/ecdar/abstractions/Location.java +++ b/src/main/java/ecdar/abstractions/Location.java @@ -14,7 +14,6 @@ import com.google.gson.JsonObject; import javafx.beans.property.*; -import java.util.Arrays; import java.util.Collections; public class Location implements Circular, Serializable, Nearable, DropDownMenu.HasColor { @@ -444,7 +443,7 @@ public enum Type { } public enum Urgency { - NORMAL, URGENT, COMMITTED + NORMAL, URGENT, COMMITTED, PROHIBITED } public enum Reachability { diff --git a/src/main/java/ecdar/controllers/LocationController.java b/src/main/java/ecdar/controllers/LocationController.java index 7ea19e28..fd0abdac 100644 --- a/src/main/java/ecdar/controllers/LocationController.java +++ b/src/main/java/ecdar/controllers/LocationController.java @@ -64,6 +64,7 @@ public class LocationController implements Initializable, SelectHelper.ItemSelec public Label idLabel; public Line nameTagLine; public Line invariantTagLine; + public Line prohibitedLocStrikeThrough; private DropDownMenu dropDownMenu; private boolean dropDownMenuInitialized = false; @@ -157,6 +158,7 @@ public void initializeDropDownMenu() { dropDownMenu.hide(); } ); + dropDownMenu.addSpacerElement(); final BooleanProperty isUrgent = new SimpleBooleanProperty(false); isUrgent.bind(getLocation().urgencyProperty().isEqualTo(Location.Urgency.URGENT)); @@ -166,6 +168,19 @@ public void initializeDropDownMenu() { } else { getLocation().setUrgency(Location.Urgency.URGENT); } + + dropDownMenu.hide(); + }); + + final BooleanProperty isProhibited = new SimpleBooleanProperty(false); + isProhibited.bind(getLocation().urgencyProperty().isEqualTo(Location.Urgency.PROHIBITED)); + dropDownMenu.addToggleableAndDisableableListElement("Prohibited", isProhibited, getLocation().getIsLocked(), event -> { + if (isProhibited.get()) { + getLocation().setUrgency(Location.Urgency.NORMAL); + } else { + getLocation().setUrgency(Location.Urgency.PROHIBITED); + } + dropDownMenu.hide(); }); diff --git a/src/main/java/ecdar/presentations/LocationPresentation.java b/src/main/java/ecdar/presentations/LocationPresentation.java index 62fd0b03..8d2a55af 100644 --- a/src/main/java/ecdar/presentations/LocationPresentation.java +++ b/src/main/java/ecdar/presentations/LocationPresentation.java @@ -346,7 +346,6 @@ private void initializeLocationShapes() { final Location location = controller.getLocation(); - BiConsumer updateUrgencies = (oldUrgency, newUrgency) -> { final Transition toUrgent = new Transition() { { @@ -370,10 +369,11 @@ protected void interpolate(final double frac) { } }; - if(oldUrgency.equals(Location.Urgency.NORMAL) && !newUrgency.equals(Location.Urgency.NORMAL)) { - toUrgent.play(); + boolean isNormalOrProhibited = newUrgency.equals(Location.Urgency.NORMAL) || newUrgency.equals(Location.Urgency.PROHIBITED); - } else if(newUrgency.equals(Location.Urgency.NORMAL)) { + if(!oldUrgency.equals(Location.Urgency.URGENT) && !isNormalOrProhibited) { + toUrgent.play(); + } else if(isNormalOrProhibited && oldUrgency.equals(Location.Urgency.URGENT)) { toNormal.play(); } @@ -384,6 +384,16 @@ protected void interpolate(final double frac) { committedShape.setVisible(false); notCommittedShape.setVisible(true); } + + if(newUrgency.equals(Location.Urgency.PROHIBITED)) { + notCommittedShape.setStrokeWidth(4); + notCommittedShape.setStroke(Color.RED.getColor(Color.Intensity.A700)); + controller.prohibitedLocStrikeThrough.setVisible(true); + } else { + notCommittedShape.setStrokeWidth(1); + notCommittedShape.setStroke(location.getColor().getColor(location.getColorIntensity().next(2))); + controller.prohibitedLocStrikeThrough.setVisible(false); + } }; location.urgencyProperty().addListener((obsUrgency, oldUrgency, newUrgency) -> { @@ -399,7 +409,10 @@ protected void interpolate(final double frac) { // Delegate to style the label based on the color of the location final BiConsumer updateColor = (newColor, newIntensity) -> { notCommittedShape.setFill(newColor.getColor(newIntensity)); - notCommittedShape.setStroke(newColor.getColor(newIntensity.next(2))); + + if (!location.getUrgency().equals(Location.Urgency.PROHIBITED)) { + notCommittedShape.setStroke(newColor.getColor(newIntensity.next(2))); + } committedShape.setFill(newColor.getColor(newIntensity)); committedShape.setStroke(newColor.getColor(newIntensity.next(2))); diff --git a/src/main/java/ecdar/utility/colors/EnabledColor.java b/src/main/java/ecdar/utility/colors/EnabledColor.java index e58831c8..78cfc10b 100644 --- a/src/main/java/ecdar/utility/colors/EnabledColor.java +++ b/src/main/java/ecdar/utility/colors/EnabledColor.java @@ -9,7 +9,7 @@ public class EnabledColor { public static final ArrayList enabledColors = new ArrayList() {{ add(new EnabledColor(Color.GREY_BLUE, Color.Intensity.I700, KeyCode.DIGIT0)); add(new EnabledColor(Color.DEEP_ORANGE, Color.Intensity.I700, KeyCode.DIGIT1)); - add(new EnabledColor(Color.RED, Color.Intensity.I700, KeyCode.DIGIT2)); + add(new EnabledColor(Color.RED, Color.Intensity.I500, KeyCode.DIGIT2)); add(new EnabledColor(Color.PINK, Color.Intensity.I500, KeyCode.DIGIT3)); add(new EnabledColor(Color.PURPLE, Color.Intensity.I500, KeyCode.DIGIT4)); add(new EnabledColor(Color.INDIGO, Color.Intensity.I500, KeyCode.DIGIT5)); diff --git a/src/main/resources/ecdar/presentations/LocationPresentation.fxml b/src/main/resources/ecdar/presentations/LocationPresentation.fxml index b6d02cc0..941f513c 100644 --- a/src/main/resources/ecdar/presentations/LocationPresentation.fxml +++ b/src/main/resources/ecdar/presentations/LocationPresentation.fxml @@ -46,6 +46,8 @@