Use auto focus on the first input field on all screens

This commit is contained in:
Bernard Labno 2018-01-31 19:02:34 +01:00
parent 0b28e12905
commit f0a985ea0d
6 changed files with 24 additions and 1 deletions

View file

@ -401,6 +401,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
} catch (ParseException ignore) {
}
}
GUIUtil.requestFocus(filterTextField);
}
@Override
@ -911,6 +912,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
root.getChildren().add(2, messagesAnchorPane);
scrollToBottom();
GUIUtil.requestFocus(inputTextArea);
}
addListenersOnSelectDispute();

View file

@ -124,8 +124,10 @@ public class DepositView extends ActivatableView<VBox, Void> {
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label(Res.get("funds.deposit.noAddresses")));
tableViewSelectionListener = (observableValue, oldValue, newValue) -> {
if (newValue != null)
if (newValue != null) {
fillForm(newValue.getAddressString());
GUIUtil.requestFocus(amountTextField);
}
};
setSelectColumnCellFactory();
@ -205,6 +207,8 @@ public class DepositView extends ActivatableView<VBox, Void> {
updateList();
}
};
GUIUtil.focusWhenAddedToScene(amountTextField);
}
@Override

View file

@ -241,6 +241,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
inputsToggleGroup.selectToggle(useAllInputsRadioButton);
updateInputSelection();
GUIUtil.requestFocus(withdrawToTextField);
}
@Override

View file

@ -174,6 +174,8 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
return null;
}
});
GUIUtil.focusWhenAddedToScene(amountTextField);
}
@Override

View file

@ -156,6 +156,8 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
model.onFocusOutAmountTextField(oldValue, newValue, amountTextField.getText());
amountTextField.setText(model.amount.get());
};
GUIUtil.focusWhenAddedToScene(amountTextField);
}

View file

@ -97,6 +97,14 @@ public class GUIUtil {
return 0;
}
public static void focusWhenAddedToScene(Node node) {
node.sceneProperty().addListener((observable, oldValue, newValue) -> {
if (null != newValue) {
node.requestFocus();
}
});
}
@SuppressWarnings("PointlessBooleanExpression")
public static void showFeeInfoBeforeExecute(Runnable runnable) {
//noinspection UnusedAssignment
@ -448,6 +456,10 @@ public class GUIUtil {
new Popup<>().information(Res.get("popup.warning.downloadNotComplete")).show();
}
public static void requestFocus(Node node) {
UserThread.execute(node::requestFocus);
}
public static void reSyncSPVChain(WalletsSetup walletsSetup, Preferences preferences) {
try {
walletsSetup.reSyncSPVChain();