Class 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
  • Field Details

    • STRIKETHROUGH

      public static final String STRIKETHROUGH
      See Also:
    • SELECTED_HINT

      public static final String SELECTED_HINT
      See Also:
    • SELECTED_HINT_EVENT

      public static final String SELECTED_HINT_EVENT
      See Also:
    • SELECTED_HINT_KEY

      public static final String SELECTED_HINT_KEY
      See Also:
    • _keyName

      protected String _keyName
    • _codeName

      protected String _codeName
    • _format

      protected MapFormat _format
    • _codeType

      protected char _codeType
    • keyType

      protected char keyType
    • _panel

      protected String _panel
    • _page

      protected String _page
    • _autoevent

      protected String _autoevent
    • _autoeventparam

      protected String _autoeventparam
    • _decodedValues

      protected LinkedHashMap<Object,HashGetter> _decodedValues
    • _dbv

      protected DBView _dbv
    • _sv

      protected StaticView _sv
    • _maxItems

      protected int _maxItems
    • _msgExceededMaxItems

      protected String _msgExceededMaxItems
    • _emptyAsNull

      protected boolean _emptyAsNull
    • maxTagWidth

      protected int maxTagWidth
    • maxHeight

      protected int maxHeight
  • Constructor Details

    • InputMultiDecoder

      public InputMultiDecoder()
  • Method Details

    • setCODETYPE

      public void setCODETYPE(String s)
      Sets the type of the code value
      Parameters:
      s - Accepted values are: "long" to state that the code value is a Long; "string" to state that the code value is a String
    • setCODENAME

      public void setCODENAME(String s)
      Sets the name of the model field containing the code value
      Parameters:
      s - The name of the code field
    • setKEYNAME

      public void setKEYNAME(String s)
      Sets the name of the model field containing the key value
      Parameters:
      s - The name of the key field
    • setFORMAT

      public void setFORMAT(String s)
      Sets the string that defines the MapFormat of 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 a MapFormat
    • setSTATICVIEW

      public void setSTATICVIEW(String path)
      Sets the reference to the StaticView that 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 the UIFactory mechanism to resolve the correct path of the XML file.
      Parameters:
      path - The reference path to the StaticView used by the InputMultiDecoder
    • setPANEL

      public void setPANEL(String p)
      Sets the registryname that identifies the Panel that will be displayed when the user clicks on the magnifier button, triggering the onSearch(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 the setDecoding(HashGetter...) method of the instance of the InputMultiDecoder that has opened the panel
      Parameters:
      p - The registryname that identifies the panel that lists the possible values to select
    • setPAGE

      public void setPAGE(String dp)
      Sets the path of the page that will be displayed when the user clicks on the magnifier button, triggering the onSearch(Object) event. This attribute must be prefixed by the underscore character (like: _page) to allows the UIFactory mechanism 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

      public void setAUTOEVENT(String s)
      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

      public void setAUTOEVENTPARAM(String s)
      Sets the parameter for the auto event associated to the field (see setAUTOEVENT()).
      Parameters:
      s - A string that represents the param attribute of the auto event associated to the field
    • setMAXITEMS

      public void setMAXITEMS(String s)
      Sets the maximun number of decoded items for the input
      Parameters:
      s - The maximum number of items
    • setEMPTYASNULL

      public void setEMPTYASNULL(String s)
      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

      public void setDBView(DBView dbv)
      Sets the DBView that will be used to extract the record whose code match against the one selected by the user.
      Parameters:
      dbv - The DBView used by the InputMultiDecoder
    • getKeyName

      public String getKeyName()
      Returns the name of the model field containing the key value
      Returns:
      The name of the key field
    • getCodeName

      public String getCodeName()
      Returns the name of the model field containing the code value
      Returns:
      The name of the code field
    • setKEYTYPE

      public void setKEYTYPE(String s)
      Sets the type of the key that the InputDecoder manages.
      Parameters:
      s - The type of the key. Possible values are:
      • long
      • string
    • setMAXHEIGHT

      public void setMAXHEIGHT(String b)
      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

      public void setMAXTAGWIDTH(String b)
      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: Component
      Setup the Component
      Overrides:
      setup in class Input
    • buildSetupScript

      public void buildSetupScript(StringBuilder sb)
      Description copied from class: Component
      Every component can add a script to the StringBuilder, script executed when the component is created.
      Overrides:
      buildSetupScript in class Component
      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

      public org.apache.ecs.Element getHtml(EntitySet es)
      Description copied from class: Input
      Returns the html of the Input element
      Overrides:
      getHtml in class Input
      Parameters:
      es - The EntitySet
      Returns:
      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: AjaxableComponent
      Defines the html part of the element that changes when an Ajax interaction occurs
      Specified by:
      getFrameHtml in interface AjaxableComponent
      Parameters:
      c - The Change object that defines the specific morphing type for the element
      es - The EntitySet to 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: AjaxableComponent
      Defines the morphing of the element that occurs when there is an Ajax interaction
      Specified by:
      changed in interface AjaxableComponent
      Parameters:
      c - The Change object that defines the specific morphing type for the element
    • getDefaultChange

      public overit.geocall.ux.servlet.processor.Change getDefaultChange()
      Description copied from interface: AjaxableComponent
      Defines the default Change object for the element
      Specified by:
      getDefaultChange in interface AjaxableComponent
      Returns:
      The default Change object that defines the default morphing type of the element
    • getContentHtml

      public org.apache.ecs.Element getContentHtml(Object generationhandle, EntitySet es)
      Description copied from class: Input
      Implements the interface Arrangeable. It returns the html code that represents the active part of the input field, i.e. the field and the validation scripts
      Specified by:
      getContentHtml in interface Arrangeable
      Overrides:
      getContentHtml in class Input
      Parameters:
      generationhandle - The handle of the generation
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the input field or null if the field don't have a graphical representation
    • getWrapperHtml

      protected org.apache.ecs.html.Div getWrapperHtml(boolean ro, String cssClass)
    • getHiddenHtml

      public org.apache.ecs.Element getHiddenHtml(Object generationhandle, EntitySet es)
      Description copied from class: Input
      Implements the interface Arrangeable. It returns the hidden but active html part of an hidden input field.
      Specified by:
      getHiddenHtml in interface Arrangeable
      Overrides:
      getHiddenHtml in class Input
      Parameters:
      generationhandle - The handle of the generation
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the hidden part of the field or null if the field is visible.
    • getTagsHtml

      protected org.apache.ecs.Element getTagsHtml(Set<Object> keys, boolean ro)
      Generates the html for the decoded values (TAGs)
      Parameters:
      keys - values fetched from the values container
      ro - boolean indicating if the field is read only or not
      Returns:
      the html for the decoded values (TAGs)
    • getTagElement

      protected org.apache.ecs.Element getTagElement(HashGetter value, String desc)
    • getTagClearButton

      protected org.apache.ecs.Element getTagClearButton(boolean ro)
    • getTagsFieldStyle

      protected String getTagsFieldStyle()
    • getCleanButton

      protected org.apache.ecs.Element getCleanButton(boolean ro)
    • getSearchButton

      protected org.apache.ecs.Element getSearchButton(boolean ro)
    • getValidationSupportHtml

      protected org.apache.ecs.Element getValidationSupportHtml(EntitySet es)
      Generate the html element used to handle the field's validation.
      Parameters:
      es - The EntitySet to which the element belongs
      Returns:
      the html element used to handle the field's validation
    • validate

      protected void validate(org.apache.ecs.html.Input i, EntitySet es, boolean ro)
      Overrides:
      validate in class Input
    • onDecode

      public boolean onDecode(UIMessage uim)
      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 - UIMessage containing the parameters
      Returns:
      false
    • onRemoveTag

      public boolean onRemoveTag(UIMessage uim)
      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 - UIMessage containing the parameters
      Returns:
      false
    • onSearch

      public boolean onSearch(Object o)
      Called when the user clicks on the magnifier icon, it opens a page (setPAGE(String)) or shows a Panel (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

      public boolean onRemoveAllTags(Object o)
      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

      protected void addToValues(Object value)
    • removeFromValues

      protected void removeFromValues(Object value)
    • onRestore

      public void onRestore(Object o)
      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 of HashGetter that contains the decoded values
    • setDecoding

      public void setDecoding(HashGetter... decodedValues)
      Sets the decoded values of the InputMultiDecoder, starting from the content of the HashGetter passed as parameter, that must contain an entry key and an entry code.
      Parameters:
      decodedValues - The map that contains the decoded values
    • setCode

      protected void setCode(Object code)
    • setValue

      protected HashGetter setValue(Object key)
    • getStrikethrough

      protected boolean getStrikethrough(HashGetter value)
    • isSelectedHint

      protected boolean isSelectedHint(HashGetter values)
    • prepareName

      protected String prepareName()
      Overrides:
      prepareName in class Input
    • prepareValueSet

      protected Set<Object> prepareValueSet()
    • getHintsFieldName

      protected String getHintsFieldName()
      Overrides:
      getHintsFieldName in class Input
    • queryHints

      protected DBView queryHints(String req, long sequence) throws InterruptedException
      Overrides:
      queryHints in class Input
      Throws:
      InterruptedException
    • validateConcreteValue

      public void validateConcreteValue(String name, Object value, boolean strong, Map arriving) throws ValidationException
      Overrides:
      validateConcreteValue in class Input
      Throws:
      ValidationException
    • isKeyStringType

      protected final boolean isKeyStringType()