package market.guess.ui.desktop.components; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.layout.HBox; import market.guess.ui.desktop.model.ParticipantRow; import market.guess.ui.desktop.util.Views; public class ParticipantItemView extends HBox { @FXML private Label userLabel; @FXML private Label yesLabel; @FXML private Label noLabel; @FXML private Label valueLabel; @FXML private Label feesLabel; public ParticipantItemView() { Views.loadRoot(this, "participant_item.fxml"); } public ParticipantItemView(ParticipantRow p) { this(); update(p); } public void update(ParticipantRow p) { userLabel.setText(p.user() + (p.tag().isEmpty() ? "" : " (" + p.tag() + ")")); yesLabel.setText(String.valueOf(p.yes())); noLabel.setText(String.valueOf(p.no())); valueLabel.setText(p.value()); feesLabel.setText(p.fees()); } }