com.fatwire.cs.ui.view.renderer.attribute
Class BasicDataRenderer

java.lang.Object
  extended by com.fatwire.cs.ui.view.renderer.attribute.BaseRenderer
      extended by com.fatwire.cs.ui.view.renderer.attribute.BasicDataRenderer
All Implemented Interfaces:
AdvancedAttributeRenderer, AttributeDataRenderer
Direct Known Subclasses:
BasicDataTemplate

public abstract class BasicDataRenderer
extends BaseRenderer
implements AdvancedAttributeRenderer

A convenience base class for renderer implementations. Extending classes, in most cases, needs to provide an implementation for this.renderEdit(AttributeData, com.fatwire.cs.ui.view.renderer.AttributeDataBinding , AttributeDef , String )


Field Summary
static java.lang.String _20_PERCENT
           
static java.lang.String _80_PERCENT
           
protected static java.lang.String CENTER
           
static java.lang.String CSTEXT_ALIGN_RIGHT
           
 
Constructor Summary
BasicDataRenderer()
           
 
Method Summary
 void addNewField(ActionEvent event)
           
protected  HtmlRowLayout createAddNew(AttributeDef def, java.lang.String methodBinding, Asset.AttributeType attributeType)
          Creates a UIComponent bound to the 'Add New' functionality of multi valued attributes.
protected  HtmlRowLayout createAddSelectedItems(AttributeDef def, AttributeDataBinding binding, Asset.AttributeType attributeType)
          Creates a UIComponent bound to the 'Add New' functionality of multi valued attributes.
protected  java.util.List<UIComponent> createAttributeButtons(AttributeDef def, AttributeDataBinding binding, int numOfItems, int curIndex, Asset.AttributeType attributeType)
          Creates multi valued attribute buttons (Add New, Move up, Move down and Remove)
protected  CoreCommandLink createCreateNew(AttributeDef def, java.lang.String methodBinding, Asset.AttributeType attributeType)
          Create the button used to create new asset
protected  UIComponent createDownButton(AttributeDef def, java.lang.String methodBinding, int curIndex, Asset.AttributeType attributeType)
          Creates a UIComponent bound to ordering ('move down') for multi valued attributes.
protected  UIComponent createRemoveButton(AttributeDef def, java.lang.String methodBinding, int curIndex, Asset.AttributeType attributeType)
          Creates a UIComponent bound to remove for multi valued attributes.
protected  UIComponent createUpButton(AttributeDef def, java.lang.String methodBinding, int curIndex, Asset.AttributeType attributeType)
          Creates a UIComponent bound to ordering ('move up') for multi valued attributes.
protected  java.lang.String getLabelText(java.lang.Object value, AttributeDef def)
           
protected  CoreOutputText getNoValueText()
           
protected  boolean isAddNewButtonEnabled(AttributeDef def)
          Custom Attribute Renderer can override this to disable the add new button in lieu of there own implementation
protected  boolean isAddSelectedEnabled(AttributeDef def, AttributeEditor editor)
          Custom Attribute Renderer can override this to disable the show assets , link asset & link parent new button in lieu of there own implementation
protected  boolean isCreateNewEnabled(AttributeDef def, AttributeEditor editor)
          Custom Attribute Renderer can override this to disable the create new button in lieu of there own implementation
protected  boolean isEmpty(java.lang.String input)
           
protected  boolean isRemoveButtonEnabled(AttributeDef def, int currentIndex, int totalItems)
          Custom Attribute Renderer can override this to disable the delete button in lieu of there own implementation
protected  boolean isUpDownButtonEnabled(AttributeDef def)
          Custom Attribute Renderer can override this to disable the up button in lieu of there own implementation
 void moveDown(ActionEvent event)
           
 void moveUp(ActionEvent event)
           
protected  void placeControlsAndLabel(RenderedComponents renderedComponents)
          Places the controls and label in two columns.If the renderers need a different layout they can overwrite it.
 void removeItem(ActionEvent event)
           
 UIComponent render(RenderDataContext renderContext)
          Renders an attribute's data.
protected  java.util.List<UIComponent> renderData(RenderDataContext renderContext)
          Generates components that are to be displayed in Edit mode.
 
Methods inherited from class com.fatwire.cs.ui.view.renderer.attribute.BaseRenderer
createLabel, createList, createText, createText, formatId, generateID, generateLabelID, getContext, isMultiValued, isMultiValueOrdered, isSingleValued, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSTEXT_ALIGN_RIGHT

public static final java.lang.String CSTEXT_ALIGN_RIGHT
See Also:
Constant Field Values

_80_PERCENT

public static final java.lang.String _80_PERCENT
See Also:
Constant Field Values

_20_PERCENT

public static final java.lang.String _20_PERCENT
See Also:
Constant Field Values

CENTER

protected static final java.lang.String CENTER
See Also:
Constant Field Values
Constructor Detail

BasicDataRenderer

public BasicDataRenderer()
Method Detail

render

public UIComponent render(RenderDataContext renderContext)
                   throws UIException
Description copied from interface: AttributeDataRenderer
Renders an attribute's data. Edit and inspect mode is determined by the RenderDataContext Rendering is done in memory and the resulting component is returned back to caller. It is the callers responsibility to eventually use the return value to paint the screen.

Specified by:
render in interface AttributeDataRenderer
Returns:
UIComponent that contains attribute's data rendered.
Throws:
UIException

renderData

protected java.util.List<UIComponent> renderData(RenderDataContext renderContext)
                                          throws UIException
Generates components that are to be displayed in Edit mode.

Parameters:
RenderDataContext - renderContext information for this attribute
Returns:
List of JSF components that will be rendered as Edit mode.
Throws:
UIException

placeControlsAndLabel

protected void placeControlsAndLabel(RenderedComponents renderedComponents)
Places the controls and label in two columns.If the renderers need a different layout they can overwrite it.

Parameters:
cotLabel -
controls -
componentRow -

createAddNew

protected HtmlRowLayout createAddNew(AttributeDef def,
                                     java.lang.String methodBinding,
                                     Asset.AttributeType attributeType)
Creates a UIComponent bound to the 'Add New' functionality of multi valued attributes. Modified: Aug 27, 2010 Reason: If multivalued and its asset reference item then we will attach and add a "create new asset buttton"for Asset will Reason: PR#20037 Dash-UI Fixed the rapid decent throws an exception and DASH interface crash when user clicks on Add new button on ImagePicker multivalued attributes * * * @param def definition of the attribute to be painted.

Parameters:
methodBinding - method to bind to upon 'Add New'
Returns:
UIComponent bound to the 'Add New' functionality for multi valued attributes

createCreateNew

protected CoreCommandLink createCreateNew(AttributeDef def,
                                          java.lang.String methodBinding,
                                          Asset.AttributeType attributeType)
Create the button used to create new asset

Parameters:
def -
methodBinding -
Returns:
Modified: May 07, 2009 Reason: Fixed PR#19765 PickaAsset problem in DASH the Create button dissapears when attribute subType is Any and start menu new same asset type and assigned subtype ( Flex family ) Modified: May 03, 2011 Reason: Fixed PR#25511 Fixed the hole in the logic to correctly determine for Asset Child reference if the user has the assigned privileges to create a "NEW" child asset of that specific asset type. Only when thats the case do we create and display a "Create New Child Asset Button"

createUpButton

protected UIComponent createUpButton(AttributeDef def,
                                     java.lang.String methodBinding,
                                     int curIndex,
                                     Asset.AttributeType attributeType)
Creates a UIComponent bound to ordering ('move up') for multi valued attributes.

Parameters:
def - definition of the attribute to be painted.
methodBinding - method to bind to upon 'move up'
curIndex - current index of the multi valued attribute's item.
Returns:
UIComponent bound to the 'move up' functionality for multi valued attributes

createDownButton

protected UIComponent createDownButton(AttributeDef def,
                                       java.lang.String methodBinding,
                                       int curIndex,
                                       Asset.AttributeType attributeType)
Creates a UIComponent bound to ordering ('move down') for multi valued attributes.

Parameters:
def - definition of the attribute to be painted.
methodBinding - method to bind to upon 'move down'
curIndex - current index of the multi valued attribute's item.
Returns:
UIComponent bound to the 'move down' functionality for multi valued attributes

createRemoveButton

protected UIComponent createRemoveButton(AttributeDef def,
                                         java.lang.String methodBinding,
                                         int curIndex,
                                         Asset.AttributeType attributeType)
Creates a UIComponent bound to remove for multi valued attributes.

Parameters:
def - definition of the attribute to be painted.
methodBinding - method to bind to upon 'remove item'
curIndex - current index of the multi valued attribute's item.
Returns:
UIComponent bound to the 'remove item' functionality for multi valued attributes

createAttributeButtons

protected java.util.List<UIComponent> createAttributeButtons(AttributeDef def,
                                                             AttributeDataBinding binding,
                                                             int numOfItems,
                                                             int curIndex,
                                                             Asset.AttributeType attributeType)
Creates multi valued attribute buttons (Add New, Move up, Move down and Remove)

Parameters:
def - definition of the attribute to be painted.
binding - dynamic binding information
numOfItems - Number of items in the attribute data
curIndex - Current index of the attribute item.
Returns:
List of components that are appropriate for a given attribute (depending on where it is in the index and so on).

isAddNewButtonEnabled

protected boolean isAddNewButtonEnabled(AttributeDef def)
Custom Attribute Renderer can override this to disable the add new button in lieu of there own implementation

Returns:
is button should be displayed

isAddSelectedEnabled

protected boolean isAddSelectedEnabled(AttributeDef def,
                                       AttributeEditor editor)
Custom Attribute Renderer can override this to disable the show assets , link asset & link parent new button in lieu of there own implementation

Returns:
are show assets , link asset & link parent should be displayed

isCreateNewEnabled

protected boolean isCreateNewEnabled(AttributeDef def,
                                     AttributeEditor editor)
Custom Attribute Renderer can override this to disable the create new button in lieu of there own implementation

Returns:
whether create button should be displayed.

isUpDownButtonEnabled

protected boolean isUpDownButtonEnabled(AttributeDef def)
Custom Attribute Renderer can override this to disable the up button in lieu of there own implementation

Returns:
is button should be displayed

isRemoveButtonEnabled

protected boolean isRemoveButtonEnabled(AttributeDef def,
                                        int currentIndex,
                                        int totalItems)
Custom Attribute Renderer can override this to disable the delete button in lieu of there own implementation

Parameters:
currentIndex - is 0 based
Returns:
is button should be displayed

createAddSelectedItems

protected HtmlRowLayout createAddSelectedItems(AttributeDef def,
                                               AttributeDataBinding binding,
                                               Asset.AttributeType attributeType)
Creates a UIComponent bound to the 'Add New' functionality of multi valued attributes.

Parameters:
def - definition of the attribute to be painted.
methodBinding - method to bind to upon 'Add New'
Returns:
UIComponent bound to the 'Add New' functionality for multi valued attributes

addNewField

public void addNewField(ActionEvent event)
Specified by:
addNewField in interface AdvancedAttributeRenderer

moveUp

public void moveUp(ActionEvent event)
Specified by:
moveUp in interface AdvancedAttributeRenderer

moveDown

public void moveDown(ActionEvent event)
Specified by:
moveDown in interface AdvancedAttributeRenderer

removeItem

public void removeItem(ActionEvent event)
Specified by:
removeItem in interface AdvancedAttributeRenderer

getLabelText

protected java.lang.String getLabelText(java.lang.Object value,
                                        AttributeDef def)

isEmpty

protected boolean isEmpty(java.lang.String input)

getNoValueText

protected CoreOutputText getNoValueText()


Copyright (c) 2003 - 2011 FatWire Corporation All Rights Reserved.