<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you 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.
-->

<layout:TablePanes title="Table Panes" maximized="true"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns:content="org.apache.pivot.wtk.content"
    xmlns:layout="org.apache.pivot.tutorials.layout"
    xmlns="org.apache.pivot.wtk">
    <bxml:define>
        <Menu.Section bxml:id="cellSection">
            <Menu.Item action="configureCell" buttonData="Configure Cell Content"/>
        </Menu.Section>
        <Menu.Section bxml:id="rowSection">
            <Menu.Item action="configureRow" buttonData="Configure Row"/>
            <Menu.Item action="insertRow" buttonData="Insert Row"/>
            <Menu.Item action="removeRow" buttonData="Remove Row"/>
        </Menu.Section>
        <Menu.Section bxml:id="columnSection">
            <Menu.Item action="configureColumn" buttonData="Configure Column"/>
            <Menu.Item action="insertColumn" buttonData="Insert Column"/>
            <Menu.Item action="removeColumn" buttonData="Remove Column"/>
        </Menu.Section>
    </bxml:define>

    <SplitPane splitRatio="0.6">
        <left>
            <Border>
                <TablePane bxml:id="tablePane" styles="{verticalSpacing:21, showHorizontalGridLines:true,
                    horizontalSpacing:21, showVerticalGridLines:true, padding:10}">
                    <columns>
                        <TablePane.Column width="-1"/>
                        <TablePane.Column width="50"/>
                        <TablePane.Column width="-1"/>
                        <TablePane.Column width="1*"/>
                        <TablePane.Column width="2*"/>
                    </columns>

                    <TablePane.Row height="-1">
                        <TablePane.Filler/>
                        <Label text="50" styles="{horizontalAlignment:'center'}"/>
                        <Label text="-1" styles="{horizontalAlignment:'center'}"/>
                        <Label text="1*" styles="{horizontalAlignment:'center'}"/>
                        <Label text="2*" styles="{horizontalAlignment:'center'}"/>
                    </TablePane.Row>

                    <TablePane.Row height="50">
                        <Label text="50" styles="{verticalAlignment:'center'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                    </TablePane.Row>

                    <TablePane.Row height="-1">
                        <Label text="-1" styles="{verticalAlignment:'center'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                    </TablePane.Row>

                    <TablePane.Row height="1*">
                        <Label text="1*" styles="{verticalAlignment:'center'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                    </TablePane.Row>

                    <TablePane.Row height="2*">
                        <Label text="2*" styles="{verticalAlignment:'center'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                        <Panel styles="{backgroundColor:'#dddcd5'}"/>
                    </TablePane.Row>
                </TablePane>
            </Border>
        </left>

        <right>
            <Border styles="{padding:4}">
                <Form styles="{showFlagIcons:false}">
                    <Form.Section>
                        <Checkbox Form.label="Show horizontal grid lines" selected="true">
                            <buttonStateListeners>
                                <![CDATA[
                                function stateChanged(button, previousState) {
                                    tablePane.getStyles().put("showHorizontalGridLines",
                                        button.isSelected());
                                }
                                ]]>
                            </buttonStateListeners>
                        </Checkbox>

                        <Checkbox Form.label="Show vertical grid lines" selected="true">
                            <buttonStateListeners>
                                <![CDATA[
                                function stateChanged(button, previousState) {
                                    tablePane.getStyles().put("showVerticalGridLines",
                                        button.isSelected());
                                }
                                ]]>
                            </buttonStateListeners>
                        </Checkbox>

                        <Spinner Form.label="Horizontal spacing" selectedIndex="21"
                            styles="{sizeToContent:true}">
                            <spinnerData>
                                <content:NumericSpinnerData lowerBound="0" upperBound="50"/>
                            </spinnerData>

                            <spinnerSelectionListeners>
                                <![CDATA[
                                function selectedIndexChanged(spinner, previousSelectedIndex) {
                                    tablePane.getStyles().put("horizontalSpacing",
                                        spinner.getSelectedItem());
                                }
                                ]]>
                            </spinnerSelectionListeners>
                        </Spinner>

                        <Spinner Form.label="Vertical spacing" selectedIndex="21"
                            styles="{sizeToContent:true}">
                            <spinnerData>
                                <content:NumericSpinnerData lowerBound="0" upperBound="50"/>
                            </spinnerData>

                            <spinnerSelectionListeners>
                                <![CDATA[
                                function selectedIndexChanged(spinner, previousSelectedIndex) {
                                    tablePane.getStyles().put("verticalSpacing",
                                        spinner.getSelectedItem());
                                }
                                ]]>
                            </spinnerSelectionListeners>
                        </Spinner>

                        <Spinner Form.label="Padding" selectedIndex="10"
                            styles="{sizeToContent:true}">
                            <spinnerData>
                                <content:NumericSpinnerData lowerBound="0" upperBound="25"/>
                            </spinnerData>

                            <spinnerSelectionListeners>
                                <![CDATA[
                                function selectedIndexChanged(spinner, previousSelectedIndex) {
                                    tablePane.getStyles().put("padding",
                                        spinner.getSelectedItem());
                                }
                                ]]>
                            </spinnerSelectionListeners>
                        </Spinner>
                    </Form.Section>
                </Form>
            </Border>
        </right>
    </SplitPane>
</layout:TablePanes>
