Package overit.geocall.basic.ui.control
Class InputMultiDecoder
java.lang.Object
overit.geocall.platform.ui.UINode
overit.geocall.ui.Component
overit.geocall.ui.Control
overit.geocall.basic.ui.control.Input
overit.geocall.basic.ui.control.InputMultiDecoder
- All Implemented Interfaces:
Serializable,overit.geocall.marks.MethodExposer,overit.geocall.marks.NameExposer,AjaxableComponent,Arrangeable,Badgeable,ValueValidator,Identified,Tool,overit.geocall.ux.configurability.UIConfigurable,overit.geocall.ux.edm.ModelConfigurable
- Direct Known Subclasses:
InputMultiDecoderDataCollectionSheetDynamicPanel,InputMultiDecoderForecastActivity,InputMultiDecoderMaterials,InputMultiDecoderMultistageGroups,InputMultiDecoderMultistageOperations,InputMultiDecoderTransferRequest,InputMultiDecoderWarehouse
@Component
@Configurable
@FilterCriteria({IS_IN,IS_NOT_IN})
public class InputMultiDecoder
extends Input
implements Arrangeable, AjaxableComponent
This component allows to search one or more value from a
StaticView,DABase, select and decode them.
The UI is like a common Input field with dynamic hints. The selection of one hint generates a new TAG in the left side of the field
whose content depends on the format value.
Each tag can be removed clicking on the relative close button.
Codes that cannot be decoded will not generate any tag.- See Also:
- GCApi:
- component
-
Nested Class Summary
Nested classes/interfaces inherited from class overit.geocall.ui.Component
Component.Configurable, Component.ConfigurableAttribute, Component.ConfigurableAttributes, Component.FilterCriteria, Component.Registry -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected charprotected DBViewprotected LinkedHashMap<Object, HashGetter> protected booleanprotected MapFormatprotected Stringprotected intprotected Stringprotected Stringprotected Stringprotected StaticViewprotected charprotected intprotected intstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class overit.geocall.basic.ui.control.Input
_autofocus, _da, _dao, _dao0, _defaultFocus, _event, _eventicon, _eventmsg, _eventparam, _eventprompt, _eventsnumber, _eventtitle, _ff, _fullSize, _hidden, _hinter, _hints, _hintsCache, _key, _label2, _letterCase, _maxlength, _msg, _msgCampoObbligatorio, _msgErroreCampo, _notnull, _numeric, _placeholder, _query, _roevent, _size, _value, autocomplete, configuredFullSize, configuredNotNull, configuredSize, FILTER_CRITERION_ATTRIBUTE, filterCriteria, FULL_SIZE_ATTRIBUTE, NOT_NULL_ATTRIBUTE, promptEmpty, SIZE_ATTRIBUTEFields inherited from class overit.geocall.ui.Control
_blank, _cleaner, _dblink, _enabled, _ro, _title, altEventIconsList, altIcon, ariaDescription, ariaLabel, badge, badgeformat, FILTER_PREFIXES, LABEL_ATTRIBUTE, LABEL_IN_LINE_ATTRIBUTE, STATE_BLANK, STATE_NORMAL, STATE_RO, STATE_ROBLANKFields inherited from class overit.geocall.ui.Component
_basic, _childrenContainers, _currentId, _gridalign, _gridcols, _gridrows, _gridvalign, _iconElement, _id, _keylabel, _label, _layoutName, _name, _parentContainer, _registryName, _shortcut, _tabindex, _transformations, _valuesContainer, aliasField, BR, configHidden, configuredLabel, configuredLabelInLine, defaultHidden, ELEMENT_BR, ELEMENT_NULL, entityContainer, entityName, extendedField, fullHeight, important, labelInLine, layoutLabel, PIXEL_IMG, safeInlineServiceFields inherited from interface overit.geocall.ui.AjaxableComponent
FRAME_ID_PREFIX, NOTRANSITION, TRANSITION_BODY_MORPH, TRANSITION_BODY_RESIZE, TRANSITION_BORDER_RESIZE, TRANSITION_DOWN, TRANSITION_UP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToValues(Object value) voidEvery component can add a script to the StringBuilder, script executed when the component is created.voidchanged(overit.geocall.ux.servlet.processor.Change c) Defines the morphing of the element that occurs when there is an Ajax interactionprotected org.apache.ecs.ElementgetCleanButton(boolean ro) Returns the name of the model field containing thecodevalueorg.apache.ecs.ElementgetContentHtml(Object generationhandle, EntitySet es) Implements the interfaceArrangeable.overit.geocall.ux.servlet.processor.ChangeDefines the defaultChangeobject for the elementorg.apache.ecs.ElementgetFrameHtml(overit.geocall.ux.servlet.processor.Change c, EntitySet es) Defines the html part of the element that changes when an Ajax interaction occursorg.apache.ecs.ElementgetHiddenHtml(Object generationhandle, EntitySet es) Implements the interfaceArrangeable.protected Stringorg.apache.ecs.ElementReturns the html of the Input elementReturns the name of the model field containing thekeyvalueprotected org.apache.ecs.ElementgetSearchButton(boolean ro) protected booleangetStrikethrough(HashGetter value) protected org.apache.ecs.ElementgetTagClearButton(boolean ro) protected org.apache.ecs.ElementgetTagElement(HashGetter value, String desc) protected Stringprotected org.apache.ecs.ElementgetTagsHtml(Set<Object> keys, boolean ro) Generates the html for the decoded values (TAGs)protected org.apache.ecs.ElementGenerate the html element used to handle the field's validation.protected org.apache.ecs.html.DivgetWrapperHtml(boolean ro, String cssClass) protected final booleanprotected booleanisSelectedHint(HashGetter values) booleanCalled to decode the value (when the user inputs the value and the field loses the focus, or when the user inputs the value and presses the tab key).booleanCalled when the user clicks on the far left x icon in the field, it clears all the value of the field.booleanonRemoveTag(UIMessage uim) Called when the user clicks on the x icon in the field, it clears the value of the field.voidCalled when the InputMultiDecoder is managed with the selection of the values on a new page (setPAGE(String)), and the user returns on the page that contains the field, after the choice of the values.booleanCalled when the user clicks on the magnifier icon, it opens a page (setPAGE(String)) or shows aPanel(setPANEL(String).protected Stringprotected DBViewqueryHints(String req, long sequence) protected voidremoveFromValues(Object value) voidSets the name of the event associated to the field and triggered when the user change the field value.voidSets the parameter for the auto event associated to the field (seesetAUTOEVENT()).protected voidvoidSets the name of the model field containing thecodevaluevoidSets the type of thecodevaluevoidSets theDBViewthat will be used to extract the record whose code match against the one selected by the user.voidsetDecoding(HashGetter... decodedValues) Sets the decoded values of the InputMultiDecoder, starting from the content of theHashGetterpassed as parameter, that must contain an entrykeyand an entrycode.voidBoolean flag that indicate if the empty field should be submitted as a null value or as an empty set.voidSets the string that defines theMapFormatof the label that will be displayed in the not editable part of the field (on the right).voidsetKEYNAME(String s) Sets the name of the model field containing thekeyvaluevoidsetKEYTYPE(String s) Sets the type of the key that the InputDecoder manages.voidSets the max height for the tags container in px.
If this attribute is set, when the container start to reach the max height, it stops its growth and displays a scroll overflow to displays all tags.voidSets the maximun number of decoded items for the inputvoidSets the max width for the tags in px.
If this attribute is set, when the tag start to reach the max width defined, it stops its growth truncates some chars and there will be displayed some ellipsesvoidSets the path of the page that will be displayed when the user clicks on the magnifier button, triggering theonSearch(Object)event.voidSets theregistrynamethat identifies thePanelthat will be displayed when the user clicks on the magnifier button, triggering theonSearch(Object)event.voidsetSTATICVIEW(String path) Sets the reference to theStaticViewthat will be used to extract the record from the data layer whose code match against the one selected by the user.protected voidsetup()Setup the Componentprotected voidsetupKeyboardListeners(org.apache.ecs.html.Input i, boolean ro) protected HashGetterprotected voidvoidvalidateConcreteValue(String name, Object value, boolean strong, Map arriving) Methods inherited from class overit.geocall.basic.ui.control.Input
addEventButtons, addHint, addHint, addHintsButton, ajaxQuery, buildDisplayScript, connect, control, getClassStyle, getConfigurableProperties, getDefaultValue, getDescriptionHtml, getFilterCriteriaToRemove, getFullSize, getGenerationHandle, getHIDDEN, getHintsEventButton, getInsideEventButton, getInsideEventButton, getLetterCase, getNOTNULL, getSize, getVisibleDescriptionHtml, isImportant, isNotNull, isValueIgnoredByCriterion, prepareValue, registerValidators, setAUTOCOMPLETE, setAUTOFOCUS, setConfiguredProperty, setDA, setDAO, setDAO0, setDEFAULTFOCUS, setEVENT, setEVENTMSG, setEVENTPARAM, setEVENTPROMPT, setEVENTTITLE, setFILTERCRITERIA, setFULLSIZE, setHIDDEN, setHints, setHINTS, setHINTSCACHE, setICON, setIMPORTANT, setKEY, setLABEL2, setLETTERCASE, setMAXLENGTH, setModelProperties, setMSG, setNAME, setNOTNULL, setNUMERIC, setPARAM, setPLACEHOLDER, setPROMPT, setPROMPTEMPTY, setQUERY, setROEVENT, setSIZE, setupAutocomplete, setVALUE, validateChangingValue, validateNotNull, validateUnchangingValue, validateValueMethods inherited from class overit.geocall.ui.Control
avoidNull, clean, getBadgeFormat, getBadgeValue, getBLANK, getCleaner, getDAValues, getDBLINK, getKEYLABEL, getLABEL, getRO, getState, getTITLE, getValues, getWM, isEnabled, isEnabledBasedOnFunction, isFunctionEnabled, isRoBasedOnFunction, nameWithNoFilterPrefix, setALTEVENTICON, setALTICON, setARIADESCRIPTION, setARIALABEL, setBADGEFORMAT, setBADGEVALUE, setBLANK, setCLEANER, setDBLINK, setENABLED, setFUNCTION, setRO, setTitle, setTITLEMethods inherited from class overit.geocall.ui.Component
adapt, appendAttribute, calcKeyLabel, calcLabel, calcShortcut, canBeConfigured, changed, clearConfiguredProperties, componentIterator, componentSize, containerIterator, createAjaxFrame, deprecate, fillSetupScript, generateFlexableFullHeightContainer, generateId, getBASIC, getBoolean, getBoolean, getChildrenComponents, getChildrenContainers, getDefaultLabel, getDefaultLayoutLabel, getEntityContainer, getEntityName, getFullHeight, getGridAlign, getGridCols, getGridRows, getGridVAlign, getHtmlLabel, getHtmlLabel, getIcon, getId, getIdentity, getint, getLayoutLabel, getLayoutName, getNAME, getParentComponent, getParentContainer, getPublishedChildrenList, getRegistryName, getSHORTCUT, getTabIndex, getTeacher, getValuesContainer, getWindow, initChilds, isActivable, isActive, isAliasField, isConfigHidden, isDefaultHidden, isExtendedField, isLabelInLine, onInit, setActivable, setActive, setAliasField, setBASIC, setConfigHidden, setDEFAULTHIDDEN, setEntityName, setExtendedField, setFULLHEIGHT, setGRIDALIGN, setGRIDCOLS, setGRIDROWS, setGRIDVALIGN, setIdentity, setLabel, setLABEL, setLABELINLINE, setLAYOUTLABEL, setLAYOUTNAME, setREGISTRYNAME, setTooltip, setValuesContainer, stringForJs, tabIndexerMethods inherited from class overit.geocall.platform.ui.UINode
addChild, addChildText, getChildren, getNodeId, getParent, getRoot, getSchema, setNodeId, setParent, setSchemaMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface overit.geocall.ui.Arrangeable
getDescriptionHtml, getGenerationHandleMethods inherited from interface overit.geocall.ui.Badgeable
badgeFormat, makeBadgedIcon
-
Field Details
-
STRIKETHROUGH
- See Also:
-
SELECTED_HINT
- See Also:
-
SELECTED_HINT_EVENT
- See Also:
-
SELECTED_HINT_KEY
- See Also:
-
_keyName
-
_codeName
-
_format
-
_codeType
protected char _codeType -
keyType
protected char keyType -
_panel
-
_page
-
_autoevent
-
_autoeventparam
-
_decodedValues
-
_dbv
-
_sv
-
_maxItems
protected int _maxItems -
_msgExceededMaxItems
-
_emptyAsNull
protected boolean _emptyAsNull -
maxTagWidth
protected int maxTagWidth -
maxHeight
protected int maxHeight
-
-
Constructor Details
-
InputMultiDecoder
public InputMultiDecoder()
-
-
Method Details
-
setCODETYPE
Sets the type of thecodevalue- Parameters:
s- Accepted values are: "long" to state that thecodevalue is a Long; "string" to state that thecodevalue is a String
-
setCODENAME
Sets the name of the model field containing thecodevalue- Parameters:
s- The name of thecodefield
-
setKEYNAME
Sets the name of the model field containing thekeyvalue- Parameters:
s- The name of thekeyfield
-
setFORMAT
Sets the string that defines theMapFormatof the label that will be displayed in the not editable part of the field (on the right). Usually the format is defined in such a way that facilitates the readability (for example it reports the value of a description field). This attribute is mandatory.- Parameters:
s- The string that defines aMapFormat
-
setSTATICVIEW
Sets the reference to theStaticViewthat will be used to extract the record from the data layer whose code match against the one selected by the user. This attribute must be prefixed with the underscore character (like: _staticView) to allows theUIFactorymechanism to resolve the correct path of the XML file.- Parameters:
path- The reference path to the StaticView used by the InputMultiDecoder
-
setPANEL
Sets theregistrynamethat identifies thePanelthat will be displayed when the user clicks on the magnifier button, triggering theonSearch(Object)event. The panel should contains a list representing the codes and theirs decoded values, and allows the user to directly select one or more of them. To return the selected value to the InputMultiDecoder, it is possible to invoke thesetDecoding(HashGetter...)method of the instance of the InputMultiDecoder that has opened the panel- Parameters:
p- Theregistrynamethat identifies the panel that lists the possible values to select
-
setPAGE
Sets the path of the page that will be displayed when the user clicks on the magnifier button, triggering theonSearch(Object)event. This attribute must be prefixed by the underscore character (like: _page) to allows theUIFactorymechanism to resolve the correct path of the XML file.
Ideally this page contains a list representing the codes and theirs decoded values, and allows the users to directly select one or more of them.- Parameters:
dp- The path of the page that lists the possible values to select
-
setAUTOEVENT
Sets the name of the event associated to the field and triggered when the user change the field value.- Parameters:
s- The string that represents the name of the event associated to the field
-
setAUTOEVENTPARAM
Sets the parameter for the auto event associated to the field (seesetAUTOEVENT()).- Parameters:
s- A string that represents the param attribute of the auto event associated to the field
-
setMAXITEMS
Sets the maximun number of decoded items for the input- Parameters:
s- The maximum number of items
-
setEMPTYASNULL
Boolean flag that indicate if the empty field should be submitted as a null value or as an empty set.- Parameters:
s- A string that represents a boolean value ("true" or "1", "false" or "0").
If the string is not recognized as a boolean value, it will be used the default value, that is false
-
setDBView
Sets theDBViewthat will be used to extract the record whose code match against the one selected by the user.- Parameters:
dbv- TheDBViewused by the InputMultiDecoder
-
getKeyName
Returns the name of the model field containing thekeyvalue- Returns:
- The name of the
keyfield
-
getCodeName
Returns the name of the model field containing thecodevalue- Returns:
- The name of the
codefield
-
setKEYTYPE
Sets the type of the key that the InputDecoder manages.- Parameters:
s- The type of the key. Possible values are:
- long
- string
-
setMAXHEIGHT
Sets the max height for the tags container in px.
If this attribute is set, when the container start to reach the max height, it stops its growth and displays a scroll overflow to displays all tags.- Parameters:
b- the max height for the tags container in px.
-
setMAXTAGWIDTH
Sets the max width for the tags in px.
If this attribute is set, when the tag start to reach the max width defined, it stops its growth truncates some chars and there will be displayed some ellipses- Parameters:
b- the max width for the tags in px.
-
setup
protected void setup()Description copied from class:ComponentSetup the Component -
buildSetupScript
Description copied from class:ComponentEvery component can add a script to the StringBuilder, script executed when the component is created.- Overrides:
buildSetupScriptin classComponent- Parameters:
sb- The StringBuilder on which we want to add the script
-
setupKeyboardListeners
protected void setupKeyboardListeners(org.apache.ecs.html.Input i, boolean ro) -
getHtml
Description copied from class:InputReturns the html of the Input element -
getFrameHtml
public org.apache.ecs.Element getFrameHtml(overit.geocall.ux.servlet.processor.Change c, EntitySet es) Description copied from interface:AjaxableComponentDefines the html part of the element that changes when an Ajax interaction occurs- Specified by:
getFrameHtmlin interfaceAjaxableComponent- Parameters:
c- TheChangeobject that defines the specific morphing type for the elementes- TheEntitySetto which the element belongs- Returns:
- The html part of the element that changes when an Ajax interaction occurs
-
changed
public void changed(overit.geocall.ux.servlet.processor.Change c) Description copied from interface:AjaxableComponentDefines the morphing of the element that occurs when there is an Ajax interaction- Specified by:
changedin interfaceAjaxableComponent- Parameters:
c- TheChangeobject that defines the specific morphing type for the element
-
getDefaultChange
public overit.geocall.ux.servlet.processor.Change getDefaultChange()Description copied from interface:AjaxableComponentDefines the defaultChangeobject for the element- Specified by:
getDefaultChangein interfaceAjaxableComponent- Returns:
- The default
Changeobject that defines the default morphing type of the element
-
getContentHtml
Description copied from class:InputImplements the interfaceArrangeable. It returns the html code that represents the active part of the input field, i.e. the field and the validation scripts- Specified by:
getContentHtmlin interfaceArrangeable- Overrides:
getContentHtmlin classInput- Parameters:
generationhandle- The handle of the generationes- TheEntitySetto which the element belongs- Returns:
- The html code of the input field or null if the field don't have a graphical representation
-
getWrapperHtml
-
getHiddenHtml
Description copied from class:InputImplements the interfaceArrangeable. It returns the hidden but active html part of an hidden input field.- Specified by:
getHiddenHtmlin interfaceArrangeable- Overrides:
getHiddenHtmlin classInput- Parameters:
generationhandle- The handle of the generationes- TheEntitySetto which the element belongs- Returns:
- The html code of the hidden part of the field or null if the field is visible.
-
getTagsHtml
Generates the html for the decoded values (TAGs)- Parameters:
keys- values fetched from the values containerro- boolean indicating if the field is read only or not- Returns:
- the html for the decoded values (TAGs)
-
getTagElement
-
getTagClearButton
protected org.apache.ecs.Element getTagClearButton(boolean ro) -
getTagsFieldStyle
-
getCleanButton
protected org.apache.ecs.Element getCleanButton(boolean ro) -
getSearchButton
protected org.apache.ecs.Element getSearchButton(boolean ro) -
getValidationSupportHtml
Generate the html element used to handle the field's validation.- Parameters:
es- TheEntitySetto which the element belongs- Returns:
- the html element used to handle the field's validation
-
validate
-
onDecode
Called to decode the value (when the user inputs the value and the field loses the focus, or when the user inputs the value and presses the tab key). At the end it calls the autoevent, if set (setAUTOEVENT(String))- Parameters:
uim-UIMessagecontaining the parameters- Returns:
false
-
onRemoveTag
Called when the user clicks on the x icon in the field, it clears the value of the field. At the end it calls the autoevent, if set (setAUTOEVENT(String))- Parameters:
uim-UIMessagecontaining the parameters- Returns:
false
-
onSearch
Called when the user clicks on the magnifier icon, it opens a page (setPAGE(String)) or shows aPanel(setPANEL(String). The page or panel should contains a list representing the codes and theirs decoded values, and should allows the user to directly select one of them.- Parameters:
o- Not used- Returns:
false
-
onRemoveAllTags
Called when the user clicks on the far left x icon in the field, it clears all the value of the field. At the end it calls the autoevent, if set (setAUTOEVENT(String))- Parameters:
o- Not used- Returns:
false
-
addToValues
-
removeFromValues
-
onRestore
Called when the InputMultiDecoder is managed with the selection of the values on a new page (setPAGE(String)), and the user returns on the page that contains the field, after the choice of the values.- Parameters:
o- The array ofHashGetterthat contains the decoded values
-
setDecoding
Sets the decoded values of the InputMultiDecoder, starting from the content of theHashGetterpassed as parameter, that must contain an entrykeyand an entrycode.- Parameters:
decodedValues- The map that contains the decoded values
-
setCode
-
setValue
-
getStrikethrough
-
isSelectedHint
-
prepareName
- Overrides:
prepareNamein classInput
-
prepareValueSet
-
getHintsFieldName
- Overrides:
getHintsFieldNamein classInput
-
queryHints
- Overrides:
queryHintsin classInput- Throws:
InterruptedException
-
validateConcreteValue
public void validateConcreteValue(String name, Object value, boolean strong, Map arriving) throws ValidationException - Overrides:
validateConcreteValuein classInput- Throws:
ValidationException
-
isKeyStringType
protected final boolean isKeyStringType()
-