Class AccountWidget

java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.components.AccountWidget
All Implemented Interfaces:
Component

public class AccountWidget extends HtmlTag
Account-state widget that renders either guest links or authenticated user actions.

Configuration is mutable and not thread-safe. Rendering generates state-derived content without modifying stored children, and forwards context to inherited children. Configure before sharing; custom child delegates and request contexts have their own sharing requirements.

Authenticated actions use disclosure navigation, not an ARIA menu. Load framework JS/CSS once in the shell for native-button activation and dismissal.

  • Method Details

    • createGuest

      public static AccountWidget createGuest()
      Creates a guest-state widget.
      Returns:
      guest widget
    • createAuthenticated

      public static AccountWidget createAuthenticated(String username)
      Creates an authenticated-state widget.
      Parameters:
      username - display name
      Returns:
      authenticated widget
    • createDynamic

      public static HtmlTag createDynamic(String endpoint)
      Creates an HTMX placeholder that loads widget HTML from an application-controlled or separately endpoint-validated URL. Encoding does not enforce destination policy or auth.
      Parameters:
      endpoint - HTMX GET endpoint
      Returns:
      placeholder div
    • withLoginUrl

      public AccountWidget withLoginUrl(String url)
      Sets an application-controlled or separately navigation-validated login URL. The generated href is encoded, without Link's scheme policy.
      Parameters:
      url - login URL
      Returns:
      this widget
    • withSignupUrl

      public AccountWidget withSignupUrl(String url)
      Sets an application-controlled or separately navigation-validated signup URL. The generated href is encoded, without Link's scheme policy; null omits the signup link.
      Parameters:
      url - signup URL
      Returns:
      this widget
    • withProfileUrl

      public AccountWidget withProfileUrl(String url)
      Sets an application-controlled or separately navigation-validated profile URL. The generated href is encoded, without Link's scheme policy.
      Parameters:
      url - profile URL
      Returns:
      this widget
    • withLogoutUrl

      public AccountWidget withLogoutUrl(String url)
      Sets an application-controlled or separately navigation-validated logout URL. The generated href is encoded, without Link's scheme policy or endpoint authorization.
      Parameters:
      url - logout URL
      Returns:
      this widget
    • getChildrenStream

      protected Stream<Component> getChildrenStream()
      Generates account content followed by inherited children without mutating either.
      Overrides:
      getChildrenStream in class HtmlTag