Class StaticText


public class StaticText extends Component<StaticText>

Static text component

The component writes the static text to the HTML DOM. This component doesn't handle any events.

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • StaticText

      public StaticText(String text)
      Creates a static text component with the specified text
      Parameters:
      text - The text content that will be placed in the HTML DOM
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
  • Method Details

    • getText

      public String getText()
      Gets the static text content
      Returns:
      The static text content or null, if no text is found
    • setText

      public StaticText setText(String text)
      Sets the Static text
      Parameters:
      text - The text content that will be placed in the HTML DOM
      Returns:
      The static text component
    • addComponent

      public StaticText addComponent(Component component)
      The Static Text component cannot have any other components assigned to it.
      Overrides:
      addComponent in class Component<StaticText>
      Parameters:
      component - The component to be added
      Returns:
      The component
      Throws:
      UnsupportedOperationException - In every case
    • setEnabled

      public StaticText setEnabled(boolean enabled)
      The static text cannot be disabled, this method doesn't do anything.
      Overrides:
      setEnabled in class Component<StaticText>
      Parameters:
      enabled - true, the component is enabled, otherwise it's disabled
      Returns:
      The static text component
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<StaticText>
      Returns:
      If the componentwas drawn, true, otherwise false
    • redraw

      public StaticText redraw()
      Redraws the component.

      All changes on the components, (even after drawing) are applied automatically. So for this reason, the components don't have to be redrawn. However, sometimes it is necessary to redraw the entire component. If this method is used, the component and all of its subcomponents will be re-sent to the client-side and the components will be re-initialized, a process that can take a significant amount of time, not to mention burden the communication channels. The use of this method for these reasons is not recommended.

      Overrides:
      redraw in class Component<StaticText>
      Returns:
      The component
    • getId

      public String getId()
      Static text display component. There is no ID assigned for the component.
      Overrides:
      getId in class Component<StaticText>
      Returns:
      Empty string