Class WebCheckControlDepictor<C extends CheckControl>

Type Parameters:
C - The type of component being depicted.
All Implemented Interfaces:
ComponentDepictor<C>, Depictor<C>, WebComponentDepictor<C>, WebDepictor<C>

public class WebCheckControlDepictor<C extends CheckControl> extends AbstractWebComponentDepictor<C>
Strategy for rendering a check control as an XHTML <input> element with type checkbox or radio.
Author:
Garret Wilson
  • Constructor Details

    • WebCheckControlDepictor

      public WebCheckControlDepictor()
      Default constructor using the XHTML <span> element.
  • Method Details

    • getMutualExclusionGroupID

      protected long getMutualExclusionGroupID(MutualExclusionPolicyModelGroup mutualExclusionModelGroup)
      Determines the ID for the mutual exclusion group. If no ID has been assigned to the given group, one will be generated and associated with the group.
      Parameters:
      mutualExclusionModelGroup - The model policy group for mutual exclusion for which its ID should be given.
      Returns:
      The component identifier for the mutual exclusion group.
    • isMutualExclusion

      protected static boolean isMutualExclusion(CheckControl checkControl)
      Determines whether the check control is a mutual exclusion control and should be considered a radio button rather than a checkbox.
      Parameters:
      checkControl - The component which should be determined to be mutual exclusion or not.
      Returns:
      true if the given component has a MutualExclusionPolicyModelGroup value listener.
      See Also:
    • getCheckControlName

      protected String getCheckControlName(CheckControl checkControl)
      Determines the identifier to place in the name attribute of the component's XHTML element. For XHTML radio buttons, a unique identifier for its mutual exclusion policy model group is returned; the component ID is returned if this is not a mutual exclusion component.
      Parameters:
      checkControl - The component for which a name should be retrieved.
      Returns:
      An identifier appropriate for the name attribute of the component's XHTML element, or null if the component's element should not have a name.
      See Also:
    • getOuterStyles

      protected Map<String,Object> getOuterStyles()
      Retrieves the styles for the outer element of the component.

      This version returns the style for color.

      This version combines the body styles with the outer styles.

      Overrides:
      getOuterStyles in class AbstractWebComponentDepictor<C extends CheckControl>
      Returns:
      The styles for the outer element of the component, mapped to CSS property names.
    • getDepictName

      public String getDepictName()
      Determines the identifier to place in the name attribute of the component's XHTML element. For XHTML radio buttons, a unique identifier for its mutual exclusion policy model group is returned; the component ID is returned if this is not a mutual exclusion component.
      Specified by:
      getDepictName in interface WebComponentDepictor<C extends CheckControl>
      Overrides:
      getDepictName in class AbstractWebComponentDepictor<C extends CheckControl>
      Returns:
      An identifier appropriate for the name attribute of the component's XHTML element, or null if the component's element should not have a name.
      See Also:
    • processEvent

      public void processEvent(PlatformEvent event)
      Description copied from class: AbstractComponentDepictor
      Processes an event from the platform.

      This implementation handles PlatformFocusEvent.

      Specified by:
      processEvent in interface Depictor<C extends CheckControl>
      Overrides:
      processEvent in class AbstractComponentDepictor<C extends CheckControl>
      Parameters:
      event - The event to be processed.
    • getInputType

      protected String getInputType()
      Determines the XHTML input type to use for getting input from the user.
      Returns:
      One of the XHTML input types.
    • depictBegin

      protected void depictBegin() throws IOException
      Description copied from class: AbstractWebComponentDepictor
      Begins the depiction process.

      This version renders the beginning XML element information, if there is any, leaving the beginning tag open for attributes.

      This version writes common XHTML attributes.

      Overrides:
      depictBegin in class AbstractWebComponentDepictor<C extends CheckControl>
      Throws:
      IOException - if there is an error updating the depiction.
    • depictEnd

      protected void depictEnd() throws IOException
      Description copied from class: AbstractWebComponentDepictor
      Ends the depiction process.

      This version renders the ending XML element information, if there is any.

      Overrides:
      depictEnd in class AbstractWebComponentDepictor<C extends CheckControl>
      Throws:
      IOException - if there is an error updating the depiction.