wiki:docs_layout_generation

Version 5 (modified by ehb, 2 months ago) (diff)

--

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
    • cursors:
      • $cursor_{row,col}{$parent} is the current location in the "parent" panel
        • updated after all components of the field have been placed
      • $loc_{row,col} is location of last grid coordinate used
        • initialized to 1,1 at the beginning of field processing
        • updated after each component of the field is placed
      • $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