Class MockedUI

All Implemented Interfaces:
AttachNotifier, DetachNotifier, HasComponents, HasComponentsOfType<Component>, HasElement, HasEnabled, HasStyle, PollNotifier, RouterLayout, Serializable

public class MockedUI extends UI
The UI the mocked environment creates by default.

It stands in for the browser in the two places the browser would normally act: it renders a navigation server-side, since there is no client router to hand the location to, and it flushes the state tree after a modality change, since there is no client response to trigger it.

The class is not final, so a test that needs a different UI can pass a factory producing a subclass, but the shape of what it overrides is not part of the published API.

For internal use only. May be renamed or removed in a future release.

See Also:
  • Constructor Details

    • MockedUI

      public MockedUI()
      Creates the UI.
  • Method Details

    • setChildComponentModal

      public void setChildComponentModal(Component childComponent, ModalityMode mode)
      Description copied from class: UI
      Change the child component server side modality by modality mode: ModalityMode.STRICT, ModalityMode.VISUAL, or ModalityMode.MODELESS. The component needs to be a child of this UI. By default, all child components are modeless. Note that calling this doesn't show a modality curtain or change the visible state of the components in the UI - that should be handled by the component separately. Thus, this is purely a server side feature.
      Overrides:
      setChildComponentModal in class UI
      Parameters:
      childComponent - the child component to change state for
      mode - the modality mode, not null
    • addToModalComponent

      public void addToModalComponent(Component component)
      Description copied from class: UI
      Add component as child to the most recently set component with modality, either ModalityMode.STRICT or ModalityMode.VISUAL, if there is one. Else it will be added to the UI normally.

      This is meant to be used with components that are not added as part of a layout, like dialog, so that they are interactive when a component with modality opens up an overlay component.

      Overrides:
      addToModalComponent in class UI
      Parameters:
      component - component to add to modal component