Adds a keyMode to the text view at the specified position.

@param {orion.editor.KeyMode} mode the editor keyMode.
@param {Number} [index=length] the index.
17185
function(mode, index) {
			var keyModes = this._keyModes;
			if (index !== undefined) {
				keyModes.splice(index, 0, mode);
			} else {
				keyModes.push(mode);
			}
			//TODO: API needed for this
			if (mode._modeAdded) {
				mode._modeAdded();
			}
		}
296387
protected void addMode(CliModeContainer mode) {

    CliModeObject old = this.id2ModeMap.put(mode.getId(), mode);
    if (old != null) {
      CliStyleHandling handling = this.cliStyle.modeDuplicated();
      DuplicateObjectException exception = new DuplicateObjectException(mode, mode.getMode().id());
      if (handling != CliStyleHandling.OK) {
        handling.handle(LOG, exception);
      }
    }
  }
1122509
private static void defineMode(QrMode[] inputMode, int[] inputData) {

        int mlen;

        for (int i = 0; i < inputData.length; i++) {
            if (inputData[i] > 0xff) {
                inputMode[i] = QrMode.KANJI;
            } else {
                inputMode[i] = QrMode.BINARY;
                if (isAlpha(inputData[i])) {
                    inputMode[i] = QrMode.ALPHANUM;
                }
                if (inputData[i] == FNC1) {
                    inputMode[i] = QrMode.ALPHANUM;
                }
                if (isNumeric(inputData[i])) {
                    inputMode[i] = QrMode.NUMERIC;
                }
            }
        }

        // TODO: uncomment
//        /* If less than 6 numeric digits together then don't use numeric mode */
//        for (int i = 0; i < inputMode.length; i++) {
//            if (inputMode[i] == QrMode.NUMERIC) {
//                if (((i != 0) && (inputMode[i - 1] != QrMode.NUMERIC)) || (i == 0)) {
//                    mlen = 0;
//                    while (((mlen + i) < inputMode.length) && (inputMode[mlen + i] == QrMode.NUMERIC)) {
//                        mlen++;
//                    };
//                    if (mlen < 6) {
//                        for (int j = 0; j < mlen; j++) {
//                            inputMode[i + j] = QrMode.ALPHANUM;
//                        }
//                    }
//                }
//            }
//        }
//
//        /* If less than 4 alphanumeric characters together then don't use alphanumeric mode */
//        for (int i = 0; i < inputMode.length; i++) {
//            if (inputMode[i] == QrMode.ALPHANUM) {
//                if (((i != 0) && (inputMode[i - 1] != QrMode.ALPHANUM)) || (i == 0)) {
//                    mlen = 0;
//                    while (((mlen + i) < inputMode.length) && (inputMode[mlen + i] == QrMode.ALPHANUM)) {
//                        mlen++;
//                    };
//                    if (mlen < 4) {
//                        for (int j = 0; j < mlen; j++) {
//                            inputMode[i + j] = QrMode.BINARY;
//                        }
//                    }
//                }
//            }
//        }
    }
181244
function changeMode( newMode ) {
					var editorPos = editable.getDocumentPosition();

					switch ( newMode ) {
						case 'top':
							updatePos( 'absolute', 'top', editorPos.y - spaceHeight - dockedOffsetY );
							break;
						case 'pin':
							updatePos( 'fixed', 'top', pinnedOffsetY );
							break;
						case 'bottom':
							updatePos( 'absolute', 'top', editorPos.y + ( editorRect.height || editorRect.bottom - editorRect.top ) + dockedOffsetY );
							break;
					}

					mode = newMode;
				}
590869
public void setMode(int mode) {
        // check arg
        switch (mode) {
            case MODE_EXACT:
            case MODE_JCOMPOUNDMAPPER:
                break;
            default:
                throw new IllegalArgumentException("Invalid mode specified!");
        }
        this.mode = mode;

        // re-gen atom expressions
        int numAtoms = mol.getAtomCount();
        for (int atomIdx = 0; atomIdx < numAtoms; atomIdx++)
            this.aexpr[atomIdx] = encodeAtomExpr(atomIdx);
    }
870353
private void initModeSwitch(final EditMode current) {

        FormLayout modes = new FormLayout();
        modes.setHeight("100%");
        modes.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

        m_modeSelect = new ComboBox();
        m_modeSelect.setCaption(m_messages.key(Messages.GUI_VIEW_SWITCHER_LABEL_0));

        // add Modes
        m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.DEFAULT);
        m_modeSelect.setItemCaption(
            CmsMessageBundleEditorTypes.EditMode.DEFAULT,
            m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_DEFAULT_0));
        m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.MASTER);
        m_modeSelect.setItemCaption(
            CmsMessageBundleEditorTypes.EditMode.MASTER,
            m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_MASTER_0));

        // set current mode as selected
        m_modeSelect.setValue(current);

        m_modeSelect.setNewItemsAllowed(false);
        m_modeSelect.setTextInputAllowed(false);
        m_modeSelect.setNullSelectionAllowed(false);

        m_modeSelect.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

            public void valueChange(ValueChangeEvent event) {

                m_listener.handleModeChange((EditMode)event.getProperty().getValue());

            }
        });

        modes.addComponent(m_modeSelect);
        m_modeSwitch = modes;
    }
831354
public final void setIconTintMode(@NonNull final PorterDuff.Mode mode) {
        Condition.INSTANCE.ensureNotNull(mode, "The icon tint mode may not be null");
        this.tintMode = mode;
        adaptIconTint();
    }
928256
public void setEditorMode(EditorMode editorMode) {

        if (editorMode != m_editorMode) {
            EditorMode oldEditorMode = m_editorMode;
            m_editorMode = editorMode;
            m_controller.setEditorModeInSession(m_editorMode);
            if (oldEditorMode == EditorMode.compareLocales) {
                // reload sitemap editor because we may need to move to a different site
                reloadForLocaleCompareRoot(m_editorMode);
                return;
            }
            switch (m_editorMode) {
                case galleries:
                    m_tree.getElement().getStyle().setDisplay(Display.NONE);
                    setGalleriesVisible(true);
                    m_toolbar.setNewGalleryEnabled(false, "");
                    setCategoriesVisible(false);
                    setModelPagesVisible(false);
                    setHeaderVisible(true);
                    m_localeComparison.setVisible(false);
                    m_toolbar.setClipboardEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_CLIPBOARD_DISABLE_0));
                    getController().loadGalleries();
                    break;
                case navigation:
                    m_tree.getElement().getStyle().clearDisplay();
                    setGalleriesVisible(false);
                    setModelPagesVisible(false);
                    setCategoriesVisible(false);
                    setHeaderVisible(true);
                    m_localeComparison.setVisible(false);
                    m_toolbar.setNewEnabled(true, null);

                    m_inNavigationStyle.setValue(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().navMode());
                    break;
                case vfs:
                    m_tree.getElement().getStyle().clearDisplay();
                    setGalleriesVisible(false);
                    setCategoriesVisible(false);
                    setHeaderVisible(true);
                    m_localeComparison.setVisible(false);
                    m_toolbar.setNewEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_NEW_DISABLE_0));
                    m_toolbar.setClipboardEnabled(true, null);
                    m_inNavigationStyle.setValue(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().vfsMode());
                    setModelPagesVisible(false);
                    break;
                case modelpages:
                    m_tree.getElement().getStyle().setDisplay(Display.NONE);
                    setGalleriesVisible(false);
                    setCategoriesVisible(false);
                    setModelPagesVisible(true);
                    setHeaderVisible(true);
                    m_localeComparison.setVisible(false);
                    m_toolbar.setNewEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_NEW_DISABLE_0));
                    m_toolbar.setClipboardEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_CLIPBOARD_DISABLE_0));
                    getController().loadModelPages();

                    break;
                case categories:
                    m_tree.getElement().getStyle().setDisplay(Display.NONE);
                    setGalleriesVisible(false);
                    setModelPagesVisible(false);
                    setCategoriesVisible(true);
                    setHeaderVisible(true);
                    m_localeComparison.setVisible(false);
                    m_toolbar.setNewEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_NEW_DISABLE_0));
                    m_toolbar.setClipboardEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_CLIPBOARD_DISABLE_0));
                    getController().loadCategories(false, null);
                    break;
                case compareLocales:
                    m_tree.getElement().getStyle().setDisplay(Display.NONE);
                    setGalleriesVisible(false);
                    setModelPagesVisible(false);
                    setCategoriesVisible(false);
                    setHeaderVisible(false);
                    m_toolbar.setNewEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_NEW_DISABLE_0));
                    m_toolbar.setClipboardEnabled(false, Messages.get().key(Messages.GUI_TOOLBAR_CLIPBOARD_DISABLE_0));
                    m_localeComparison.setVisible(true);
                    m_controller.getData().getRoot().getId();
                    CmsJsUtil.callNamedFunctionWithString(
                        CmsGwtConstants.CALLBACK_REFRESH_LOCALE_COMPARISON,
                        "" + m_controller.getData().getRoot().getId());
                    break;

                default:

            }
            // check if the tree has been drawn yet
            getRootItem().updateEditorMode();
            m_toolbar.setMode(editorMode);
        }
    }
1030209
function setMode(oBinding, iIndex) {
				if (oBinding.parts) {
					oBinding.parts.forEach(function (vPart, i) {
						if (typeof vPart === "string") {
							vPart = oBinding.parts[i] = {path : vPart};
						}
						setMode(vPart, i);
					});
					b2ndLevelMergedNeeded = b2ndLevelMergedNeeded || iIndex !== undefined;
				} else {
					oBinding.mode = oBindingMode;
				}
			}
1180524
function addMode(middle, mode, settings) {
    if (!modes.includes(mode)) throw `Incorrect bodyparser mode ${mode}`;
    middle.push(bodyParser[mode](settings[mode]));
}
104730
def setmode(mode):
    
    if hasattr(mode, '__getitem__'):
        set_custom_pin_mappings(mode)
        mode = CUSTOM

    assert mode in [BCM, BOARD, SUNXI, CUSTOM]
    global _mode
    _mode = mode
1056502
public SM2 setMode(SM2Mode mode) {
		this.mode = mode;
		if (null != this.engine) {
			this.engine.setMode(mode);
		}
		return this;
	}
1370931
private void addModal(Component component, ModalListener listener,
						Integer modalDepth) {
	if (modalDepth == null) {
	  modalDepth = defaultModalDepth;
	}
	if (components.contains(component) == false) {

	  rootPane.getLayeredPane().remove(getModalPanel());
	  rootPane.getLayeredPane().add(getModalPanel(), modalDepth);

	  KeyboardFocusManager focusManager =
		  KeyboardFocusManager.getCurrentKeyboardFocusManager();
	  focusManager.clearGlobalFocusOwner();
	  getModalPanel().removeAll();
	  getModalPanel().add("", component);
	  resizeModalPanel();
	  getModalPanel().repaint();
	  components.add(component);
	  depths.put(component, modalDepth);
	  addListener(component, listener);
	}
  }
1095057
private void changeFormMode(@AuthMode int mode) {
        Log.d(TAG, "Mode changed to " + mode);
        if (lastFormMode == mode || !showDatabase && !showEnterprise) {
            return;
        }
        Log.d(TAG, "Mode changed to " + mode);
        lastFormMode = mode;
        lockWidget.showTopBanner(false);
        if (socialLayout != null) {
            socialLayout.setCurrentMode(mode);
        }
        switch (mode) {
            case AuthMode.LOG_IN:
                showLogInForm();
                lockWidget.showBottomBanner(false);
                lockWidget.updateButtonLabel(R.string.com_auth0_lock_action_log_in);
                break;
            case AuthMode.SIGN_UP:
                showSignUpForm();
                lockWidget.showBottomBanner(true);
                lockWidget.updateButtonLabel(R.string.com_auth0_lock_action_sign_up);
                break;
        }
    }
948599
public void matrixMode(MatrixMode mode) {
		switch (mode) {
		case PROJECTION:
			gl.glMatrixMode(GL2.GL_PROJECTION);
			break;
		case MODELVIEW:
			gl.glMatrixMode(GL2.GL_MODELVIEW);
			break;
		default:
			break;
		}
	}
624062
void onRadioToggle(int index) {
        for (int i = 0; i < getChildCount(); i++) {

            if (i != index) {
                BootstrapButton b = retrieveButtonChild(i);
                b.setSelected(false);
            }
        }
    }
1304593
public void clickOnEditText(int index) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "clickOnEditText("+index+")");
		}
		
		clicker.clickOn(EditText.class, index);
	}