Handles an ActionInitTarget state change.
486541
def handle_inittarget(
        state_change: ActionInitTarget,
        channel_state: NettingChannelState,
        pseudo_random_generator: random.Random,
        block_number: BlockNumber,
) -> TransitionResult[TargetTransferState]:
    
    transfer = state_change.transfer
    route = state_change.route

    assert channel_state.identifier == transfer.balance_proof.channel_identifier
    is_valid, channel_events, errormsg = channel.handle_receive_lockedtransfer(
        channel_state,
        transfer,
    )

    if is_valid:
        # A valid balance proof does not mean the payment itself is still valid.
        # e.g. the lock may be near expiration or have expired. This is fine. The
        # message with an unusable lock must be handled to properly synchronize the
        # local view of the partner's channel state, allowing the next balance
        # proofs to be handled. This however, must only be done once, which is
        # enforced by the nonce increasing sequentially, which is verified by
        # the handler handle_receive_lockedtransfer.
        target_state = TargetTransferState(route, transfer)

        safe_to_wait, _ = is_safe_to_wait(
            transfer.lock.expiration,
            channel_state.reveal_timeout,
            block_number,
        )

        # If there is not enough time to safely unlock the lock on-chain
        # silently let the transfer expire. The target task must be created to
        # handle the ReceiveLockExpired state change, which will clear the
        # expired lock.
        if safe_to_wait:
            message_identifier = message_identifier_from_prng(pseudo_random_generator)
            recipient = transfer.initiator
            secret_request = SendSecretRequest(
                recipient=Address(recipient),
                channel_identifier=CHANNEL_IDENTIFIER_GLOBAL_QUEUE,
                message_identifier=message_identifier,
                payment_identifier=transfer.payment_identifier,
                amount=transfer.lock.amount,
                expiration=transfer.lock.expiration,
                secrethash=transfer.lock.secrethash,
            )
            channel_events.append(secret_request)

        iteration = TransitionResult(target_state, channel_events)
    else:
        # If the balance proof is not valid, do *not* create a task. Otherwise it's
        # possible for an attacker to send multiple invalid transfers, and increase
        # the memory usage of this Node.
        unlock_failed = EventUnlockClaimFailed(
            identifier=transfer.payment_identifier,
            secrethash=transfer.lock.secrethash,
            reason=errormsg,
        )
        channel_events.append(unlock_failed)
        iteration = TransitionResult(None, channel_events)

    return iteration
1256681
def on_state_changed(self, state):
        
        if state:
            self.editor.sig_breakpoints_changed.connect(self.repaint)
            self.editor.sig_debug_stop.connect(self.set_current_line_arrow)
            self.editor.sig_debug_stop[()].connect(self.stop_clean)
            self.editor.sig_debug_start.connect(self.start_clean)
        else:
            self.editor.sig_breakpoints_changed.disconnect(self.repaint)
            self.editor.sig_debug_stop.disconnect(self.set_current_line_arrow)
            self.editor.sig_debug_stop[()].disconnect(self.stop_clean)
            self.editor.sig_debug_start.disconnect(self.start_clean)
420510
public void toggleState()
    {
        if (m_iCurrentState == ON)
            m_iCurrentState = NULL;
        else if (m_iCurrentState == OFF)
            m_iCurrentState = ON;
        else
            m_iCurrentState = OFF;
        this.updateImage();
    }
1152099
def emitTriggered(self, action):
        
        self.currentActionChanged.emit(action)
        self.currentIndexChanged.emit(self.indexOf(action))
        
        if not self.signalsBlocked():
            self.triggered.emit(action)
478100
private void handleIntent() {
        Bundle extras = getIntent().getExtras();

        if (extras != null) {
            handleHideNavigationIntent(extras);
            handleShowButtonBarIntent(extras);
            handleNextButtonTextIntent(extras);
            handleBackButtonTextIntent(extras);
            handleFinishButtonTextIntent(extras);
            handleShowProgressIntent(extras);
            handleProgressFormatIntent(extras);
            handleNoBreadcrumbsIntent(extras);
        }
    }
1349129
public void stateChanged (ChangeEvent e)
    {
        JSlider source = (JSlider)e.getSource();
        if (!source.getValueIsAdjusting()) {
            _value.setText(Integer.toString(source.getValue()));
        }
    }
792491
function(a) {
		gui.Spirit.prototype.onaction.call(this, a);
		this.action.$handleownaction = false;
		switch (a.type) {
			case gui.$ACTION_XFRAME_VISIBILITY:
				this._waiting = false;
				if (gui.hasModule("gui-layout@wunderbyte.com")) { // TODO: - fix
					if (a.data === true) {
						this.visibility.on();
					} else {
						this.visibility.off();
					}
				}
				a.consume();
				break;
		}
	}
1087951
private function handleNodeStateChanges()
    {
        $input = $this->getEnvironment()->getInputProvider();
        if (($modelId = $input->getParameter('ptg')) && ($providerName = $input->getParameter('provider'))) {
            $states = $this->getTreeNodeStates();
            // Check if the open/close all has been triggered or just a model.
            if ('all' === $modelId) {
                if ($states->isAllOpen()) {
                    $states->resetAll();
                }
                $states->setAllOpen($states->isAllOpen());
            } else {
                $this->toggleModel($providerName, $modelId);
            }

            ViewHelpers::redirectHome($this->environment);
        }
    }
706886
def initialize_state(self):
        
        if self.__hardware_source:
            self.__data_item_states_changed_event_listener = self.__hardware_source.data_item_states_changed_event.listen(self.__data_item_states_changed)
            self.__acquisition_state_changed_event_listener = self.__hardware_source.acquisition_state_changed_event.listen(self.__acquisition_state_changed)
        if self.on_display_name_changed:
            self.on_display_name_changed(self.display_name)
        self.__update_buttons()
        if self.on_data_item_states_changed:
            self.on_data_item_states_changed(list())
1246650
private void doRunningStateChange(RunningState newState) {
    RunningState oldState = null;
    JobExecutionStateListener stateListener = null;
    this.changeLock.lock();
    try {
      // verify transition
      if (null == this.runningState) {
        Preconditions.checkState(RunningState.PENDING == newState);
      }
      else {
        Preconditions.checkState(EXPECTED_PRE_TRANSITION_STATES.get(newState).contains(this.runningState),
            "unexpected state transition " + this.runningState + " --> " + newState);
      }

      oldState = this.runningState;
      this.runningState = newState;
      if (this.listener.isPresent()) {
        stateListener = this.listener.get();
      }
      this.runningStateChanged.signalAll();
    }
    finally {
      this.changeLock.unlock();
    }
    if (null != stateListener) {
      stateListener.onStatusChange(this, oldState, newState);
    }
  }
977852
@Override
    public void init(final Class<? extends State> stateClass) throws InitializationException {
        try {
            currentState = getState(stateClass);
            change.firePropertyChange(STATE_CHANGE, null, currentState.getClass());
        } catch (NotAvailableException ex) {
            throw new InitializationException(this, ex);
        }
    }
62249
def changed_action(mapper, connection, target):
    """"""
    action_history = get_history(target, 'action')
    argument_history = get_history(target, 'argument')
    owner_history = get_history(
        target,
        'user' if isinstance(target, ActionUsers) else
        'role' if isinstance(target, ActionRoles) else 'role_name')

    if action_history.has_changes() or argument_history.has_changes() \
       or owner_history.has_changes():
        current_access.delete_action_cache(
            get_action_cache_key(target.action, target.argument))
        current_access.delete_action_cache(
            get_action_cache_key(
                action_history.deleted[0] if action_history.deleted
                else target.action,
                argument_history.deleted[0] if argument_history.deleted
                else target.argument)
        )
1149182
@UiThread
    public void rebindIfNeeded() {
        ThreadUtils.ensureMainThread();

        Iterator<RouterTransaction> backstackIterator = backstack.reverseIterator();
        while (backstackIterator.hasNext()) {
            RouterTransaction transaction = backstackIterator.next();

            if (transaction.controller.getNeedsAttach()) {
                performControllerChange(transaction, null, true, new SimpleSwapChangeHandler(false));
            } else {
                setControllerRouter(transaction.controller);
            }
        }
    }
1034073
private Action handleAddUpdateActionStatus(final JpaActionStatus actionStatus, final JpaAction action) {

        String controllerId = null;
        LOG.debug("handleAddUpdateActionStatus for action {}", action.getId());

        // information status entry - check for a potential DOS attack
        assertActionStatusQuota(action);
        assertActionStatusMessageQuota(actionStatus);

        switch (actionStatus.getStatus()) {
        case ERROR:
            final JpaTarget target = (JpaTarget) action.getTarget();
            target.setUpdateStatus(TargetUpdateStatus.ERROR);
            handleErrorOnAction(action, target);
            break;
        case FINISHED:
            controllerId = handleFinishedAndStoreInTargetStatus(action);
            break;
        case DOWNLOADED:
            controllerId = handleDownloadedActionStatus(action);
            break;
        default:
            break;
        }

        actionStatus.setAction(action);
        actionStatusRepository.save(actionStatus);
        final Action savedAction = actionRepository.save(action);

        if (controllerId != null) {
            requestControllerAttributes(controllerId);
        }

        return savedAction;
    }
553324
def _on_state_changed(self):
        """"""
        raw_state, generation = self.state.raw_state_and_generation
        if generation != self._last_generation:
            self._last_generation = generation
            self._send_update(raw_state, generation)
1317801
private synchronized void setState(int state) {
        mState = state;

        // Give the new state to the Handler so the UI Activity can update
        mHandler.obtainMessage(ISOBlueDemo.MESSAGE_STATE_CHANGE, state, -1)
                .sendToTarget();
    }
883721
def async_state_change_callback(self, addr, state, value):
        """"""
        _LOGGING.info('Device %s state %s value is changed to %s',
                      addr, state, value)