Class Button

All Implemented Interfaces:
Serializable, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Badgeable, Hideable, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable
Direct Known Subclasses:
ExitButton, ResetButton, SubmitButton

@Component public class Button extends Control implements Hideable
The class extends Control and implements the button, the user interface element that allows to throw events.
See Also:
GCApi:
component
  • Field Details

    • _type

      protected String _type
    • _visible

      protected SetPredicate _visible
    • _rovisible

      protected SetPredicate _rovisible
    • _blankvisible

      protected SetPredicate _blankvisible
    • _lastshow

      protected boolean _lastshow
    • _labelName

      protected String _labelName
    • _msg

      protected String _msg
    • _prompt

      protected String _prompt
    • promptEmpty

      protected boolean promptEmpty
    • _param

      protected String _param
    • _anchor

      protected String _anchor
    • _htmlid

      protected String _htmlid
    • _form

      protected String _form
  • Constructor Details

    • Button

      public Button()
  • Method Details

    • setMSG

      public void setMSG(String s)
      Sets the string that appears as a message for the event associated to the Button.
      If there is a message, when the user clicks the Button a javascript alert will appear, containing the message and two buttons; by pressing one of the two the event will be triggered, while pressing the other will not. Therefore usually this alert is used to request confirmation of proceeding to the user.
      Using this method the message will be translated by the Teacher.
      Parameters:
      s - A string that represents the message contained in the alert that will appears when the user clicks the Button
    • setPROMPT

      public void setPROMPT(String s)
      Sets the string that appears as a prompt message for the event associated to the Button.
      If there is a prompt, when the user clicks the Button a javascript alert will appear, containing a message (that is the prompt string set with this method), an input field that the user can edit, and two buttons; by pressing one of the two, the event will be triggered, while pressing the other will not. If the event is triggered, it will receives in the HashGetter an entry with key: "prompt", and value: the string that the user has inserted into the input field of the alert. Therefore usually this alert is used to request confirmation of proceeding to the user, that can also insert a parameter, that will be managed by the event.
      Using this method the prompt message will be translated by the Teacher.
      Parameters:
      s - A string that represents the message contained in the alert that will appears when the user clicks the Button
    • setPROMPTEMPTY

      public void setPROMPTEMPTY(String s)
      Sets if the value returned by the prompt can be an empty string ""
      Parameters:
      s - true if you want to allow to return an empty value by the prompt, false otherwise.
    • setPARAM

      public void setPARAM(String s)
      Sets a parameter that will be passed to the event associated to the Button.
      If there is a param, when the event is triggered it will receives in the HashGetter an entry with key: "param", and value: the string set with this method. The parameter can therefore be managed by the event.
      Parameters:
      s - A string that represents the parameter passed to the event triggered by the Button
    • setANCHOR

      public void setANCHOR(String s)
      Defines the name of the anchor that is used to reposition the scrolling of the page following the execution of the event associated with the button. The name must correspond to the value of a reference attribute of a Grid or a Section, set using the appropriate set methods (Grid.setREF(java.lang.String), Section.setREF(java.lang.String)).
      The relocation mechanism works only with non-Ajax events, the ones that reload the page.
      Parameters:
      s - The name of the anchor
    • setHTMLID

      public void setHTMLID(String s)
      Sets forcibly the id that will be associated to the button, instead of the one generated by the Component.generateId()
      Parameters:
      s - The string that represents the id
    • setFORM

      public void setFORM(String s)
      Sets the reference to a specific Form element.
      It is possible to position the Button outside of a form, but still allow the submission of the values of a referenced form by setting it, using this method. If the Button is in a form, then also setting this attribute, the submitted values will be those of the form to which the Button belongs.
      Parameters:
      s - The registryname (Component.setREGISTRYNAME(java.lang.String)) of the Form
    • setDEFAULT

      public void setDEFAULT(String s)
      Defines if the Button is the default one, ie is of type SUBMIT and is the one activated when the user press the Enter key of the keyboard. If there is more than one SUBMIT buttons, then when the user press the Enter key, it will be activated the first that appears in the DOM.
      Parameters:
      s - true if the Button must be the default one, false otherwise
    • setVISIBLE

      public void setVISIBLE(String s)
      Sets the visibility of the Button
      Specified by:
      setVISIBLE in interface Hideable
      Parameters:
      s - true if the Button will be visible, false otherwise, or a name of a function used to determine visibility (see isVisible())
    • getVISIBLE

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

      public void setROVISIBLE(String s)
      Sets the visibility of the Button when it readonly state is true
      Parameters:
      s - true if the Button will be visible when read only, false otherwise, or a name of a function used to determine visibility (see isVisible())
    • setBLANKVISIBLE

      public void setBLANKVISIBLE(String s)
      Sets the visibility of the Button when it blank state is true
      Parameters:
      s - true if the Button will be visible when in blank state, false otherwise, or a name of a function used to determine visibility (see isVisible())
    • setLASTSHOW

      public void setLASTSHOW(String s)
      Sets the visibility of the Button when the Window that contains it is the last one of the stack
      Parameters:
      s - true if the Button will be visible when the window that contains it is the last one of the stack, false otherwise
    • isVisible

      public boolean isVisible()
      Checks the visibility of the Button, based on the set parameters (setVISIBLE(java.lang.String), setROVISIBLE(java.lang.String), setBLANKVISIBLE(java.lang.String)) and the status. See getBoolean(visible,id,true))
      Specified by:
      isVisible in interface Hideable
      Returns:
      true if the Button is visible, false otherwise
    • setLABELNAME

      public void setLABELNAME(String s)
      Sets the name of the field used to retrieves the label that will appear in the Button;
      Parameters:
      s - The string that defines the label for the Button
    • validate

      protected void validate(org.apache.ecs.html.Button b, EntitySet es, boolean ro)
    • prepareLabel

      protected String prepareLabel()
    • prepareName

      protected String prepareName()
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es)
      Returns the html code of the Button
      Specified by:
      getHtml in class Component
      Parameters:
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the Button
    • setMsg

      public void setMsg(String s)
      Sets programmatically the string that appears as a message for the event associated to the Button.
      Using this method the message will not be translated by the Teacher.
      See setMSG(java.lang.String) for the meaning of the attribute.
      Parameters:
      s - A string that represents the message contained in the alert that will appears when the user clicks the Button
    • setPrompt

      public void setPrompt(String s)
      Sets programmatically the string that appears as a prompt message for the event associated to the Button.
      Using this method the message will not be translated by the Teacher.
      See (java.lang.String) for the meaning of the attribute.
      Parameters:
      s - A string that represents the prompt message contained in the alert that will appears when the user clicks the Button
    • isImportant

      public boolean isImportant()
      Gets if this Button is important or not. A Button object is considered important if it is not visible.
      Overrides:
      isImportant in class Control
      Returns:
      true if this Inout is important, false otherwise.
    • areVisibleAttrsBasedOnFunction

      public boolean areVisibleAttrsBasedOnFunction()
      Gets if the visible attribute is based on a function instead of a boolean value.
      Returns:
      true if the read only attribute is based on a function instead of a boolean value, false otherwise.