Skip to content

Commit 669c732

Browse files
committed
Only shows the button on the operations that need it and minimize only hides the sockets with a view.
1 parent 7e9854c commit 669c732

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

ui/src/main/java/edu/wpi/grip/ui/pipeline/StepController.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import edu.wpi.grip.core.Step;
55
import edu.wpi.grip.core.sockets.InputSocket;
66
import edu.wpi.grip.core.sockets.OutputSocket;
7+
import edu.wpi.grip.core.sockets.Socket;
8+
import edu.wpi.grip.core.sockets.SocketHint;
79
import edu.wpi.grip.ui.Controller;
810
import edu.wpi.grip.ui.annotations.ParametrizedController;
911
import edu.wpi.grip.ui.components.ExceptionWitnessResponderButton;
@@ -22,6 +24,7 @@
2224

2325
import javafx.fxml.FXML;
2426
import javafx.scene.Node;
27+
import javafx.scene.control.Button;
2528
import javafx.scene.control.Labeled;
2629
import javafx.scene.image.Image;
2730
import javafx.scene.image.ImageView;
@@ -59,6 +62,8 @@ public class StepController implements Controller {
5962
private VBox outputs;
6063
@FXML
6164
private ImageView expandIcon;
65+
@FXML
66+
private Button expand;
6267
private ControllerMap<InputSocketController, Node> inputSocketMapManager;
6368
private ControllerMap<OutputSocketController, Node> outputSocketMapManager;
6469

@@ -89,12 +94,21 @@ private void initialize() {
8994
new Image(InputStream.class.cast(icon))));
9095
buttons.getChildren().add(0, exceptionWitnessResponderButtonFactory.create(step, "Step Error"));
9196

92-
expandIcon.setImage(new Image("/edu/wpi/grip/ui/icons/up.png"));
97+
if (step.getInputSockets().stream()
98+
.allMatch(inputSocket -> inputSocket.getSocketHint().getView()
99+
.equals(SocketHint.View.NONE))){
100+
expand.setManaged(false);
101+
} else {
102+
expandIcon.setImage(new Image("/edu/wpi/grip/ui/icons/up.png"));
103+
}
104+
93105
// Add a SocketControlView for each input socket and output socket
94106
for (InputSocket<?> inputSocket : step.getInputSockets()) {
95107
InputSocketController tempSocket = inputSocketControllerFactory.create(inputSocket);
96108
inputSocketMapManager.add(tempSocket);
97-
inputSockets.add(tempSocket);
109+
if(!inputSocket.getSocketHint().getView().equals(SocketHint.View.NONE)) {
110+
inputSockets.add(tempSocket);
111+
}
98112
}
99113

100114
for (OutputSocket<?> outputSocket : step.getOutputSockets()) {

ui/src/main/resources/edu/wpi/grip/ui/pipeline/Step.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</graphic>
8080
</Label>
8181
<Separator orientation="HORIZONTAL" />
82-
<Button fx:id="Expand" onMouseClicked="#expand" styleClass="expand"
82+
<Button fx:id="expand" onMouseClicked="#expand" styleClass="expand"
8383
maxWidth="Infinity" prefHeight="0" HBox.hgrow="ALWAYS">
8484
<graphic>
8585
<ImageView fx:id="expandIcon">
@@ -89,7 +89,7 @@
8989
</ImageView>
9090
</graphic>
9191
<tooltip>
92-
<Tooltip text="Expands and contracts the shown sockets"/>
92+
<Tooltip text="Minimizes/Maximizes the inputs in the step"/>
9393
</tooltip>
9494
</Button>
9595
<VBox fx:id="inputs" styleClass="sockets" />

0 commit comments

Comments
 (0)