wiki:docs_layout_generation

layout generation

  • layout is specified in module.json

  • processing steps:
    1. genapp
      1. genapp_util.pl calls ga_layout.pm:layout_expand( modulelayoutname, layout[initially empty object ref], fulljson] )
        1. ga_layout.pm:layout_expand()
          1. calls layout_prep( modulejsonname, layout, fulljson )
            1. sets up panel defaults
            2. inserts buttons if not specified
            3. special inserts (progress, output_msgs, etc)
            4. extracts field & layout info and fillout layout object with data needed for layout
          2. phase 1 - panels
            1. check for missing panels and assigns parent panels
              1. collect parent panel names
              2. validate panelpos & default panel if not specified
            2. propagate (unspecified) parent keys (gap, align, label, data)
            3. assign CSS grid info (row, column, spans in parent div)
          3. phase 2 - fields
            1. check for missing parent panels & assign parent panels
            2. propagate parent keys
            3. assign CSS grid info (row, column, spans etc in parent div)
      2. generated application
        1. module load
          1. ga.layout structure setup (from types/type{.input|.output})
          2. ga.layout.process( defaults )
            • source in js/layout.js
            • consumes ga.layout definitions
            1. add submit & reset buttons
              • shouldn't this already happen in ga_layout.pm ?
              • adds eval for submit & reset (needed)
            2. calls layout.js:ga.layout.setup()
              • recursively builds html for module

cursors in ga_layout.pm

  • fields
    • fields contain multiple components
      • currently label, data, repeats
    • each field is placed at a location within the panel described by the field's layout:location
    • field's layout:location types for row or col
      • number - a numeric coordinate
      • [start#, end#] - a range of coordinate numbers
      • "full" - the complete row or column - only currently supported for col on component "repeats"
      • "next" - begin new row (like carriage return) only currently supported for row on component "repeats"
    • cursors:
      • $cursor_{row,col}{$parent} is the current location in the "parent" panel
        • initially updated after the "setup" of the field in the panel
        • updated after the field is fully placed past the max_{row,col}
      • $loc_{row,col} is the base starting location for the field
        • initialized to $cursor_{row,col}($parent} at the beginning of field processing
      • $max_{row,col} is the location of the max grid coordinate used
        • updated after each component of the field is placed

simplified

module.json -> ga_layout.pm -> layout.js

testing

  • /src/genapp/tmp/layout/test2 $ ga_layout.pl energy.json > test1 && node ../layout2html.js test1 > test.html
Last modified 4 months ago Last modified on Jun 3, 2020, 10:25:41 AM