示例#1
0
  @Override
  public void initialize() {
    disputesTable = new TableView<>();
    VBox.setVgrow(disputesTable, Priority.SOMETIMES);
    disputesTable.setMinHeight(150);
    root.getChildren().add(disputesTable);

    TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn();
    disputesTable.getColumns().add(tradeIdColumn);
    TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
    disputesTable.getColumns().add(roleColumn);
    TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
    disputesTable.getColumns().add(dateColumn);
    TableColumn<Dispute, Dispute> contractColumn = getContractColumn();
    disputesTable.getColumns().add(contractColumn);
    TableColumn<Dispute, Dispute> stateColumn = getStateColumn();
    disputesTable.getColumns().add(stateColumn);

    disputesTable.getSortOrder().add(dateColumn);
    disputesTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new Label("There are no open tickets");
    placeholder.setWrapText(true);
    disputesTable.setPlaceholder(placeholder);
    disputesTable.getSelectionModel().clearSelection();

    disputeChangeListener = (observableValue, oldValue, newValue) -> onSelectDispute(newValue);
  }
示例#2
0
 public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top) {
   Label label = new Label(text);
   label.setWrapText(true);
   GridPane.setHalignment(label, HPos.LEFT);
   GridPane.setRowIndex(label, rowIndex);
   GridPane.setColumnSpan(label, 2);
   GridPane.setMargin(label, new Insets(top, 0, 0, 0));
   gridPane.getChildren().add(label);
   return label;
 }
  private TitledPane createTitledPane(CreditRequest creditRequest) {
    TitledPane titledPane = new TitledPane();
    titledPane.setText("UserId: " + creditRequest.getUserId());
    VBox vBox = new VBox();
    TextFlow textFlow = new TextFlow();

    Label label = new Label(creditRequest.toString());
    label.setWrapText(true);
    textFlow.getChildren().add(label);

    textFlow.getChildren().add(new Label("Validate: "));
    CheckBox isValidCheckBox = new CheckBox();
    CheckBox rejectCheckBox = new CheckBox();

    isValidCheckBox
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue == true) {
                rejectCheckBox.setSelected(false);
                creditRequest.setValidated(true);
              } else {
                creditRequest.setValidated(null);
              }
            });
    textFlow.getChildren().add(isValidCheckBox);

    textFlow.getChildren().add(new Label("Reject: "));
    rejectCheckBox
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue == true) {
                isValidCheckBox.setSelected(false);
                creditRequest.setValidated(false);
              } else {
                creditRequest.setValidated(null);
              }
            });
    textFlow.getChildren().add(rejectCheckBox);

    Button creditHistoryButton = new Button("View Credit History");
    creditHistoryButton.setOnAction(
        e -> {
          session.setUserUnderValidationId(creditRequest.getUserId());
          screens.toCreditHistoryPage();
        });
    vBox.getChildren().add(textFlow);
    vBox.getChildren().add(creditHistoryButton);

    titledPane.setContent(vBox);

    return titledPane;
  }
    public FileGridCell() {
      Label titleLabel = new Label();
      titleLabel.setPrefWidth(80);
      titleLabel.setWrapText(true);
      titleLabel.setTextAlignment(TextAlignment.CENTER);
      title = titleLabel.textProperty();

      ImageView iconView = new ImageView();
      icon = iconView.imageProperty();

      VBox vbox = new VBox(iconView, titleLabel);
      vbox.setAlignment(Pos.TOP_CENTER);

      setGraphic(vbox);
    }
  /** Set the Labels */
  protected void setLabels() {
    mLabels = new HashMap<String, Label>();
    mValues = new HashMap<String, Label>();

    for (String name : mLabelNames) {
      Label newLabel1 = new Label(name);
      Label newLabel2 = new Label();
      newLabel1.setFont(new Font("Arial", 20));
      newLabel2.setFont(new Font("Arial", 20));
      mLabels.put(name, newLabel1);
      mValues.put(name, newLabel2);
    }

    Label upgradeLabel = new Label(mUpgradeName);
    upgradeLabel.setFont(new Font("Arial", 25));
    upgradeLabel.setWrapText(true);
    mLabels.put(mUpgradeName, upgradeLabel);

    update();
  }
示例#6
0
  private Tuple2<TableView<Offer>, VBox> getOfferTable(Offer.Direction direction) {
    TableView<Offer> tableView = new TableView();

    // price
    TableColumn<Offer, Offer> priceColumn = new TableColumn<>();
    priceColumn.textProperty().bind(priceColumnLabel);
    priceColumn.setMinWidth(120);
    priceColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    priceColumn.setCellFactory(
        new Callback<TableColumn<Offer, Offer>, TableCell<Offer, Offer>>() {
          @Override
          public TableCell<Offer, Offer> call(TableColumn<Offer, Offer> column) {
            return new TableCell<Offer, Offer>() {
              @Override
              public void updateItem(final Offer item, boolean empty) {
                super.updateItem(item, empty);
                if (item != null && !empty) setText(formatter.formatFiat(item.getPrice()));
                else setText("");
              }
            };
          }
        });
    tableView.getColumns().add(priceColumn);

    // amount
    TableColumn<Offer, Offer> amountColumn = new TableColumn<>("Amount (BTC)");
    amountColumn.setText("Amount (BTC)");
    amountColumn.setMinWidth(120);
    amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    amountColumn.setCellFactory(
        new Callback<TableColumn<Offer, Offer>, TableCell<Offer, Offer>>() {
          @Override
          public TableCell<Offer, Offer> call(TableColumn<Offer, Offer> column) {
            return new TableCell<Offer, Offer>() {
              @Override
              public void updateItem(final Offer item, boolean empty) {
                super.updateItem(item, empty);
                if (item != null && !empty) setText(formatter.formatCoin(item.getAmount()));
                else setText("");
              }
            };
          }
        });
    tableView.getColumns().add(amountColumn);

    // volume
    TableColumn<Offer, Offer> volumeColumn = new TableColumn<>("Amount (BTC)");
    volumeColumn.setMinWidth(120);
    volumeColumn.textProperty().bind(volumeColumnLabel);
    volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    volumeColumn.setCellFactory(
        new Callback<TableColumn<Offer, Offer>, TableCell<Offer, Offer>>() {
          @Override
          public TableCell<Offer, Offer> call(TableColumn<Offer, Offer> column) {
            return new TableCell<Offer, Offer>() {
              @Override
              public void updateItem(final Offer item, boolean empty) {
                super.updateItem(item, empty);
                if (item != null && !empty) setText(formatter.formatFiat(item.getOfferVolume()));
                else setText("");
              }
            };
          }
        });
    tableView.getColumns().add(volumeColumn);

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new Label("Currently there are no offers available");
    placeholder.setWrapText(true);
    tableView.setPlaceholder(placeholder);

    Label titleLabel =
        new Label(
            direction.equals(Offer.Direction.BUY)
                ? "Offers for buy bitcoin (bid)"
                : "Offers for sell bitcoin (ask)");
    titleLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 16; -fx-alignment: center");
    UserThread.execute(() -> titleLabel.prefWidthProperty().bind(tableView.widthProperty()));

    VBox vBox = new VBox();
    vBox.setSpacing(10);
    vBox.setFillWidth(true);
    vBox.setMinHeight(150);
    vBox.getChildren().addAll(titleLabel, tableView);
    return new Tuple2<>(tableView, vBox);
  }