use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.
the class KeyDownHandlerCommonTest method tabKeyCanvasActions.
@Test
public void tabKeyCanvasActions() {
final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_TAB), Optional.of(false), Optional.of(false));
handler.onKeyDown(e);
verify(gridCell).flush();
verify(e).preventDefault();
verifyCommonActions();
}
use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.
the class KeyDownHandlerDatePickerTest method enterKeyCanvasActions.
@Test
public void enterKeyCanvasActions() {
final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER), Optional.of(false), Optional.of(false));
handler.onKeyDown(e);
verify(gridCell, never()).flush();
verify(gridCell, never()).destroyResources();
verifyCommonActions();
}
use of com.google.gwt.event.dom.client.KeyDownEvent in project kie-wb-common by kiegroup.
the class AssignmentListItemWidgetViewImpl method init.
@PostConstruct
public void init() {
// Configure dataType and customDataType controls
dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
// Configure processVar and constant controls
processVarComboBox.init(this, false, processVar, constant, true, true, CONSTANT_PROMPT, ENTER_CONSTANT_PROMPT);
name.setRegExp("^[a-zA-Z0-9\\-\\.\\_]*$", StunnerFormsClientFieldsConstants.INSTANCE.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.INSTANCE.Invalid_character_in_name());
customDataType.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
int iChar = event.getNativeKeyCode();
if (iChar == ' ') {
event.preventDefault();
}
}
});
name.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!allowDuplicateNames) {
String value = name.getText();
if (isDuplicateName(value)) {
notification.fire(new NotificationEvent(duplicateNameErrorMessage, NotificationEvent.NotificationType.ERROR));
name.setValue("");
ValueChangeEvent.fire(name, "");
}
}
}
});
}
use of com.google.gwt.event.dom.client.KeyDownEvent in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImpl method init.
@PostConstruct
public void init() {
// Configure dataType and customDataType controls
dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
name.setRegExp("^[a-zA-Z0-9\\-\\.\\_]*$", "Removed invalid characters from name", "Invalid character in name");
customDataType.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(final KeyDownEvent event) {
int iChar = event.getNativeKeyCode();
if (iChar == ' ') {
event.preventDefault();
}
}
});
name.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
if (!allowDuplicateNames) {
String value = name.getText();
if (isDuplicateName(value)) {
notification.fire(new NotificationEvent(duplicateNameErrorMessage, NotificationEvent.NotificationType.ERROR));
name.setValue("");
ValueChangeEvent.fire(name, "");
}
}
notifyModelChanged();
}
});
}
use of com.google.gwt.event.dom.client.KeyDownEvent in project che by eclipse.
the class View method handleEvents.
private void handleEvents() {
KeyDownHandler handler = new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if (KeyboardEvent.KeyCode.ESC == event.getNativeEvent().getKeyCode()) {
event.stopPropagation();
event.preventDefault();
if (delegate != null) {
delegate.onEscapeKey();
}
} else if (KeyboardEvent.KeyCode.ENTER == event.getNativeEvent().getKeyCode()) {
event.stopPropagation();
event.preventDefault();
if (delegate != null) {
delegate.onEnterKey();
}
}
}
};
focusPanel.addDomHandler(handler, KeyDownEvent.getType());
closeButton.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (delegate != null) {
delegate.onClose();
}
event.stopPropagation();
}
}, ClickEvent.getType());
/* Don't start moving the window when clicking close button */
closeButton.addDomHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
event.preventDefault();
event.stopPropagation();
}
}, MouseDownEvent.getType());
MouseHandler mouseHandler = new MouseHandler();
header.addDomHandler(mouseHandler, MouseDownEvent.getType());
header.addDomHandler(mouseHandler, MouseUpEvent.getType());
header.addDomHandler(mouseHandler, MouseMoveEvent.getType());
}
Aggregations