This class keeps track of the focus state of the given window.
Focus changes for example when the user switches a browser tab,
goes to the location bar or switches to another application.
423386
function(win) {
    win = win || window;
    
    this.lastFocus = new Date().getTime();
    this._isFocused = true;
    
    var _self = this;

    // IE < 9 supports focusin and focusout events
    if ("onfocusin" in win.document) {
        event.addListener(win.document, "focusin", function(e) {
            _self._setFocused(true);
        });

        event.addListener(win.document, "focusout", function(e) {
            _self._setFocused(!!e.toElement);
        });
    }
    else {
        event.addListener(win, "blur", function(e) {
            _self._setFocused(false);
        });

        event.addListener(win, "focus", function(e) {
            _self._setFocused(true);
        });
    }
}
361330
protected void onSelectedInstantChanged() {
        if (selectedInstant == null) {
            getInputWidget().setText("");
            anchorLabel();
        } else {
            getInputWidget().setText(getInstantPrinter().print(selectedInstant));
            floatLabel();
        }

        if (instantPickerListener != null)
            instantPickerListener.onInstantChanged(this, selectedInstant);
    }
20628
@Override
    protected void onFocusChanged(boolean focused, int direction,
                                  Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
        showErrorIconHax(lastErrorIcon);
    }
1127723
function () {
            this.changeProperty("selectedTab", this._cfg.tabId);
            if (this._cfg.waiAria) {
                // Focusing the Tab before focusing the TabPanel is not enough to make the screen reader read the tab's title first
                // A sufficient timeout would be necessary, but we can't program that way safely
                // this._focus();
                var controlledTabPanelId = this._getControlledTabPanelId();
                if (controlledTabPanelId != null) {
                    var tabPanelElement = ariaUtilsDom.getElementById(controlledTabPanelId);
                    ariaTemplatesNavigationManager.focusFirst(tabPanelElement);
                }
            }
        }
824492
public void setOnfocus(java.lang.String onfocus) {
        getStateHelper().put(PropertyKeys.onfocus, onfocus);
        handleAttribute("onfocus", onfocus);
    }
886007
public static void switchFocus (Stage stage, Focusable widget) {
		if (focusedWidget == widget) return;
		if (focusedWidget != null) focusedWidget.focusLost();
		focusedWidget = widget;
		if (stage != null) stage.setKeyboardFocus(null);
		focusedWidget.focusGained();
	}
787597
public void toggleFocus(boolean focusOn) {

        if (focusOn) {
            addStyleName(formCss().focused());
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_help) || m_hasError) {
                if (shouldDisplayTooltipAbove()) {
                    addStyleName(formCss().displayAbove());
                } else {
                    removeStyleName(formCss().displayAbove());
                }
            } else {
                m_helpBubble.getStyle().setDisplay(Display.NONE);
            }
        } else {
            removeStyleName(formCss().focused());
            if (m_widget != null) {
                if (m_handler.hasSingleOptionalValue()) {
                    if (m_handler.getWidgetService().shouldRemoveLastValueAfterUnfocus(m_widget)) {
                        m_handler.removeAttributeValue(this);
                    }

                }
            }
        }
    }
118948
public void myFocusGained()
    {
        m_bInFocus = true;
        String strText = super.getText();
        if (m_strDescription.equals(strText))
        {   // Don't notify of change
            if (m_actionListener != null)
                this.removeActionListener(m_actionListener);
            this.changeFont(false);
            super.setText(Constants.BLANK);
            if (m_actionListener != null)
                this.addActionListener(m_actionListener);
        }
    }
457738
@Override
    public void windowLostFocus(WindowEvent e) {
        // This section is part of the bug fix for blank popup windows in linux.
        if (!enableHideWhenFocusIsLost) {
            e.getWindow().requestFocus();
            return;
        }
        // This fixes a linux-specific behavior where the focus can be "lost" by clicking a child
        // component (inside the same panel!).
        if (InternalUtilities.isMouseWithinComponent(displayWindow)) {
            return;
        }
        hide();
    }
661982
def _tab_changed(self):
        """"""
        current = self.tab_widget.currentWidget()
        if current == self.analysisTab:
            self.btn_back.setEnabled(False)
            self.btn_next.setEnabled(True)
        elif current == self.reportingTab:
            if self._current_index == 0:
                # Only if the user is coming from the first tab
                self._populate_reporting_tab()
            self.reporting_options_layout.setEnabled(
                self._multi_exposure_if is not None)
            self.btn_back.setEnabled(True)
            self.btn_next.setEnabled(True)
        else:
            self.btn_back.setEnabled(True)
            self.btn_next.setEnabled(False)
        self._current_index = current
699180
function() {
        this.logger.log("focus");
        this.valueChangeSource = Slider.SOURCE_UI_EVENT;

        // Focus the background element if possible
        var el = this.getEl();

        if (el.focus) {
            try {
                el.focus();
            } catch(e) {
                // Prevent permission denied unhandled exception in FF that can
                // happen when setting focus while another element is handling
                // the blur.  @TODO this is still writing to the error log 
                // (unhandled error) in FF1.5 with strict error checking on.
            }
        }

        this.verifyOffset();

        return !this.isLocked();
    }
504375
public void setFocus(boolean focus) {
		if (focus) {
			if (currentFocus != null) {
				currentFocus.setFocus(false);
			}
			currentFocus = this;
		} else {
			if (currentFocus == this) {
				currentFocus = null;
			}
		}
		this.focus = focus;
	}
251828
function () {
            if (fidj.isDefinedAndNotNull(new_window.location) && (typeof new_window.location.href == "string")) {
                //fidj.InternalLog.log('openChildBrowser', 'new location=' + new_window.location.href);
            } else if (fidj.isDefinedAndNotNull(new_window.document) && (typeof new_window.document.URL == "string")) {
                //fidj.InternalLog.log('openChildBrowser', 'new url=' + new_window.document.URL);
            }
            if (!locationChanged) {
                if (fidj.isDefinedAndNotNull(new_window.location) &&
                    (typeof new_window.location.href == "string") &&
                    (initialLocation != new_window.location.href)) {
                    fidj.InternalLog.log('openChildBrowser', 'new location=' + new_window.location.href);
                    locationChanged = true;
                    setTimeout(new_window_tracker, 100);
                    return;
                } else if (fidj.isDefinedAndNotNull(new_window.document) &&
                    (typeof new_window.document.URL == "string") &&
                    (initialUrl != new_window.document.URL)) {
                    fidj.InternalLog.log('openChildBrowser', 'new url=' + new_window.document.URL);
                    locationChanged = true;
                    setTimeout(new_window_tracker, 100);
                    return;
                }
            } else {
                if (fidj.isDefinedAndNotNull(new_window.location) &&
                    (typeof new_window.location.href == "string") &&
                    (new_window.location.href.indexOf('about:blank') >= 0)) {
                    fidj.InternalLog.log('openChildBrowser', 'onLocationChange');
                    if (onLocationChange) onLocationChange();
                    closeChildBrowserAfterLocationChange = true;
                    new_window.close();
                    return;
                } else if (fidj.isDefinedAndNotNull(new_window.document) &&
                    (typeof new_window.document.URL == "string") &&
                    (new_window.document.URL.indexOf('about:blank') >= 0)) {
                    fidj.InternalLog.log('openChildBrowser', 'onUrlChange');
                    if (onLocationChange) onLocationChange();
                    closeChildBrowserAfterLocationChange = true;
                    new_window.close();
                    return;
                }
            }
            if (new_window.closed) {
                fidj.InternalLog.log('openChildBrowser', 'onClose');
                if (!closeChildBrowserAfterLocationChange) {
                    if (onClose) onClose();
                }
                return;
            }
            //fidj.InternalLog.log('openChildBrowser', 'track locationChanged=' + locationChanged);
            setTimeout(new_window_tracker, 100);
        }
307753
def markCurrentChanged(self):
        
        view = self.currentView()
        if view:
            view.setCurrent()
            self.setFocus()
            view.setFocus()
            self._hintLabel.hide()
        else:
            self._hintLabel.show()
            self._hintLabel.setText(self.hint())

        if not self.count():
            self.tabBar().clear()

        self.adjustSizeConstraint()
1325766
function(url) {
      if (!isSupportHistoryAPI && ('' + url).indexOf('#') === 0) {
        changeState(null, url);
      } else {
        windowLocation.assign(url);
      }
    }
1137758
function( giveFocus ) {

                // If we need to give focus, do it before changing states.
                if ( giveFocus ) {
                    // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
                    // The focus is triggered *after* the close has completed - causing it
                    // to open again. So unbind and rebind the event at the next tick.
                    P.$root.off( 'focus.toOpen' ).eq(0).focus()
                    setTimeout( function() {
                        P.$root.on( 'focus.toOpen', handleFocusToOpenEvent )
                    }, 0 )
                }

                // Remove the “active” class.
                $ELEMENT.removeClass( CLASSES.active )
                aria( ELEMENT, 'expanded', false )

                // * A Firefox bug, when `html` has `overflow:hidden`, results in
                //   killing transitions :(. So remove the “opened” state on the next tick.
                //   Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
                setTimeout( function() {

                    // Remove the “opened” and “focused” class from the picker root.
                    P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused )
                    aria( P.$root[0], 'hidden', true )

                }, 0 )

                // If it’s already closed, do nothing more.
                if ( !STATE.open ) return P

                // Set it as closed.
                STATE.open = false

                // Allow the page to scroll.
                if ( IS_DEFAULT_THEME ) {
                    $html.
                        css( 'overflow', '' ).
                        css( 'padding-right', '-=' + getScrollbarWidth() )
                }

                // Unbind the document events.
                $document.off( '.' + STATE.id )

                // Trigger the queued “close” events.
                return P.trigger( 'close' )
            }
832546
function tab(e) {
        var parentRole = getParentRole();

        if (parentRole == "tablist") {
          var elm = getFocusElements(focusedControl.getEl('body'))[0];

          if (elm) {
            elm.focus();
          }
        } else {
          moveFocus(e.shiftKey ? -1 : 1);
        }
      }