本文整理汇总了Java中com.google.gwt.event.dom.client.KeyDownEvent.isShiftKeyDown方法的典型用法代码示例。如果您正苦于以下问题:Java KeyDownEvent.isShiftKeyDown方法的具体用法?Java KeyDownEvent.isShiftKeyDown怎么用?Java KeyDownEvent.isShiftKeyDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.KeyDownEvent
的用法示例。
在下文中一共展示了KeyDownEvent.isShiftKeyDown方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int key = event.getNativeKeyCode();
if (event.isControlKeyDown()) {
if (key == KEY_PLUS || key == KEY_MINUS) {
app.getToolbar().zoomChangeClicked(key == KEY_PLUS ? 1 : -1);
event.preventDefault();
}
} else if (!event.isShiftKeyDown()) {
boolean handled = true;
switch (key) {
case KeyCodes.KEY_HOME:
changePage(0, -1, -1);
break;
case KeyCodes.KEY_END:
changePage(dataStore.getPageCount() - 1, 1, 1);
break;
default:
handled = false;
}
if (handled)
event.preventDefault();
}
}
示例2: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent e) {
final int keyCode = e.getNativeKeyCode();
final boolean isShiftKeyDown = e.isShiftKeyDown();
switch (keyCode) {
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ENTER:
gridCell.flush();
moveSelection(keyCode,
isShiftKeyDown);
e.preventDefault();
case KeyCodes.KEY_ESCAPE:
gridCell.destroyResources();
gridPanel.setFocus(true);
gridLayer.batch();
}
e.stopPropagation();
}
示例3: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent e) {
final int keyCode = e.getNativeKeyCode();
final boolean isShiftKeyDown = e.isShiftKeyDown();
switch (keyCode) {
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ESCAPE:
gridCell.destroyResources();
case KeyCodes.KEY_ENTER:
moveSelection(keyCode,
isShiftKeyDown);
gridPanel.setFocus(true);
gridLayer.batch();
}
e.stopPropagation();
}
示例4: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@UiHandler("editArea")
void onKeyDown(KeyDownEvent e) {
resizeTimer.cancel();
if ((e.isControlKeyDown() || e.isMetaKeyDown()) && !e.isAltKeyDown() && !e.isShiftKeyDown()) {
switch (e.getNativeKeyCode()) {
case 's':
case 'S':
e.preventDefault();
CallbackGroup group = new CallbackGroup();
save(group);
group.done();
return;
}
} else if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE && !isDirty()) {
if (isNew()) {
removeUI();
restoreSelection();
return;
}
setEdit(false);
if (autoClosed) {
setOpen(false);
}
getCm().focus();
return;
}
expandTimer.schedule(250);
}
示例5: getOperation
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
private KeyboardOperation getOperation(final KeyDownEvent event) {
final int keyCode = event.getNativeKeyCode();
final boolean isShiftKeyDown = event.isShiftKeyDown();
final boolean isControlKeyDown = event.isControlKeyDown();
for (KeyboardOperation operation : operations) {
if (operation.getKeyCode() == keyCode) {
if (keyDownStateMatches(isShiftKeyDown,
operation.isShiftKeyDown()) && keyDownStateMatches(isControlKeyDown,
operation.isControlKeyDown())) {
return operation;
}
}
}
return null;
}
示例6: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown( KeyDownEvent event )
{
if( event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE )
{
if( edition == null )
return;
event.stopPropagation();
event.preventDefault();
killCurrentEdit();
}
else if( event.getNativeKeyCode() == KeyCodes.KEY_TAB )
{
if( edition == null )
return;
event.stopPropagation();
event.preventDefault();
// find next cell to be edited
int editionRow = getRow( refMng.getRef( edition.editedObject ) );
CellPos pos = null;
if( event.isShiftKeyDown() )
pos = getPrevPos( editionRow, edition.editedCol );
else
pos = getNextPos( editionRow, edition.editedCol );
if( pos != null )
{
beginEdit( pos.row, pos.col );
return;
}
}
}
示例7: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
// Catch tab and move between select:s
if (keycode == KeyCodes.KEY_TAB && event.getSource() == options
&& !event.isShiftKeyDown()) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
clearSelections(options, true);
// Focus selections
selections.setFocus(true);
}
if (keycode == KeyCodes.KEY_TAB && event.isShiftKeyDown()
&& event.getSource() == selections) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
clearSelections(selections, true);
// Focus options
options.setFocus(true);
}
if (keycode == getNavigationSelectKey()) {
// Prevent default behavior
event.preventDefault();
// Decide which select the selection was made in
if (event.getSource() == options) {
// Prevents the selection to become a single selection when
// using Enter key as the selection key (default)
options.setFocus(false);
addItem();
} else if (event.getSource() == selections) {
// Prevents the selection to become a single selection when
// using Enter key as the selection key (default)
selections.setFocus(false);
removeItem();
}
}
}
示例8: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
if ( !isEnabled( ) || isReadOnly( ) )
return;
if (Utils.isNotBlank(promptText) && promptText.equals(super.getText())
&& !(event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB)) {
removePrompts();
}
int keyCode = event.getNativeEvent().getKeyCode();
// allow special keys
switch(keyCode) {
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_BACKSPACE:
case KeyCodes.KEY_DELETE:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
case KeyCodes.KEY_UP:
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_END:
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
case KeyCodes.KEY_PAGEDOWN:
case KeyCodes.KEY_PAGEUP:
case KeyCodes.KEY_HOME:
case KeyCodes.KEY_SHIFT:
case KeyCodes.KEY_ALT:
case KeyCodes.KEY_CTRL:
return;
default:
if (event.isAltKeyDown() || (event.isControlKeyDown() &&
(keyCode == KeyCodes.KEY_C || keyCode == KeyCodes.KEY_V
|| keyCode == KeyCodes.KEY_X )))
return;
if (!event.isShiftKeyDown()) {
// check for decimal '.'
if (isDecimal() && isDot(keyCode) && !getText().contains("."))
return;
// check for negative sign '-'
if (getCursorPos() == 0 && isDash(keyCode) && !getText().startsWith("-"))
return;
// filter out non-digits
if (isDigit(keyCode)) {
return;
}
}
}
cancelKey();
}
示例9: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
public void onKeyDown(KeyDownEvent event) {
this.keyDown = event.getNativeKeyCode();
boolean preventDefault = false;
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_DELETE:
case KeyCodes.KEY_BACKSPACE:
if (this.token != null) {
this.reset();
this.maskHelper.refreshValueBox();
event.preventDefault();
}
break;
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_UP:
event.preventDefault();
break;
case KeyCodes.KEY_LEFT:
preventDefault = this.maskHelper.focusPrevious();
break;
case KeyCodes.KEY_RIGHT:
preventDefault = this.maskHelper.focusNext();
break;
case KeyCodes.KEY_TAB:
if (event.isShiftKeyDown()) {
preventDefault = this.maskHelper.focusPrevious();
} else {
preventDefault = this.maskHelper.focusNext();
}
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
if (this.handleKeyDown(this.keyDown)) {
this.maskHelper.refreshValueBox();
this.schedule(this.maskHelper.initialDelayMilis);
}
}
示例10: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
// Catch tab and move between select:s
if (keycode == KeyCodes.KEY_TAB && event.getSource() == optionsListBox) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
for (int i = 0; i < optionsListBox.getItemCount(); i++) {
optionsListBox.setItemSelected(i, false);
}
// Focus selections
selectionsListBox.setFocus(true);
}
if (keycode == KeyCodes.KEY_TAB && event.isShiftKeyDown() && event.getSource() == selectionsListBox) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
for (int i = 0; i < selectionsListBox.getItemCount(); i++) {
selectionsListBox.setItemSelected(i, false);
}
// Focus options
optionsListBox.setFocus(true);
}
if (keycode == getNavigationSelectKey()) {
// Prevent default behavior
event.preventDefault();
// Decide which select the selection was made in
if (event.getSource() == optionsListBox) {
// Prevents the selection to become a single selection when
// using Enter key
// as the selection key (default)
optionsListBox.setFocus(false);
moveSelectedItemsLeftToRight();
} else if (event.getSource() == selectionsListBox) {
// Prevents the selection to become a single selection when
// using Enter key
// as the selection key (default)
selectionsListBox.setFocus(false);
moveSelectedItemsRightToLeft();
}
}
}