Package com.adobe.acs.commons.mcp.form
Class FieldComponent
- java.lang.Object
-
- com.adobe.acs.commons.mcp.form.FieldComponent
-
- Direct Known Subclasses:
AbstractContainerComponent,AutocompleteComponent,ButtonComponent,CheckboxComponent,DatePickerComponent,FileUploadComponent,PasswordComponent,PathfieldComponent,RadioComponent,RichTextEditorComponent,SelectComponent,TagPickerComponent,TextfieldComponent
public abstract class FieldComponent extends Object
Describes a component in a manner which supports auto-generated forms
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFieldComponent.ClientLibraryType
-
Constructor Summary
Constructors Constructor Description FieldComponent()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddClientLibraries(FieldComponent component)voidaddClientLibraries(FieldComponent.ClientLibraryType type, String... categories)voidaddClientLibraries(FieldComponent.ClientLibraryType type, Collection<String> categories)voidaddClientLibrary(String category)org.apache.sling.api.resource.ResourcebuildComponentResource()If your component needs child nodes then override this method, call the superclass implementation, and then use addChildren to add additional nodes to it.AccessibleObjectgetAccessibleObject()Optional<Boolean>getBooleanOption(String option)StringgetCategory()Map<FieldComponent.ClientLibraryType,Set<String>>getClientLibraryCategories()org.apache.sling.api.resource.ResourceMetadatagetComponentMetadata()FieldgetField()Deprecated.Use getAccessibleObject and AccessibleObjectUtils to handle both Method (getter) or FieldsFormFieldgetFieldDefinition()org.apache.sling.api.scripting.SlingScriptHelpergetHelper()StringgetHtml()StringgetName()Optional<String>getOption(String option)Collection<String>getOptionNames()StringgetPath()StringgetResourceSuperType()StringgetResourceType()booleanhasOption(String optionName)abstract voidinit()voidpurgeEmptyMetadata()voidsetCategory(String category)voidsetHelper(org.apache.sling.api.scripting.SlingScriptHelper helper)voidsetPath(String path)voidsetResourceSuperType(String resourceSuperType)voidsetResourceType(String resourceType)voidsetup(String name, AccessibleObject fieldOrMethod, FormField field, org.apache.sling.api.scripting.SlingScriptHelper sling)
-
-
-
Method Detail
-
setup
public final void setup(String name, AccessibleObject fieldOrMethod, FormField field, org.apache.sling.api.scripting.SlingScriptHelper sling)
-
init
public abstract void init()
-
setHelper
public final void setHelper(org.apache.sling.api.scripting.SlingScriptHelper helper)
-
getHelper
public final org.apache.sling.api.scripting.SlingScriptHelper getHelper()
-
setPath
public final void setPath(String path)
-
getPath
public final String getPath()
-
getField
@Deprecated public final Field getField()
Deprecated.Use getAccessibleObject and AccessibleObjectUtils to handle both Method (getter) or FieldsGet form field if possible- Returns:
- Form field if a safe cast is possible otherwise null
-
getAccessibleObject
public final AccessibleObject getAccessibleObject()
-
getFieldDefinition
public final FormField getFieldDefinition()
-
getHtml
public final String getHtml()
-
buildComponentResource
public org.apache.sling.api.resource.Resource buildComponentResource()
If your component needs child nodes then override this method, call the superclass implementation, and then use addChildren to add additional nodes to it.- Returns:
-
getComponentMetadata
public final org.apache.sling.api.resource.ResourceMetadata getComponentMetadata()
- Returns:
- the componentMetadata
-
getClientLibraryCategories
public final Map<FieldComponent.ClientLibraryType,Set<String>> getClientLibraryCategories()
-
addClientLibrary
public final void addClientLibrary(String category)
-
addClientLibraries
public final void addClientLibraries(FieldComponent.ClientLibraryType type, String... categories)
-
addClientLibraries
public final void addClientLibraries(FieldComponent.ClientLibraryType type, Collection<String> categories)
-
addClientLibraries
public final void addClientLibraries(FieldComponent component)
-
getResourceType
public final String getResourceType()
- Returns:
- the resourceType
-
setResourceType
public final void setResourceType(String resourceType)
- Parameters:
resourceType- the resourceType to set
-
getResourceSuperType
public final String getResourceSuperType()
- Returns:
- the resourceSuperType
-
setResourceSuperType
public final void setResourceSuperType(String resourceSuperType)
- Parameters:
resourceSuperType- the resourceSuperType to set
-
purgeEmptyMetadata
public final void purgeEmptyMetadata()
-
getName
public final String getName()
- Returns:
- the name
-
getOptionNames
public final Collection<String> getOptionNames()
-
hasOption
public final boolean hasOption(String optionName)
-
getCategory
public final String getCategory()
- Returns:
- the category
-
setCategory
public final void setCategory(String category)
- Parameters:
category- the category to set
-
-