Search in sources :

Example 1 with ListView

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();
}
Also used : TitledPane(javafx.scene.control.TitledPane) TabPane(javafx.scene.control.TabPane) ListView(javafx.scene.control.ListView) HOGMCodeArea(com.sri.ai.praise.sgsolver.demo.editor.HOGMCodeArea) Tab(javafx.scene.control.Tab) HOGMQueryError(com.sri.ai.praise.sgsolver.solver.HOGMQueryError) Node(javafx.scene.Node)

Example 2 with ListView

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;
}
Also used : SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ListCell(javafx.scene.control.ListCell) Node(javafx.scene.Node) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) SVNLogEntryPath(org.tmatesoft.svn.core.SVNLogEntryPath)

Example 3 with 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;
}
Also used : Button(javafx.scene.control.Button) PaymentAccountFactory(io.bitsquare.payment.PaymentAccountFactory) PaymentMethod(io.bitsquare.payment.PaymentMethod) Popup(io.bitsquare.gui.main.overlays.popups.Popup) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) TradeCurrency(io.bitsquare.locale.TradeCurrency) Tuple2(io.bitsquare.common.util.Tuple2) PaymentMethodForm(io.bitsquare.gui.components.paymentmethods.PaymentMethodForm) Inject(javax.inject.Inject) PaymentAccount(io.bitsquare.payment.PaymentAccount) Layout(io.bitsquare.gui.util.Layout) VPos(javafx.geometry.VPos) Callback(javafx.util.Callback) GridPane(javafx.scene.layout.GridPane) BSFormatter(io.bitsquare.gui.util.BSFormatter) Label(javafx.scene.control.Label) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) UserThread(io.bitsquare.common.UserThread) ImageUtil(io.bitsquare.gui.util.ImageUtil) io.bitsquare.gui.util.validation(io.bitsquare.gui.util.validation) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) TimeUnit(java.util.concurrent.TimeUnit) FormBuilder(io.bitsquare.gui.util.FormBuilder) Tuple3(io.bitsquare.common.util.Tuple3) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) CryptoCurrencyForm(io.bitsquare.gui.components.paymentmethods.CryptoCurrencyForm) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg) PaymentAccount(io.bitsquare.payment.PaymentAccount) ListCell(javafx.scene.control.ListCell) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) Button(javafx.scene.control.Button) ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane)

Example 4 with ListView

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);
        }
    });
}
Also used : ListView(javafx.scene.control.ListView) YoutubeQuality(com.github.axet.vget.vhs.YouTubeInfo.YoutubeQuality) ListCell(javafx.scene.control.ListCell) TextFieldListCell(javafx.scene.control.cell.TextFieldListCell) StringConverter(javafx.util.StringConverter) Dragboard(javafx.scene.input.Dragboard) FXML(javafx.fxml.FXML)

Example 5 with ListView

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;
}
Also used : Button(javafx.scene.control.Button) PopmoneyValidator(bisq.desktop.util.validation.PopmoneyValidator) Coin(org.bitcoinj.core.Coin) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) BSFormatter(bisq.desktop.util.BSFormatter) PaymentAccountFactory(bisq.core.payment.PaymentAccountFactory) WesternUnionAccount(bisq.core.payment.WesternUnionAccount) ComboBox(javafx.scene.control.ComboBox) Res(bisq.core.locale.Res) MoneyBeamValidator(bisq.desktop.util.validation.MoneyBeamValidator) BICValidator(bisq.desktop.util.validation.BICValidator) AliPayForm(bisq.desktop.components.paymentmethods.AliPayForm) PopmoneyForm(bisq.desktop.components.paymentmethods.PopmoneyForm) SwishForm(bisq.desktop.components.paymentmethods.SwishForm) VenmoForm(bisq.desktop.components.paymentmethods.VenmoForm) AliPayValidator(bisq.desktop.util.validation.AliPayValidator) SepaInstantForm(bisq.desktop.components.paymentmethods.SepaInstantForm) Popup(bisq.desktop.main.overlays.popups.Popup) ChaseQuickPayValidator(bisq.desktop.util.validation.ChaseQuickPayValidator) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder(bisq.desktop.util.FormBuilder) ClearXchangeValidator(bisq.desktop.util.validation.ClearXchangeValidator) PaymentMethod(bisq.core.payment.payload.PaymentMethod) Collectors(java.util.stream.Collectors) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) OKPayForm(bisq.desktop.components.paymentmethods.OKPayForm) OKPayValidator(bisq.desktop.util.validation.OKPayValidator) VenmoValidator(bisq.desktop.util.validation.VenmoValidator) PaymentAccount(bisq.core.payment.PaymentAccount) List(java.util.List) CashDepositForm(bisq.desktop.components.paymentmethods.CashDepositForm) RevolutValidator(bisq.desktop.util.validation.RevolutValidator) AnchorPane(javafx.scene.layout.AnchorPane) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UpholdForm(bisq.desktop.components.paymentmethods.UpholdForm) UserThread(bisq.common.UserThread) SpecificBankForm(bisq.desktop.components.paymentmethods.SpecificBankForm) IBANValidator(bisq.desktop.util.validation.IBANValidator) FasterPaymentsForm(bisq.desktop.components.paymentmethods.FasterPaymentsForm) MoneyBeamForm(bisq.desktop.components.paymentmethods.MoneyBeamForm) SwishValidator(bisq.desktop.util.validation.SwishValidator) ClearXchangeForm(bisq.desktop.components.paymentmethods.ClearXchangeForm) ListView(javafx.scene.control.ListView) FXCollections(javafx.collections.FXCollections) FxmlView(bisq.desktop.common.view.FxmlView) Inject(javax.inject.Inject) ClearXchangeAccount(bisq.core.payment.ClearXchangeAccount) Tuple2(bisq.common.util.Tuple2) USPostalMoneyOrderValidator(bisq.desktop.util.validation.USPostalMoneyOrderValidator) Tuple3(bisq.common.util.Tuple3) VPos(javafx.geometry.VPos) UpholdValidator(bisq.desktop.util.validation.UpholdValidator) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) RevolutForm(bisq.desktop.components.paymentmethods.RevolutForm) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) NationalBankForm(bisq.desktop.components.paymentmethods.NationalBankForm) SameBankForm(bisq.desktop.components.paymentmethods.SameBankForm) WesternUnionForm(bisq.desktop.components.paymentmethods.WesternUnionForm) Label(javafx.scene.control.Label) InteracETransferValidator(bisq.desktop.util.validation.InteracETransferValidator) PerfectMoneyForm(bisq.desktop.components.paymentmethods.PerfectMoneyForm) BisqEnvironment(bisq.core.app.BisqEnvironment) StringConverter(javafx.util.StringConverter) CashAppValidator(bisq.desktop.util.validation.CashAppValidator) USPostalMoneyOrderForm(bisq.desktop.components.paymentmethods.USPostalMoneyOrderForm) TimeUnit(java.util.concurrent.TimeUnit) PaymentMethodForm(bisq.desktop.components.paymentmethods.PaymentMethodForm) InputValidator(bisq.core.util.validation.InputValidator) ChaseQuickPayForm(bisq.desktop.components.paymentmethods.ChaseQuickPayForm) ImageUtil(bisq.desktop.util.ImageUtil) SepaForm(bisq.desktop.components.paymentmethods.SepaForm) ImageView(javafx.scene.image.ImageView) CashAppForm(bisq.desktop.components.paymentmethods.CashAppForm) InteracETransferForm(bisq.desktop.components.paymentmethods.InteracETransferForm) PerfectMoneyValidator(bisq.desktop.util.validation.PerfectMoneyValidator) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) PaymentAccount(bisq.core.payment.PaymentAccount) ListCell(javafx.scene.control.ListCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ListView(javafx.scene.control.ListView) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AnchorPane(javafx.scene.layout.AnchorPane)

Aggregations

ListView (javafx.scene.control.ListView)28 Label (javafx.scene.control.Label)15 ListCell (javafx.scene.control.ListCell)13 Button (javafx.scene.control.Button)12 Callback (javafx.util.Callback)10 GridPane (javafx.scene.layout.GridPane)9 ChangeListener (javafx.beans.value.ChangeListener)8 Insets (javafx.geometry.Insets)8 ImageView (javafx.scene.image.ImageView)8 Inject (javax.inject.Inject)8 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)7 AnchorPane (javafx.scene.layout.AnchorPane)7 UserThread (bisq.common.UserThread)6 Tuple2 (bisq.common.util.Tuple2)6 Res (bisq.core.locale.Res)6 FxmlView (bisq.desktop.common.view.FxmlView)6 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)6 Popup (bisq.desktop.main.overlays.popups.Popup)6 File (java.io.File)6 ObservableList (javafx.collections.ObservableList)6