當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyCodes.KEY_TAB屬性代碼示例

本文整理匯總了Java中com.google.gwt.event.dom.client.KeyCodes.KEY_TAB屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyCodes.KEY_TAB屬性的具體用法?Java KeyCodes.KEY_TAB怎麽用?Java KeyCodes.KEY_TAB使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.gwt.event.dom.client.KeyCodes的用法示例。


在下文中一共展示了KeyCodes.KEY_TAB屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onKeyUp

/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
開發者ID:bonprix,項目名稱:vaadin-combobox-multiselect,代碼行數:34,代碼來源:VComboBoxMultiselect.java

示例2: handleTabKey

/**
 * Handles TAB key and Shift-TAB key presses.
 */
protected boolean handleTabKey(Event event, ChartState chartInfo, int keyCode,
    boolean isShiftKeyDown) {
  if (DOM.eventGetType(event) != chartInfo.getTabKeyEventCode()) {
    return false;
  }

  if (keyCode == KeyCodes.KEY_TAB) {
    if (isShiftKeyDown) {
      chartInfo.chart.prevFocus();
    } else {
      chartInfo.chart.nextFocus();
    }
    return true;
  }

  return false;
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:20,代碼來源:AbstractEventHandler.java

示例3: onKeyPress

public void onKeyPress(KeyPressEvent event) {
  ChartState chartInfo = getChartState(event);

  Chart chart = chartInfo.chart;

  int keyCode = event.getCharCode();
  boolean handled = true;
  if (keyCode == KeyCodes.KEY_TAB) {
    handled = handleTabKey((Event)event.getNativeEvent(), chartInfo, keyCode, event.isShiftKeyDown());
  } else if (keyCode == KEY_Z) {
    chart.nextZoom();
  } else if (keyCode == KEY_X) {
    chart.prevZoom();
  } else if (keyCode == KeyCodes.KEY_ENTER) {
    chart.maxZoomToFocus();
  } else {
    handled = false;
  }

  chartInfo.setHandled(handled);
  if (handled) {
      event.stopPropagation();
      event.preventDefault();
  }
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:25,代碼來源:ChartKeyPressHandler.java

示例4: onKey

private void onKey(KeyEvent<?> event, int charCode, int keyCode) {
  if ('0' <= charCode && charCode <= '9') {
    if (event.isAnyModifierKeyDown()) {
      event.preventDefault();
    }
  } else {
    switch (keyCode) {
      case KeyCodes.KEY_BACKSPACE:
      case KeyCodes.KEY_LEFT:
      case KeyCodes.KEY_RIGHT:
      case KeyCodes.KEY_HOME:
      case KeyCodes.KEY_END:
      case KeyCodes.KEY_TAB:
      case KeyCodes.KEY_DELETE:
        break;

      default:
        // Allow copy and paste using ctl-c/ctrl-v,
        // or whatever the platform's convention is.
        if (!(event.isControlKeyDown() || event.isMetaKeyDown() || event.isAltKeyDown())) {
          event.preventDefault();
        }
        break;
    }
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:26,代碼來源:NpIntTextBox.java

示例5: handleKeyPress

private void handleKeyPress(char keyCode) {
  if (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_TAB) {
    // Pressing <tab>, <enter> or <return> will surrender focus.
    textEdit.cancelKey();
    textEdit.setFocus(false);
  } else if (!validateKeyCode(keyCode)) {
    textEdit.cancelKey();
  }
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:9,代碼來源:TextPropertyEditorBase.java

示例6: handleKeyPress

private void handleKeyPress(char keyCode) {
  if (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_TAB) {
    // Pressing <tab>, <enter> or <return> will surrender focus.
    urlField.cancelKey();
    urlField.setFocus(false);
  } else if (!validateKeyCode(keyCode)) {
    urlField.cancelKey();
  }
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:9,代碼來源:YoungAndroidDefaultURLPropertyEditor.java

示例7: onKeyUp

@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
                String tbText = tb.getText() == null ? "" : tb.getText();
                String currentText = currentSuggestion == null ? "" : currentSuggestion.getReplacementString();
                if (!this.preventFilterAfterSelect && !tbText.equals(currentText))
                    filterOptions(currentPage);
                else {
                    if (!event.isAnyModifierKeyDown())
                        event.stopPropagation();
                }
                this.preventFilterAfterSelect = false;
                break;
            case KeyCodes.KEY_TAB:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
                // NOP
                break;
            case KeyCodes.KEY_ESCAPE:
                reset();
                break;
        }

        updateEditState();
    }
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:33,代碼來源:CubaSearchSelectWidget.java

示例8: onKeyUp

@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
            case KeyCodes.KEY_TAB:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
            case KeyCodes.KEY_ESCAPE:
                // NOP
                break;
            default:
                // special case for "clear" shortcut action
                if (event.isShiftKeyDown() && event.getNativeKeyCode() == KeyCodes.KEY_DELETE) {
                    suggestionPopup.hide();
                } else {
                    // do not show options popup if we handle shortcut action
                    if (!event.isControlKeyDown()
                            && !event.isAltKeyDown()) {
                        super.onKeyUp(event);
                    }
                }
                break;
        }
    }
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:31,代碼來源:CubaComboBoxWidget.java

示例9: keyToString

private static String keyToString(int code) {
  switch (code) {
    case KeyCodes.KEY_SPACE:
      return "Space";
    case KeyCodes.KEY_BACKSPACE:
      return "Backspace";
    case KeyCodes.KEY_DELETE:
      return "Del";
    case KeyCodes.KEY_INSERT:
      return "Insert";
    case KeyCodes.KEY_ENTER:
      return "Enter";
    case KeyCodes.KEY_ESCAPE:
      return "Esc";
    case KeyCodes.KEY_TAB:
      return "Tab";
    case KeyCodes.KEY_HOME:
      return "Home";
    case KeyCodes.KEY_END:
      return "End";
    case KeyCodes.KEY_PAGEUP:
      return "PageUp";
    case KeyCodes.KEY_PAGEDOWN:
      return "PageDown";
    case KeyCodes.KEY_LEFT:
      return "\u2190";
    case KeyCodes.KEY_UP:
      return "\u2191";
    case KeyCodes.KEY_RIGHT:
      return "\u2192";
    case KeyCodes.KEY_DOWN:
      return "\u2193";
    default:
      return new Character((char) code).toString();
  }
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:36,代碼來源:EventWrapper.java

示例10: isAcceleratorInner

/**
 * Parameterised to allow testing different browser/os permuations
 * @param event
 * @param isMac
 * @param quirksHasOldSchoolClipboardShortcuts
 */
@VisibleForTesting
static boolean isAcceleratorInner(SignalEvent event, boolean isMac,
    boolean quirksHasOldSchoolClipboardShortcuts) {
  switch (event.getKeySignalType()) {
    case INPUT:
      // Alt on its own is a simple modifier, like shift, on OSX
      boolean maybeAltKey = !isMac && event.getAltKey();

      // NOTE(user): Perhaps we should create a registry in
      // EditorEventSubHandler of non-metesque like command keys such as TAB.
      // For now TAB is our only special case, but we may need to allow
      // implementers to define arbitrary keys as accelerators.
      return event.getCtrlKey() || event.getMetaKey() || event.getKeyCode() == KeyCodes.KEY_TAB
          || maybeAltKey;
    case DELETE:
      if (quirksHasOldSchoolClipboardShortcuts &&
          event.getKeyCode() == KeyCodes.KEY_DELETE && KeyModifier.SHIFT.check(event)) {

        // shift+delete on windows/linux is cut
        // (shift+insert and ctrl+insert are other clipboard alternatives,
        // but that's handled below).

        return true;
      } else {
        return false;
      }
    case NAVIGATION:
      // All navigation does not count
      return false;
    case NOEFFECT:
      // Random special keys like ESC, F7, TAB, INS, etc count
      return true;
  }
  throw new RuntimeException("Unknown KeySignal type");
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:41,代碼來源:EditorEventHandler.java

示例11: onKeyDown

public void onKeyDown(KeyDownEvent event) {
  ChartState chartInfo = getChartState(event);
  Chart chart = chartInfo.chart;
  boolean handled = true;
  int keyCode = event.getNativeKeyCode();
  // all checks (except TAB) are to prevent focus stealing by the browser.
    if (keyCode == KeyCodes.KEY_PAGEUP) {
    } else if (keyCode == KeyCodes.KEY_PAGEDOWN) {
    } else if (keyCode == KeyCodes.KEY_UP) {
        if (UP_NUM < KEY_DOWN_MAX) {
            if (UP_NUM != 0) {
                chart.nextZoom();
            }
            UP_NUM++;
        }
    } else if (keyCode == KeyCodes.KEY_DOWN) {
        if (DOWN_NUM < KEY_DOWN_MAX) {
            if (DOWN_NUM != 0) {
                chart.prevZoom();
            }
            DOWN_NUM++;
        }
    } else if (keyCode == KeyCodes.KEY_TAB) {
        handled = handleTabKey((Event) event.getNativeEvent(), chartInfo, keyCode,
                event.isShiftKeyDown());
    } else {
        handled = false;
    }
  chartInfo.setHandled(handled);
  if (handled) {
     event.stopPropagation();
     event.preventDefault();
  }
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:34,代碼來源:ChartKeyDownHandler.java

示例12: onKeyPress

@Override
public void onKeyPress(KeyPressEvent event)
{
    if (promptText.equals(this.getText())
            && !(event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB))
    {
        hidePrompt();
    }
}
 
開發者ID:turbomanage,項目名稱:listmaker,代碼行數:9,代碼來源:PromptedTextArea.java

示例13: onKeyPress

@Override
public void onKeyPress(KeyPressEvent event)
{
	if (promptText.equals(this.getText())
		&& !(event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB))
	{
		hidePrompt();
	}
}
 
開發者ID:turbomanage,項目名稱:listmaker,代碼行數:9,代碼來源:PromptedTextBox.java

示例14: onKeyUp

@Override
public void onKeyUp(KeyUpEvent event) {
	if (isReadOnly() || !isEnabled()) {
		return;
	}

	int keyCode = event.getNativeEvent().getKeyCode();

	boolean processed = false;

	switch (keyCode) {
	case KeyCodes.KEY_LEFT:
	case KeyCodes.KEY_RIGHT:
	case KeyCodes.KEY_BACKSPACE:
	case KeyCodes.KEY_DELETE:
	case KeyCodes.KEY_TAB:
		if (getText().isEmpty()) {
			setValue(formatValue(min));
		}
		return;
	case KeyCodes.KEY_UP:
		if (step != 0) {
			increaseValue();
			processed = true;
		}
		break;
	case KeyCodes.KEY_DOWN:
		if (step != 0) {
			decreaseValue();
			processed = true;
		}
		break;
	}

	if (processed) {
		cancelKey();
	}
}
 
開發者ID:mecatran,項目名稱:OpenTripPlanner-client-gwt,代碼行數:38,代碼來源:ValueTextBox.java

示例15: onKeyPress

@Override
public void onKeyPress(KeyPressEvent event) {

	if (isReadOnly() || !isEnabled()) {
		return;
	}

	int keyCode = event.getNativeEvent().getKeyCode();

	switch (keyCode) {
	case KeyCodes.KEY_LEFT:
	case KeyCodes.KEY_RIGHT:
	case KeyCodes.KEY_BACKSPACE:
	case KeyCodes.KEY_DELETE:
	case KeyCodes.KEY_TAB:
	case KeyCodes.KEY_UP:
	case KeyCodes.KEY_DOWN:
		return;
	}

	int index = getCursorPos();
	String previousText = getText();
	String newText;
	if (getSelectionLength() > 0) {
		newText = previousText.substring(0, getCursorPos())
				+ event.getCharCode()
				+ previousText.substring(
						getCursorPos() + getSelectionLength(),
						previousText.length());
	} else {
		newText = previousText.substring(0, index) + event.getCharCode()
				+ previousText.substring(index, previousText.length());
	}
	cancelKey();

	setValue(newText, true);
}
 
開發者ID:mecatran,項目名稱:OpenTripPlanner-client-gwt,代碼行數:37,代碼來源:ValueTextBox.java


注:本文中的com.google.gwt.event.dom.client.KeyCodes.KEY_TAB屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。