use of javafx.beans.property.ReadOnlyObjectWrapper in project bitsquare by bitsquare.
the class OpenOffersView method setOfferIdColumnCellFactory.
private void setOfferIdColumnCellFactory() {
offerIdColumn.setCellValueFactory((openOfferListItem) -> new ReadOnlyObjectWrapper<>(openOfferListItem.getValue()));
offerIdColumn.setCellFactory(new Callback<TableColumn<OpenOfferListItem, OpenOfferListItem>, TableCell<OpenOfferListItem, OpenOfferListItem>>() {
@Override
public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
return new TableCell<OpenOfferListItem, OpenOfferListItem>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final OpenOfferListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
field = new HyperlinkWithIcon(model.getTradeId(item), true);
field.setOnAction(event -> offerDetailsWindow.show(item.getOffer()));
field.setTooltip(new Tooltip("Open popup for details"));
setGraphic(field);
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class TraderDisputeView method getSelectColumn.
// /////////////////////////////////////////////////////////////////////////////////////////
// Table
// /////////////////////////////////////////////////////////////////////////////////////////
private TableColumn<Dispute, Dispute> getSelectColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("shared.select"));
column.setMinWidth(80);
column.setMaxWidth(80);
column.setSortable(false);
column.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
@Override
public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
return new TableCell<Dispute, Dispute>() {
Button button;
@Override
public void updateItem(final Dispute item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new AutoTooltipButton(Res.get("shared.select"));
setGraphic(button);
}
button.setOnAction(e -> tableView.getSelectionModel().select(item));
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
};
}
});
return column;
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class TraderDisputeView method getStateColumn.
private TableColumn<Dispute, Dispute> getStateColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("support.state")) {
{
setMinWidth(50);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
@Override
public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
return new TableCell<Dispute, Dispute>() {
public ReadOnlyBooleanProperty closedProperty;
public ChangeListener<Boolean> listener;
@Override
public void updateItem(final Dispute item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
listener = (observable, oldValue, newValue) -> {
setText(newValue ? Res.get("support.closed") : Res.get("support.open"));
getTableRow().setOpacity(newValue ? 0.4 : 1);
};
closedProperty = item.isClosedProperty();
closedProperty.addListener(listener);
boolean isClosed = item.isClosed();
setText(isClosed ? Res.get("support.closed") : Res.get("support.open"));
getTableRow().setOpacity(isClosed ? 0.4 : 1);
} else {
if (closedProperty != null) {
closedProperty.removeListener(listener);
closedProperty = null;
}
setText("");
}
}
};
}
});
return column;
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class DepositView method setSelectColumnCellFactory.
private void setSelectColumnCellFactory() {
selectColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
selectColumn.setCellFactory(new Callback<TableColumn<DepositListItem, DepositListItem>, TableCell<DepositListItem, DepositListItem>>() {
@Override
public TableCell<DepositListItem, DepositListItem> call(TableColumn<DepositListItem, DepositListItem> column) {
return new TableCell<DepositListItem, DepositListItem>() {
Button button;
@Override
public void updateItem(final DepositListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new AutoTooltipButton(Res.get("shared.select"));
setGraphic(button);
}
button.setOnAction(e -> tableView.getSelectionModel().select(item));
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
};
}
});
}
use of javafx.beans.property.ReadOnlyObjectWrapper in project bisq-desktop by bisq-network.
the class LockedView method setAddressColumnCellFactory.
private void setAddressColumnCellFactory() {
addressColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
addressColumn.setCellFactory(new Callback<TableColumn<LockedListItem, LockedListItem>, TableCell<LockedListItem, LockedListItem>>() {
@Override
public TableCell<LockedListItem, LockedListItem> call(TableColumn<LockedListItem, LockedListItem> column) {
return new TableCell<LockedListItem, LockedListItem>() {
private HyperlinkWithIcon hyperlinkWithIcon;
@Override
public void updateItem(final LockedListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
String address = item.getAddressString();
hyperlinkWithIcon = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> openBlockExplorer(item));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", address)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);
if (hyperlinkWithIcon != null)
hyperlinkWithIcon.setOnAction(null);
}
}
};
}
});
}
Aggregations