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

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.BaseAjaxItemPicker
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder
Direct Known Subclasses:
UIAjaxCategoryPicker, UIAjaxFilePicker, UIAjaxFolderPicker, UIAjaxTagPicker

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

Base class for the JSP components representing Ajax object pickers. Handles the JSF lifecycle for the Ajax component. The Ajax calls themselves are processed via the class org.alfresco.web.bean.ajax.PickerBean. The derived components are only responsible for specifing the ajax service call to make, plus any defaults for icons etc.


Field Summary
protected static int ACTION_CANCEL
           
protected static int ACTION_DONE
           
protected  java.lang.Boolean disabled
          flag to show whether the component is disabled
protected static java.lang.String EMPTY
           
protected static java.lang.String FOLDER_IMAGE_PREFIX
           
protected  java.lang.String height
          Height style override for picker selector area
protected static java.lang.String ID_ICON
           
protected static java.lang.String ID_ID
           
protected static java.lang.String ID_NAME
           
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 an item is selected
protected static java.lang.String MSG_CANCEL
           
protected static java.lang.String MSG_GO_UP
           
protected static java.lang.String MSG_OK
           
protected  java.lang.Boolean singleSelect
          True for single select mode, false for multi-select mode
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Constructor Summary
BaseAjaxItemPicker()
           
 
Method Summary
 void decode(javax.faces.context.FacesContext context)
           
 void encodeBegin(javax.faces.context.FacesContext fc)
           
protected abstract  java.lang.String getDefaultIcon()
           
abstract  java.lang.String getFamily()
           
 java.lang.String getHeight()
           
protected  java.lang.String getHiddenFieldName()
          We use a unique hidden field name based on our client Id.
 java.lang.String getInitialSelection()
           
protected  java.lang.String getItemJson(java.lang.String id, java.lang.String name, java.lang.String icon)
          Returns Json string representing an already-selected item.
 java.lang.String getLabel()
           
protected  java.lang.String getRequestAttributes()
           
protected abstract  java.lang.String getServiceCall()
           
 java.lang.Boolean getSingleSelect()
           
 boolean isDisabled()
          Determines whether the component should be rendered in a disabled state
 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 setHeight(java.lang.String height)
           
 void setInitialSelection(java.lang.String initialSelection)
           
 void setLabel(java.lang.String label)
           
 void setSingleSelect(java.lang.Boolean singleSelect)
           
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, broadcast, 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

MSG_GO_UP

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

MSG_OK

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

MSG_CANCEL

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

ID_ID

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

ID_NAME

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

ID_ICON

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

EMPTY

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

FOLDER_IMAGE_PREFIX

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

label

protected java.lang.String label
label to be displayed before an item is selected


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


singleSelect

protected java.lang.Boolean singleSelect
True for single select mode, false for multi-select mode


height

protected java.lang.String height
Height style override for picker selector area


ACTION_DONE

protected static int ACTION_DONE

ACTION_CANCEL

protected static int ACTION_CANCEL
Constructor Detail

BaseAjaxItemPicker

public BaseAjaxItemPicker()
Method Detail

getFamily

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

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)

encodeBegin

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

getServiceCall

protected abstract java.lang.String getServiceCall()
Returns:
the ajax service bean call, for instance 'PickerBean.getFolderNodes'

getDefaultIcon

protected abstract java.lang.String getDefaultIcon()
Returns:
default icon for the picker - if null then assume 'icon' property is always returned in service call results JSON objects.

getRequestAttributes

protected java.lang.String getRequestAttributes()
Returns:
custom request properties optional for some specific picker implementations

getLabel

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

setLabel

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

getInitialSelection

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

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

getSingleSelect

public java.lang.Boolean getSingleSelect()
Returns:
true is single select mode, false for multi-select

setSingleSelect

public void setSingleSelect(java.lang.Boolean singleSelect)
Parameters:
singleSelect - true for single select mode, false for multi-select

getHeight

public java.lang.String getHeight()
Returns:
Returns the height.

setHeight

public void setHeight(java.lang.String height)
Parameters:
height - The height to set.

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

getItemJson

protected java.lang.String getItemJson(java.lang.String id,
                                       java.lang.String name,
                                       java.lang.String icon)
Returns Json string representing an already-selected item.

Returns:
hidden field name


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