aboutsummaryrefslogtreecommitdiffstats
path: root/ui-desktop/src/main/java/market/guess/ui/desktop/components/ParticipantItemView.java
blob: 2161cfe1bab5e3c0a30ab1a6411ddfb84a89a33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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());
  }
}