Skip to content

Instantly share code, notes, and snippets.

@emorgado
Created April 6, 2015 13:35
Show Gist options
  • Save emorgado/d8a49ecb5d5bef07fdc4 to your computer and use it in GitHub Desktop.
Save emorgado/d8a49ecb5d5bef07fdc4 to your computer and use it in GitHub Desktop.
ProcessamentoController.java
clItemBetonadaSobrepeso.setCellFactory(new Callback<TableColumn<ItemBetonada, Boolean>, TableCell<ItemBetonada, Boolean>>() {
public TableCell<ItemBetonada, Boolean> call(TableColumn<ItemBetonada, Boolean> param) {
return new TableCell<ItemBetonada, Boolean>() {
Label label;
{
label = new Label("");
label.getStyleClass().add("mixcontroller-icon");
setGraphic(label);
}
@Override
public void updateItem(Boolean item, boolean empty) {
super.updateItem(item, empty);
TableRow<ItemBetonada> row = getTableRow();
if (row != null) {
row.getStyleClass().removeAll("greenRow","redRow");
}
ItemBetonada itemBetonada = row.getItem();
if (itemBetonada != null && itemBetonada.getQuantidadeMedida() > 0) {
label.getStyleClass().removeAll("text-color-red", "text-color-green", "text-color-blue");
if (itemBetonada.getSobrePeso() == true) {
label.setText("g");
label.getStyleClass().add("text-color-red");
row.getStyleClass().add("redRow");
} else {
label.setText("i");
label.getStyleClass().add("text-color-green");
}
}
}
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment