Skip to content

Commit

Permalink
Merge pull request #4427 from mP1/feature/SpreadsheetTextBox-addXXXLi…
Browse files Browse the repository at this point in the history
…stener-addEventListener

SpreadsheetTextBox.addXXXListener addEventListener
  • Loading branch information
mP1 authored Jan 15, 2025
2 parents 5e1ce76 + cb1cb8b commit 68b789d
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,43 +65,42 @@ public SpreadsheetTextBox addChangeListener(final ChangeListener<Optional<String

@Override
public SpreadsheetTextBox addClickListener(final EventListener listener) {
Objects.requireNonNull(listener, "listener");
this.textBox.getInputElement()
.addEventListener(
EventType.click,
listener::handleEvent
);
return this;
return this.addEventListener(
EventType.click,
listener
);
}

@Override
public SpreadsheetTextBox addFocusListener(final EventListener listener) {
Objects.requireNonNull(listener, "listener");
this.textBox.getInputElement()
.addEventListener(
EventType.focus,
listener::handleEvent
);
return this;
return this.addEventListener(
EventType.focus,
listener
);
}

@Override
public SpreadsheetTextBox addKeydownListener(final EventListener listener) {
Objects.requireNonNull(listener, "listener");

this.textBox.addEventListener(
return this.addEventListener(
EventType.keydown,
listener
);
return this;
}

@Override
public SpreadsheetTextBox addKeyupListener(final EventListener listener) {
return this.addEventListener(
EventType.keyup,
listener
);
}

private SpreadsheetTextBox addEventListener(final EventType eventType,
final EventListener listener) {
Objects.requireNonNull(listener, "listener");

this.textBox.addEventListener(
EventType.keyup,
eventType,
listener
);
return this;
Expand Down

0 comments on commit 68b789d

Please sign in to comment.