Skip to content

Commit

Permalink
SpreadsheetTextBox.addXXXListener addEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
mP1 committed Jan 15, 2025
1 parent 5e1ce76 commit cb1cb8b
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 cb1cb8b

Please sign in to comment.