Class Layout

All Implemented Interfaces:
Serializable, Comparable<Layout>, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Identified, Tool

@Component public class Layout extends Component implements Comparable<Layout>
This component only takes effect within the ResponsiveGrid and defines the child component's arrangement, referencing it or via the corresponding LAYOUTNAME (as shown in the example) or, without this, via the NAME.
To visualize the components in line it is sufficient to define a layout by writing the LAYOUTNAME of the various components one after the other (the number of spaces inserted between a LAYOUTNAME and the other has no graphic effect, but allows to align the columns making them easier readable).

 <Layout>
     NAME SURNAME EMAIL
 </Layout>
 
To display them in Column it is sufficient to write the LAYOUTNAME of the various components one below the other

 <Layout>
     NAME
     SURNAME
     EMAIL
 </Layout>
 
Combining the two techniques it is possible to create a grid, possibly inserting empty cells using the dot character. The following example shows a 2x2 grid in which the first column of the second row is empty.

 <Layout>
     NAME SURNAME
     .    EMAIL
 </Layout>
 
It is possible for a component to occupy 2 or more columns / rows simply by repeating the LAYOUTNAME in 2 the more adjacent columns / rows. The following example presents a grid in which the email field occupies the two columns of the second row.

 <Layout>
     NAME  SURNAME
     EMAIL EMAIL
 </Layout>
 
See Also:
GCApi:
component
  • Field Details

  • Constructor Details

    • Layout

      public Layout()
  • Method Details

    • create

      protected static Layout create(Component parent, SimpleMatrix matrix)
    • createDefault

      protected static Layout createDefault(Component parent)
    • setSIZE

      public void setSIZE(String s)
      Indicates the maximum size of the workarea or viewport within which this layout is activated.
      Parameters:
      s - The accepted values ??are:
      • XL: the layout is activated for all window sizes (default)
      • LG: the layout is activated if the viewport / workarea does not exceed 1200px. Otherwise the XL layout is activated
      • MD: the layout is activated if the viewport / workarea does not exceed 992px. Otherwise the LG layout is activated
      • SM: the layout is activated if the viewport / workarea does not exceed 768px. Otherwise the MD layout is activated
      • XS: the layout is activated if the viewport / workarea does not exceed 567px. Otherwise the SM layout is activated
    • setMODE

      public void setMODE(String s)
      Indicates the alignment mode of the labels against the component.
      Parameters:
      s - The allowed values ??are:
      • arranging: the label is positioned to the left of the component (default)
      • control: the label is positioned above the component
    • getSize

      public Layout.Size getSize()
      Returns:
      the maximum size of the workarea or viewport within which this layout is activated.
    • getMode

      public Layout.Mode getMode()
      Returns:
      the alignment mode of the label against the component
    • setTarget

      public void setTarget(Layout.Target t)
      Indicates whether the layout should be chosen considering the size of the window rather than the workarea. In the first case, the grid will react only after resizing the browser window, while in the second case it will also on the TaskBar open/close.
      Parameters:
      t - The Layout.Target
    • setIsForSupport

      public void setIsForSupport(boolean b)
      Indicates whether the layout it's used for support reason only. An example is when layout is used to create and populate the SortableGridComponents.
      Parameters:
      b - true or false.
    • isForSupport

      public boolean isForSupport()
      Gets whether the layout it's used for support reason only. An example is when layout is used to create and populate the SortableGridComponents.
      Returns:
      true if is for support
    • setIsBasedOnXML

      public void setIsBasedOnXML(boolean b)
      Indicates whether the layout it's created starting from a programmatically xml definition or if it's has been added via configuration by the user.
      Parameters:
      b - true or false.
    • setHasDefaultBase

      public void setHasDefaultBase(boolean b)
      Indicates whether the layout has a default or not.
      Parameters:
      b - true or false.
    • isBasedOnXML

      public boolean isBasedOnXML()
      Gets if the layout it's created starting from a programmatically xml definition or if it's has been added via configuration by the user.
      Returns:
      true if is based on xml
    • hasDefaultBase

      public boolean hasDefaultBase()
      Gets if the layout has a default or not.
      Returns:
      true if is based on xml
    • setRealParentName

      public void setRealParentName(String s)
      Indicates the real ResponsiveGrid parent name for the component.
      This attribute will be used when the Layout will be used as a fake layout to populate the SortableGrid object and use the gridstack plugin to configure the grid layout. In that case the parent for the Layout will be a fake parent, so with this attribute it could be possible to hold trace of the real grid parent name.
      Parameters:
      s - The realParentName to set
    • getRealParentName

      public String getRealParentName()
      Gets The real grid parent name of the component.
      Returns:
      string of real grid parent name of the component
    • getSpacing

      public Layout.Spacing getSpacing()
      Returns the spacing of the Layout
      Returns:
      The Layout.Spacing
    • setSpacing

      public void setSpacing(Layout.Spacing s)
      Sets the spacing of the Layout.
      Parameters:
      s - The accepted values are:
      • control: standard spacing to use when components are Control (default)
      • container: increased spacing, to be used when the components are Containers
    • setCOLUMNSWIDTH

      public void setCOLUMNSWIDTH(String s)
      Sets a list of widths separated by a comma, for each column of the layout.
      The widths can be specified with any measurement unit allowed via css for the width attribute.
      Parameters:
      s - a list of widths separated by a comma, for each column of the layout
    • getAreas

      protected Collection<overit.geocall.basic.ui.control.Layout.Area> getAreas()
    • getArea

      protected overit.geocall.basic.ui.control.Layout.Area getArea(Component c)
    • getArea

      public overit.geocall.basic.ui.control.Layout.Area getArea(int column, int row)
    • getAreaComponent

      public Component getAreaComponent(String layoutName)
    • getRows

      protected int getRows()
    • getCols

      protected int getCols()
    • getMatrix

      protected SimpleMatrix getMatrix()
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es)
      Description copied from class: Component
      Abstract method that must be extended and returns the html code of the Component
      Specified by:
      getHtml in class Component
      Parameters:
      es - The EntitySet to which the element belongs
      Returns:
      The html of the Component
    • addChildText

      public void addChildText(String layout)
      Description copied from class: UINode
      Empty method
      Overrides:
      addChildText in class UINode
      Parameters:
      layout - Not used
    • addExtendedAttributesOnLayout

      public String addExtendedAttributesOnLayout(String l, ResponsiveGrid rg)
    • addUnknownStaticComponentOnLayout

      public String addUnknownStaticComponentOnLayout(String l)
    • hasUserConfigurations

      public boolean hasUserConfigurations()
      Gets if this Layout has a user's configuration, or not.
      This method it's used by ResponsiveGrid and ResponsiveGridFrame to know if they have to highlight the config icon or not in order to communicate to the user that the Grid is changed or not.
      Returns:
      if this Layout has a user's configuration, or not.
    • reloadLayout

      public void reloadLayout()
    • getDefaultLayout

      public String getDefaultLayout()
      Gets the default layout defined by xml or by the profile configuration.
      Returns:
      the default layout defined by xml or by the profile configuration.
    • setDefaultLayout

      public void setDefaultLayout(String s)
      Sets the default layout.
      Parameters:
      s - the default layout to set.
    • getStaticLayout

      public String getStaticLayout()
      Gets the static layout defined by xml.
      This layout may be equals to the default layout when there is no profile layout configuration set
      Returns:
      the static layout defined by xml.
    • setStaticLayout

      public void setStaticLayout(String s)
      Sets the static layout defined by xml for this layout.
      This layout may be equals to the default layout when there is no profile layout configuration set
      Parameters:
      s - the static layout defined by xml to set.
    • setup

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

      public String toString()
      Overrides:
      toString in class Object
    • getAsText

      public String getAsText()
      Gets the String representation of this layout
      Returns:
      the String representation of this layout
    • showOnlyDefinedAreas

      protected void showOnlyDefinedAreas(StringBuilder builder)
    • alignDescriptions

      protected void alignDescriptions(StringBuilder builder)
    • createSideLabelGridTemplate

      protected void createSideLabelGridTemplate(StringBuilder builder, overit.geocall.basic.ui.control.Layout.AreaMetadata metadata)
    • createSideLabelGridTemplateForIE

      protected void createSideLabelGridTemplateForIE(StringBuilder builder, overit.geocall.basic.ui.control.Layout.AreaMetadata metadata)
    • createTopLabelGridTemplate

      protected void createTopLabelGridTemplate(StringBuilder builder, overit.geocall.basic.ui.control.Layout.AreaMetadata metadata)
    • createTopLabelGridTemplateForIE

      protected void createTopLabelGridTemplateForIE(StringBuilder builder, overit.geocall.basic.ui.control.Layout.AreaMetadata metadata)
    • toAreaName

      protected String toAreaName(String s)
    • createLayout

      protected void createLayout(SimpleMatrix matrix)
    • createLayout

      public void createLayout(String definition)
    • createArea

      protected overit.geocall.basic.ui.control.Layout.Area createArea(String name, int row, int col)
    • assignComponentsToArea

      public void assignComponentsToArea(List<Component> components)
    • assignComponentToAreaIfAbsent

      public void assignComponentToAreaIfAbsent(Component component, Consumer<Component> consumer)
    • setupComponentVisibility

      public void setupComponentVisibility(Set<String> profileDiffs, Set<String> userDiffs, Component c)
    • setupComponentVisibilityBasedOnOldUserConfigs

      public void setupComponentVisibilityBasedOnOldUserConfigs(Set<String> userDiffs, Component c)
    • setupComponentVisibilityNew

      public void setupComponentVisibilityNew(Set<String> visibilitySet, Component c)
    • compareTo

      public int compareTo(Layout other)
      Specified by:
      compareTo in interface Comparable<Layout>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object