Class Form

All Implemented Interfaces:
Serializable, EntityContainer, ValuesContainer, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, AjaxableComponent, Badgeable, DraggableDroppable, Hideable, ContentChangeListener, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable
Direct Known Subclasses:
overit.geocallapp.wfm.schedulazione.manuale.attivitaschedulabili.CAttivitaSchedulabili, overit.geocallapp.wfm.schedulazione.manuale.attivitaurgenti.CAttivitaUrgenti, OutputForm, SchedulableBundles

The class extends Container and implements the html form element, the user interface element that allows to arranges the positions and manages the behaviors of the child components, that are mainly input and output fields.
See Also:
GCApi:
component
  • Field Details

    • _values

      protected SensibleHashGetter _values
    • _pubValues

      protected HashGetter _pubValues
    • _daValues

      protected HashGetter _daValues
    • _method

      protected String _method
    • _anchor

      protected String _anchor
    • _rolabel

      protected String _rolabel
    • _blanklabel

      protected String _blanklabel
    • _visible

      protected String _visible
    • _mode

      protected char _mode
    • _draggable

      protected String _draggable
    • _droppable

      protected String _droppable
    • role

      protected String role
    • autoSeek

      protected HashSet<String> autoSeek
    • seek

      protected HashSet<String> seek
    • seekCondition

      protected HashSet<String> seekCondition
    • entities

      protected LinkedHashSet<String> entities
    • validators

      protected final HashMap<String,ValueValidator> validators
    • _xclass

      protected String _xclass
      Filter attribute used in copy and paste and drag and drop actions. We can paste / drop the content only if the origin object has the same xclass of the destination object
  • Constructor Details

    • Form

      public Form()
      Creates a new instance of Form
  • Method Details

    • connect

      protected void connect()
      Overrides:
      connect in class Component
    • setSEEK

      public void setSEEK(String ss)
      Sets the must-seek fields.
      Parameters:
      ss - String containing the must-seek fields. Accepted values are:
      • 'auto': only control field like 'read only', 'not null' and 'hidden' field will be validated (field with a 'registryname' will not be considered). It is possible to add more field to validate by adding them after 'auto' using this syntax: 'auto,+AUSENAME' and it is possible to not validate one or more field by subtract it using this syntax: 'auto,-AUSENAME';
      • 'full': every single field in the form will be validated, it is possible to not validate one or more field by subtract it using this syntax: 'full,-AUSENAME';
      • string containing the list of all the added field to validate separated with a comma, for example: '+AUSENAME,+AUSEDATE'.
      It's also possible to define that the fields that have a registryName or are not db-linked, are not automatically added to the seek fields list of this Form. For this purpose the seek attribute can be set in this way: seek="auto,-registered,-notDbLinked,...." .
    • setSEEKCONDITION

      public void setSEEKCONDITION(String ss)
      Sets seek condition. Used only in some particular cases, the use is not recommended.
      Parameters:
      ss - String containing the seek condition
    • setHARMLESS

      public void setHARMLESS(String s)
      Sets if the form will be used without persists data on db.
      A Form is harmelss when it doesn't perform insert, delete and/or update operations on the data layer.
      Parameters:
      s - "true" or "1" if the form is a filter form, "false" or "0" otherwise.
    • isHarmlessContainer

      public boolean isHarmlessContainer()
      Description copied from interface: ValuesContainer
      Gets if the container is a filter or an edit container
      Specified by:
      isHarmlessContainer in interface ValuesContainer
      Returns:
      true if is a filter container, false otherwise.
    • getSeek

      public HashSet<String> getSeek()
      Gets the set of must-seek fields
      Returns:
      The set of must-seek fields
    • setDRAGGABLE

      public void setDRAGGABLE(String s)
      Specifies if the form (and therefore all its values) can be dragged to another (droppable) component
      Parameters:
      s - A string that defines if the form is draggable, and the behavior of the dragging. The possible accepted values are:
      "+" the drag operation copies the form values;
      "-" the drag operation removes the form values;
      "+-" the drag operation copies or removes the form values depending on whether the CTRL key is pressed or not during the drag operation.
    • setDROPPABLE

      public void setDROPPABLE(String s)
      Specifies if the user can drop some values from another (draggable) component into the form
      Parameters:
      s - A string that defines if the form accepts the drop of values from another component. The possible value is: "f" (any other value works in the same way, but we strongly suggest using the letter "f" to avoid any future conflicts due to developments on the component behavior
    • setXCLASS

      public void setXCLASS(String xclass)
      Sets a particular xclass to the form; this string is used to limit the operations of copy / cut / paste / drag / drop that can be executed only between objects that have the same xclass attribute. If no value is specified, there aren't restriction imposed; otherwise a value can be pasted / dropped on the form only if the source component has the same xclass value
      Parameters:
      xclass - The string that defines the xclass for the form
    • setMETHOD

      public void setMETHOD(String s)
      Defines the submit mechanism used by the form
      Parameters:
      s - The string that defines the submit mechanism. Possible values are:
      "POST": submit the values using POST HTTP method
      "FILE": submit a multipart request using POST method. This attribute value should be used if the form contains an InputUpload field
    • setANCHOR

      public void setANCHOR(String s)
      Adds the anchor html attribute to the form
      Parameters:
      s - The string that defines the value of the anchor attribute
    • setROLE

      public void setROLE(String r)
      Adds the role html attribute to the form.
      This attirbute is needed due to accessibility reason, for example to set the role="search" on a form that it's used to research some records.
      Parameters:
      r - The string that defines the value of the role attribute
    • setVISIBLE

      public void setVISIBLE(String s)
      Defines if the form should be rendered or not
      Specified by:
      setVISIBLE in interface Hideable
      Parameters:
      s - A string that represent a boolean value ("true" or "1", "false" or "0") or a function.
      If the string is not recognized as a boolean value, it is considered as a user function with this meaning: if the user currently logged in the application has the function, the form will be rendered, otherwise it will not
    • getVISIBLE

      public boolean getVISIBLE()
      Deprecated.
      Use isVisible() instead
      Specified by:
      getVISIBLE in interface Hideable
      Returns:
      Use isVisible() instead
    • isVisible

      public boolean isVisible()
      Checks if the form is rendered for the user currently logged in the application, or not (see getBoolean(visible,id,true))
      Specified by:
      isVisible in interface Hideable
      Returns:
      true if the form is visible, false otherwise
    • getLABEL

      public String getLABEL()
      Returns the label associated to the form
      Overrides:
      getLABEL in class Control
      Returns:
      A string that represents the label of the form. It is possible to define a shortcut letter, see Component.calcLabel(s)
    • getSHORTCUT

      public String getSHORTCUT()
      Returns the letter of the label (setLABEL(s)), the readonly label (setROLABEL(s)) or the blank label (setBLANKLABEL(s)), used as shortcut to switch to the form, when inserted into a ServerMultiForm, pressing ALT + the letter used as shortcut
      Overrides:
      getSHORTCUT in class Component
      Returns:
      The letter used as shortcut
    • getKEYLABEL

      public String getKEYLABEL()
      Returns the key label, used by the ServerMultiForm
      Overrides:
      getKEYLABEL in class Control
      Returns:
      The string that represents the key label It is possible to define a shortcut letter, see Component.calcLabel(s)
    • setLABEL

      public void setLABEL(String s)
      Sets the label of the form
      Overrides:
      setLABEL in class Component
      Parameters:
      s - The string that will be used as label for the form
    • setROLABEL

      public void setROLABEL(String s)
      Sets the label shown when the form is in readonly state
      Parameters:
      s - The string that will be used as label for the form in readonly state
    • setBLANKLABEL

      public void setBLANKLABEL(String s)
      Sets the label shown when the form is in blank state
      Parameters:
      s - The string that will be used as label for the form in blank state
    • setBlankLabel

      public void setBlankLabel(String s)
      Sets the label shown when the form is in blank state. Using this method the label passed as a parameter will not be processed by the translation mechanism and will remain unchanged even after a change of language
      Parameters:
      s - The string that will be used as label for the form in blank state
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es)
      Returns the html code of the form
      Overrides:
      getHtml in class Container
      Parameters:
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the form
    • changed

      public void changed(overit.geocall.ux.servlet.processor.Change change)
      Implements the AjaxableComponent interface. It defines the morphing of the form element that occurs when there is an Ajax interaction
      Specified by:
      changed in interface AjaxableComponent
      Parameters:
      change - The Change object that defines the specific morphing type for the form
    • getDefaultChange

      public overit.geocall.ux.servlet.processor.Change getDefaultChange()
      Implements the AjaxableComponent interface. It defines the default Change object for the form
      Specified by:
      getDefaultChange in interface AjaxableComponent
      Returns:
      The default Change object that defines the default morphing type of the form
    • getFrameHtml

      public org.apache.ecs.Element getFrameHtml(overit.geocall.ux.servlet.processor.Change change, EntitySet es)
      Implements the AjaxableComponent interface. It defines the html part of the form that changes when an Ajax interaction occurs
      Specified by:
      getFrameHtml in interface AjaxableComponent
      Parameters:
      change - The Change object that defines the specific morphing type for the form
      es - The EntitySet to which the element belongs
      Returns:
      The html part of the form that changes when an Ajax interaction occurs
    • setMODE

      public void setMODE(String mode)
      Defines the way in which the values are managed on every event.
      Parameters:
      mode - A string that defines the way in which the values are managed. Possible values are:
      "r": reload mode (this is the default mode); the form values are reloaded on every event (form refresh, tab switch, etc.)
      "a": append mode; the form values are appended / updated on every event (form refresh, tab switch, etc.))
    • collectValues

      public void collectValues(HashGetter values, HashGetter daValues)
      Implements the ValuesContainer interface. It is used to collect the form values
      Specified by:
      collectValues in interface ValuesContainer
      Parameters:
      values - The HashGetter that contains the values of the form otherwise only the validations to avoid tampering of parameters must be executed
      daValues - The HashGetter that contains the DA values of the form
    • setCollectedValues

      public void setCollectedValues(HashGetter values, HashGetter daValues)
      Implements the ValuesContainer interface. It is used to set the collected values of the form
      Specified by:
      setCollectedValues in interface ValuesContainer
      Parameters:
      values - The HashGetter that contains the values of the form
      daValues - The HashGetter that contains the DA values of the form
    • getCollectedValues

      public HashGetter getCollectedValues()
      Implements the ValuesContainer interface. It returns the collected values of the form
      Specified by:
      getCollectedValues in interface ValuesContainer
      Returns:
      An HashGetter that contains the collected values of the form
    • getCollectedDAValues

      public HashGetter getCollectedDAValues()
      Implements the ValuesContainer interface. It returns the collected DA values of the form
      Specified by:
      getCollectedDAValues in interface ValuesContainer
      Returns:
      An HashGetter that contains the collected DA values of the form
    • getPublishedValues

      public HashGetter getPublishedValues()
      Implements the ValuesContainer interface. It returns the published values of the form
      Specified by:
      getPublishedValues in interface ValuesContainer
      Returns:
      An HashGetter that contains the published values of the form
    • getReadOnlyAndNotEnabledFields

      public Map<String,Control> getReadOnlyAndNotEnabledFields()
      Description copied from interface: ValuesContainer
      Gets the read only or not enabled fields registered into the values container.
      If a ro or a not enabled field it has been registered, means that field won't be configurable and it will be seeked from the server at every submit.
      Specified by:
      getReadOnlyAndNotEnabledFields in interface ValuesContainer
      Returns:
      the read only or not enabled fields registered into the values container.
    • registerReadOnlyAndNotEnabledField

      public void registerReadOnlyAndNotEnabledField(String fieldName, Control c)
      Description copied from interface: ValuesContainer
      Register into the valuesContainer a read only or a not enabled field.
      Registering a ro or a not enabled field means that this field won't be configurable and it will be seeked from the server at every submit.
      Specified by:
      registerReadOnlyAndNotEnabledField in interface ValuesContainer
      Parameters:
      fieldName - The name of the field
      c - The field.
    • contentChanged

      public void contentChanged()
      Implements the ContentChangeListener interface. It calls the Component.changed() method.
      Specified by:
      contentChanged in interface ContentChangeListener
    • dragDrop

      public void dragDrop(DragDrop.Part source, DragDrop.Part destination, boolean moving)
      Implements the DraggableDroppable interface. It is the method that implements the operation of drag and drop on the same object. In the case of the form the method is empty because this kind of interaction is not useful
      Specified by:
      dragDrop in interface DraggableDroppable
      Parameters:
      source - The source object, from where we are dragging
      destination - The destination object, where we are dropping
      moving - true if the operation removes the values dragged from the source (like a cut operation), false otherwise (like a copy operation)
    • drag

      public Object drag(DragDrop.Part source) throws DragDropException
      Implements the DraggableDroppable interface. It is the method that implements the operation of drag from the form
      Specified by:
      drag in interface DraggableDroppable
      Parameters:
      source - The form element from which we are dragging
      Returns:
      The values of the form that we are dragging
      Throws:
      DragDropException - If an error occurs during the drag operation, a DragDropException is raised
    • dragged

      public void dragged(DragDrop.Part source, DragDrop.Part destination, Object dragged, boolean moved) throws DragDropException
      Implements the DraggableDroppable interface. It is the method called when the object is dropped
      Specified by:
      dragged in interface DraggableDroppable
      Parameters:
      source - The source object, from which we are dragging
      destination - The destination object, the form element on which we are dropping
      dragged - The object that we want to drop on the form
      moved - true if the operation removes the values dragged from the source (like a cut operation), false otherwise (like a copy operation)
      Throws:
      DragDropException - f an error occurs during the operation, a DragDropException is raised
    • drop

      public Object drop(DragDrop.Part source, DragDrop.Part destination, Object toDrop) throws DragDropException
      Implements the DraggableDroppable interface. It is the method that implements the operation of drop on the form
      Specified by:
      drop in interface DraggableDroppable
      Parameters:
      source - The source object, from which we are dragging
      destination - The destination object, the form element on which we are dropping
      toDrop - The object that we want to drop on the form
      Returns:
      The object dropped, or null if the operation of drop is not possible
      Throws:
      DragDropException - If an error occurs during the drop operation, a DragDropException is raised
    • setENTITY

      public void setENTITY(String s)
      Sets the entities related to this form
      Parameters:
      s - The list of the entities separated by a comma
    • getEntities

      public Set<String> getEntities()
      Description copied from interface: EntityContainer
      Gets the collected entities fo the container
      Specified by:
      getEntities in interface EntityContainer
      Returns:
      The collected entities
    • collectEntities

      public void collectEntities(String[] entities)
      Description copied from interface: EntityContainer
      Collects all the entities related to the container
      Specified by:
      collectEntities in interface EntityContainer
      Parameters:
      entities - The entities to collect
    • buildSetupScript

      public void buildSetupScript(StringBuilder sb)
      Every component can add a script to the StringBuilder, script executed when the component is created The method add the script that controls the validity of the fields of the form
      Overrides:
      buildSetupScript in class Component
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • registerValidator

      public void registerValidator(String name, ValueValidator vv)
      Description copied from interface: ValuesContainer
      registers a validator for valuesthat will arrive
      Specified by:
      registerValidator in interface ValuesContainer
      Parameters:
      name - the name of the validator, that is the name of the arriving variable or the name concatenated with an _* if the variabile is an indexed variable
      vv - the validator instance
    • getEntityValidator

      public EntityValidator getEntityValidator()
      Description copied from interface: EntityContainer
      Gets the EntityValidator related to the container.
      Specified by:
      getEntityValidator in interface EntityContainer
      Returns:
      The EntityValidator related to the container.
    • registerSeek

      public void registerSeek(String name)
      Description copied from interface: ValuesContainer
      registers a validator for values that will arrive
      Specified by:
      registerSeek in interface ValuesContainer
      Parameters:
      name - the name of a field that must be seeked in every values validation
    • removeFromSeek

      public void removeFromSeek(String name)
      Description copied from interface: ValuesContainer
      remove a validator from the values that will arrive
      Specified by:
      removeFromSeek in interface ValuesContainer
      Parameters:
      name - the name of a field that won't be seeked anymore
    • seek

      protected void seek(String name, Set validated) throws ValidationException
      Throws:
      ValidationException
    • validateValues

      public void validateValues(Map arriving, boolean strong)
      Description copied from interface: ValuesContainer
      validate the arriving values against the regisgtered validators
      Specified by:
      validateValues in interface ValuesContainer
      Parameters:
      arriving - the values that has been pisted through an event
      strong - if true the values validaton needs to be complete, otherwise only the validations to avoid tampering of parameters must be executed
    • sanitizeValues

      public void sanitizeValues()
      Description copied from interface: ValuesContainer
      Sanitize collected values by removing those that should not be kept in memory/session (e.g. UpFiles)
      Specified by:
      sanitizeValues in interface ValuesContainer