Class Component

All Implemented Interfaces:
Serializable, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Identified, Tool
Direct Known Subclasses:
AreaTitle, BrowserCache, CardField, CardIcon, CardLayout, Control, Drag, Frame, Html, Image, JFCStyle, Layout, LoadScript, Matrix, StringHelper, UIAssert

public abstract class Component extends UINode implements Identified, overit.geocall.marks.NameExposer, overit.geocall.marks.MethodExposer, Tool
This is an abstract class that must be extended to implements an user interface element. The purpose of this class is to provide the methods and behaviours of a generic user interface element, no matter if it?s target is to provide a simple graphic decoration or must manage a complex user interaction.
See Also:
  • Field Details

    • _basic

      protected boolean _basic
    • BR

      protected static final String BR
      See Also:
    • ELEMENT_BR

      protected static final org.apache.ecs.Element ELEMENT_BR
    • ELEMENT_NULL

      protected static final org.apache.ecs.Element ELEMENT_NULL
    • _currentId

      protected static long _currentId
    • _gridcols

      protected int _gridcols
    • _gridrows

      protected int _gridrows
    • _gridalign

      protected char _gridalign
    • _gridvalign

      protected char _gridvalign
    • fullHeight

      protected boolean fullHeight
    • defaultHidden

      protected SetPredicate defaultHidden
    • configHidden

      protected boolean configHidden
    • extendedField

      protected boolean extendedField
    • aliasField

      protected boolean aliasField
    • important

      protected Boolean important
    • layoutLabel

      protected String layoutLabel
    • safeInlineService

      protected SafeInlineService safeInlineService
    • PIXEL_IMG

      public static final String PIXEL_IMG
      Defines the pixel image html element
      See Also:
    • _registryName

      protected String _registryName
    • _parentContainer

      protected Container _parentContainer
    • _valuesContainer

      protected ValuesContainer _valuesContainer
    • entityContainer

      protected EntityContainer entityContainer
    • _childrenContainers

      protected ArrayList _childrenContainers
    • _name

      protected String _name
    • _layoutName

      protected String _layoutName
    • _label

      protected String _label
    • _keylabel

      protected String _keylabel
    • labelInLine

      protected boolean labelInLine
    • configuredLabelInLine

      protected Boolean configuredLabelInLine
    • configuredLabel

      protected String configuredLabel
    • _shortcut

      protected String _shortcut
    • _iconElement

      protected IconHD _iconElement
    • _id

      protected String _id
    • _tabindex

      protected int _tabindex
    • entityName

      protected String entityName
    • _transformations

      protected static HashMap _transformations
  • Constructor Details

    • Component

      public Component()
      Main constructor
  • Method Details

    • setGRIDCOLS

      public void setGRIDCOLS(String s)
      Sets the number of the columns of the grid, used for positioning, that the component will fill
      Parameters:
      s - The number of the columns
    • setGRIDROWS

      public void setGRIDROWS(String s)
      Sets the number of the rows of the grid, used for positioning, that the component will fill
      Parameters:
      s - The number of the rows
    • setGRIDALIGN

      public void setGRIDALIGN(String s)
      Sets the horizontal alignment of the component within the grid's cell.
      Parameters:
      s - use the letter "l" to obtain a component aligned at the left;
      use the letter "c" to obtain a component aligned at the center;
      use the letter "r" to obtain a component aligned at the right
    • setGRIDVALIGN

      public void setGRIDVALIGN(String s)
      Sets the vertical alignment of the component within the grid's cell.
      Parameters:
      s - use the letter "t" to obtain a component aligned at the top;
      use the letter "m" to obtain a component aligned at the middle;
      use the letter "b" to obtain a component aligned at the bottom
    • getGridCols

      public int getGridCols()
      Returns the number of the columns of the grid, used for positioning, that the component fills
      Returns:
      The number of the columns that the component fills
    • getGridRows

      public int getGridRows()
      Returns the number of the rows of the grid, used for positioning, that the component fills
      Returns:
      The number of the rows that the component fills
    • getGridAlign

      public char getGridAlign()
      Returns the horizontal alignment of the component within the grid's cell.
      Returns:
      "l" if the componentis aligned at the left;
      "c" if the component is aligned at the center;
      "r" if the component is aligned at the right
    • getGridVAlign

      public char getGridVAlign()
      Returns the vertical alignment of the component within the grid's cell.
      Returns:
      "t" if the componentis aligned at the top;
      "m" if the component is aligned at the middle;
      "b" if the component is aligned at the bottom
    • setBASIC

      public void setBASIC(String s)
    • getBASIC

      public boolean getBASIC()
    • setFULLHEIGHT

      public void setFULLHEIGHT(String s)
      Sets the vertical size of the component to fullsize. So, when it is sets to true, the height of the component will occupy all the space possible
      Parameters:
      s - String containing the boolean value to enable fullsize mode or not.
    • getFullHeight

      public boolean getFullHeight()
      Gets if the vertical size of the component is set to full height or not.
      Returns:
      true if the vertical size of the component is set to full height, false otherwise.
    • generateFlexableFullHeightContainer

      protected String generateFlexableFullHeightContainer()
    • setDEFAULTHIDDEN

      public void setDEFAULTHIDDEN(String s)
      Sets if the component is hidden by default or not.
      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
    • isDefaultHidden

      public boolean isDefaultHidden()
      Gets if the component is hidden by default or not.
      Attribute to use in combination with ResponsiveGrid with a name and editable attribute set to true.
      Returns:
      true if the component is hidden by default or false otherwise.
    • setIMPORTANT

      public void setIMPORTANT(String s)
      Sets if the component is an important component or not.
      If a component is important it cannot be hidden via configurability and it will be validated into the seek validation phase after a submit to the server.
      Otherwise, if the component is not important, no matter what kind of component it is (not null, hidden etc), it will be possible to hide and shows up it via configurability and the seek validation phase won't validate it after a submit.
      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
    • isImportant

      public boolean isImportant()
      Gets if the component is important or not. A Component object is considered important if has a registryName attribute set.
      Returns:
      true if the component is important, false otherwise.
    • setConfigHidden

      public void setConfigHidden(boolean b)
      Sets if the component is hidden by configurability or not. This attribute cannot be set from xml, and it's used only programmatically to define if the component must be hidden by the user interface or not. It's based upon the defaultHidden attribute concept, taking into account if the component is an important component or not.
      Parameters:
      b - true or false
    • isConfigHidden

      public boolean isConfigHidden()
      Gets if the component is hidden by configurability or not. This attribute cannot be set from xml, and it's used only programmatically to define if the component must be hidden by the user interface or not. It's based upon the defaultHidden attribute concept, taking into account if the component is an important component or not.
      Returns:
      true if the component is hidden by default or false otherwise.
    • setExtendedField

      public void setExtendedField(boolean b)
      Sets if the component is an extended component or not. Default value is false
      A component is an extension field when is created starting from the EDM (Extensible Data Model) and it is inserted into the page using the configurability.
      Parameters:
      b - true or false
    • isExtendedField

      public boolean isExtendedField()
      Gets if the component is an extended component or not. A component is an extension field when is created starting from the EDM (Extensible Data Model) and it is inserted into the page using the configurability.
      Returns:
      true if the component is an extension or false otherwise.
    • setAliasField

      public void setAliasField(boolean b)
      Sets if the component is an alias extended component or not. Default value is false
      A component is an alias field when is created to being an alter ego of another existing field (either static or extended).
      The Alias fields are used, for example, to define a range filter criterion allowind the user to duplicate the original field and defining a range of filter criteria.
      Parameters:
      b - true or false
    • isAliasField

      public boolean isAliasField()
      Gets if the component is an alias extended component or not. Default value is false
      A component is an alias field when is created to being an alter ego of another existing field (either static or extended).
      The Alias fields are used, for example, to define a range filter criterion allowind the user to duplicate the original field and defining a range of filter criteria.
      Returns:
      true if the component is an alias or false otherwise.
    • isActive

      public boolean isActive()
      + Gets if the component is active or not.
      If the user cannot view an extended attribute the field will be disabled and so not active.
      The field's value will be not submitted to the server.
      Returns:
      true if the field is active, false otherwise.
    • setActive

      public void setActive(boolean active)
      Sets if the component is active or not.
      If the user cannot view an extended attribute the field will be disabled and so not active.
      The field's value will be not submitted to the server.
      Parameters:
      active - True or false.
    • isActivable

      public boolean isActivable()
      Gets if the component can be activated (on the UI side) when is disabled.
      If the user cannot view an extended attribute but could edit it an edit icon will appear inside the field to give to the user the possibility to activate and edit the field.
      The field will be submitted to the servir if activated.
      Returns:
      true if the field is activable, false otherwise.
    • setActivable

      public void setActivable(boolean activable)
      Sets if the component can be activated (on the UI side) when is disabled.
      If the user cannot view an extended attribute but could edit it an edit icon will appear inside the field to give to the user the possibility to activate and edit the field.
      The field will be submitted to the servir if activated.
      Parameters:
      activable - True or false.
    • setLAYOUTLABEL

      public void setLAYOUTLABEL(String s)
      Sets the label that will be used into the configuration panel to identify this component. If a component doesn't have a label set, it will be displayed without a label into the user interface, but to identify it into the configuration panel will be possible to use this attribute without changing the component behavior into the user interface.
      Attribute to use in combination with ResponsiveGrid with a name and editable attribute set to true.
      Parameters:
      s - the string that will appear into configuration panel for this component
    • getLayoutLabel

      public String getLayoutLabel()
      Gets the label that will be used into the configuration panel to identify this component. If a component doesn't have a label set, it will be displayed without a label into the user interface, but to identify it into the configuration panel will be possible to use this attribute without changing the component behavior into the user interface.
      Returns:
      The label that will appear into configuration panel for this component
    • getDefaultLayoutLabel

      public String getDefaultLayoutLabel()
    • getDefaultLabel

      public String getDefaultLabel()
      Gets the label set as default, before the configurability.
      It can be set into the xml or into the model properties for EDM dynamics fields.
      Returns:
      the label set as default
    • generateId

      public String generateId()
      Generates an unique identifier string for the component
      Returns:
      The unique identifier string of the component
    • getId

      public String getId()
      Returns the unique identifier string of the component (if it's null it generates it with generateId())
      Returns:
      The unique identifier string of the component
    • getBoolean

      protected static boolean getBoolean(String s, boolean def)
      Returns the boolean value that corresponds to the string passed as first parameter. If the string is not recognized as a boolean value ("true" or "1", "false" or "0"), it will be returned the default boolean value, passed as second parameter
      Parameters:
      s - The string that defines the boolean value
      def - The default boolean value
      Returns:
      s The boolean value that corresponds to the string, or the default one
    • getBoolean

      protected static boolean getBoolean(String value, Identity id, boolean def)
      Extension of the behaviour of the getBoolean(String, boolean) method that allows to check the presence of the value inside the sets of functions of the Identity
      Parameters:
      value - A string that represents a boolean value, or a function. If the string starts with ! the search logic of the function is reversed
      id - identity The Identity of the user
      def - The default boolean value
      Returns:
      The boolean value that corresponds to the string if the string is recognized as a boolean; if the string is null or an empty string, the method returns the default value. In every other cases, the method checks if the Identity has the function defined by the value parameter and returns true if it has it, or false otherwise (if the search logic is reversed, the output will be the opposite)
    • getint

      protected static int getint(String s, int def)
    • stringForJs

      public static String stringForJs(String s)
      Returns a processed "safe for JavaScript" version of the string
      Parameters:
      s - The string that must be processed
      Returns:
      The same string passed as parameter in which any character ' have been replaced by characters \'
    • deprecate

      protected void deprecate(String methodname)
    • calcLabel

      public static String calcLabel(String s)
      Returns the label processed to remove any @ character.
      The character is used to indicate the shortcut to the component; by simultaneously pressing ALT and the letter of the label following the @ character, the component will become active (the input will be focused, the form of a multiform will be the active one, etc.)
      Parameters:
      s - The label of the component
      Returns:
      The label without the @ character, or null if the label was null
    • calcShortcut

      public static String calcShortcut(String s)
      Returns the character that defines the shortcut for the label (the one that follows the @ character, if present). See calcLabel(String)
      Parameters:
      s - The label of the component
      Returns:
      The character that defines the shortcut, or null if not present
    • calcKeyLabel

      public static String calcKeyLabel(String s)
      Returns the label in which the shortcut letter (the one that follows the @ character, see calcLabel(String)) is underlined to emphasize it and highlight to the user which letter is to be pressed to use the shortcut
      Parameters:
      s - The label of the component
      Returns:
      The label with the shortcut letter emphasized
    • getHtmlLabel

      public org.apache.ecs.html.Label getHtmlLabel(String label, boolean notnull, boolean nowrap, boolean basic, String forx)
      Returns the Label element, i.e. the html code of the component's label
      Parameters:
      label - The string that defines the label
      notnull - true if the component needs to be valued when you make a submit action, false otherwise. When this attribute is true a particular class of style is assigned to the label to show the user that the component must have a value before the submit
      nowrap - true if the label cannot be wrapped, false otherwise
      basic - true for legacy visualization mode, false (default) otherwise
      forx - The name of the Component to which the label is associated
      Returns:
      The Label element, or null if the label passed as parameter was null or an empty string
    • getHtmlLabel

      public org.apache.ecs.html.Label getHtmlLabel(String label, boolean notnull, boolean nowrap, boolean basic, String forx, String className)
      Returns the Label element, i.e. the html code of the component's label
      Parameters:
      label - The string that defines the label
      notnull - true if the component needs to be valued when you make a submit action, false otherwise. When this attribute is true a particular class of style is assigned to the label to show the user that the component must have a value before the submit
      nowrap - true if the label cannot be wrapped, false otherwise
      basic - true for legacy visualization mode, false (default) otherwise
      forx - The name of the Component to which the label is associated
      className - Css style class to add to the label element
      Returns:
      The Label element, or null if the label passed as parameter was null or an empty string
    • isLabelInLine

      protected boolean isLabelInLine()
      Gets the real labelInLine value to apply.
      This method returns the value of the attribute based on if there is a user customization on the labelInLine attribute. If there is no customization returns the default value.
      Returns:
      the real labelInLine value to apply
    • setLABELINLINE

      public void setLABELINLINE(String s)
      Defines if the label of the component can be wrapped or not
      Parameters:
      s - true if the label can be wrapped, false otherwise
    • setICON

      public void setICON(String icon)
      Sets the icon associated to the component
      Parameters:
      icon - It can be the icon's path, the thematic icon's name or an svg element
    • setREGISTRYNAME

      public void setREGISTRYNAME(String s)
      Sets the string used to retrieve the component instance within the Java classes. This reference must be unique within every XML file that user has navigated before to reach the page related to this XML. So pay attention to not specify generic values (something like "form", "field", etc.) in order to avoid possible conflicts and unwanted behaviours
      Parameters:
      s - The string used to retrieve the component instance
    • getRegistryName

      public String getRegistryName()
      Gets the component's registry name if component has it.
      Returns:
      The component's registry name if exists, null otherwise.
    • getIcon

      public Icon getIcon()
      Returns the IconHD associated to the component
      Returns:
      The icon associated to the component
    • getIdentity

      public Identity getIdentity()
      Returns the Identity associated to the component
      Specified by:
      getIdentity in interface Identified
      Returns:
      The Identity of the user currently logged in the application
    • setIdentity

      public void setIdentity(Identity identity)
      Sets the Identity to the component
      Specified by:
      setIdentity in interface Identified
      Parameters:
      identity - The Identity that must be associated to the component
    • getParentComponent

      public Component getParentComponent()
      Returns the parent Component
      Returns:
      The parent Component
    • getValuesContainer

      public ValuesContainer getValuesContainer()
      Returns the ValuesContainer of the Componentt. If the Component is an instance of ValuesContainer itself, like for example a Form, then the pointer to itself will be returned
      Returns:
      The ValuesContainer
    • setValuesContainer

      public void setValuesContainer(ValuesContainer valuesContainer)
      Sets the ValuesContainer for the Component.
      Parameters:
      valuesContainer - The ValuesContainer to set
    • getEntityContainer

      public EntityContainer getEntityContainer()
      Returns the EntityContainer of the Componentt. If the Component is an instance of EntityContainer itself, like for example a Form, then the pointer to itself will be returned
      Returns:
      The EntityContainer
    • componentIterator

      public Iterator componentIterator()
      Returns an Iterator over the collection of the childrens of the Component
      Returns:
      The Iterator used to iterate over the childrens of the Component
    • getChildrenComponents

      public ArrayList getChildrenComponents()
      Returns the children components of the Component
      Returns:
      The ArrayList of the childrens of the Component
    • componentSize

      public int componentSize()
      Returns the size, i.e. the number of childrens of the Component
      Returns:
      The number of childrens of the Component
    • setNAME

      public void setNAME(String s)
      Sets the name of the component.
      During the submit actions, the Input objects depends on the value of this attribute to add the parameter at the form values; for this reason, this attribute is mandatory for every Input component
      Parameters:
      s - The name of the component, used for the submit actions
    • getNAME

      public String getNAME()
      Returns the name of the component (see setNAME(String))
      Returns:
      The name of the component
    • setLAYOUTNAME

      public void setLAYOUTNAME(String stateName)
      Sets the layoutName, the name used for layout purpose such the dragging and dropping of the column for repositioning. To make the repositioning mechanism work, the names of the columns must be all different; if there are cases of homonymy, the layoutName can be introduced, so that the columns can be differentiated.
      Parameters:
      stateName - The name used for layout purpose
    • getLayoutName

      public String getLayoutName()
      Returns the layoutName, the name used for layout purpose such the dragging and dropping of the column for repositioning
      Returns:
      The string that corresponds to the layoutName of the column
    • setLABEL

      public void setLABEL(String s)
      Sets the label of the component; the label position depends on the type of the component, and on the positioning grid used. Usually it contains a short description that helps the user to understand the meaning of the component (what is the use of the component, what the component contains, etc.)

      The label can contain the @ character, used to define the shortcut to the component; by simultaneously pressing ALT and the letter of the label following the @ character, the component will become active (the input will be focused, the form of a multiform will be the active one, etc.)

      Using this method the label will be translated by the Teacher

      Parameters:
      s - The string that defines the label of the component
    • setLabel

      public void setLabel(String s)
      Sets the label of the component; the label position depends on the type of the component, and on the positioning grid used. Usually it contains a short description that helps the user to understand the meaning of the component (what is the use of the component, what the component contains, etc.).
      Using this method the label will not be translated.
      Parameters:
      s - The string that defines the label of the component
    • getLABEL

      public String getLABEL()
      Returns the label of the component
      Returns:
      The string that defines the label of the component
    • getKEYLABEL

      public String getKEYLABEL()
      Returns the key label of the component
      Returns:
      The string that defines the label of the component
    • getSHORTCUT

      public String getSHORTCUT()
      Returns the shortcut of the component i.e. the character that follows the @ character. By simultaneously pressing ALT and the letter of the label following the @ character, the component will become active (the input will be focused, the form of a multiform will be the active one, etc.)
      Returns:
      The character used as the shortcut for the component
    • containerIterator

      public Iterator containerIterator()
      Returns an Iterator over the collection of children containers of the Component
      Returns:
      The iterator over the children containers
    • getChildrenContainers

      public ArrayList getChildrenContainers()
      Returns the collection of children containers of the Component
      Returns:
      The ArrayList of children containers
    • getParentContainer

      public Container getParentContainer()
      Returns the parent Container of the Component
      Returns:
      The parent Container
    • getWindow

      public Window getWindow()
      Returns the Window that contains the Component
      Returns:
      The Window that contains the Component
    • getHtml

      public abstract org.apache.ecs.Element getHtml(EntitySet es)
      Abstract method that must be extended and returns the html code of the Component
      Parameters:
      es - The EntitySet to which the element belongs
      Returns:
      The html of the Component
    • getPublishedChildrenList

      public List getPublishedChildrenList()
      Returns the published childs. Those that are not published are not even searched to be synchronized via Ajax
      Returns:
      The List of published childs
    • buildSetupScript

      public void buildSetupScript(StringBuilder sb)
      Every component can add a script to the StringBuilder, script executed when the component is created.
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • buildDisplayScript

      public void buildDisplayScript(StringBuilder sb)
      Every component can add a script to the StringBuilder, script executed when the component is displayed.
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • fillSetupScript

      public void fillSetupScript(StringBuffer sb)
      Deprecated.
      Use buildSetupScript(). Remains only for backward compatibility with legacy objects created to work both on geocall 4 and following versions
      Parameters:
      sb - buildSetupScript().
    • setup

      protected void setup()
      Setup the Component
    • connect

      protected void connect()
    • onInit

      public void onInit(Container parent)
      Initilizes the Component and all its childs
      Parameters:
      parent - The parent Container of the Component
    • initChilds

      public void initChilds(Container parent)
      Call the onInit(Container) method of all the childrens (see UINode.getChildren()) of the Component
      Parameters:
      parent - The component of which we want to initialize the children
    • tabIndexer

      public int tabIndexer(int from)
    • getTabIndex

      public final int getTabIndex()
    • getTeacher

      public Teacher getTeacher()
      Returns the Teacher, the object that manages the translations
      Returns:
      The Teacher that manages the translations
    • getEntityName

      public String getEntityName()
      Returns the entity that will be used to validate the extended field. If this component is not an EDM component, no entity will be set
      Returns:
      The entity that will be used to validate the extended field, If this component is not an EDM component, null.
    • setEntityName

      public void setEntityName(String entity)
      Sets the entity that will be used to validate the extended field. If this component is not an EDM component, no entity must be set
      Parameters:
      entity - The entity to set.
    • ajaxQuery

      public void ajaxQuery(HttpServletRequest request, HttpServletResponse response)
      Method that must be extended to implements the Ajax interaction request / response logic for the Component
      Parameters:
      request - HttpServletRequest
      response - HttpServletResponse
    • changed

      public void changed()
      Defines the morphing of the component that occurs when there is an Ajax interaction
    • createAjaxFrame

      public org.apache.ecs.ConcreteElement createAjaxFrame()
    • appendAttribute

      public static void appendAttribute(org.apache.ecs.ElementAttributes element, String attribute, String value)
      Utility method that appends the desired value to an attribute of the element. If the attribute is not already present for the element, then it is added and set up with the value passed as a parameter
      Parameters:
      element - The element
      attribute - The attribute to which add the value (if the attribute is not present, it will be added)
      value - The value to append to the attribute
    • adapt

      public static String adapt(String icon)
    • setTooltip

      public void setTooltip(org.apache.ecs.ElementAttributes el, String content)
      Sets the tooltip attribute on element.
      Parameters:
      el - The Element on which add the attribute tooltip
      content - The content of the tooltip attribute.
    • clearConfiguredProperties

      public void clearConfiguredProperties()
      Clear the Collection of configured UI properties.
      This collection contains all the user UI properties customization applied to the component.
    • canBeConfigured

      public boolean canBeConfigured()
      Gets if the component is allowed to be configured or not.
      A configurable component is a component for which user can edit its UI properties into the configurability panels (Form and Tables).
      A component is configurable if it has the @Component.Configurable annotation and if its layout name or its name are not null.
      Returns:
      true if the component is allowed to be configured, false otherwise.