Class XUpload
- java.lang.Object
-
- de.xima.fc.form.common.items.XUpload
-
- All Implemented Interfaces:
IXItem
,IXItemBasic
,IXValuableItem
public class XUpload extends Object implements IXItem, IXValuableItem
-
-
Constructor Summary
Constructors Constructor Description XUpload()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayList<XItemPropertyDesc>
getAvailableProperties(Locale locale)
Gets a list of base properties available for this item.IXItemFieldNameConventions
getFieldNameConventions()
Gets the naming conventions for the form fields used by this type of form item.String
getIcon()
String
getPrefix()
Finds the prefix for form items of this type, such ascb
for checkboxes ortf
for input fields.boolean
isSubmitsValues()
Checks whether form items of this type can send values to the server when the form is submitted.IXProcessUploadResult
processUpload(IXProcessUploadParams params)
Lets you customize how uploaded files are handled.void
renderItem(com.hp.gagawa.java.elements.Div container, XItemRenderData renderData, XItemRenderCtx renderCtx, IXFormRenderContext formRenderCtx)
Creates the HTML for this form item that is included in the final rendered form.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.form.common.models.IXItemBasic
getAutoReRender, isShouldRenderForAttributeOnLabel, isShouldRenderUnit, isShowInDrawerPanel, isShowInElementSelect, renderItemPreview, validate, validate, validateGlobal
-
-
-
-
Method Detail
-
getAvailableProperties
public ArrayList<XItemPropertyDesc> getAvailableProperties(Locale locale)
Description copied from interface:IXItemBasic
Gets a list of base properties available for this item.Note that plugins may extend these properties. Use
de.xima.fc.web.common.fd2.XItemPropertiesHelper#getAvailableProperties
to get a list of all properties, including properties added by plugins.Note: Caching the properties returned by this method is not required. Just create the list of properties and return it.
- Specified by:
getAvailableProperties
in interfaceIXItemBasic
- Parameters:
locale
- The current locale that can be used for locale dependent properties.- Returns:
- A list of all base properties available for this item.
-
getIcon
public String getIcon()
- Specified by:
getIcon
in interfaceIXItemBasic
- Returns:
- The CSS class for the icon of this form item, such as for example
ico-fc-XCheckbox
.
-
getPrefix
public String getPrefix()
Description copied from interface:IXItemBasic
Finds the prefix for form items of this type, such ascb
for checkboxes ortf
for input fields. This prefix is used, for example, in the designer to generate a default name for newly added form items (tf-1
,cb-2
).- Specified by:
getPrefix
in interfaceIXItemBasic
- Returns:
- The prefix for form items of this type.
-
getFieldNameConventions
public IXItemFieldNameConventions getFieldNameConventions()
Description copied from interface:IXItemBasic
Gets the naming conventions for the form fields used by this type of form item. The default assumption is that in the rendered form, only a single form field (such as<input>
) exists, with the name as configured in the form designer. The default implementation returnsDefaultXItemFieldNameConventions
, which is suitable for such form items.Some form items may have more complex naming conventions. For example, an upload form item could have a secondary input field for storing the UUID of the upload; and the name of that derived input field could e.g. be the configured name (e.g.
upl1
) plus some suffix (e.g.upl1.uuid
). Other form could have more derived field names with various data, as is the case for e.g. the builtin appointment picker form item with various related field names suchapp1_date
,app1_time
,app1_date_time
, orapp1.typeuuid
etc.This method must return the field name conventions for such items, so that these conventions can be respected and enforced by formcycle. formcycle must be aware of the naming conventions for various reason, e.g. in order to be able to reject submitted request values when the request value belongs to a form item that is unavailable
in a certain state
orfor certain user groups
.- Specified by:
getFieldNameConventions
in interfaceIXItemBasic
- Returns:
- The naming conventions for this type of item. A
null
value is treated as ifDefaultXItemFieldNameConventions
had been returned.
-
isSubmitsValues
public boolean isSubmitsValues()
Description copied from interface:IXItemBasic
Checks whether form items of this type can send values to the server when the form is submitted. Form items that do not submit values are, for example, not validated and no values are ever stored in the database. Form items such as pictures or charts do no submit values, while classical form elements such as input fields and checkboxes are a prime example of form items that do submit values.- Specified by:
isSubmitsValues
in interfaceIXItemBasic
- Returns:
- Whether form element of this type can send values to the server when the form is submitted.
-
processUpload
public IXProcessUploadResult processUpload(IXProcessUploadParams params) throws IOException
Description copied from interface:IXItemBasic
Lets you customize how uploaded files are handled. For example, you could use this method to compress uploaded images and replace the original file with the compressed version.- Specified by:
processUpload
in interfaceIXItemBasic
- Parameters:
params
- Parameters for the upload process the item can make use of, such as the uploaded file.- Returns:
- The result of this method, possibly with a modified file. May return null for the standard handling.
- Throws:
IOException
- If an error occurs during the upload process. This will result in the form submission being rejected.
-
renderItem
public void renderItem(com.hp.gagawa.java.elements.Div container, XItemRenderData renderData, XItemRenderCtx renderCtx, IXFormRenderContext formRenderCtx)
Description copied from interface:IXItemBasic
Creates the HTML for this form item that is included in the final rendered form. You should append one or more HTML elements to the container that is passed to this method.- Specified by:
renderItem
in interfaceIXItemBasic
- Parameters:
container
- The container that will contain this form item in the final form. You should append children to this container.renderData
- The current render data with the properties and options of the item.renderCtx
- The current render context giving you access to the global configuration.formRenderCtx
- The form render context giving you access to the global form configuration.- See Also:
IXItemBasic.renderItemPreview(Div, XItemRenderData, XItemRenderCtx, IXFormRenderContext)
-
-