use of javafx.scene.control.TextField in project POL-POM-5 by PhoenicisOrg.
the class SearchBox method populate.
/**
* Populates the searchbox
*/
private void populate() {
this.getStyleClass().add("searchBox");
this.searchField = new TextField();
this.searchField.getStyleClass().add("searchBar");
this.searchField.prefHeightProperty().bind(this.prefHeightProperty());
this.searchField.prefWidthProperty().bind(this.prefWidthProperty());
this.searchField.textProperty().addListener(event -> this.onSearch.ifPresent(onSearch -> onSearch.accept(getText())));
AnchorPane.setLeftAnchor(searchField, 0.0);
AnchorPane.setRightAnchor(searchField, 0.0);
this.clearButton = new Button();
this.clearButton.getStyleClass().add("searchCleanButton");
this.clearButton.setOnMouseClicked(event -> {
this.searchField.clear();
this.onClear.ifPresent(Runnable::run);
});
AnchorPane.setRightAnchor(clearButton, 0.0);
this.getChildren().addAll(searchField, clearButton);
}
use of javafx.scene.control.TextField in project bisq-desktop by bisq-network.
the class SwishForm method addFormForDisplayAccount.
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), swishAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(swishAccount.getPaymentMethod().getId()));
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), swishAccount.getHolderName());
TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.mobile"), swishAccount.getMobileNr()).second;
field.setMouseTransparent(false);
TradeCurrency singleTradeCurrency = swishAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
addLimitations();
}
use of javafx.scene.control.TextField in project bisq-desktop by bisq-network.
the class UpholdForm method addFormForDisplayAccount.
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), upholdAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(upholdAccount.getPaymentMethod().getId()));
TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.uphold.accountId"), upholdAccount.getAccountId()).second;
field.setMouseTransparent(false);
addLimitations();
addCurrenciesGrid(false);
}
use of javafx.scene.control.TextField in project bisq-desktop by bisq-network.
the class MainView method getBalanceBox.
private Tuple2<TextField, VBox> getBalanceBox(String text) {
TextField textField = new TextField();
textField.setEditable(false);
// 140
textField.setPrefWidth(115);
textField.setMouseTransparent(true);
textField.setFocusTraversable(false);
textField.getStyleClass().add("display-text-field");
Label label = new AutoTooltipLabel(text);
label.setId("nav-balance-label");
label.setPadding(new Insets(0, 5, 0, 5));
label.setPrefWidth(textField.getPrefWidth());
VBox vBox = new VBox();
vBox.setSpacing(3);
vBox.setPadding(new Insets(11, 0, 0, 0));
vBox.getChildren().addAll(textField, label);
return new Tuple2<>(textField, vBox);
}
use of javafx.scene.control.TextField in project bisq-desktop by bisq-network.
the class MainView method initialize.
@Override
protected void initialize() {
MainView.rootContainer = root;
ToggleButton marketButton = new NavButton(MarketView.class, Res.get("mainView.menu.market"));
ToggleButton buyButton = new NavButton(BuyOfferView.class, Res.get("mainView.menu.buyBtc"));
ToggleButton sellButton = new NavButton(SellOfferView.class, Res.get("mainView.menu.sellBtc"));
ToggleButton portfolioButton = new NavButton(PortfolioView.class, Res.get("mainView.menu.portfolio"));
ToggleButton fundsButton = new NavButton(FundsView.class, Res.get("mainView.menu.funds"));
ToggleButton disputesButton = new NavButton(DisputesView.class, Res.get("mainView.menu.support"));
ToggleButton settingsButton = new NavButton(SettingsView.class, Res.get("mainView.menu.settings"));
ToggleButton accountButton = new NavButton(AccountView.class, Res.get("mainView.menu.account"));
ToggleButton daoButton = new NavButton(DaoView.class, Res.get("mainView.menu.dao"));
Pane portfolioButtonHolder = new Pane(portfolioButton);
Pane disputesButtonHolder = new Pane(disputesButton);
if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
daoButton.setVisible(false);
daoButton.setManaged(false);
}
root.sceneProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
newValue.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
// TODO can be removed once DAO is released
if (Utilities.isAltOrCtrlPressed(KeyCode.D, keyEvent)) {
if (BisqEnvironment.getBaseCurrencyNetwork().isBitcoin()) {
daoButton.setVisible(true);
daoButton.setManaged(true);
}
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT1, keyEvent)) {
marketButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT2, keyEvent)) {
buyButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT3, keyEvent)) {
sellButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT4, keyEvent)) {
portfolioButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT5, keyEvent)) {
fundsButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT6, keyEvent)) {
disputesButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT7, keyEvent)) {
settingsButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT8, keyEvent)) {
accountButton.fire();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.DIGIT9, keyEvent)) {
if (daoButton.isVisible())
daoButton.fire();
}
});
}
});
HBox leftNavPane = new HBox(marketButton, buyButton, sellButton, portfolioButtonHolder, fundsButton, disputesButtonHolder) {
{
setLeftAnchor(this, 10d);
setTopAnchor(this, 0d);
}
};
Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> marketPriceBox = getMarketPriceBox();
ComboBox<PriceFeedComboBoxItem> priceComboBox = marketPriceBox.first;
priceComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
model.setPriceFeedComboBoxItem(newValue);
});
ChangeListener<PriceFeedComboBoxItem> selectedPriceFeedItemListener = (observable, oldValue, newValue) -> {
if (newValue != null)
priceComboBox.getSelectionModel().select(newValue);
};
model.selectedPriceFeedComboBoxItemProperty.addListener(selectedPriceFeedItemListener);
priceComboBox.setItems(model.priceFeedComboBoxItems);
HBox.setMargin(marketPriceBox.second, new Insets(0, 0, 0, 0));
Tuple2<TextField, VBox> availableBalanceBox = getBalanceBox(Res.get("mainView.balance.available"));
availableBalanceBox.first.textProperty().bind(model.availableBalance);
Tuple2<TextField, VBox> reservedBalanceBox = getBalanceBox(Res.get("mainView.balance.reserved"));
reservedBalanceBox.first.textProperty().bind(model.reservedBalance);
Tuple2<TextField, VBox> lockedBalanceBox = getBalanceBox(Res.get("mainView.balance.locked"));
lockedBalanceBox.first.textProperty().bind(model.lockedBalance);
HBox rightNavPane = new HBox(marketPriceBox.second, availableBalanceBox.second, reservedBalanceBox.second, lockedBalanceBox.second, settingsButton, accountButton, daoButton) {
{
setRightAnchor(this, 10d);
setTopAnchor(this, 0d);
}
};
root.widthProperty().addListener((observable, oldValue, newValue) -> {
double w = (double) newValue;
if (w > 0) {
leftNavPane.setSpacing(w >= 1080 ? 12 : 6);
rightNavPane.setSpacing(w >= 1080 ? 12 : 6);
}
});
AnchorPane contentContainer = new AnchorPane() {
{
setId("content-pane");
setLeftAnchor(this, 0d);
setRightAnchor(this, 0d);
setTopAnchor(this, 60d);
setBottomAnchor(this, 10d);
}
};
AnchorPane applicationContainer = new AnchorPane(leftNavPane, rightNavPane, contentContainer) {
{
setId("content-pane");
}
};
BorderPane baseApplicationContainer = new BorderPane(applicationContainer) {
{
setId("base-content-container");
}
};
baseApplicationContainer.setBottom(createFooter());
setupNotificationIcon(portfolioButtonHolder);
setupDisputesIcon(disputesButtonHolder);
navigation.addListener(viewPath -> {
if (viewPath.size() != 2 || viewPath.indexOf(MainView.class) != 0)
return;
Class<? extends View> viewClass = viewPath.tip();
View view = viewLoader.load(viewClass);
contentContainer.getChildren().setAll(view.getRoot());
navButtons.getToggles().stream().filter(toggle -> toggle instanceof NavButton).filter(button -> viewClass == ((NavButton) button).viewClass).findFirst().orElseThrow(() -> new BisqException("No button matching %s found", viewClass)).setSelected(true);
});
VBox splashScreen = createSplashScreen();
root.getChildren().addAll(baseApplicationContainer, splashScreen);
model.showAppScreen.addListener((ov, oldValue, newValue) -> {
if (newValue) {
navigation.navigateToPreviousVisitedView();
if (!persistedFilesCorrupted.isEmpty()) {
if (persistedFilesCorrupted.size() > 1 || !persistedFilesCorrupted.get(0).equals("ViewPathAsString")) {
// show warning that some files has been corrupted
new Popup<>().warning(Res.get("popup.warning.incompatibleDB", persistedFilesCorrupted.toString(), model.getAppDateDir())).useShutDownButton().show();
} else {
log.debug("We detected incompatible data base file for Navigation. That is a minor issue happening with refactoring of UI classes " + "and we don't display a warning popup to the user.");
}
}
transitions.fadeOutAndRemove(splashScreen, 1500, actionEvent -> disposeSplashScreen());
}
});
// Delay a bit to give time for rendering the splash screen
UserThread.execute(model::start);
}
Aggregations