Skip to content

Commit

Permalink
feat: Improve HyperlinkTableCell (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknowIfGuestInDream committed Aug 4, 2023
1 parent 53abab8 commit 43e12d4
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* Hyperlink Cell for TableView
*
*
* @author: unknowIfGuestInDream
* @date: 2023/8/4 13:43
*/
Expand All @@ -35,16 +35,15 @@ protected void updateItem(T item, boolean empty) {
setText(null);
setGraphic(null);
} else {
setGraphic(hyperlink);
getTableRow();
getTableView().getItems();
hyperlink.setText(getTableColumn().getCellObservableValue(getIndex()).getValue().toString());
hyperlink.setOnAction(e -> {
String url = func.apply(getTableView().getItems().get(getIndex())).toString();
if (!url.isEmpty()) {
CoreUtil.openWeb(url);
}
});
String url = func.apply(getTableView().getItems().get(getIndex())).toString();
if (!url.isEmpty()) {
setGraphic(hyperlink);
hyperlink.setText(getTableColumn().getCellObservableValue(getIndex()).getValue().toString());
hyperlink.setOnAction(e -> CoreUtil.openWeb(url));
} else {
setGraphic(null);
setText(getTableColumn().getCellObservableValue(getIndex()).getValue().toString());
}
}
}

Expand Down

0 comments on commit 43e12d4

Please sign in to comment.