Java Code Examples for javafx.scene.control.Cell#setGraphic()

The following examples show how to use javafx.scene.control.Cell#setGraphic() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CellUtils.java    From ARMStrong with Mozilla Public License 2.0 6 votes vote down vote up
static <T> void startEdit(final Cell<T> cell,
                          final StringConverter<T> converter,
                          final HBox hbox,
                          final Node graphic,
                          final TextField textField) {
    if (textField != null) {
        textField.setText(getItemText(cell, converter));
    }
    cell.setText(null);

    if (graphic != null) {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
Example 2
Source File: CellUtiles.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
static <T> void startEdit(final Cell<T> cell,
                          final StringConverter<T> converter,
                          final HBox hbox,
                          final Node graphic,
                          final TextField textField) {
    textField.setText(getItemText(cell, converter));
    cell.setText(null);

    if (graphic != null) {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
Example 3
Source File: CTimePeriodField.java    From Open-Lowcode with Eclipse Public License 2.0 5 votes vote down vote up
static void updateItem(
		final Cell<TimePeriod> cell,
		final HBox hbox,
		final Node graphic,
		final TimePeriodField timeperiodfield) {
	if (cell.isEmpty()) {
		cell.setText(null);
		cell.setGraphic(null);
	} else {
		if (cell.isEditing()) {
			if (timeperiodfield != null) {
				timeperiodfield.setTimePeriod(cell.getItem());
			}
			cell.setText(null);

			if (graphic != null) {
				hbox.getChildren().setAll(graphic, timeperiodfield);
				cell.setGraphic(hbox);
			} else {
				cell.setGraphic(timeperiodfield);
			}
		} else {
			cell.setText((cell.getItem() != null ? cell.getItem().toString() : ""));
			cell.setGraphic(graphic);
		}
	}
}
 
Example 4
Source File: CellUtils.java    From ARMStrong with Mozilla Public License 2.0 5 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final ChoiceBox<T> choiceBox) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (choiceBox != null) {
                choiceBox.getSelectionModel().select(cell.getItem());
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, choiceBox);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(choiceBox);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
Example 5
Source File: CellUtils.java    From ARMStrong with Mozilla Public License 2.0 5 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final TextField textField) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (textField != null) {
                //textField.setText(getItemText(cell, converter));
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, textField);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(textField);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
Example 6
Source File: CellUtils.java    From ARMStrong with Mozilla Public License 2.0 5 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final ComboBox<T> comboBox) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (comboBox != null) {
                comboBox.getSelectionModel().select(cell.getItem());
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, comboBox);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(comboBox);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
Example 7
Source File: CellUtiles.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final ChoiceBox<T> choiceBox) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (choiceBox != null) {
                choiceBox.getSelectionModel().select(cell.getItem());
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, choiceBox);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(choiceBox);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
Example 8
Source File: CellUtiles.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final TextField textField) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (textField != null) {
                textField.setText(getItemText(cell, converter));
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, textField);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(textField);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
Example 9
Source File: CellUtiles.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final ComboBox<T> comboBox) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (comboBox != null) {
                comboBox.getSelectionModel().select(cell.getItem());
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, comboBox);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(comboBox);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
Example 10
Source File: CellUtils.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
static <T> void cancelEdit(Cell<T> cell, final StringConverter<T> converter, Node graphic) {
    cell.setText(getItemText(cell, converter));
    cell.setGraphic(graphic);
}
 
Example 11
Source File: CellUtiles.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
static <T> void cancelEdit(Cell<T> cell, final StringConverter<T> converter, Node graphic) {
    cell.setText(getItemText(cell, converter));
    cell.setGraphic(graphic);
}