当前位置: 首页>>代码示例>>Java>>正文


Java KeyDownEvent.isShiftKeyDown方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:25,代码来源:SinglePageLayout.java

示例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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:21,代码来源:KeyDownHandlerCommon.java

示例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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:20,代码来源:KeyDownHandlerDatePicker.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:29,代码来源:DraftBox.java

示例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;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:BaseGridWidgetKeyboardHandler.java

示例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;
		}
	}
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:38,代码来源:DynArrayInFlexTable.java

示例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();
        }
    }
}
 
开发者ID:tepi,项目名称:ListBuilder,代码行数:41,代码来源:VListBuilder.java

示例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();
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:58,代码来源:NumberBox.java

示例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);
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:43,代码来源:MaskValueBoxHelper.java

示例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();
		}
	}

}
 
开发者ID:tepi,项目名称:ListBuilder,代码行数:56,代码来源:VListBuilder.java


注:本文中的com.google.gwt.event.dom.client.KeyDownEvent.isShiftKeyDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。