com.arsdigita.cms.ui.authoring
Class TextAssetBody

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.TextStylable
              extended bycom.arsdigita.bebop.BlockStylable
                  extended bycom.arsdigita.bebop.SimpleContainer
                      extended bycom.arsdigita.bebop.PropertyEditor
                          extended bycom.arsdigita.cms.ui.SecurityPropertyEditor
                              extended bycom.arsdigita.cms.ui.authoring.TextAssetBody
All Implemented Interfaces:
AuthoringStepComponent, Cloneable, com.arsdigita.bebop.Component, com.arsdigita.bebop.Container, EventListener, com.arsdigita.util.Lockable, com.arsdigita.bebop.event.RequestListener, com.arsdigita.bebop.Resettable
Direct Known Subclasses:
TemplateBody, TextPageBody

public abstract class TextAssetBody
extends SecurityPropertyEditor
implements com.arsdigita.bebop.Resettable, AuthoringStepComponent, com.arsdigita.bebop.event.RequestListener

Displays the mime-type and the body of a single TextAsset. Maintains a form or uploading files into the text body of the asset, and a form for editing the text of the asset.

Unlike most other authoring components, this component does not require the asset to exist. If the asset does not exist (i.e., if !m_assetModel.isSelected(state)), the upload and editing forms will create a new asset and set it in the model by calling setSelectedObject on the asset selection model. Child classes should override the createTextAsset(PageState) method in to create a valid text asset.

This component is used primarily in TextPageBody and TemplateBody

Version:
$Id: //cms/dev/src/com/arsdigita/cms/ui/authoring/TextAssetBody.java#21 $
Author:
Stanislav Freidin (sfreidin@arsdigita.com)

Nested Class Summary
 class TextAssetBody.PageFileForm
          A form for editing TextAsset items.
 class TextAssetBody.PageTextForm
          A form for editing the body of the text.
 
Nested classes inherited from class com.arsdigita.cms.ui.SecurityPropertyEditor
SecurityPropertyEditor.AccessListModel, SecurityPropertyEditor.AccessListModelBuilder
 
Nested classes inherited from class com.arsdigita.bebop.PropertyEditor
com.arsdigita.bebop.PropertyEditor.DefaultModel, com.arsdigita.bebop.PropertyEditor.DefaultModelBuilder, com.arsdigita.bebop.PropertyEditor.IdentityCellRenderer
 
Field Summary
static String FILE_UPLOAD
           
static String TEXT_ENTRY
           
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.BlockStylable
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
TextAssetBody(ItemSelectionModel assetModel)
          Construct a new TextPageBody component
TextAssetBody(ItemSelectionModel assetModel, AuthoringKitWizard parent)
          Construct a new TextPageBody component
 
Method Summary
protected  void addFileWidgets(TextAssetBody.PageFileForm c)
           
protected  void addTextWidgets(TextAssetBody.PageTextForm c)
           
protected  void cancelStreamlinedCreation(com.arsdigita.bebop.PageState state)
          Cancel streamlined creation for this step if the streamlined creation parameter is turned on _and_ the streamlined_creation global state param is set to 'active'
protected  TextAsset createOrGetTextAsset(ItemSelectionModel assetModel, com.arsdigita.bebop.PageState s)
           
protected abstract  TextAsset createTextAsset(com.arsdigita.bebop.PageState s)
          Create a brand new TextAsset.
 ItemSelectionModel getAssetSelectionModel()
          Return the ItemSelectionModel which will be used to maintain the current text asset
protected  com.arsdigita.toolbox.ui.DomainObjectPropertySheet getBodyPropertySheet(ItemSelectionModel assetModel)
           
protected  String getDefaultMimeType()
           
protected  TextAssetBody.PageFileForm getPageFileForm()
          This is the form that is used to upload files.
 TextAsset getTextAsset(com.arsdigita.bebop.PageState state)
          Get the current text asset, if any
protected  void maybeForwardToNextStep(com.arsdigita.bebop.PageState state)
          Forward to the next step if the streamlined creation parameter is turned on _and_ the streamlined_creation global state param is set to 'active'
 void pageRequested(com.arsdigita.bebop.event.RequestEvent e)
          Open the edit component if the streamlined creation parameter is turned on _and_ the streamlined_creation global state param is set to 'active'
 void register(com.arsdigita.bebop.Page p)
          Registers globa state param for cancelling streamlined creation
 void reset(com.arsdigita.bebop.PageState s)
          Reset this component to its original state
protected  void setMimeTypeOptions(com.arsdigita.bebop.form.SingleSelect mimeSelect)
          Adds the options for the mime type select widget of TextPageForm and sets the default mime type.
protected abstract  void updateTextAsset(com.arsdigita.bebop.PageState s, TextAsset a)
          Set additional parameters of a brand new text asset, such as the parent ID, after the asset has been successfully uploaded
 
Methods inherited from class com.arsdigita.cms.ui.SecurityPropertyEditor
add, add, addComponent, addComponent, addListeners, addSecurityListener, getAccessMap, setComponentAccess
 
Methods inherited from class com.arsdigita.bebop.PropertyEditor
add, add, add, add, addCancelListener, addComponent, addComponent, addProcessListener, addVisibilityListener, getComponent, getDisplayComponent, getDisplayPane, getLabelsMap, getList, getModel, getModelBuilder, getSelectedComponentKey, lock, setDisplayComponent, setModelBuilder, showComponent, showDisplayPane
 
Methods inherited from class com.arsdigita.bebop.SimpleContainer
add, add, children, contains, generateChildrenXML, generateParent, generateXML, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size
 
Methods inherited from class com.arsdigita.bebop.BlockStylable
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment
 
Methods inherited from class com.arsdigita.bebop.TextStylable
setBackgroundColor, setColor
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.cms.ui.authoring.AuthoringStepComponent
addCompletionListener
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

FILE_UPLOAD

public static final String FILE_UPLOAD
See Also:
Constant Field Values

TEXT_ENTRY

public static final String TEXT_ENTRY
See Also:
Constant Field Values
Constructor Detail

TextAssetBody

public TextAssetBody(ItemSelectionModel assetModel)
Construct a new TextPageBody component

Parameters:
assetModel - The ItemSelectionModel which will be responsible for maintaining the current asset

TextAssetBody

public TextAssetBody(ItemSelectionModel assetModel,
                     AuthoringKitWizard parent)
Construct a new TextPageBody component

Parameters:
assetModel - The ItemSelectionModel which will be responsible for maintaining the current asset
parent - The parent wizard which contains the form. The form may use the wizard's methods, such as stepForward and stepBack, in its process listener.
Method Detail

getBodyPropertySheet

protected com.arsdigita.toolbox.ui.DomainObjectPropertySheet getBodyPropertySheet(ItemSelectionModel assetModel)

setMimeTypeOptions

protected void setMimeTypeOptions(com.arsdigita.bebop.form.SingleSelect mimeSelect)
Adds the options for the mime type select widget of TextPageForm and sets the default mime type.


getTextAsset

public TextAsset getTextAsset(com.arsdigita.bebop.PageState state)
Get the current text asset, if any

Parameters:
state - represents the current request

reset

public void reset(com.arsdigita.bebop.PageState s)
Reset this component to its original state

Specified by:
reset in interface com.arsdigita.bebop.Resettable
Parameters:
s - the current page state

createOrGetTextAsset

protected TextAsset createOrGetTextAsset(ItemSelectionModel assetModel,
                                         com.arsdigita.bebop.PageState s)

createTextAsset

protected abstract TextAsset createTextAsset(com.arsdigita.bebop.PageState s)
Create a brand new TextAsset. Child classes should override this method to do the right thing. The default implementation creates a parent-less TextAsset with a unique name.

Parameters:
s - the current page state
Returns:
a valid TextAsset

updateTextAsset

protected abstract void updateTextAsset(com.arsdigita.bebop.PageState s,
                                        TextAsset a)
Set additional parameters of a brand new text asset, such as the parent ID, after the asset has been successfully uploaded

Parameters:
s - the current page state
a - the new TextAsset

getAssetSelectionModel

public ItemSelectionModel getAssetSelectionModel()
Return the ItemSelectionModel which will be used to maintain the current text asset


maybeForwardToNextStep

protected void maybeForwardToNextStep(com.arsdigita.bebop.PageState state)
Forward to the next step if the streamlined creation parameter is turned on _and_ the streamlined_creation global state param is set to 'active'

Parameters:
state - the PageState

cancelStreamlinedCreation

protected void cancelStreamlinedCreation(com.arsdigita.bebop.PageState state)
Cancel streamlined creation for this step if the streamlined creation parameter is turned on _and_ the streamlined_creation global state param is set to 'active'

Parameters:
state - the PageState

pageRequested

public void pageRequested(com.arsdigita.bebop.event.RequestEvent e)
Open the edit component if the streamlined creation parameter is turned on _and_ the streamlined_creation global state param is set to 'active'

Specified by:
pageRequested in interface com.arsdigita.bebop.event.RequestListener

getPageFileForm

protected TextAssetBody.PageFileForm getPageFileForm()
This is the form that is used to upload files. This method can be used so that a subclass can use their own subclass of PageFileForm.


getDefaultMimeType

protected String getDefaultMimeType()

addFileWidgets

protected void addFileWidgets(TextAssetBody.PageFileForm c)

addTextWidgets

protected void addTextWidgets(TextAssetBody.PageTextForm c)

register

public void register(com.arsdigita.bebop.Page p)
Registers globa state param for cancelling streamlined creation

Specified by:
register in interface com.arsdigita.bebop.Component


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC