org.alfresco.web.ui.repo.component
Class AbstractItemSelector

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.AbstractItemSelector
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder
Direct Known Subclasses:
UICategorySelector, UISpaceSelector, UIWebProjectFolderSelector

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

Abstract component to allow the selection of a hierarchical item


Nested Class Summary
static class AbstractItemSelector.ItemSelectorEvent
          Class representing the clicking of a breadcrumb element.
 
Field Summary
protected  java.lang.String avmStore
          current AVM store being browsed
protected  java.lang.Boolean disabled
          Flag to show whether the component is disabled
protected  java.lang.String initialSelectionId
          id of the initially selected item, if value is not set
protected  java.lang.String label
          label to be displayed before a space is selected
protected  int mode
          what mode the component is in
protected static int MODE_BEFORE_SELECTION
           
protected static int MODE_CANCEL_SELECTION
           
protected static int MODE_CONFIRM_SELECTION
           
protected static int MODE_DRILLDOWN_SELECTION
           
protected static int MODE_INITIAL_SELECTION
           
protected  java.lang.String navigationId
          currently browsing node id
protected static java.lang.String OPTION
           
protected  java.lang.Integer spacing
          cellspacing between options
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Constructor Summary
AbstractItemSelector()
          Default constructor
 
Method Summary
 void broadcast(javax.faces.event.FacesEvent event)
           
 void decode(javax.faces.context.FacesContext context)
           
 void encodeBegin(javax.faces.context.FacesContext context)
           
protected  java.lang.String encodeFieldValues(int mode, java.lang.String id)
           
abstract  java.util.Collection getChildrenForNode(javax.faces.context.FacesContext context)
          Returns a collection of child associations for the current navigation node
abstract  java.lang.String getDefaultLabel()
          Retrieves the default label to show if none has been defined and nothing has been selected
protected static org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService(javax.faces.context.FacesContext context)
          Use Spring JSF integration to return the Dictionary Service bean instance
abstract  java.lang.String getFamily()
           
protected static org.alfresco.service.cmr.repository.NodeService getFastNodeService(javax.faces.context.FacesContext context)
          Use Spring JSF integration to return the node Service bean instance
protected  java.lang.String getHiddenFieldName()
          We use a unique hidden field name based on our client Id.
 java.lang.String getInitialSelection()
           
abstract  java.lang.String getItemIcon(javax.faces.context.FacesContext context, org.alfresco.service.cmr.repository.NodeRef ref)
           
 java.lang.String getLabel()
           
protected static org.alfresco.service.cmr.repository.NodeService getNodeService(javax.faces.context.FacesContext context)
          Use Spring JSF integration to return the Node Service bean instance
abstract  java.lang.String getParentNodeId(javax.faces.context.FacesContext context)
          Retrieves the id of the parent node of the current navigation node
abstract  java.util.Collection getRootChildren(javax.faces.context.FacesContext context)
          Returns a collection of child associations of the root
 java.lang.Integer getSpacing()
           
 boolean isDisabled()
          Determines whether the component should be rendered in a disabled state
protected  java.lang.String renderNodeLink(javax.faces.context.FacesContext context, java.lang.String id, java.lang.String name, java.lang.String prefix, java.lang.StringBuilder buf)
          Render a node descendant as a clickable link
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setDisabled(boolean disabled)
          Determines whether the component should be rendered in a disabled state
 void setInitialSelection(java.lang.String initialSelection)
           
 void setLabel(java.lang.String label)
           
 void setSpacing(java.lang.Integer spacing)
           
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, compareValues, getConvertedValue, 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

OPTION

protected static final java.lang.String OPTION
See Also:
Constant Field Values

MODE_BEFORE_SELECTION

protected static final int MODE_BEFORE_SELECTION
See Also:
Constant Field Values

MODE_INITIAL_SELECTION

protected static final int MODE_INITIAL_SELECTION
See Also:
Constant Field Values

MODE_DRILLDOWN_SELECTION

protected static final int MODE_DRILLDOWN_SELECTION
See Also:
Constant Field Values

MODE_CONFIRM_SELECTION

protected static final int MODE_CONFIRM_SELECTION
See Also:
Constant Field Values

MODE_CANCEL_SELECTION

protected static final int MODE_CANCEL_SELECTION
See Also:
Constant Field Values

label

protected java.lang.String label
label to be displayed before a space is selected


spacing

protected java.lang.Integer spacing
cellspacing between options


mode

protected int mode
what mode the component is in


navigationId

protected java.lang.String navigationId
currently browsing node id


avmStore

protected java.lang.String avmStore
current AVM store being browsed


initialSelectionId

protected java.lang.String initialSelectionId
id of the initially selected item, if value is not set


disabled

protected java.lang.Boolean disabled
Flag to show whether the component is disabled

Constructor Detail

AbstractItemSelector

public AbstractItemSelector()
Default constructor

Method Detail

getFamily

public abstract java.lang.String getFamily()
Overrides:
getFamily in class javax.faces.component.UIInput
See Also:
UIComponent.getFamily()

getDefaultLabel

public abstract java.lang.String getDefaultLabel()
Retrieves the default label to show if none has been defined and nothing has been selected

Returns:
Default label

getParentNodeId

public abstract java.lang.String getParentNodeId(javax.faces.context.FacesContext context)
Retrieves the id of the parent node of the current navigation node

Parameters:
context - The Faces context
Returns:
Id of the parent node or null if the parent is the root

getChildrenForNode

public abstract java.util.Collection getChildrenForNode(javax.faces.context.FacesContext context)
Returns a collection of child associations for the current navigation node

Parameters:
context - The Faces context
Returns:
The children

getRootChildren

public abstract java.util.Collection getRootChildren(javax.faces.context.FacesContext context)
Returns a collection of child associations of the root

Parameters:
context - The Faces context
Returns:
The root options

getItemIcon

public abstract java.lang.String getItemIcon(javax.faces.context.FacesContext context,
                                             org.alfresco.service.cmr.repository.NodeRef ref)
Parameters:
ref - NodeRef to the item to get the icon for
Returns:
The icon image to display next to the item links, or null for no icon

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:
UIComponentBase.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:
UIInput.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:
UIComponentBase.encodeBegin(javax.faces.context.FacesContext)

getLabel

public java.lang.String getLabel()
Returns:
Returns the label.

setLabel

public void setLabel(java.lang.String label)
Parameters:
label - The label to set.

getSpacing

public java.lang.Integer getSpacing()
Returns:
Returns the cell spacing value between space options. Default is 2.

setSpacing

public void setSpacing(java.lang.Integer spacing)
Parameters:
spacing - The spacing to set.

getInitialSelection

public java.lang.String getInitialSelection()
Returns:
Returns the initial selecttion.

setInitialSelection

public void setInitialSelection(java.lang.String initialSelection)
Parameters:
initialSelection - The initial selection to set.

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

getHiddenFieldName

protected java.lang.String getHiddenFieldName()
We use a unique hidden field name based on our client Id. This is on the assumption that there won't be many selectors on screen at once! Also means we have less values to decode on submit.

Returns:
hidden field name

encodeFieldValues

protected java.lang.String encodeFieldValues(int mode,
                                             java.lang.String id)

renderNodeLink

protected java.lang.String renderNodeLink(javax.faces.context.FacesContext context,
                                          java.lang.String id,
                                          java.lang.String name,
                                          java.lang.String prefix,
                                          java.lang.StringBuilder buf)
Render a node descendant as a clickable link

Parameters:
context - FacesContext
id - The id
name - The name
prefix - The prefix
buf - String buffer
Returns:
HTML for a descendant link

getNodeService

protected static org.alfresco.service.cmr.repository.NodeService getNodeService(javax.faces.context.FacesContext context)
Use Spring JSF integration to return the Node Service bean instance

Parameters:
context - FacesContext
Returns:
Node Service bean instance or throws exception if not found

getFastNodeService

protected static org.alfresco.service.cmr.repository.NodeService getFastNodeService(javax.faces.context.FacesContext context)
Use Spring JSF integration to return the node Service bean instance

Parameters:
context - FacesContext
Returns:
Node Service bean instance or throws exception if not found

getDictionaryService

protected static org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService(javax.faces.context.FacesContext context)
Use Spring JSF integration to return the Dictionary Service bean instance

Parameters:
context - FacesContext
Returns:
Dictionary Service bean instance or throws exception if not found


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