Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/main/java/ecdar/abstractions/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -444,7 +443,7 @@ public enum Type {
}

public enum Urgency {
NORMAL, URGENT, COMMITTED
NORMAL, URGENT, COMMITTED, PROHIBITED
}

public enum Reachability {
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/ecdar/controllers/LocationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand All @@ -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();
});

Expand Down
23 changes: 18 additions & 5 deletions src/main/java/ecdar/presentations/LocationPresentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ private void initializeLocationShapes() {

final Location location = controller.getLocation();


BiConsumer<Location.Urgency, Location.Urgency> updateUrgencies = (oldUrgency, newUrgency) -> {
final Transition toUrgent = new Transition() {
{
Expand All @@ -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();
}

Expand All @@ -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) -> {
Expand All @@ -399,7 +409,10 @@ protected void interpolate(final double frac) {
// Delegate to style the label based on the color of the location
final BiConsumer<Color, Color.Intensity> 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)));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ecdar/utility/colors/EnabledColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class EnabledColor {
public static final ArrayList<EnabledColor> enabledColors = new ArrayList<EnabledColor>() {{
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<Label fx:id="idLabel" styleClass="sub-caption" mouseTransparent="true"/>
</Group>

<Line fx:id="prohibitedLocStrikeThrough" strokeWidth="3" startX="-9" startY="-9" endX="9" endY="9" style="-fx-stroke: -red-A700"/>

</Group>

</fx:root>