Start page
Start page

Start page / Plug-In Development / Universal Extensions / Input Components / GOM Form Element

GOM Form Element Definition

 

This class defines the GOM (GUI Object Model) XML tag used to include the input component in FirstSpirit form definitions in templates. It may also provide pairs of getter and setter methods which allow input component developers to support attributes in the component's XML tag.

Defining a Form Element by Implementing an Interface

Interface: de.espirit.firstspirit.access.store.templatestore.gom.GomFormElement
FirstSpirit API documentation: GomFormElement

The GOM form element definition class must implement the interface GomFormElement, which identifies the specified GOM element to act as an editor component in a form. However, as input components used in FirstSpirit should support a number of common features such as language-dependent labels and attributes which define the layout of the form element's gadget representation in form views, it is recommended to extend an abstract class AbstractGomFormElement (see below) which already implements much of this common, useful functionality.

Defining a Form Element by Extending an Abstract Class (Recommended)

Abstract class: de.espirit.firstspirit.access.store.templatestore.gom.AbstractGomFormElement
FirstSpirit API documentation: AbstractGomFormElement

The abstract class AbstractGomFormElement, which is provided in the FirstSpirit API as well, already implements GomFormElement as well as much common functionality expected of input components (such as attributes of the XML tag specifying default values (attribute preset), handling of empty values (attribute allowEmpty), and setting the component to display at full form width (attribute hFill)) and specifying language-dependent component labels (XML block <LANGINFOS />).

Extending AbstractGomFormElement, the form element class' only mandatory task is to set and provide its XML tag:

public class CustomInputComponent extends AbstractGomFormElement {

public static final String TAG = "CUSTOM_INPUT_COMPONENT";

protected String getDefaultTag() {
return TAG;
}
}
Important The tag returned by getDefaultTag() must match the component name provided in the FSM Component Definition.

The input component may be used in template form definitions as follows:

<CMS_MODULE>
<CUSTOM_INPUT_COMPONENT name="myCustomInputComponent">
<LANGINFOS>
<LANGINFO lang="*" label="Custom Input Component" />
</LANGINFOS>
</CUSTOM_INPUT_COMPONENT>
</CMS_MODULE>
Important Both the attribute name as well as the XML block <LANGINFOS /> including its inner tags are specified by the abstract class AbstractGomFormElement.

See the pages XML Tag Attributes and Additional XML Tags for information about adding custom attributes and child tags.

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2014-12-08