Skip to content

Commit

Permalink
SpreadsheetIntegerBox.addXXXListener addEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
mP1 committed Jan 15, 2025
1 parent 68b789d commit 811edd0
Showing 1 changed file with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,43 +82,42 @@ public SpreadsheetIntegerBox addChangeListener(final ChangeListener<Optional<Int

@Override
public SpreadsheetIntegerBox addClickListener(final EventListener listener) {
Objects.requireNonNull(listener, "listener");

this.integerBox.addEventListener(
return this.addEventListener(
EventType.click,
listener
);
return this;
}

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

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

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

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

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

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

0 comments on commit 811edd0

Please sign in to comment.