/**
* Attaches several handlers to the awesome box input and the container.
*/
private void attachHandlers() {
Elements.asJsElement(awesomeBoxInput).setOnBlur(new EventListener() {
@Override
public void handleEvent(Event event) {
// blur removes the focus then we hide the actual panel
if (getDelegate() != null) {
getDelegate().onBlur();
}
}
});
Elements.asJsElement(awesomeBoxInput).setOnKeyDown(new EventListener() {
@Override
public void handleEvent(Event event) {
KeyboardEvent keyEvent = (KeyboardEvent) event;
if (getDelegate() != null) {
getDelegate().onInputKeyDown(keyEvent);
}
}
});
Elements.asJsElement(closeButton).setOnClick(new EventListener() {
@Override
public void handleEvent(Event arg0) {
getDelegate().onCloseClicked();
}
});
getElement().setOnKeyUp(new EventListener() {
@Override
public void handleEvent(Event event) {
KeyboardEvent keyEvent = (KeyboardEvent) event;
if (getDelegate() != null) {
getDelegate().onKeyUp(keyEvent);
}
}
});
getElement().setOnMouseDown(new EventListener() {
@Override
public void handleEvent(Event event) {
MouseEvent mouseEvent = (MouseEvent) event;
if (getDelegate() != null) {
getDelegate().onClick(mouseEvent);