use of com.google.gwt.event.dom.client.BlurHandler in project drools-wb by kiegroup.
the class ListBoxSingletonDOMElementFactoryTest method checkDOMElementCreationBlurHandler.
@Test
@SuppressWarnings("unchecked")
public void checkDOMElementCreationBlurHandler() {
final GridBodyCellRenderContext context = mock(GridBodyCellRenderContext.class);
final Consumer<ListBoxDOMElement<String, ListBox>> onCreation = mock(Consumer.class);
final Consumer<ListBoxDOMElement<String, ListBox>> onDisplay = mock(Consumer.class);
when(context.getTransform()).thenReturn(mock(Transform.class));
factory.attachDomElement(context, onCreation, onDisplay);
final ArgumentCaptor<EventHandler> handlerCaptor = ArgumentCaptor.forClass(EventHandler.class);
verify(listBox, times(4)).addDomHandler(handlerCaptor.capture(), any(DomEvent.Type.class));
// KeyDownHandlerCommon
Assertions.assertThat(handlerCaptor.getAllValues().get(0)).isInstanceOf(KeyDownHandlerCommon.class);
// KeyDownHandler - stopPropagation
final KeyDownEvent keyDownEventMock = mock(KeyDownEvent.class);
Assertions.assertThat(handlerCaptor.getAllValues().get(1)).isInstanceOf(KeyDownHandler.class);
((KeyDownHandler) handlerCaptor.getAllValues().get(1)).onKeyDown(keyDownEventMock);
verify(keyDownEventMock).stopPropagation();
// MouseDownHandler - stopPropagation
final MouseDownEvent mouseDownEventMock = mock(MouseDownEvent.class);
Assertions.assertThat(handlerCaptor.getAllValues().get(2)).isInstanceOf(MouseDownHandler.class);
((MouseDownHandler) handlerCaptor.getAllValues().get(2)).onMouseDown(mouseDownEventMock);
verify(mouseDownEventMock).stopPropagation();
// BlurHandler
final BlurEvent blurEventMock = mock(BlurEvent.class);
Assertions.assertThat(handlerCaptor.getAllValues().get(3)).isInstanceOf(BlurHandler.class);
((BlurHandler) handlerCaptor.getAllValues().get(3)).onBlur(blurEventMock);
verify(factory).flush();
verify(gridLayer).batch();
verify(gridLienzoPanel).setFocus(true);
}
use of com.google.gwt.event.dom.client.BlurHandler in project drools-wb by kiegroup.
the class FactPatternConstraintsPageViewImpl method initialiseValueList.
private void initialiseValueList() {
// Copy value back to model
txtValueList.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(final ValueChangeEvent<String> event) {
final String valueList = txtValueList.getText();
chosenConditionsSelection.setValueList(valueList);
// ValueList is optional, no need to advise of state change
}
});
// Update Default Value widget if necessary
txtValueList.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
presenter.assertDefaultValue(availablePatternsSelection, chosenConditionsSelection);
makeDefaultValueWidget();
}
});
}
use of com.google.gwt.event.dom.client.BlurHandler in project drools-wb by kiegroup.
the class ActionInsertFactFieldsPageViewImpl method initialiseValueList.
private void initialiseValueList() {
// Copy value back to model
txtValueList.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(final ValueChangeEvent<String> event) {
final String valueList = txtValueList.getText();
chosenFieldsSelection.setValueList(valueList);
// ValueList is optional, no need to advise of state change
}
});
// Update Default Value widget if necessary
txtValueList.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
presenter.assertDefaultValue(chosenFieldsSelection);
makeDefaultValueWidget();
}
});
}
use of com.google.gwt.event.dom.client.BlurHandler in project che by eclipse.
the class TextEditorPartViewImpl method setEditorWidget.
@Override
public void setEditorWidget(final EditorWidget editorWidget) {
if (this.editorPanel.getWidget() != null) {
throw new RuntimeException("Editor already set");
}
this.editorPanel.setWidget(editorWidget);
editorWidget.addCursorActivityHandler(new CursorActivityHandler() {
@Override
public void onCursorActivity(final CursorActivityEvent event) {
delegate.editorCursorPositionChanged();
}
});
editorWidget.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
delegate.editorLostFocus();
}
});
editorWidget.addFocusHandler(new FocusHandler() {
@Override
public void onFocus(final FocusEvent event) {
delegate.editorGotFocus();
}
});
}
use of com.google.gwt.event.dom.client.BlurHandler in project rstudio by rstudio.
the class MenuBar method init.
private void init(boolean vertical, AbstractImagePrototype subMenuIcon) {
this.subMenuIcon = subMenuIcon;
Element table = DOM.createTable();
body = DOM.createTBody();
DOM.appendChild(table, body);
if (!vertical) {
Element tr = DOM.createTR();
DOM.appendChild(body, tr);
}
this.vertical = vertical;
com.google.gwt.dom.client.Element outer = FocusPanel.impl.createFocusable();
DOM.appendChild(outer, table);
setElement(outer);
Accessibility.setRole(getElement(), Accessibility.ROLE_MENUBAR);
sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONFOCUS | Event.ONKEYDOWN);
setStyleName(STYLENAME_DEFAULT);
if (vertical) {
addStyleDependentName("vertical");
} else {
addStyleDependentName("horizontal");
}
// Hide focus outline in Mozilla/Webkit/Opera
DOM.setStyleAttribute(getElement(), "outline", "0px");
// Hide focus outline in IE 6/7
DOM.setElementAttribute(getElement(), "hideFocus", "true");
// Deselect items when blurring without a child menu.
addDomHandler(new BlurHandler() {
public void onBlur(BlurEvent event) {
if (shownChildMenu == null) {
selectItem(null);
}
}
}, BlurEvent.getType());
}
Aggregations