Skip to content
This repository has been archived by the owner on Dec 17, 2020. It is now read-only.

Commit

Permalink
Fix compilation error (#446)
Browse files Browse the repository at this point in the history
* Fix compilation error

* add javadoc

* add period
  • Loading branch information
ZheSun88 authored and Denis committed May 15, 2018
1 parent 5f2cc38 commit ef2879d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.ClickNotifier;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JavaScript;
Expand Down Expand Up @@ -218,6 +219,17 @@ public Optional<T> getSelectedObject() {
return Optional.ofNullable(selectedObject);
}

/**
* Add listener to the selection change event.
*
* @param listener
* the listener to add
*/
public void addSelectionChangeListener(
ComponentEventListener<SelectionChangeEvent> listener) {
addListener(SelectionChangeEvent.class, listener);
}

/*
* Private class used to translate click events from the client to
* SelectionChangeEvents in the server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.vaadin.flow.demo.jquerytable.element.html.Option;
import com.vaadin.flow.demo.jquerytable.element.html.Select;
import com.vaadin.flow.demo.jquerytable.element.tablesorter.RichTable;
import com.vaadin.flow.demo.jquerytable.element.tablesorter.SelectionChangeEvent;
import com.vaadin.flow.demo.jquerytable.persistence.IssuesRepository;
import com.vaadin.flow.demo.jquerytable.persistence.Project;
import com.vaadin.flow.demo.jquerytable.persistence.ProjectVersion;
Expand Down Expand Up @@ -197,7 +196,7 @@ private HtmlContainer createMainContent() {

// SelectionChangeEvent listener that shows a message on screen when
// something is selected
table.addListener(SelectionChangeEvent.class, evt -> {
table.addSelectionChangeListener(evt -> {
Optional<Report> selectedObject = table.getSelectedObject();
if (selectedObject.isPresent()) {
selectedReport.setClassName("selected-report");
Expand Down

0 comments on commit ef2879d

Please sign in to comment.