com.guiseframework.platform.web
Class WebTextControlDepictor<V,C extends TextControl<V>>

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.AbstractDecoratedWebComponentDepictor<C>
                  extended by com.guiseframework.platform.web.WebTextControlDepictor<V,C>
Type Parameters:
V - The type of value represented in the control.
C - The type of component being depicted.
All Implemented Interfaces:
ComponentDepictor<C>, Depictor<C>, WebComponentDepictor<C>, WebDepictor<C>

public class WebTextControlDepictor<V,C extends TextControl<V>>
extends AbstractDecoratedWebComponentDepictor<C>

Strategy for rendering a text control as an XHTML <input> element or an XHTML <textarea> element. This view will change the XHTML element rendered based upon the number of rows requested by the text control. This implementation automatically converts between the controls LF end-of-line representation and the CRLF required by HTML <textarea>.

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
static java.lang.String XSTANDARD_CLASS_ID
          The XStandard class ID.
static com.globalmentor.net.ContentType XSTANDARD_CONTENT_TYPE
          The content type for XStandard objects.
 
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
WebTextControlDepictor()
          Default constructor using the XHTML <input> element.
 
Method Summary
protected  void depictBegin()
          Begins the rendering process.
protected  void depictBody()
          Renders the body of the component.
 java.lang.String getBodyLocalName()
          Determines the local name of the body XML element.
protected  java.lang.String getInputType()
          Determines the XHTML input type to use for getting input from the user.
 boolean isEmptyBodyElementAllowed()
          Determines whether an empty body element can be created if there is no content.
 void processEvent(PlatformEvent event)
          Processes an event from the platform.
protected  void writeDecoratorBegin()
          Writes the beginning part of the outer decorator element.
protected  void writeDecoratorEnd()
          Writes the ending part of the outer decorator element.
 
Methods inherited from class com.guiseframework.platform.web.AbstractDecoratedWebComponentDepictor
depictEnd, getBodyNamespaceURI
 
Methods inherited from class com.guiseframework.platform.web.AbstractWebComponentDepictor
addFlowStyleIDs, decorateID, depict, getBackgroundColor, getBaseStyleIDs, getBodyStyleIDs, getBodyStyles, getColor, getDepictContext, getDepictName, getLabelStyles, getLabelStyles, getLabelStyles, getLocalName, getNamespaceURI, getOuterStyles, 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
 

Field Detail

XSTANDARD_CONTENT_TYPE

public static final com.globalmentor.net.ContentType XSTANDARD_CONTENT_TYPE
The content type for XStandard objects.


XSTANDARD_CLASS_ID

public static final java.lang.String XSTANDARD_CLASS_ID
The XStandard class ID.

See Also:
Constant Field Values
Constructor Detail

WebTextControlDepictor

public WebTextControlDepictor()
Default constructor using the XHTML <input> element.

Method Detail

getBodyLocalName

public java.lang.String getBodyLocalName()
Determines the local name of the body XML element. This version returns the local name of the XHTML <input> element if exactly one row is specified, otherwise the local name of the XHTML <textarea>.

Overrides:
getBodyLocalName in class AbstractDecoratedWebComponentDepictor<C extends TextControl<V>>
Returns:
The local name of the element with no prefix, or null if this component should not be rendered as an element.

isEmptyBodyElementAllowed

public boolean isEmptyBodyElementAllowed()
Determines whether an empty body element can be created if there is no content. This version returns true for <input> and false for <textarea>.

Overrides:
isEmptyBodyElementAllowed in class AbstractDecoratedWebComponentDepictor<C extends TextControl<V>>
Returns:
Whether an empty body element can be created if there is no content.
See Also:
getBodyLocalName()

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.

processEvent

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

Specified by:
processEvent in interface Depictor<C extends TextControl<V>>
Overrides:
processEvent in class AbstractComponentDepictor<C extends TextControl<V>>
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.

depictBegin

protected void depictBegin()
                    throws java.io.IOException
Begins the rendering process.

Overrides:
depictBegin in class AbstractDecoratedWebComponentDepictor<C extends TextControl<V>>
Throws:
java.io.IOException - if there is an error rendering the component.

depictBody

protected void depictBody()
                   throws java.io.IOException
Renders the body of the component.

Overrides:
depictBody in class AbstractWebComponentDepictor<C extends TextControl<V>>
Throws:
java.io.IOException - if there is an error rendering the component.
See Also:
AbstractComponentDepictor.depictChildren()

writeDecoratorBegin

protected void writeDecoratorBegin()
                            throws java.io.IOException
Writes the beginning part of the outer decorator element. This version writes a dummy element for rich text editing if needed

Overrides:
writeDecoratorBegin in class AbstractDecoratedWebComponentDepictor<C extends TextControl<V>>
Throws:
java.io.IOException - if there is an error rendering the component.

writeDecoratorEnd

protected void writeDecoratorEnd()
                          throws java.io.IOException
Writes the ending part of the outer decorator element. This version writes a dummy element for rich text editing if needed

Overrides:
writeDecoratorEnd in class AbstractDecoratedWebComponentDepictor<C extends TextControl<V>>
Throws:
java.io.IOException - if there is an error rendering the component.
See Also:
AbstractWebComponentDepictor.writeErrorMessage()


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