Java Code Examples for com.facebook.litho.ComponentContext#getComponentScope()

The following examples show how to use com.facebook.litho.ComponentContext#getComponentScope() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMount.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void updateCurrentState(ComponentContext c, int someParam) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  TestMount.UpdateCurrentStateStateUpdate _stateUpdate =
      ((TestMount) _component).createUpdateCurrentStateStateUpdate(someParam);
  c.updateStateAsync(_stateUpdate, "TestMount.updateCurrentState");
}
 
Example 2
Source File: TestMount.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void updateCurrentStateAsync(ComponentContext c, int someParam) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  TestMount.UpdateCurrentStateStateUpdate _stateUpdate =
      ((TestMount) _component).createUpdateCurrentStateStateUpdate(someParam);
  c.updateStateAsync(_stateUpdate, "TestMount.updateCurrentState");
}
 
Example 3
Source File: TestMount.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void updateCurrentStateSync(ComponentContext c, int someParam) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  TestMount.UpdateCurrentStateStateUpdate _stateUpdate =
      ((TestMount) _component).createUpdateCurrentStateStateUpdate(someParam);
  c.updateStateSync(_stateUpdate, "TestMount.updateCurrentState");
}
 
Example 4
Source File: TestMount.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void lazyUpdateState1(ComponentContext c, final long lazyUpdateValue) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  ComponentLifecycle.StateUpdate _stateUpdate =
      new ComponentLifecycle.StateUpdate() {
        @Override
        public void updateState(StateContainer _stateContainer) {
          TestMountStateContainer stateContainer = (TestMountStateContainer) _stateContainer;
          stateContainer.state1 = lazyUpdateValue;
        }
      };
  c.updateStateLazy(_stateUpdate);
}
 
Example 5
Source File: TestLayout.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void updateCurrentState(ComponentContext c, int someParam) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  TestLayout.UpdateCurrentStateStateUpdate _stateUpdate =
      ((TestLayout) _component).createUpdateCurrentStateStateUpdate(someParam);
  c.updateStateAsync(_stateUpdate, "TestLayout.updateCurrentState");
}
 
Example 6
Source File: TestLayout.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void updateCurrentStateAsync(ComponentContext c, int someParam) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  TestLayout.UpdateCurrentStateStateUpdate _stateUpdate =
      ((TestLayout) _component).createUpdateCurrentStateStateUpdate(someParam);
  c.updateStateAsync(_stateUpdate, "TestLayout.updateCurrentState");
}
 
Example 7
Source File: TestLayout.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void updateCurrentStateSync(ComponentContext c, int someParam) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  TestLayout.UpdateCurrentStateStateUpdate _stateUpdate =
      ((TestLayout) _component).createUpdateCurrentStateStateUpdate(someParam);
  c.updateStateSync(_stateUpdate, "TestLayout.updateCurrentState");
}
 
Example 8
Source File: TestLayout.java    From litho with Apache License 2.0 5 votes vote down vote up
protected static void lazyUpdateState1(ComponentContext c, final long lazyUpdateValue) {
  Component _component = c.getComponentScope();
  if (_component == null) {
    return;
  }
  ComponentLifecycle.StateUpdate _stateUpdate =
      new ComponentLifecycle.StateUpdate() {
        @Override
        public void updateState(StateContainer _stateContainer) {
          TestLayoutStateContainer stateContainer = (TestLayoutStateContainer) _stateContainer;
          stateContainer.state1 = lazyUpdateValue;
        }
      };
  c.updateStateLazy(_stateUpdate);
}
 
Example 9
Source File: TestMount.java    From litho with Apache License 2.0 4 votes vote down vote up
public static EventHandler getTestEventHandler(ComponentContext context) {
  if (context.getComponentScope() == null) {
    return null;
  }
  return ((TestMount) context.getComponentScope()).testEventHandler;
}
 
Example 10
Source File: TestMount.java    From litho with Apache License 2.0 4 votes vote down vote up
static void onClickEventTrigger(ComponentContext c, View view) {
  TestMount component = (TestMount) c.getComponentScope();
  component.onClickEventTrigger((EventTriggerTarget) component, view);
}
 
Example 11
Source File: TestLayout.java    From litho with Apache License 2.0 4 votes vote down vote up
public static EventHandler getTestEventHandler(ComponentContext context) {
  if (context.getComponentScope() == null) {
    return null;
  }
  return ((TestLayout) context.getComponentScope()).testEventHandler;
}
 
Example 12
Source File: TestLayout.java    From litho with Apache License 2.0 4 votes vote down vote up
static void onClickEventTrigger(ComponentContext c, View view) {
  TestLayout component = (TestLayout) c.getComponentScope();
  component.onClickEventTrigger((EventTriggerTarget) component, view);
}