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
15 changes: 10 additions & 5 deletions src/main/java/us/ihmc/publisher/logger/ui/CameraBean.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package us.ihmc.publisher.logger.ui;

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import us.ihmc.robotDataLogger.CameraConfiguration;
import us.ihmc.robotDataLogger.CameraType;

public class CameraBean
{

public final ObjectProperty<CameraType> camera_type = new SimpleObjectProperty<>(CameraType.CAPTURE_CARD_MAGEWELL);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the camera type so that it can be saved to the file via the gui

public final SimpleStringProperty camera_name = new SimpleStringProperty();
public final SimpleIntegerProperty camera_id = new SimpleIntegerProperty();
public final SimpleIntegerProperty camera_input = new SimpleIntegerProperty();
Expand All @@ -17,13 +19,17 @@ public CameraBean(byte id)
this.camera_id.set(id);
camera_name.set("");
}

public CameraBean(CameraConfiguration config)
{
camera_id.set(config.getCameraId());
camera_input.set(Integer.valueOf(config.getIdentifierAsString()));
camera_name.set(config.getNameAsString());
}

public CameraType getCamera_type()
{
return camera_type.get();
}

public String getCamera_name()
Expand All @@ -40,13 +46,12 @@ public int getCamera_input()
{
return camera_input.get();
}

public void pack(CameraConfiguration camera)
{
camera.setType(CameraType.CAPTURE_CARD);
camera.setType(getCamera_type());
camera.setName(getCamera_name());
camera.setCameraId((byte) getCamera_id());
camera.setIdentifier(String.valueOf(getCamera_input()));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.ComboBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.stage.FileChooser;
Expand Down Expand Up @@ -60,6 +61,9 @@ public class LoggerDeployController implements Initializable
@FXML
TableView<CameraBean> camera_table;

@FXML
TableColumn<CameraBean, CameraType> camera_type_column;

@FXML
TableColumn<CameraBean, String> camera_name_col;

Expand Down Expand Up @@ -127,6 +131,14 @@ public void initialize(URL location, ResourceBundle resources)

camera_table.setEditable(true);

ObservableList<CameraType> cameraOptionsList = FXCollections.observableArrayList(CameraType.values);
camera_type_column.setCellFactory(ComboBoxTableCell.forTableColumn(cameraOptionsList));
camera_type_column.setCellValueFactory(new PropertyValueFactory<CameraBean, CameraType>("camera_type"));
camera_type_column.setOnEditCommit(e ->
{
e.getRowValue().camera_type.set(e.getNewValue());
});

camera_id_col.setCellValueFactory(new PropertyValueFactory<CameraBean, Integer>("camera_id"));

camera_name_col.setCellFactory(TextFieldTableCell.forTableColumn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@
<children>
<TableView fx:id="camera_table" prefHeight="480.0" prefWidth="1234.0" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="camera_id_col" prefWidth="244.5" text="ID"/>
<TableColumn fx:id="camera_name_col" prefWidth="318.0" text="Name"/>
<TableColumn fx:id="camera_input_col" prefWidth="193.0" text="Input Number"/>
<TableColumn fx:id="camera_type_column" prefWidth="250.0" text="Type"/>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new column to javaFX

<TableColumn fx:id="camera_id_col" prefWidth="50.0" text="ID"/>
<TableColumn fx:id="camera_name_col" prefWidth="325.0" text="Name"/>
<TableColumn fx:id="camera_input_col" prefWidth="125.0" text="Input Number"/>
</columns>
</TableView>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="5.0">
Expand Down
Loading