table-view.json 4.25 KB
/*
 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
{
  // a tree of actors
  /*
   *  4 by 4 table:
   * |------------------------------------|
   * |          |    2(right,top)|   |    |
   * |  -  -  - |----------------|---|----|
   * |          |                |   |    |
   * |          |                |   |    |
   * |          |                |   |    |
   * |  -  -  - |  -  -  -  -  - |--------|
   * |          |                |   |    |
   * |    1     |                |   |    |
   * |          |  3             | 4 |    |
   * |          |aligned to      |   |    |
   * |          |(left, center)  |   |    |
   * |  -  -  - |  -  -  -  -  - |--------|
   * |          |                |   '    |
   * |          |                |   '    |
   * |          |                |   5    |
   * |          |                |   '    |
   * |          |                |   '    |
   * |------------------------------------|
  */

  "stage": [{
      "name":"simpleTable",
      "type":"TableView",
      "background":{
        "visualType": "COLOR",
        "mixColor": [0.5,0.5,0,1]
        },
      "parentOrigin": "CENTER",
      "size":[400,400,1],
      "rows": 4,
      "columns": 4,
      "cellPadding": [10, 5],
      "layoutRows": {  // set the height of the rows
        "0": { "policy": "fixed", "value": 40 },
        "1": { "policy": "relative", "value": 0.33 },
        "2": { "policy": "fit", "value": 0 }
      },
      "layoutColumns": { // set the widths of the columns
        "0": { "policy": "fit", "value": 0 },
        "2": { "policy": "relative", "value": 0.2 },
        "3": { "policy": "fixed", "value": 30 }
      },
      "actors": [{
          "name":"gallery1",
          "type":"ImageView",
          "heightResizePolicy":"FILL_TO_PARENT",
          "image": "{DEMO_IMAGE_DIR}gallery-small-1.jpg",
          "properties": { // properties registered dynamically
            "cellIndex": [0,0], // property to specify the top-left cell this child occupies
            "rowSpan":4, // property to specify how many rows this child occupies, if not set, default value is 1
            "columnSpan":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1
          }
        },{
          "name":"gallery2",
          "type":"ImageView",
          "heightResizePolicy":"FILL_TO_PARENT",
          "image": "{DEMO_IMAGE_DIR}gallery-small-2.jpg",
          "properties": { // properties registered dynamically
            "cellIndex": [0,1],
            "cellHorizontalAlignment": "right" // property to specify how to align horizontally inside the cells, if not set, default value is 'left'
          }
        },{
          "name":"gallery3",
          "type":"ImageView",
          "image": "{DEMO_IMAGE_DIR}gallery-small-3.jpg",
          "properties": {
            "cellIndex":[1,1],
            "rowSpan":3,
            "cellHorizontalAlignment": "left",// property to specify how to align horizontally inside the cells, if not set, default value is 'left'
            "cellVerticalAlignment": "center" // property to specify how to align vertically inside the cells, if not set, default value is 'top'
          }
        }, {
          "name":"gallery4",
          "type":"ImageView",
          "widthResizePolicy":"FILL_TO_PARENT",
          "image": "{DEMO_IMAGE_DIR}gallery-small-4.jpg",
          "properties": {
            "cellIndex":[2,2]
          }
        }, {
          "name":"gallery5",
          "type":"ImageView",
          "widthResizePolicy":"FILL_TO_PARENT",
          "heightResizePolicy":"FILL_TO_PARENT",
          "image": "{DEMO_IMAGE_DIR}gallery-small-5.jpg",
          "properties": {
            "cellIndex":[3,2],
            "columnSpan": 2
          }
        }]
    }]
}