Class InputDecoder

All Implemented Interfaces:
Serializable, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Arrangeable, Badgeable, ValueValidator, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable
Direct Known Subclasses:
AjaxInputDecoder, InputDecoderDataCollectionType, InputDecoderForecastHeader, overit.geocallapp.wfm.technicalobject.decoder.InputDecoderTechnicalObject, overit.geocallapp.wfm.amministrazione.anautente.decodifica.InputDecoderUtenti, SearchField

This class implements the graphic user interface elements that is used to decode an input in the corresponding value, input selected by the user from a StaticView rather than from the database through a task. This component can be useful for example when there is a model containing the user's typology and we want to decode the typology code into the relative description, or in all situations comparable to this
See Also:
GCApi:
component
  • Field Details

    • _key

      protected String _key
    • _format

      protected MapFormat _format
    • _nowrap

      protected boolean _nowrap
    • _code

      protected String _code
    • _decodedValues

      protected HashGetter _decodedValues
    • _staticView

      protected StaticView _staticView
    • _page

      protected String _page
    • _panel

      protected String _panel
    • _reset

      protected Icon _reset
    • _autoevent

      protected String _autoevent
    • _autoeventOnSet

      protected boolean _autoeventOnSet
    • _autoeventparam

      protected String _autoeventparam
    • _codetype

      protected char _codetype
    • keyType

      protected char keyType
    • _msgCerca

      protected String _msgCerca
    • _msgSvuota

      protected String _msgSvuota
    • _msgCodice

      protected String _msgCodice
  • Constructor Details

    • InputDecoder

      public InputDecoder()
      Creates a new InputDecoder
  • Method Details

    • setKEY

      public void setKEY(String key)
      Sets the name of the model field containing the key value
      Overrides:
      setKEY in class Input
      Parameters:
      key - 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
    • 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 of them. To return the selected value to the InputDecoder in the previous page, it is possible to pop the page from the WindowManager passing the selected record as parameter.
      Parameters:
      dp - The path of the page that lists the possible values to select
    • 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 of them. To return the selected value to the InputDecoder, it is possible to invoke the setDecoding(HashGetter) method of the instance of the InputDecoder that has opened the panel
      Parameters:
      p - The registryname that identifies the panel that lists the possible values to select
    • setNOTNULL

      public void setNOTNULL(String s)
      Description copied from class: Input
      Defines if the value of the field can be empty when submitted
      By setting true to this attribute, the user can't make a submit until the value of the field is compiled
      Overrides:
      setNOTNULL in class Input
      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
    • setFULLSIZE

      public void setFULLSIZE(String s)
      Description copied from class: Input
      Indicates if the field has to occupy all the available space in width
      Overrides:
      setFULLSIZE in class Input
      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
    • setPLACEHOLDER

      public void setPLACEHOLDER(String s)
      Description copied from class: Input
      Sets the placeholder, the short hint that usually describes the expected value that appears in the field before the user enters a value
      Overrides:
      setPLACEHOLDER in class Input
      Parameters:
      s - The string that will appear as a placeholder in the field
    • 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. By setting an autoevent, a form submit will be automatically performed when the field loses the focus.
      Parameters:
      s - The string that represents the name of the event associated to the field
    • setAUTOEVENTONSET

      public void setAUTOEVENTONSET(String s)
      Defines whether the autoevent should be triggered or not when the decoded values have been programmatically set.
      Parameters:
      s - A string that represents a boolean value ("true" or "1", "false" or "0").
    • 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
    • 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
    • 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
    • setup

      protected void setup()
      Description copied from class: Component
      Setup the Component
      Overrides:
      setup in class Input
    • nullEquals

      protected static boolean nullEquals(Object o1, Object o2)
    • getDa

      public DABase getDa()
      Returns the DABase associated to the InputDecoder
      Returns:
      The instance of the DABase object used by the InputDecoder
    • getDao

      public DAO getDao()
      Returns the DAO associated to the InputDecoder
      Returns:
      The instance of the DAO object used by the InputDecoder
    • 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 InputDecoder
    • setNOWRAP

      public void setNOWRAP(String s)
      Defines whether to wrap or not the field value
      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
    • setCODE

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

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

      protected Long prepareLongValue()
    • prepareStringValue

      protected String prepareStringValue()
    • setDecoding

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

      protected void setValue(Object value)
    • setCode

      protected void setCode(Object code)
    • changeCollectedValue

      protected void changeCollectedValue(String name, Object value)
    • getDecodeFromCodeQueryId

      public int getDecodeFromCodeQueryId()
      Returns the specific query id used for the decoding. If it is set a specific query, with Input.setQUERY(String), the field uses that one for the decoding, instead of the standard DABase.SELECT_FILTER
      Returns:
      The query id used for the decoding
    • getDecodeCommandFromCodeQueryId

      public Command getDecodeCommandFromCodeQueryId()
      Returns the specific query id used for the decoding. If it is set a specific query, with Input.setQUERY(String), the field uses that one for the decoding, instead of the standard DABase.SELECT_FILTER
      Returns:
      The query id used for the decoding
    • getHtmlField

      protected org.apache.ecs.Element getHtmlField()
    • setEVENT

      public void setEVENT(String s)
      Description copied from class: Input
      Sets one or more events associated to the input field.
      By setting an event, a button will be created inside the field, clicking on which the event will be triggered. Each button will have a default icon.
      If the input field is in readonly state, also every event button of the field is readonly (not clickable).
      Overrides:
      setEVENT in class Input
      Parameters:
      s - A ListAttribute of strings (separated by the character | ) each of which represents the name of an event associated to the field
    • getEventButton

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

      protected org.apache.ecs.Element getCleanButton(boolean ro)
    • 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
    • onDecode

      public boolean onDecode(Object o)
      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:
      o - HashGetter containing the parameters to decode
      Returns:
      false
    • onClean

      public boolean onClean(Object o)
      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:
      o - Not used
      Returns:
      false
    • onRestore

      public void onRestore(Object o)
      Called when the InputDecoder 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 value.
      At the end it calls the autoevent, if set (setAUTOEVENT(String))
      Parameters:
      o - The HashGetter that contains the decoded values
    • getDescriptionHtml

      public org.apache.ecs.Element getDescriptionHtml(Object generationhandle, EntitySet es)
      Description copied from class: Input
      Implements the interface Arrangeable. It returns the html code that represents the component description i.e. the formatted label of the field
      Specified by:
      getDescriptionHtml in interface Arrangeable
      Overrides:
      getDescriptionHtml in class Input
      Parameters:
      generationhandle - The handle of the generation
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the label, or null if the field don't have it or is hidden
    • 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.
    • getGenerationHandle

      public Object getGenerationHandle()
      Description copied from class: Input
      Implements the interface Arrangeable
      Specified by:
      getGenerationHandle in interface Arrangeable
      Overrides:
      getGenerationHandle in class Input
      Returns:
      null
    • 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
    • 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
    • manageNoDecodedValue

      protected void manageNoDecodedValue(org.apache.ecs.ConcreteElement ce)
    • buildDisplayScript

      public void buildDisplayScript(StringBuilder sb)
      Description copied from class: Input
      Every component can add a script to the StringBuilder, script executed when the component is displayed. The method add the script that controls the focus on the input field.
      Overrides:
      buildDisplayScript in class Input
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • isKeyStringType

      protected final boolean isKeyStringType()
    • getFilterCriteriaToRemove

      protected Set<SqlOperator> getFilterCriteriaToRemove(Set<overit.geocall.ux.configurability.UIProperty> properties)
      Overrides:
      getFilterCriteriaToRemove in class Input