use of javafx.scene.control.cell.TextFieldTableCell in project Gargoyle by callakrsos.
the class FxTableViewUtil method getDisplayText.
/**
* 테이블컬럼에서 화면에 보여주는 텍스트를 리턴한다.
* @작성자 : KYJ
* @작성일 : 2017. 3. 31.
* @param tc
* @param row
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Object getDisplayText(TableColumn<?, ?> tc, int row) {
Callback cellFactory = tc.getCellFactory();
if (cellFactory != null) /*&& cellObservableValue != null*/
{
// Object value = cellObservableValue.getValue();
Object call = cellFactory.call(tc);
if (call != null && call instanceof TableCell) {
TableCell cell = (TableCell) call;
StringConverter converter = null;
if (cell instanceof TextFieldTableCell) {
TextFieldTableCell txtCell = (TextFieldTableCell) cell;
converter = txtCell.getConverter();
} else // }
if (cell instanceof ComboBoxTableCell) {
ComboBoxTableCell txtCell = (ComboBoxTableCell) cell;
converter = txtCell.getConverter();
} else // else if (cell instanceof HyperlinkTableCell) {
// HyperlinkTableCell txtCell = (HyperlinkTableCell) cell;
// converter = txtCell.getConverter();
// }
/* else 기본값. */
{
try {
Method m = cell.getClass().getMethod("converterProperty");
if (m != null) {
Object object = m.invoke(cell);
if (object != null && object instanceof ObjectProperty) {
ObjectProperty<StringConverter> convert = (ObjectProperty<StringConverter>) object;
converter = convert.get();
}
}
} catch (Exception e) {
// Nothing...
}
}
if (converter != null) {
Object cellData = tc.getCellData(row);
return converter.toString(cellData);
}
}
return call;
}
return tc.getCellData(row);
}
Aggregations