use of javafx.scene.control.ListView in project aic-praise by aic-sri-international.
the class QueryController method displayQueryErrors.
private void displayQueryErrors(String query, List<HOGMQueryError> queryErrors, ParsedHOGModel parsedModel, long millisecondsToCompute) {
String title = "Query '" + query + "' encountered " + queryErrors.size() + " error(s) when attempting to compute answer (" + duration("took ", millisecondsToCompute) + ")";
ListView<HOGMQueryError> errors = new ListView<>(FXCollections.observableList(queryErrors));
//errors.setFixedCellSize(24);
errors.setPrefHeight(24 * 5);
errors.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
errors.getSelectionModel().selectedIndexProperty().addListener((obs, oldValue, newValue) -> {
if (newValue.intValue() >= 0) {
HOGMQueryError qError = errors.getItems().get(newValue.intValue());
if (qError.getContext() == HOGMQueryError.Context.MODEL) {
modelPageEditor.highlight(qError.getStartContextIndex(), qError.getEndContextIndex());
} else if (qError.getContext() == HOGMQueryError.Context.QUERY) {
queryComboBox.getEditor().selectAll();
}
}
});
Node resultContent = null;
if (SGSolverDemoController.isInDebugMode()) {
HOGMCodeArea parsedModelArea = createParsedModelView(parsedModel);
TabPane resultTabs = new TabPane();
resultTabs.getTabs().add(new Tab("Errors", errors));
resultTabs.getTabs().add(new Tab("Parsed As", parsedModelArea));
resultContent = resultTabs;
} else {
resultContent = errors;
}
TitledPane resultPane = new TitledPane(title, resultContent);
FXUtil.setTitledPaneIcon(resultPane, FontAwesomeIcons.TIMES);
showResultPane(resultPane);
errors.getSelectionModel().selectFirst();
}
use of javafx.scene.control.ListView in project Gargoyle by callakrsos.
the class FxSVNHistoryDataSupplier method createEntryListView.
// MenuItem createDiffMenu(){
//
// }
ListView<SVNLogEntry> createEntryListView(ObservableList<SVNLogEntry> list) {
ListView<SVNLogEntry> listView = new ListView<SVNLogEntry>(list);
listView.setCellFactory(new Callback<ListView<SVNLogEntry>, ListCell<SVNLogEntry>>() {
@Override
public ListCell<SVNLogEntry> call(ListView<SVNLogEntry> param) {
ListCell<SVNLogEntry> listCell = new ListCell<SVNLogEntry>() {
/* (non-Javadoc)
* @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean)
*/
@Override
protected void updateItem(SVNLogEntry item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
} else {
long revision = item.getRevision();
String author = item.getAuthor();
String dateString = YYYY_MM_DD_HH_MM_SS_PATTERN.format(item.getDate());
String message = item.getMessage();
setText(String.format("Resivion :%d author %s date :%s message :%s ", revision, author, dateString, message));
}
}
};
return listCell;
}
});
listView.setPrefSize(600, ListView.USE_COMPUTED_SIZE);
listView.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
if (ev.getClickCount() == 2 && ev.getButton() == MouseButton.PRIMARY) {
SVNLogEntry selectedItem = listView.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
Map<String, SVNLogEntryPath> changedPaths = selectedItem.getChangedPaths();
if (ValueUtil.isNotEmpty(changedPaths)) {
ObservableList<GargoyleSVNLogEntryPath> collect = createStream(Arrays.asList(selectedItem)).collect(FxCollectors.toObservableList());
Node showing = null;
if (collect.isEmpty()) {
showing = new Label("Empty.");
showing.setStyle("-fx-text-fill:black");
} else {
showing = createHistoryListView(collect);
}
FxUtil.showPopOver(ev.getPickResult().getIntersectedNode(), showing);
}
}
}
});
return listView;
}
use of javafx.scene.control.ListView in project bitsquare by bitsquare.
the class AltCoinAccountsView method buildForm.
///////////////////////////////////////////////////////////////////////////////////////////
// Base form
///////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
addTitledGroupBg(root, gridRow, 1, "Manage accounts");
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your altcoin accounts:", Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
paymentAccountsListView = tuple.second;
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {
@Override
public ListCell<PaymentAccount> call(ListView<PaymentAccount> list) {
return new ListCell<PaymentAccount>() {
final Label label = new Label();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final PaymentAccount item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getAccountName());
removeButton.setOnAction(e -> onDeleteAccount(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, "Add new account", "Export Accounts", "Import Accounts");
addAccountButton = tuple3.first;
exportButton = tuple3.second;
importButton = tuple3.third;
}
use of javafx.scene.control.ListView in project Gargoyle by callakrsos.
the class UtubeDownloaderComposite method initialize.
@FXML
public void initialize() {
btnDownload.setDisable(true);
this.txtDownloadLocation.setText(System.getProperty("user.home"));
this.txtDownloadLocation.setPromptText("Downlaod Location");
// this.lvDownlaodCont.setCellFactory(new Callback<ListView<UtubeItemDVO>, ListCell<UtubeItemDVO>>() {
//
// @Override
// public ListCell<UtubeItemDVO> call(ListView<UtubeItemDVO> param) {
// return new UtubeListCell();
// }
// });
// this.lvDownlaodCont.setOnDragDetected(ev -> {
// ev.setDragDetect(true);
// });
txtUtubeURL.setOnDragOver(ev -> {
if (ev.getDragboard().hasUrl()) {
ev.acceptTransferModes(TransferMode.LINK);
ev.consume();
}
});
txtUtubeURL.setOnDragDropped(ev -> {
Dragboard dragboard = ev.getDragboard();
String url = dragboard.getUrl();
txtUtubeURL.setText(url);
});
txtUtubeURL.textProperty().addListener((oba, o, n) -> {
btnDownload.setDisable(n.trim().isEmpty());
});
// 초기값
this.cbQuality.getItems().addAll(YoutubeQuality.values());
// 디폴트
this.cbQuality.getSelectionModel().select(YoutubeQuality.p480);
this.cbQuality.setCellFactory(new Callback<ListView<YoutubeQuality>, ListCell<YoutubeQuality>>() {
@Override
public ListCell<YoutubeQuality> call(ListView<YoutubeQuality> param) {
return new TextFieldListCell<>(new StringConverter<YoutubeQuality>() {
@Override
public String toString(YoutubeQuality object) {
return object.name();
}
@Override
public YoutubeQuality fromString(String string) {
return YoutubeQuality.valueOf(string);
}
});
}
});
this.wasDownloading.addListener((oba, o, n) -> {
if (n != null)
this.btnDownload.setDisable(n.booleanValue());
});
this.downloadedFile.addListener((oba, o, n) -> {
if (n != null && n.exists()) {
// btnOpen.setDisable(false);
this.txtFileName.setText(n.getName());
} else {
// btnOpen.setDisable(true);
}
});
}
use of javafx.scene.control.ListView in project bisq-desktop by bisq-network.
the class FiatAccountsView method buildForm.
// /////////////////////////////////////////////////////////////////////////////////////////
// Base form
// /////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
tuple.first.setTextAlignment(TextAlignment.RIGHT);
// noinspection unchecked
paymentAccountsListView = tuple.second;
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {
@Override
public ListCell<PaymentAccount> call(ListView<PaymentAccount> list) {
return new ListCell<PaymentAccount>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final PaymentAccount item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getAccountName());
removeButton.setOnAction(e -> onDeleteAccount(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, Res.get("shared.addNewAccount"), Res.get("shared.ExportAccounts"), Res.get("shared.importAccounts"));
addAccountButton = tuple3.first;
exportButton = tuple3.second;
importButton = tuple3.third;
}
Aggregations