com.guiseframework.platform.web
Class WebCheckControlDepictor<C extends CheckControl>

java.lang.Object
  extended by com.guiseframework.platform.AbstractDepictor<C>
      extended by com.guiseframework.platform.AbstractComponentDepictor<C>
          extended by com.guiseframework.platform.web.AbstractWebComponentDepictor<C>
              extended by com.guiseframework.platform.web.WebCheckControlDepictor<C>
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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.guiseframework.platform.AbstractComponentDepictor
AbstractComponentDepictor.DepictedCompositeComponentListener
 
Nested classes/interfaces inherited from class com.guiseframework.platform.AbstractDepictor
AbstractDepictor.DepictedPropertyChangeListener
 
Field Summary
 
Fields inherited from class com.guiseframework.platform.web.AbstractWebComponentDepictor
BODY_END_PATTERN, BODY_START_PATTERN
 
Fields inherited from class com.guiseframework.platform.AbstractComponentDepictor
childPropertyChangeListener
 
Fields inherited from interface com.guiseframework.platform.Depictor
GENERAL_PROPERTY
 
Constructor Summary
WebCheckControlDepictor()
          Default constructor using the XHTML <span> element.
 
Method Summary
protected  void depictBegin()
          Begins the rendering process.
protected  void depictEnd()
          Ends the rendering process.
protected  java.lang.String getCheckControlName(CheckControl checkControl)
          Determines the identifier to place in the name attribute of the component's XHTML element.
 java.lang.String getDepictName()
          Determines the identifier to place in the name attribute of the component's XHTML element.
protected  java.lang.String getInputType()
          Determines the XHTML input type to use for getting input from the user.
protected  long getMutualExclusionGroupID(MutualExclusionPolicyModelGroup mutualExclusionModelGroup)
          Determines the ID for the mutual exclusion group.
protected  java.util.Map<java.lang.String,java.lang.Object> getOuterStyles()
          Retrieves the styles for the outer element of the component.
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.
 void processEvent(PlatformEvent event)
          Processes an event from the platform.
 
Methods inherited from class com.guiseframework.platform.web.AbstractWebComponentDepictor
addFlowStyleIDs, decorateID, depict, depictBody, getBackgroundColor, getBaseStyleIDs, getBodyStyleIDs, getBodyStyles, getColor, getDepictContext, getLabelStyles, getLabelStyles, getLabelStyles, getLocalName, getNamespaceURI, getPlatform, hasLabelContent, hasLabelContent, hasLabelContent, hasLabelContent, isEmptyElementAllowed, isMouseListener, writeBodyIDClassAttributes, writeClassAttribute, writeDirectionAttribute, writeDirectionAttribute, writeErrorMessage, writeFloatClear, writeIDAttribute, writeIDClassAttributes, writeLabel, writeLabelContent, writeLabelContent, writeLabelContent, writeLabelContent, writeLabelContent, writeLabelContent, writeParameterInputs, writeStyleAttribute, writeText
 
Methods inherited from class com.guiseframework.platform.AbstractComponentDepictor
depictChild, depictChildren, depictedObjectPropertyChange, getDepictedCompositeComponentListener, getErrorMessage, installed, uninstalled
 
Methods inherited from class com.guiseframework.platform.AbstractDepictor
getDepictedObject, getDepictedPropertyChangeListener, getIgnoredProperties, getModifiedProperties, getSession, isDepicted, setDepicted, setPropertyModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.guiseframework.platform.Depictor
getDepictedObject, getSession, installed, isDepicted, setDepicted, uninstalled
 

Constructor Detail

WebCheckControlDepictor

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

Method Detail

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:
MutualExclusionPolicyModelGroup

getCheckControlName

protected java.lang.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:
MutualExclusionPolicyModelGroup

getOuterStyles

protected java.util.Map<java.lang.String,java.lang.Object> getOuterStyles()
Retrieves the styles for the outer element of the component. 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.
See Also:
AbstractWebComponentDepictor.getBodyStyles()

getDepictName

public java.lang.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:
getCheckControlName(CheckControl)

processEvent

public void processEvent(PlatformEvent event)
Processes an event from the platform.

Specified by:
processEvent in interface Depictor<C extends CheckControl>
Overrides:
processEvent in class AbstractComponentDepictor<C extends CheckControl>
Parameters:
event - The event to be processed.
Throws:
java.lang.IllegalArgumentException - if the given event is a relevant DepictEvent with a source of a different depicted object.

getInputType

protected java.lang.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 java.io.IOException
Begins the rendering process.

Overrides:
depictBegin in class AbstractWebComponentDepictor<C extends CheckControl>
Throws:
java.io.IOException - if there is an error rendering the component.
java.lang.IllegalArgumentException - if the given value control represents a value type this controller doesn't support.

depictEnd

protected void depictEnd()
                  throws java.io.IOException
Ends the rendering process.

Overrides:
depictEnd in class AbstractWebComponentDepictor<C extends CheckControl>
Throws:
java.io.IOException - if there is an error rendering the component.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.