Skip to content

Commit

Permalink
Refactor code: Remove unnecessary 'this' keyword
Browse files Browse the repository at this point in the history
The 'this' keyword was removed from various lines in the code for simplification. The keyword was redundant and does not impact functionality, thus improving code readability. All implementation and behaviour remains the same.
  • Loading branch information
dlemmermann committed Dec 1, 2023
1 parent 5ee380e commit 5b2b1f7
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ protected void layoutChildren(double x, double y, double w, double h) {
Bounds bounds = displayNode.getBoundsInParent();

// use the same bounds for the globe that were computed for the button cell
this.globeButton.resizeRelocate(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
this.globeButton.setVisible(getSkinnable().getValue() == null);
this.globeButton.setManaged(getSkinnable().getValue() == null);
this.globeButton.toFront();
globeButton.resizeRelocate(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
globeButton.setVisible(getSkinnable().getValue() == null);
globeButton.setManaged(getSkinnable().getValue() == null);
globeButton.toFront();
}
};
}
Expand Down Expand Up @@ -1007,10 +1007,10 @@ private String countryName() {
private final class PhoneNumberFormatter implements UnaryOperator<TextFormatter.Change> {

private PhoneNumberFormatter() {
PhoneNumberField.this.setTextFormatter(new TextFormatter<>(this));
PhoneNumberField.this.addEventHandler(KeyEvent.KEY_PRESSED, e -> {
setTextFormatter(new TextFormatter<>(this));
addEventHandler(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.BACK_SPACE
&& (PhoneNumberField.this.getText() == null || PhoneNumberField.this.getText().isEmpty())
&& (getText() == null || getText().isEmpty())
&& getSelectedCountry() != null
&& !getDisableCountryDropdown()) {

Expand Down Expand Up @@ -1072,7 +1072,7 @@ private void resolveCountry(TextFormatter.Change change) {
setSelectedCountry(country);
if (!isCountryCodeVisible()) {
Platform.runLater(() -> {
PhoneNumberField.this.setText(Optional.ofNullable(country.defaultAreaCode()).map(String::valueOf).orElse(""));
setText(Optional.ofNullable(country.defaultAreaCode()).map(String::valueOf).orElse(""));
change.setText("");
change.setCaretPosition(0);
change.setAnchor(0);
Expand Down Expand Up @@ -1129,8 +1129,8 @@ private void setFormattedPhoneNumber(String newRawPhoneNumber) {
try {
selfUpdate = true;
String formattedPhoneNumber = doFormat(newRawPhoneNumber, getSelectedCountry());
PhoneNumberField.this.setText(formattedPhoneNumber);
PhoneNumberField.this.positionCaret(formattedPhoneNumber.length());
setText(formattedPhoneNumber);
positionCaret(formattedPhoneNumber.length());
} finally {
selfUpdate = false;
}
Expand Down

0 comments on commit 5b2b1f7

Please sign in to comment.