use of javafx.scene.control.ToggleGroup in project bisq-desktop by bisq-network.
the class MenuItem method initialize.
@Override
public void initialize() {
listener = viewPath -> {
if (viewPath.size() != 4 || viewPath.indexOf(VotingView.class) != 2)
return;
selectedViewClass = viewPath.tip();
loadView(selectedViewClass);
};
ToggleGroup toggleGroup = new ToggleGroup();
dashboard = new MenuItem(navigation, toggleGroup, Res.get("shared.dashboard"), VotingDashboardView.class, AwesomeIcon.DASHBOARD);
vote = new MenuItem(navigation, toggleGroup, Res.get("share.vote"), VoteView.class, AwesomeIcon.EDIT);
history = new MenuItem(navigation, toggleGroup, Res.get("share.history"), VotingHistoryView.class, AwesomeIcon.TABLE);
leftVBox.getChildren().addAll(dashboard, vote, history);
}
use of javafx.scene.control.ToggleGroup in project bisq-desktop by bisq-network.
the class DisputeSummaryWindow method addReasonControls.
private void addReasonControls() {
Label label = addLabel(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.reason"), 10);
GridPane.setValignment(label, VPos.TOP);
reasonWasBugRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.bug"));
reasonWasUsabilityIssueRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.usability"));
reasonProtocolViolationRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.protocolViolation"));
reasonNoReplyRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.noReply"));
reasonWasScamRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.scam"));
reasonWasBankRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.bank"));
reasonWasOtherRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.other"));
HBox feeRadioButtonPane = new HBox();
feeRadioButtonPane.setSpacing(20);
feeRadioButtonPane.getChildren().addAll(reasonWasBugRadioButton, reasonWasUsabilityIssueRadioButton, reasonProtocolViolationRadioButton, reasonNoReplyRadioButton, reasonWasBankRadioButton, reasonWasScamRadioButton, reasonWasOtherRadioButton);
GridPane.setRowIndex(feeRadioButtonPane, rowIndex);
GridPane.setColumnIndex(feeRadioButtonPane, 1);
GridPane.setMargin(feeRadioButtonPane, new Insets(10, 0, 10, 0));
gridPane.getChildren().add(feeRadioButtonPane);
reasonToggleGroup = new ToggleGroup();
reasonWasBugRadioButton.setToggleGroup(reasonToggleGroup);
reasonWasUsabilityIssueRadioButton.setToggleGroup(reasonToggleGroup);
reasonProtocolViolationRadioButton.setToggleGroup(reasonToggleGroup);
reasonNoReplyRadioButton.setToggleGroup(reasonToggleGroup);
reasonWasScamRadioButton.setToggleGroup(reasonToggleGroup);
reasonWasOtherRadioButton.setToggleGroup(reasonToggleGroup);
reasonWasBankRadioButton.setToggleGroup(reasonToggleGroup);
reasonToggleSelectionListener = (observable, oldValue, newValue) -> {
if (newValue == reasonWasBugRadioButton)
disputeResult.setReason(DisputeResult.Reason.BUG);
else if (newValue == reasonWasUsabilityIssueRadioButton)
disputeResult.setReason(DisputeResult.Reason.USABILITY);
else if (newValue == reasonProtocolViolationRadioButton)
disputeResult.setReason(DisputeResult.Reason.PROTOCOL_VIOLATION);
else if (newValue == reasonNoReplyRadioButton)
disputeResult.setReason(DisputeResult.Reason.NO_REPLY);
else if (newValue == reasonWasScamRadioButton)
disputeResult.setReason(DisputeResult.Reason.SCAM);
else if (newValue == reasonWasBankRadioButton)
disputeResult.setReason(DisputeResult.Reason.BANK_PROBLEMS);
else if (newValue == reasonWasOtherRadioButton)
disputeResult.setReason(DisputeResult.Reason.OTHER);
};
reasonToggleGroup.selectedToggleProperty().addListener(reasonToggleSelectionListener);
}
use of javafx.scene.control.ToggleGroup in project bisq-desktop by bisq-network.
the class FeeOptionWindow method addContent.
private void addContent() {
Label label = addLabel(gridPane, ++rowIndex, Res.get("feeOptionWindow.info"));
GridPane.setColumnSpan(label, 2);
GridPane.setHalignment(label, HPos.LEFT);
toggleGroup = new ToggleGroup();
Tuple3<Label, RadioButton, RadioButton> tuple = addLabelRadioButtonRadioButton(gridPane, ++rowIndex, toggleGroup, Res.get("feeOptionWindow.optionsLabel"), "BTC", "BSQ");
RadioButton radioButtonBTC = tuple.second;
RadioButton radioButtonBSQ = tuple.third;
makerFeeTextField = addLabelTextField(gridPane, ++rowIndex, Res.getWithCol("createOffer.currencyForFee"), makerFeeWithCodeProperty.get()).second;
toggleChangeListener = (observable, oldValue, newValue) -> {
final boolean isBtc = newValue == radioButtonBTC;
selectionChangedHandler.accept(isBtc);
if (!isBsqForFeeAvailable && !isBtc) {
if (missingBsq != null) {
// We don't call hide() because we want to keep the blurred bg
if (stage != null)
stage.hide();
else
log.warn("Stage is null");
cleanup();
onHidden();
// noinspection unchecked
new Popup().warning(missingBsq).actionButtonTextWithGoTo("navigation.dao.wallet.receive").onAction(() -> {
UserThread.runAfter(() -> {
hide();
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqReceiveView.class);
}, 100, TimeUnit.MILLISECONDS);
}).closeButtonText(Res.get("feeOptionWindow.useBTC")).onClose(() -> {
selectionChangedHandler.accept(true);
closeHandler.run();
}).show();
}
UserThread.execute(() -> {
toggleGroup.selectToggle(radioButtonBTC);
radioButtonBSQ.setDisable(true);
});
}
};
toggleGroup.selectedToggleProperty().addListener(toggleChangeListener);
toggleGroup.selectToggle(!isBsqForFeeAvailable || isCurrencyForMakerFeeBtc ? radioButtonBTC : radioButtonBSQ);
makerFeeTextField.textProperty().bind(makerFeeWithCodeProperty);
}
use of javafx.scene.control.ToggleGroup in project bisq-desktop by bisq-network.
the class NetworkSettingsView method initialize.
public void initialize() {
btcHeader.setText(Res.get("settings.net.btcHeader"));
p2pHeader.setText(Res.get("settings.net.p2pHeader"));
onionAddressLabel.setText(Res.get("settings.net.onionAddressLabel"));
btcNodesLabel.setText(Res.get("settings.net.btcNodesLabel"));
bitcoinPeersLabel.setText(Res.get("settings.net.bitcoinPeersLabel"));
useTorForBtcJLabel.setText(Res.get("settings.net.useTorForBtcJLabel"));
bitcoinNodesLabel.setText(Res.get("settings.net.bitcoinNodesLabel"));
useProvidedNodesRadio.setText(Res.get("settings.net.useProvidedNodesRadio"));
useCustomNodesRadio.setText(Res.get("settings.net.useCustomNodesRadio"));
usePublicNodesRadio.setText(Res.get("settings.net.usePublicNodesRadio"));
reSyncSPVChainLabel.setText(Res.getWithCol("settings.net.reSyncSPVChainLabel"));
reSyncSPVChainButton.setText(Res.get("settings.net.reSyncSPVChainButton"));
p2PPeersLabel.setText(Res.get("settings.net.p2PPeersLabel"));
onionAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.onionAddressColumn")));
creationDateColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.creationDateColumn")));
connectionTypeColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.connectionTypeColumn")));
totalTrafficLabel.setText(Res.get("settings.net.totalTrafficLabel"));
roundTripTimeColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.roundTripTimeColumn")));
sentBytesColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.sentBytesColumn")));
receivedBytesColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.receivedBytesColumn")));
peerTypeColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.peerTypeColumn")));
openTorSettingsButton.setText(Res.get("settings.net.openTorSettingsButton"));
GridPane.setMargin(bitcoinPeersLabel, new Insets(4, 0, 0, 0));
GridPane.setValignment(bitcoinPeersLabel, VPos.TOP);
GridPane.setMargin(p2PPeersLabel, new Insets(4, 0, 0, 0));
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
bitcoinPeersTextArea.setPrefRowCount(4);
tableView.setMinHeight(180);
tableView.setPrefHeight(180);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
tableView.getSortOrder().add(creationDateColumn);
creationDateColumn.setSortType(TableColumn.SortType.ASCENDING);
bitcoinPeersToggleGroup = new ToggleGroup();
useProvidedNodesRadio.setToggleGroup(bitcoinPeersToggleGroup);
useCustomNodesRadio.setToggleGroup(bitcoinPeersToggleGroup);
usePublicNodesRadio.setToggleGroup(bitcoinPeersToggleGroup);
useProvidedNodesRadio.setUserData(BitcoinNodes.BitcoinNodesOption.PROVIDED);
useCustomNodesRadio.setUserData(BitcoinNodes.BitcoinNodesOption.CUSTOM);
usePublicNodesRadio.setUserData(BitcoinNodes.BitcoinNodesOption.PUBLIC);
selectedBitcoinNodesOption = BitcoinNodes.BitcoinNodesOption.values()[preferences.getBitcoinNodesOptionOrdinal()];
// in case PUBLIC is selected but we blocked it (B2X risk) we revert to provided nodes
if ((selectedBitcoinNodesOption == BitcoinNodes.BitcoinNodesOption.CUSTOM && (preferences.getBitcoinNodes() == null || preferences.getBitcoinNodes().isEmpty())) || (selectedBitcoinNodesOption == BitcoinNodes.BitcoinNodesOption.PUBLIC && isPreventPublicBtcNetwork())) {
selectedBitcoinNodesOption = BitcoinNodes.BitcoinNodesOption.PROVIDED;
preferences.setBitcoinNodesOptionOrdinal(selectedBitcoinNodesOption.ordinal());
}
if (!bitcoinNodes.useProvidedBtcNodes()) {
selectedBitcoinNodesOption = BitcoinNodes.BitcoinNodesOption.PUBLIC;
preferences.setBitcoinNodesOptionOrdinal(selectedBitcoinNodesOption.ordinal());
}
selectBitcoinPeersToggle();
onBitcoinPeersToggleSelected(false);
bitcoinPeersToggleGroupListener = (observable, oldValue, newValue) -> {
selectedBitcoinNodesOption = (BitcoinNodes.BitcoinNodesOption) newValue.getUserData();
preferences.setBitcoinNodesOptionOrdinal(selectedBitcoinNodesOption.ordinal());
onBitcoinPeersToggleSelected(true);
};
btcNodesInputTextFieldListener = (observable, oldValue, newValue) -> preferences.setBitcoinNodes(newValue);
btcNodesInputTextFieldFocusListener = (observable, oldValue, newValue) -> {
if (oldValue && !newValue)
showShutDownPopup();
};
filterPropertyListener = (observable, oldValue, newValue) -> {
applyPreventPublicBtcNetwork();
};
// TODO sorting needs other NetworkStatisticListItem as columns type
/* creationDateColumn.setComparator((o1, o2) ->
o1.statistic.getCreationDate().compareTo(o2.statistic.getCreationDate()));
sentBytesColumn.setComparator((o1, o2) ->
((Integer) o1.statistic.getSentBytes()).compareTo(((Integer) o2.statistic.getSentBytes())));
receivedBytesColumn.setComparator((o1, o2) ->
((Integer) o1.statistic.getReceivedBytes()).compareTo(((Integer) o2.statistic.getReceivedBytes())));*/
}
use of javafx.scene.control.ToggleGroup in project OTP2_R6_svaap by JNuutinen.
the class SettingsMenu method makeBackgroundSettings.
/**
* Apumetodi, joka rakentaa taustateeman asetukset.
*
* @param messages Lokalisoidut merkkijonot.
*/
private void makeBackgroundSettings(ResourceBundle messages) {
backgroundColorText = new Text(messages.getString("background"));
backgroundColorText.setStyle("-fx-fill: white");
final ToggleGroup bgButtons = new ToggleGroup();
normalBgButton = new RadioButton(messages.getString("normal"));
normalBgButton.setTextFill(Color.WHITE);
normalBgButton.setToggleGroup(bgButtons);
normalBgButton.setSelected(true);
normalBgButton.setUserData(NormalSpaceTheme.getInstance());
redBgButton = new RadioButton(messages.getString("red"));
redBgButton.setTextFill(Color.WHITE);
redBgButton.setToggleGroup(bgButtons);
redBgButton.setUserData(RedSpaceTheme.getInstance());
greenBgButton = new RadioButton(messages.getString("green"));
greenBgButton.setTextFill(Color.WHITE);
greenBgButton.setToggleGroup(bgButtons);
greenBgButton.setUserData(GreenSpaceTheme.getInstance());
purpleBgButton = new RadioButton(messages.getString("purple"));
purpleBgButton.setTextFill(Color.WHITE);
purpleBgButton.setToggleGroup(bgButtons);
purpleBgButton.setUserData(PurpleSpaceTheme.getInstance());
underWaterBgButton = new RadioButton(messages.getString("water"));
underWaterBgButton.setTextFill(Color.WHITE);
underWaterBgButton.setToggleGroup(bgButtons);
underWaterBgButton.setUserData(UnderwaterTheme.getInstance());
setBackgroundRadioButtonCallback(bgButtons);
}
Aggregations