Overview

This document specifies what is and how should look Project Layout (Layout) used with Swart Service (Service).

Components are rendered in View using Layout Components System described in this document.

Units in View are component units CU and they are in format of a whole number. 1 CU is a space that occupies one component.

Layout Components System can place components by:

  • Auto placement method
  • Using Layout Configuration File

Auto placement

Auto placement is default method for rendering components in View. It is used when Layout Configuration File is not provided by user. It takes all components and placed them in rectangular shape.

Layout Configuration File

Layout Configuration File describes how Layers are placed in View and how components are wrapped in Layers.

General Layout Rules

  • Layout is represented as XML document
  • Only Layer nodes allowed
  • Layer properties are nodes attributes
  • If x or y property are not specified layer will grow as row. If one of x or y is specified it will grow on missing size. Both specified then layer will occupied that space

Layer properties

  • name – specify layer name – optional
  • bind – specify layer’s name from Project’s Architecture to bind – see rules
  • direction – how components, or other layers are placed in current layer – optional
  • x – number of fields by X axis in CU unit – optional
  • y – number of fields by Y axis in CU unit – optional
  • alignItems – how items in layer are aligned in layer – optional
  • itemOffset – specify offset of an item – optional
  • offset – layer offset. Array, values for x, y – optional
  • color – hex color for components in Layer
  • fill – fill layer with empty components – optional

Properties Rules

name:

  • only letters, numbers, underscore allowed for characters
  • unique

bind:

  • mandatory if layer contains components, otherwise must not be present
  • must be the same name defined in Project’s Architecture

direction:

  • only one of predefined values: column, row. Default value: row

x:

  • only positive numbers

y:

  • only positive numbers

alignItems:

  • only one of predefined values: top, bottom, left, right. Default value: top

itemOffset:

  • only positive numbers
  • pair of values for x, y
  • must be lower then x or y number of components if any of it is present

offset:

  • only positive numbers
  • pair of values for x,y

color:

  • hex value for color. Default: random
  • must start with ‘#’ sign

fill:

  • boolean. Default: false

Example

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layer name="MAIN" direction="column">
    <layer name="SW" direction="row">
        <layer name="library" x="1" y="19" fill="true" bind="LIBRARY"></layer>
        <layer name="SW1_1" direction="column">
            <layer name="APPL_L">
                <layer name="appl" bind="APPL" x="18" alignItems="bottom" itemOffset="1,0"></layer>
            </layer>
            <layer name="RTE_L">
                <layer name="rte" y="2" x="18" fill="true" bind="RTE"></layer>
            </layer>
            <layer name="BSW" direction="row">
                <layer name="BSW1_1" direction="column">
                    <layer name="BSW2_1">
                        <layer name="BSW3_1" offset="1,0" direction="column">
                            <layer bind="SYSTEMSERVICES" x="3" ></layer>
                            <layer bind="ONBOARDDEVICEABSTRACTION" x="3" ></layer>
                        </layer>
                        <layer name="BSW3_2" offset="1,0" direction="column">
                            <layer bind="MEMORYSERVICES" x="1" ></layer>
                            <layer bind="MEMORYHWABSTRACTION" x="1" ></layer>
                        </layer>
                    </layer>
                    <layer name="BSW2_2" direction="row" offset="1,0">
                        <layer bind="MICROCONTROLLERDRIVERS" x="3" ></layer>
                        <layer bind="MEMORYDRIVERS" x="3" ></layer>
                        <layer bind="COMMUNICATIONDRIVERS" x="5" ></layer>
                        <layer bind="IODRIVERS" x="5" ></layer>
                    </layer>
                </layer>
                <layer bind="CD" x="1" offset="1,0">
                    <layer bind="COMPLEXDRIVERS" x="1"></layer>
                </layer>
            </layer>
        </layer>
    </layer>
</layer>
Go to Top