Package io.guise.framework.platform.web
Class WebCheckControlDepictor<C extends CheckControl>
- java.lang.Object
-
- io.guise.framework.platform.AbstractDepictor<C>
-
- io.guise.framework.platform.AbstractComponentDepictor<C>
-
- io.guise.framework.platform.web.AbstractWebComponentDepictor<C>
-
- io.guise.framework.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 typecheckbox
orradio
.- Author:
- Garret Wilson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.guise.framework.platform.AbstractComponentDepictor
AbstractComponentDepictor.DepictedCompositeComponentListener
-
Nested classes/interfaces inherited from class io.guise.framework.platform.AbstractDepictor
AbstractDepictor.DepictedPropertyChangeListener
-
-
Field Summary
-
Fields inherited from class io.guise.framework.platform.web.AbstractWebComponentDepictor
BODY_END_PATTERN, BODY_START_PATTERN
-
Fields inherited from class io.guise.framework.platform.AbstractComponentDepictor
childPropertyChangeListener
-
Fields inherited from interface io.guise.framework.platform.Depictor
GENERAL_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description WebCheckControlDepictor()
Default constructor using the XHTML<span>
element.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
depictBegin()
Begins the depiction process.protected void
depictEnd()
Ends the depiction 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 io.guise.framework.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 io.guise.framework.platform.AbstractComponentDepictor
depictChild, depictChildren, depictedObjectPropertyChange, getDepictedCompositeComponentListener, getErrorMessage, installed, uninstalled
-
Methods inherited from class io.guise.framework.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 io.guise.framework.platform.Depictor
getDepictedObject, getSession, installed, isDepicted, setDepicted, uninstalled
-
-
-
-
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 aMutualExclusionPolicyModelGroup
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 returns the style for color.
This version combines the body styles with the outer styles.
- Overrides:
getOuterStyles
in classAbstractWebComponentDepictor<C extends CheckControl>
- Returns:
- The styles for the outer element of the component, mapped to CSS property names.
-
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 interfaceWebComponentDepictor<C extends CheckControl>
- Overrides:
getDepictName
in classAbstractWebComponentDepictor<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)
Description copied from class:AbstractComponentDepictor
Processes an event from the platform.This implementation handles
PlatformFocusEvent
.- Specified by:
processEvent
in interfaceDepictor<C extends CheckControl>
- Overrides:
processEvent
in classAbstractComponentDepictor<C extends CheckControl>
- Parameters:
event
- The event to be processed.
-
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
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 classAbstractWebComponentDepictor<C extends CheckControl>
- Throws:
java.io.IOException
- if there is an error updating the depiction.
-
depictEnd
protected void depictEnd() throws java.io.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 classAbstractWebComponentDepictor<C extends CheckControl>
- Throws:
java.io.IOException
- if there is an error updating the depiction.
-
-