org.alfresco.web.ui.repo.component.property
Class BaseAssociationEditor

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by org.alfresco.web.ui.repo.component.property.BaseAssociationEditor
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder
Direct Known Subclasses:
UIAssociationEditor, UIChildAssociationEditor

public abstract class BaseAssociationEditor
extends javax.faces.component.UIInput

Base class for all association editor components


Nested Class Summary
static class BaseAssociationEditor.AssocEditorEvent
          Class representing an action relevant to the AssociationEditor component.
 
Field Summary
protected  java.util.Map added
           
protected  java.lang.String associationName
           
protected  java.util.List availableOptions
          List containing the currently available options
protected  java.lang.String availableOptionsSize
           
protected  java.lang.String changingAssociation
           
protected  java.lang.Boolean disabled
           
protected  boolean highlightedRow
           
protected  java.lang.String noSelectedItemsMsg
           
protected  java.util.Map originalAssocs
          Map of the original associations keyed by the noderef of the child
protected  java.util.Map removed
           
protected  java.lang.String searchTerm
           
protected  java.lang.String selectedItemsMsg
           
protected  java.lang.String selectItemMsg
           
protected  java.lang.String selectItemsMsg
           
protected  boolean showAvailable
           
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Constructor Summary
BaseAssociationEditor()
          Default constructor
 
Method Summary
protected abstract  void addTarget(Node node, java.lang.String[] toAdd)
          Updates the component and node state to reflect an association being added
 void broadcast(javax.faces.event.FacesEvent event)
           
 void decode(javax.faces.context.FacesContext context)
           
 void encodeBegin(javax.faces.context.FacesContext context)
           
protected  org.alfresco.service.cmr.dictionary.AssociationDefinition getAssociationDefinition(javax.faces.context.FacesContext context)
          Retrieves the AssociationDefinition for the association we are representing
 java.lang.String getAssociationName()
          Returns the name of the association this component is editing
protected  void getAvailableOptions(javax.faces.context.FacesContext context, java.lang.String contains)
          Retrieves the available options for the current association
 java.lang.String getAvailableOptionsSize()
          Returns the size of the select control
 java.lang.String getNoSelectedItemsMsg()
          Returns the message to display when no items have been selected, if one hasn't been set it defaults to the message in the bundle under key 'no_selected_items'.
 java.lang.String getSelectedItemsMsg()
          Returns the message to display for the selected items, if one hasn't been set it defaults to the message in the bundle under key 'selected_items'.
 java.lang.String getSelectItemMsg()
          Returns the message to display for select an item, if one hasn't been set it defaults to the message in the bundle under key 'search_select_item'.
 java.lang.String getSelectItemsMsg()
          Returns the message to display for select items, if one hasn't been set it defaults to the message in the bundle under key 'search_select_items'.
 boolean isDisabled()
          Determines whether the component should be rendered in a disabled state
protected abstract  void populateAssocationMaps(Node node, org.alfresco.service.cmr.repository.NodeService nodeService)
          Populates all the internal Maps with the appropriate association reference objects
protected abstract  void removeTarget(Node node, java.lang.String targetRef)
          Updates the component and node state to reflect an association being removed
protected  void renderAvailableOptions(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out, org.alfresco.service.cmr.repository.NodeService nodeService, java.lang.String targetType, boolean allowMany)
          Renders the list of available options for a new association
protected  void renderExistingAssociation(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out, org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef targetRef, boolean allowMany)
          Renders an existing association with the appropriate options
protected abstract  void renderExistingAssociations(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out, org.alfresco.service.cmr.repository.NodeService nodeService, boolean allowMany)
          Renders the existing associations in an editable form
protected  void renderNone(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out)
          Renders the message
protected abstract  void renderReadOnlyAssociations(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out, org.alfresco.service.cmr.repository.NodeService nodeService)
          Renders the existing associations in a read-only form
protected  void renderSearchField(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out)
          Renders the search fields
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setAssociationName(java.lang.String associationName)
          Sets the name of the association this component will edit
 void setAvailableOptionsSize(java.lang.String availableOptionsSize)
          Sets the size of the select control
 void setDisabled(boolean disabled)
          Determines whether the component should be rendered in a disabled state
 void setNoSelectedItemsMsg(java.lang.String noSelectedItemsMsg)
          Sets the no selected items message to display in the UI
 void setSelectedItemsMsg(java.lang.String selectedItemsMsg)
          Sets the selected items message to display in the UI
 void setSelectItemMsg(java.lang.String selectItemMsg)
          Sets the select an item message to display in the UI
 void setSelectItemsMsg(java.lang.String selectItemsMsg)
          Sets the select items message to display in the UI
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, compareValues, getConvertedValue, getFamily, getSubmittedValue, getValidator, getValidators, getValue, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, setValue, setValueChangeListener, updateModel, validate, validateValue
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter
 

Field Detail

associationName

protected java.lang.String associationName

availableOptionsSize

protected java.lang.String availableOptionsSize

selectItemMsg

protected java.lang.String selectItemMsg

selectItemsMsg

protected java.lang.String selectItemsMsg

selectedItemsMsg

protected java.lang.String selectedItemsMsg

noSelectedItemsMsg

protected java.lang.String noSelectedItemsMsg

searchTerm

protected java.lang.String searchTerm

disabled

protected java.lang.Boolean disabled

showAvailable

protected boolean showAvailable

originalAssocs

protected java.util.Map originalAssocs
Map of the original associations keyed by the noderef of the child


added

protected java.util.Map added

removed

protected java.util.Map removed

availableOptions

protected java.util.List availableOptions
List containing the currently available options


changingAssociation

protected java.lang.String changingAssociation

highlightedRow

protected boolean highlightedRow
Constructor Detail

BaseAssociationEditor

public BaseAssociationEditor()
Default constructor

Method Detail

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UIInput
See Also:
StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.UIInput
See Also:
StateHolder.saveState(javax.faces.context.FacesContext)

decode

public void decode(javax.faces.context.FacesContext context)
Overrides:
decode in class javax.faces.component.UIInput
See Also:
UIComponent.decode(javax.faces.context.FacesContext)

broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException
Overrides:
broadcast in class javax.faces.component.UIInput
Throws:
javax.faces.event.AbortProcessingException
See Also:
UIComponent.broadcast(javax.faces.event.FacesEvent)

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context)
                 throws java.io.IOException
Overrides:
encodeBegin in class javax.faces.component.UIComponentBase
Throws:
java.io.IOException
See Also:
UIComponent.encodeBegin(javax.faces.context.FacesContext)

getAssociationName

public java.lang.String getAssociationName()
Returns the name of the association this component is editing

Returns:
Association name

setAssociationName

public void setAssociationName(java.lang.String associationName)
Sets the name of the association this component will edit

Parameters:
associationName - Name of the association to edit

isDisabled

public boolean isDisabled()
Determines whether the component should be rendered in a disabled state

Returns:
Returns whether the component is disabled

setDisabled

public void setDisabled(boolean disabled)
Determines whether the component should be rendered in a disabled state

Parameters:
disabled - true to disable the component

getAvailableOptionsSize

public java.lang.String getAvailableOptionsSize()
Returns the size of the select control

Returns:
The size of the select control

setAvailableOptionsSize

public void setAvailableOptionsSize(java.lang.String availableOptionsSize)
Sets the size of the select control

Parameters:
availableOptionsSize - The size

getNoSelectedItemsMsg

public java.lang.String getNoSelectedItemsMsg()
Returns the message to display when no items have been selected, if one hasn't been set it defaults to the message in the bundle under key 'no_selected_items'.

Returns:
The message

setNoSelectedItemsMsg

public void setNoSelectedItemsMsg(java.lang.String noSelectedItemsMsg)
Sets the no selected items message to display in the UI

Parameters:
noSelectedItemsMsg - The message

getSelectedItemsMsg

public java.lang.String getSelectedItemsMsg()
Returns the message to display for the selected items, if one hasn't been set it defaults to the message in the bundle under key 'selected_items'.

Returns:
The message

setSelectedItemsMsg

public void setSelectedItemsMsg(java.lang.String selectedItemsMsg)
Sets the selected items message to display in the UI

Parameters:
selectedItemsMsg - The message

getSelectItemMsg

public java.lang.String getSelectItemMsg()
Returns the message to display for select an item, if one hasn't been set it defaults to the message in the bundle under key 'search_select_item'.

Returns:
The message

setSelectItemMsg

public void setSelectItemMsg(java.lang.String selectItemMsg)
Sets the select an item message to display in the UI

Parameters:
selectItemMsg - The message

getSelectItemsMsg

public java.lang.String getSelectItemsMsg()
Returns the message to display for select items, if one hasn't been set it defaults to the message in the bundle under key 'search_select_items'.

Returns:
The message

setSelectItemsMsg

public void setSelectItemsMsg(java.lang.String selectItemsMsg)
Sets the select items message to display in the UI

Parameters:
selectItemsMsg - The message

populateAssocationMaps

protected abstract void populateAssocationMaps(Node node,
                                               org.alfresco.service.cmr.repository.NodeService nodeService)
Populates all the internal Maps with the appropriate association reference objects

Parameters:
node - The Node we are dealing with
nodeService - The NodeService

renderReadOnlyAssociations

protected abstract void renderReadOnlyAssociations(javax.faces.context.FacesContext context,
                                                   javax.faces.context.ResponseWriter out,
                                                   org.alfresco.service.cmr.repository.NodeService nodeService)
                                            throws java.io.IOException
Renders the existing associations in a read-only form

Parameters:
context - FacesContext
out - ResponseWriter
nodeService - The NodeService
Throws:
java.io.IOException

renderExistingAssociations

protected abstract void renderExistingAssociations(javax.faces.context.FacesContext context,
                                                   javax.faces.context.ResponseWriter out,
                                                   org.alfresco.service.cmr.repository.NodeService nodeService,
                                                   boolean allowMany)
                                            throws java.io.IOException
Renders the existing associations in an editable form

Parameters:
context - FacesContext
out - ResponseWriter
nodeService - The NodeService
allowMany - Whether multiple associations are allowed
Throws:
java.io.IOException

removeTarget

protected abstract void removeTarget(Node node,
                                     java.lang.String targetRef)
Updates the component and node state to reflect an association being removed

Parameters:
node - The node we are dealing with
targetRef - The noderef of the child to remove

addTarget

protected abstract void addTarget(Node node,
                                  java.lang.String[] toAdd)
Updates the component and node state to reflect an association being added

Parameters:
node - The node we are dealing with
toAdd - The noderefs of the children to add

renderExistingAssociation

protected void renderExistingAssociation(javax.faces.context.FacesContext context,
                                         javax.faces.context.ResponseWriter out,
                                         org.alfresco.service.cmr.repository.NodeService nodeService,
                                         org.alfresco.service.cmr.repository.NodeRef targetRef,
                                         boolean allowMany)
                                  throws java.io.IOException
Renders an existing association with the appropriate options

Parameters:
context - FacesContext
out - Writer to write output to
nodeService - The NodeService
targetRef - The node at the end of the association being rendered
allowMany - Whether the current association allows multiple children
Throws:
java.io.IOException

renderSearchField

protected void renderSearchField(javax.faces.context.FacesContext context,
                                 javax.faces.context.ResponseWriter out)
                          throws java.io.IOException
Renders the search fields

Parameters:
context - Faces Context
out - The Response Writer
Throws:
java.io.IOException

renderNone

protected void renderNone(javax.faces.context.FacesContext context,
                          javax.faces.context.ResponseWriter out)
                   throws java.io.IOException
Renders the message

Parameters:
context - Faces Context
out - Response Writer
Throws:
java.io.IOException

renderAvailableOptions

protected void renderAvailableOptions(javax.faces.context.FacesContext context,
                                      javax.faces.context.ResponseWriter out,
                                      org.alfresco.service.cmr.repository.NodeService nodeService,
                                      java.lang.String targetType,
                                      boolean allowMany)
                               throws java.io.IOException
Renders the list of available options for a new association

Parameters:
context - FacesContext
out - Writer to write output to
nodeService - The NodeService
targetType - The type of the child at the end of the association
allowMany - Whether the current association allows multiple children
Throws:
java.io.IOException

getAssociationDefinition

protected org.alfresco.service.cmr.dictionary.AssociationDefinition getAssociationDefinition(javax.faces.context.FacesContext context)
Retrieves the AssociationDefinition for the association we are representing

Parameters:
context - Faces Context
Returns:
The AssociationDefinition for the association, null if a definition does not exist

getAvailableOptions

protected void getAvailableOptions(javax.faces.context.FacesContext context,
                                   java.lang.String contains)
Retrieves the available options for the current association

Parameters:
context - Faces Context
contains - The contains part of the query


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.